Browse Source

CRUD for BDTMeasurements & ClientBDTMeasurements

Vijayakrishnan Krishnan 4 năm trước cách đây
mục cha
commit
a36e8239ab

+ 25 - 0
app/Http/Controllers/bdt_measurements_Controller.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Auth;
+
+class bdt_measurements_Controller extends Controller
+{
+    public $selfName = 'bdt_measurements_Controller';
+    public $dashboardName = 'dashboard';
+
+	// GET /bdt_measurements
+	public function index(Request $request) {
+		$records = DB::table('bdt_measurement')->get();
+		return response()->view('admin/bdt_measurements/index', compact('records'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /bdt_measurements/add_new
+	public function add_new(Request $request) {
+		$records = DB::table('bdt_measurement')->get();
+		return response()->view('admin/bdt_measurements/add_new', compact('records'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+}

+ 11 - 0
app/Http/Controllers/clients_SINGLE_Controller.php

@@ -863,6 +863,17 @@ class clients_SINGLE_Controller extends Controller
 		return response()->view('pro/clients_SINGLE/SUB_bdt_devices', compact('record', 'subRecords'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
 	}
 
+	// GET /clients/view/{uid}/SUB_device_measurements
+	public function SUB_device_measurements(Request $request, $uid) {
+		$record = DB::table('client')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('client')->where('id', $uid)->first();
+			if($record) return redirect('/clients/view/' . $record->uid . '/SUB_device_measurements');
+		}
+		$subRecords = DB::table('client_bdt_measurement')->where('client_id', $record->id)->get();
+		return response()->view('pro/clients_SINGLE/SUB_device_measurements', compact('record', 'subRecords'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
 	// GET /clients/view/{uid}/ACTION_add_new_measurement
 	public function ACTION_add_new_measurement(Request $request, $uid) {
 		$record = DB::table('client')->where('uid', $uid)->first();

+ 17 - 0
generatecv/tree.txt

@@ -508,6 +508,8 @@ PRO
                     internalMemo
                     status
                     statusMemo
+            device_measurements
+                id=client_bdt_measurement.client_id
     notes|note|view|icon:file-alt
         !inc:effective_dateest,client_id,hcp_pro_id,reasons,is_signed_by_hcp,billed
         !qry:pros:SELECT id, concat(name_last, ', ', name_first) as name_display FROM pro
@@ -1273,3 +1275,18 @@ ADMIN
                 statusMemo=status_memo
         SUB
             dashboard
+    bdt_measurements|bdt_measurement|add|icon:tablet-alt
+    bdt_measurements/add_new:create
+        imei*
+        ts:number
+        batteryVoltage:number
+        signalStrength:number
+        valueTare:number
+        valueWeight:number
+        valueSystolic:number
+        valueDiastolic:number
+        valuePulse:number
+        valueUnit:number
+        valueIrregular:number
+        rssi:number
+        deviceId:number

+ 88 - 0
resources/views/admin/bdt_measurements/add_new.blade.php

@@ -0,0 +1,88 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Bdt Measurements: Add New</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="{{route('bdt_measurements-index')}}" up-close>
+                <i class="fa fa-times"></i>
+            </a>
+        </div>
+    </h4>
+
+    <form action="/post-to-api"
+          up-target="#main-content" up-history="false" up-fail-target=".failed-form-contents" up-reveal="false"
+          method="post" enctype="multipart/form-data"
+          class="border-top px-3 pt-3 pb-1 custom-submit">
+        @csrf
+
+        @if (session('message'))
+            <div class="alert alert-danger">{{ session('message') }}</div>
+        @endif
+
+        <input type="hidden" name="_api" value="/api/bdtMeasurement/create">
+        <input type="hidden" name="_success" value="{{route('bdt_measurements-index')}}">
+        <input type="hidden" name="_return" value="{{route('bdt_measurements-add_new')}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Imei *</label>
+<input class='form-control' type='text' name='imei' value='{{ old('imei') ? old('imei') : '' }}' required>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Ts </label>
+<input class='form-control' type='number' name='ts' value='{{ old('ts') ? old('ts') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Battery Voltage </label>
+<input class='form-control' type='number' name='batteryVoltage' value='{{ old('batteryVoltage') ? old('batteryVoltage') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Signal Strength </label>
+<input class='form-control' type='number' name='signalStrength' value='{{ old('signalStrength') ? old('signalStrength') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Tare </label>
+<input class='form-control' type='number' name='valueTare' value='{{ old('valueTare') ? old('valueTare') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Weight </label>
+<input class='form-control' type='number' name='valueWeight' value='{{ old('valueWeight') ? old('valueWeight') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Systolic </label>
+<input class='form-control' type='number' name='valueSystolic' value='{{ old('valueSystolic') ? old('valueSystolic') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Diastolic </label>
+<input class='form-control' type='number' name='valueDiastolic' value='{{ old('valueDiastolic') ? old('valueDiastolic') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Pulse </label>
+<input class='form-control' type='number' name='valuePulse' value='{{ old('valuePulse') ? old('valuePulse') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Unit </label>
+<input class='form-control' type='number' name='valueUnit' value='{{ old('valueUnit') ? old('valueUnit') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Value Irregular </label>
+<input class='form-control' type='number' name='valueIrregular' value='{{ old('valueIrregular') ? old('valueIrregular') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Rssi </label>
+<input class='form-control' type='number' name='rssi' value='{{ old('rssi') ? old('rssi') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Device Id </label>
+<input class='form-control' type='number' name='deviceId' value='{{ old('deviceId') ? old('deviceId') : '' }}' >
+</div>
+        <div class="form-group mb-3 d-flex justify-content-center">
+            <button class="btn btn-sm btn-primary mr-3 px-5">Submit</button>
+            <a href="{{route('bdt_measurements-index')}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 64 - 0
resources/views/admin/bdt_measurements/index.blade.php

@@ -0,0 +1,64 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <h3 class="d-flex my-3 px-3 stag-heading stag-heading-index">
+        <div>Bdt Measurements: List</div>
+        <div class="ml-auto">
+            <a class='btn btn-primary btn-sm ml-2' up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href='/bdt_measurements/add_new?optimised=1'><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New</a>
+        </div>
+    </h3>
+
+    <div class="table-responsive p-0 bg-white border stag-table stag-table-index">
+        <table class="table table-hover text-nowrap table-striped">
+            <thead>
+            <tr>
+<th>&nbsp;</th>
+<th>Imei</th>
+<th>Ts</th>
+<th>Battery Voltage</th>
+<th>Signal Strength</th>
+<th>Value Tare</th>
+<th>Value Weight</th>
+<th>Weight In Pounds</th>
+<th>Value Systolic</th>
+<th>Value Diastolic</th>
+<th>Value Pulse</th>
+<th>Value Unit</th>
+<th>Value Irregular</th>
+<th>Rssi</th>
+<th>Device Id</th>
+<th>Device Category</th>
+<th>Created At</th>
+<th>Created By Session Id</th>
+<th>Type</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($records as $record)
+                <tr>
+<td><a href="/bdt_measurements/view/<?= $record->uid ?>"><i class="fas fa-share-square"></i></a></td>
+<td><?= $record->imei ?></td>
+<td><?= $record->ts ?></td>
+<td><?= $record->battery_voltage ?></td>
+<td><?= $record->signal_strength ?></td>
+<td><?= $record->value_tare ?></td>
+<td><?= $record->value_weight ?></td>
+<td><?= $record->weight_in_pounds ?></td>
+<td><?= $record->value_systolic ?></td>
+<td><?= $record->value_diastolic ?></td>
+<td><?= $record->value_pulse ?></td>
+<td><?= $record->value_unit ?></td>
+<td><?= $record->value_irregular ?></td>
+<td><?= $record->rssi ?></td>
+<td><?= $record->device_id ?></td>
+<td><?= $record->device_category ?></td>
+<td><?= friendly_date_time($record->created_at) ?></td>
+<td><?= $record->created_by_session_id ?></td>
+<td><?= $record->type ?></td>
+                </tr>
+            @endforeach
+            </tbody>
+        </table>
+    </div>
+
+@endsection

+ 7 - 0
resources/views/layouts/generated-links.blade.php

@@ -172,3 +172,10 @@
 		<p>Client Bdt Devices</p>
 	</a>
 </li>
+
+<li class='nav-item'>
+	<a href='/bdt_measurements' class='nav-link {{ (isset(request()->route()->getController()->selfName) && strpos(request()->route()->getController()->selfName, 'bdt_measurements') === 0 ? 'active' : '') }} '>
+		<i class='nav-icon fa fa-tablet-alt'></i>
+		<p>Bdt Measurements</p>
+	</a>
+</li>

+ 2 - 1
resources/views/pro/clients/subs.blade.php

@@ -17,4 +17,5 @@
 <a href='/clients/view/<?= $record->uid ?>/SUB_client_sms_numbers' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_client_sms_numbers' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Client Sms Numbers</a>
 <a href='/clients/view/<?= $record->uid ?>/SUB_client_documents' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_client_documents' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Client Documents</a>
 <a href='/clients/view/<?= $record->uid ?>/SUB_audit_log' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_audit_log' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Audit Log</a>
-<a href='/clients/view/<?= $record->uid ?>/SUB_bdt_devices' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_bdt_devices' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Bdt Devices</a>
+<a href='/clients/view/<?= $record->uid ?>/SUB_bdt_devices' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_bdt_devices' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Bdt Devices</a>
+<a href='/clients/view/<?= $record->uid ?>/SUB_device_measurements' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_device_measurements' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Device Measurements</a>

+ 46 - 0
resources/views/pro/clients_SINGLE/SUB_device_measurements.blade.php

@@ -0,0 +1,46 @@
+@extends('pro.clients.view')
+@section('content-inner')
+
+    <div class="pb-3">
+
+        <h5 class='my-3 d-flex stag-heading stag-heading-sub'>
+            <div>Device Measurements</div>
+            <div class="ml-auto">
+                <!-- _ADD_NEW_LINK_ -->
+            </div>
+        </h5>
+
+        <div class="table-responsive p-0 bg-white border stag-table stag-table-sub">
+            <table class="table table-hover text-nowrap">
+                <thead>
+                <tr>
+                    <th>&nbsp;</th>
+<th>Client Id</th>
+<th>Bdt Measurement Id</th>
+<th>Status</th>
+<th>Status Memo</th>
+<th>Created At</th>
+<th>Created By Session Id</th>
+<th>Type</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($subRecords as $subRecord)
+                    <tr>
+                        <td><a href=""><i class="fas fa-share-square"></i></a></td>
+<td><?= $subRecord->client_id ?></td>
+<td><?= $subRecord->bdt_measurement_id ?></td>
+<td><?= $subRecord->status ?></td>
+<td><?= $subRecord->status_memo ?></td>
+<td><?= friendly_date_time($subRecord->created_at) ?></td>
+<td><?= $subRecord->created_by_session_id ?></td>
+<td><?= $subRecord->type ?></td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+
+    </div>
+
+@endsection

+ 12 - 5
routes/generated.php

@@ -99,6 +99,7 @@ Route::prefix('/clients/view/{uid}')->group(function () {
 	Route::get('SUB_client_documents', 'clients_SINGLE_Controller@SUB_client_documents')->name('clients_SINGLE-SUB_client_documents');
 	Route::get('SUB_audit_log', 'clients_SINGLE_Controller@SUB_audit_log')->name('clients_SINGLE-SUB_audit_log');
 	Route::get('SUB_bdt_devices', 'clients_SINGLE_Controller@SUB_bdt_devices')->name('clients_SINGLE-SUB_bdt_devices');
+	Route::get('SUB_device_measurements', 'clients_SINGLE_Controller@SUB_device_measurements')->name('clients_SINGLE-SUB_device_measurements');
 	Route::get('ACTION_add_new_measurement', 'clients_SINGLE_Controller@ACTION_add_new_measurement')->name('clients_SINGLE-ACTION_add_new_measurement');
 	Route::get('ACTION_add_new_client_info_line', 'clients_SINGLE_Controller@ACTION_add_new_client_info_line')->name('clients_SINGLE-ACTION_add_new_client_info_line');
 	Route::get('ACTION_add_new_client_pro_access', 'clients_SINGLE_Controller@ACTION_add_new_client_pro_access')->name('clients_SINGLE-ACTION_add_new_client_pro_access');
@@ -513,6 +514,13 @@ Route::prefix('/bdt_devices/view/{uid}')->group(function () {
 	Route::get('SUB_dashboard', 'bdt_devices_SINGLE_Controller@SUB_dashboard')->name('bdt_devices_SINGLE-SUB_dashboard');
 });
 
+// --- admin: client_bdt_devices --- //
+Route::prefix('/client_bdt_devices')->group(function () {
+	Route::get('', 'client_bdt_devices_Controller@index')->name('client_bdt_devices-index');
+	Route::get('add_new', 'client_bdt_devices_Controller@add_new')->name('client_bdt_devices-add_new');
+	Route::get('view/{uid}', 'client_bdt_devices_Controller@view')->name('client_bdt_devices-view');
+});
+
 // --- admin: client_bdt_devices_SINGLE --- //
 Route::prefix('/client_bdt_devices/view/{uid}')->group(function () {
 	Route::get('ACTION_deactivate', 'client_bdt_devices_SINGLE_Controller@ACTION_deactivate')->name('client_bdt_devices_SINGLE-ACTION_deactivate');
@@ -521,9 +529,8 @@ Route::prefix('/client_bdt_devices/view/{uid}')->group(function () {
 	Route::get('SUB_dashboard', 'client_bdt_devices_SINGLE_Controller@SUB_dashboard')->name('client_bdt_devices_SINGLE-SUB_dashboard');
 });
 
-// --- admin: client_bdt_devices --- //
-Route::prefix('/client_bdt_devices')->group(function () {
-	Route::get('', 'client_bdt_devices_Controller@index')->name('client_bdt_devices-index');
-	Route::get('add_new', 'client_bdt_devices_Controller@add_new')->name('client_bdt_devices-add_new');
-	Route::get('view/{uid}', 'client_bdt_devices_Controller@view')->name('client_bdt_devices-view');
+// --- admin: bdt_measurements --- //
+Route::prefix('/bdt_measurements')->group(function () {
+	Route::get('', 'bdt_measurements_Controller@index')->name('bdt_measurements-index');
+	Route::get('add_new', 'bdt_measurements_Controller@add_new')->name('bdt_measurements-add_new');
 });