Browse Source

CRUD for ClientBDTDevices

Vijayakrishnan Krishnan 4 years ago
parent
commit
6fcca43e9f

+ 30 - 0
app/Http/Controllers/client_bdt_devices_Controller.php

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

+ 53 - 0
app/Http/Controllers/client_bdt_devices_SINGLE_Controller.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Auth;
+
+class client_bdt_devices_SINGLE_Controller extends Controller
+{
+    public $selfName = 'client_bdt_devices_SINGLE_Controller';
+    public $dashboardName = 'dashboard';
+
+	// GET /client_bdt_devices/view/{uid}/ACTION_deactivate
+	public function ACTION_deactivate(Request $request, $uid) {
+		$record = DB::table('client_bdt_device')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('client_bdt_device')->where('id', $uid)->first();
+			if($record) return redirect('/client_bdt_devices/view/' . $record->uid . '/ACTION_deactivate');
+		}
+		return response()->view('admin/client_bdt_devices_SINGLE/ACTION_deactivate', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /client_bdt_devices/view/{uid}/ACTION_reactivate
+	public function ACTION_reactivate(Request $request, $uid) {
+		$record = DB::table('client_bdt_device')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('client_bdt_device')->where('id', $uid)->first();
+			if($record) return redirect('/client_bdt_devices/view/' . $record->uid . '/ACTION_reactivate');
+		}
+		return response()->view('admin/client_bdt_devices_SINGLE/ACTION_reactivate', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /client_bdt_devices/view/{uid}/ACTION_update
+	public function ACTION_update(Request $request, $uid) {
+		$record = DB::table('client_bdt_device')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('client_bdt_device')->where('id', $uid)->first();
+			if($record) return redirect('/client_bdt_devices/view/' . $record->uid . '/ACTION_update');
+		}
+		return response()->view('admin/client_bdt_devices_SINGLE/ACTION_update', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /client_bdt_devices/view/{uid}/SUB_dashboard
+	public function SUB_dashboard(Request $request, $uid) {
+		$record = DB::table('client_bdt_device')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('client_bdt_device')->where('id', $uid)->first();
+			if($record) return redirect('/client_bdt_devices/view/' . $record->uid . '/SUB_dashboard');
+		}
+		return response()->view('admin/client_bdt_devices_SINGLE/SUB_dashboard', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+}

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

@@ -852,6 +852,17 @@ class clients_SINGLE_Controller extends Controller
 		return response()->view('pro/clients_SINGLE/SUB_audit_log', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
 	}
 
+	// GET /clients/view/{uid}/SUB_bdt_devices
+	public function SUB_bdt_devices(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_bdt_devices');
+		}
+		$subRecords = DB::table('client_bdt_device')->where('client_id', $record->id)->get();
+		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}/ACTION_add_new_measurement
 	public function ACTION_add_new_measurement(Request $request, $uid) {
 		$record = DB::table('client')->where('uid', $uid)->first();
@@ -941,4 +952,14 @@ class clients_SINGLE_Controller extends Controller
 		}
 		return response()->view('pro/clients_SINGLE/ACTION_add_new_client_document', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
 	}
+
+	// GET /clients/view/{uid}/ACTION_add_new_client_bdt_device
+	public function ACTION_add_new_client_bdt_device(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 . '/ACTION_add_new_client_bdt_device');
+		}
+		return response()->view('pro/clients_SINGLE/ACTION_add_new_client_bdt_device', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
 }

+ 30 - 0
generatecv/tree.txt

@@ -499,6 +499,15 @@ PRO
                     notes
                     file:file
             audit_log
+            bdt_devices
+                id=client_bdt_device.client_id=>/client_bdt_devices/view/UID
+                add_new:client_bdt_device
+                    clientUid:hidden=uid
+                    deviceUid*:record:bdt_device:uid,imei
+                    instructions
+                    internalMemo
+                    status
+                    statusMemo
     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
@@ -1243,3 +1252,24 @@ ADMIN
                 memo=memo
         SUB
             dashboard
+    client_bdt_devices|client_bdt_device|add|view|icon:tablet-alt
+    client_bdt_devices/add_new:create
+        clientUid*:record:client:uid,name
+        deviceUid*:record:bdt_device:uid,imei
+        instructions
+        internalMemo
+        status
+        statusMemo
+    client_bdt_devices/view/{uid}
+        ACTIONS
+            deactivate
+                memo
+            reactivate
+                memo
+            update
+                instructions=instructions
+                internalMemo=internal_memo
+                status=status
+                statusMemo=status_memo
+        SUB
+            dashboard

+ 3 - 0
resources/views/admin/client_bdt_devices/actions.blade.php

@@ -0,0 +1,3 @@
+<a up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href='/client_bdt_devices/view/<?= $record->uid ?>/ACTION_deactivate?optimised=1' class='d-block btn btn-sm btn-default mb-3'>Deactivate</a>
+<a up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href='/client_bdt_devices/view/<?= $record->uid ?>/ACTION_reactivate?optimised=1' class='d-block btn btn-sm btn-default mb-3'>Reactivate</a>
+<a up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href='/client_bdt_devices/view/<?= $record->uid ?>/ACTION_update?optimised=1' class='d-block btn btn-sm btn-default mb-3'>Update</a>

+ 72 - 0
resources/views/admin/client_bdt_devices/add_new.blade.php

@@ -0,0 +1,72 @@
+@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>Client Bdt Devices: Add New</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="{{route('client_bdt_devices-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/clientBdtDevice/create">
+        <input type="hidden" name="_success" value="{{route('client_bdt_devices-index')}}">
+        <input type="hidden" name="_return" value="{{route('client_bdt_devices-add_new')}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Client *</label>
+<select class='form-control' name='clientUid' value='{{ old('clientUid') ? old('clientUid') : '' }}' required>
+<option value=''>-- Select --</option>
+<?php $dbOptions = \Illuminate\Support\Facades\DB::table('client')->get(); ?>
+<?php foreach($dbOptions as $o): ?>
+<option <?= $o->uid === (old('clientUid') ? old('clientUid') : '') ? 'selected' : '' ?> value='<?= $o->uid ?>'><?= $o->name ?> (<?= $o->uid ?>)</option>
+<?php endforeach; ?>
+</select>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Device *</label>
+<select class='form-control' name='deviceUid' value='{{ old('deviceUid') ? old('deviceUid') : '' }}' required>
+<option value=''>-- Select --</option>
+<?php $dbOptions = \Illuminate\Support\Facades\DB::table('bdt_device')->get(); ?>
+<?php foreach($dbOptions as $o): ?>
+<option <?= $o->uid === (old('deviceUid') ? old('deviceUid') : '') ? 'selected' : '' ?> value='<?= $o->uid ?>'><?= $o->imei ?> (<?= $o->uid ?>)</option>
+<?php endforeach; ?>
+</select>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Instructions </label>
+<input class='form-control' type='text' name='instructions' value='{{ old('instructions') ? old('instructions') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Internal Memo </label>
+<input class='form-control' type='text' name='internalMemo' value='{{ old('internalMemo') ? old('internalMemo') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status </label>
+<input class='form-control' type='text' name='status' value='{{ old('status') ? old('status') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status Memo </label>
+<input class='form-control' type='text' name='statusMemo' value='{{ old('statusMemo') ? old('statusMemo') : '' }}' >
+</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('client_bdt_devices-index')}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 60 - 0
resources/views/admin/client_bdt_devices/index.blade.php

@@ -0,0 +1,60 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <h3 class="d-flex my-3 px-3 stag-heading stag-heading-index">
+        <div>Client Bdt Devices: 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='/client_bdt_devices/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>Client Id</th>
+<th>Device Id</th>
+<th>Instructions</th>
+<th>Internal Memo</th>
+<th>Status</th>
+<th>Status Memo</th>
+<th>Created At</th>
+<th>Created By Session Id</th>
+<th>Type</th>
+<th>Is Active</th>
+<th>Deactivated At</th>
+<th>Deactivated By Session Id</th>
+<th>Deactivation Memo</th>
+<th>Reactivated At</th>
+<th>Reactivated By Session Id</th>
+<th>Reactivation Memo</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($records as $record)
+                <tr>
+<td><a href="/client_bdt_devices/view/<?= $record->uid ?>"><i class="fas fa-share-square"></i></a></td>
+<td><?= $record->client_id ?></td>
+<td><?= $record->device_id ?></td>
+<td><?= $record->instructions ?></td>
+<td><?= $record->internal_memo ?></td>
+<td><?= $record->status ?></td>
+<td><?= $record->status_memo ?></td>
+<td><?= friendly_date_time($record->created_at) ?></td>
+<td><?= $record->created_by_session_id ?></td>
+<td><?= $record->type ?></td>
+<td><?= $record->is_active ?></td>
+<td><?= friendly_date_time($record->deactivated_at) ?></td>
+<td><?= $record->deactivated_by_session_id ?></td>
+<td><?= $record->deactivation_memo ?></td>
+<td><?= friendly_date_time($record->reactivated_at) ?></td>
+<td><?= $record->reactivated_by_session_id ?></td>
+<td><?= $record->reactivation_memo ?></td>
+                </tr>
+            @endforeach
+            </tbody>
+        </table>
+    </div>
+
+@endsection

+ 3 - 0
resources/views/admin/client_bdt_devices/info.blade.php

@@ -0,0 +1,3 @@
+<h4 class="d-flex my-3 px-3 stag-heading stag-heading-info">
+    <div>Client Bdt Devices: Single [<?= $record->uid ?>]</div>
+</h4>

+ 1 - 0
resources/views/admin/client_bdt_devices/subs.blade.php

@@ -0,0 +1 @@
+<a href='/client_bdt_devices/view/<?= $record->uid ?>/SUB_dashboard' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_dashboard' ? 'bg-secondary text-white font-weight-bold' : '' }}{{ strpos(request()->route()->getActionMethod(), 'ACTION_') === 0 ? 'bg-secondary text-white font-weight-bold' : '' }}'>Dashboard</a>

+ 20 - 0
resources/views/admin/client_bdt_devices/view.blade.php

@@ -0,0 +1,20 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <div class="card rounded-0">
+        <div class="border-bottom bg-light">@include('admin/client_bdt_devices/info')</div>
+        <div class="d-flex align-items-stretch">
+            <div class="inner-side-nav">
+                <div class="border-right h-100">
+                    @include('admin/client_bdt_devices/subs')
+                </div>
+            </div>
+            <div class="flex-grow-1 px-3 pb-3 mb-3 inner-content">
+                <div>
+                    @yield('content-inner')
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 41 - 0
resources/views/admin/client_bdt_devices_SINGLE/ACTION_deactivate.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.client_bdt_devices.view')
+@section('content-inner')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Deactivate</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="#" 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="_uid" value="{{ $record->uid }}">
+        <input type="hidden" name="_api" value="/api/clientBdtDevice/deactivate">
+        <input type="hidden" name="_success" value="{{route('client_bdt_devices-view', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('client_bdt_devices_SINGLE-ACTION_deactivate', ['uid' => $record->uid])}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Memo </label>
+<input class='form-control' type='text' name='memo' value='{{ old('memo') ? old('memo') : '' }}' >
+</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('client_bdt_devices-view', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 41 - 0
resources/views/admin/client_bdt_devices_SINGLE/ACTION_reactivate.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.client_bdt_devices.view')
+@section('content-inner')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Reactivate</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="#" 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="_uid" value="{{ $record->uid }}">
+        <input type="hidden" name="_api" value="/api/clientBdtDevice/reactivate">
+        <input type="hidden" name="_success" value="{{route('client_bdt_devices-view', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('client_bdt_devices_SINGLE-ACTION_reactivate', ['uid' => $record->uid])}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Memo </label>
+<input class='form-control' type='text' name='memo' value='{{ old('memo') ? old('memo') : '' }}' >
+</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('client_bdt_devices-view', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 53 - 0
resources/views/admin/client_bdt_devices_SINGLE/ACTION_update.blade.php

@@ -0,0 +1,53 @@
+@extends('admin.client_bdt_devices.view')
+@section('content-inner')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Update</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="#" 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="_uid" value="{{ $record->uid }}">
+        <input type="hidden" name="_api" value="/api/clientBdtDevice/update">
+        <input type="hidden" name="_success" value="{{route('client_bdt_devices-view', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('client_bdt_devices_SINGLE-ACTION_update', ['uid' => $record->uid])}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Instructions </label>
+<input class='form-control' type='text' name='instructions' value='{{ old('instructions') ? old('instructions') : $record->instructions }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Internal Memo </label>
+<input class='form-control' type='text' name='internalMemo' value='{{ old('internalMemo') ? old('internalMemo') : $record->internal_memo }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status </label>
+<input class='form-control' type='text' name='status' value='{{ old('status') ? old('status') : $record->status }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status Memo </label>
+<input class='form-control' type='text' name='statusMemo' value='{{ old('statusMemo') ? old('statusMemo') : $record->status_memo }}' >
+</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('client_bdt_devices-view', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 41 - 0
resources/views/admin/client_bdt_devices_SINGLE/SUB_dashboard.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.client_bdt_devices.view')
+@section('content-inner')
+
+    <div class="row mt-3">
+    <div class="col-8">
+
+        <div class="table-responsive p-0 bg-white table-sm stag-table border-top">
+            <table class="table table-hover text-nowrap table-striped border-left border-right border-bottom">
+                <thead>
+                <tr>
+                    <th colspan="2" class="px-2">Record Details</th>
+                </tr>
+                </thead>
+                <tbody>
+                <?php foreach($record as $k => $v): ?>
+                    <?php
+                    if($k === 'id' || $k === 'uid') continue;
+                    $displayValue = $record->$k;
+                    if(substr($k, -3) === '_at') {
+                        $displayValue = friendly_date_time($record->$k);
+                    }
+                    ?>
+                    <tr>
+                        <td class="px-2 text-secondary border-right w-50">{{ ucwords(str_replace("_", " ", $k)) }}</td>
+                        <td class="px-2 font-weight-bold w-50">{{ $displayValue }}</td>
+                    </tr>
+                <?php endforeach; ?>
+                </tbody>
+            </table>
+        </div>
+
+    </div>
+    <div class="col-4">
+        <div class="border-left h-100 pl-3">
+            @include('admin/client_bdt_devices/actions')
+        </div>
+    </div>
+</div>
+
+
+@endsection

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

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

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

@@ -16,4 +16,5 @@
 <a href='/clients/view/<?= $record->uid ?>/SUB_client_sms' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_client_sms' ? 'bg-secondary text-white font-weight-bold' : '' }}'>Client Sms</a>
 <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_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>

+ 66 - 0
resources/views/pro/clients_SINGLE/ACTION_add_new_clientBDTDevice.blade.php

@@ -0,0 +1,66 @@
+@extends('pro.clients.view')
+@section('content-inner')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Add New Client BDTDevice</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="#" 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="_uid" value="{{ $record->uid }}">
+        <input type="hidden" name="_api" value="/api/clientBDTDevice/create">
+        <input type="hidden" name="_success" value="{{route('clients_SINGLE-SUB_client_documents', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('clients_SINGLE-ACTION_add_new_clientBDTDevice', ['uid' => $record->uid])}}">
+        <input class='form-control' type='hidden' name='clientUid' value='{{ old('clientUid') ? old('clientUid') : $record->uid }}' >
+<div class='form-group mb-3'>
+<label class='control-label'>Title </label>
+<input class='form-control' type='text' name='title' value='{{ old('title') ? old('title') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Category </label>
+<input class='form-control' type='text' name='category' value='{{ old('category') ? old('category') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status </label>
+<input class='form-control' type='text' name='status' value='{{ old('status') ? old('status') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Effective Date </label>
+<input class='form-control' type='date' name='effectiveDate' value='{{ old('effectiveDate') ? old('effectiveDate') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Provider </label>
+<input class='form-control' type='text' name='provider' value='{{ old('provider') ? old('provider') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Notes </label>
+<input class='form-control' type='text' name='notes' value='{{ old('notes') ? old('notes') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>File </label>
+<input class='form-control' type='file' name='file' value='{{ old('file') ? old('file') : '' }}' >
+</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('clients_SINGLE-SUB_client_documents', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 64 - 0
resources/views/pro/clients_SINGLE/ACTION_add_new_client_bdt_device.blade.php

@@ -0,0 +1,64 @@
+@extends('pro.clients.view')
+@section('content-inner')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Add New Client Bdt Device</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="#" 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="_uid" value="{{ $record->uid }}">
+        <input type="hidden" name="_api" value="/api/clientBdtDevice/create">
+        <input type="hidden" name="_success" value="{{route('clients_SINGLE-SUB_bdt_devices', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('clients_SINGLE-ACTION_add_new_client_bdt_device', ['uid' => $record->uid])}}">
+        <input class='form-control' type='hidden' name='clientUid' value='{{ old('clientUid') ? old('clientUid') : $record->uid }}' >
+<div class='form-group mb-3'>
+<label class='control-label'>Device *</label>
+<select class='form-control' name='deviceUid' value='{{ old('deviceUid') ? old('deviceUid') : '' }}' required>
+<option value=''>-- Select --</option>
+<?php $dbOptions = \Illuminate\Support\Facades\DB::table('bdt_device')->get(); ?>
+<?php foreach($dbOptions as $o): ?>
+<option <?= $o->uid === (old('deviceUid') ? old('deviceUid') : '') ? 'selected' : '' ?> value='<?= $o->uid ?>'><?= $o->imei ?> (<?= $o->uid ?>)</option>
+<?php endforeach; ?>
+</select>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Instructions </label>
+<input class='form-control' type='text' name='instructions' value='{{ old('instructions') ? old('instructions') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Internal Memo </label>
+<input class='form-control' type='text' name='internalMemo' value='{{ old('internalMemo') ? old('internalMemo') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status </label>
+<input class='form-control' type='text' name='status' value='{{ old('status') ? old('status') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Status Memo </label>
+<input class='form-control' type='text' name='statusMemo' value='{{ old('statusMemo') ? old('statusMemo') : '' }}' >
+</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('clients_SINGLE-SUB_bdt_devices', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 64 - 0
resources/views/pro/clients_SINGLE/SUB_bdt_devices.blade.php

@@ -0,0 +1,64 @@
+@extends('pro.clients.view')
+@section('content-inner')
+
+    <div class="pb-3">
+
+        <h5 class='my-3 d-flex stag-heading stag-heading-sub'>
+            <div>Bdt Devices</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="{{route('clients_SINGLE-ACTION_add_new_client_bdt_device', ['uid' => $record->uid])}}?optimised=1"><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New</a>
+            </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>Device Id</th>
+<th>Instructions</th>
+<th>Internal Memo</th>
+<th>Status</th>
+<th>Status Memo</th>
+<th>Created At</th>
+<th>Created By Session Id</th>
+<th>Type</th>
+<th>Is Active</th>
+<th>Deactivated At</th>
+<th>Deactivated By Session Id</th>
+<th>Deactivation Memo</th>
+<th>Reactivated At</th>
+<th>Reactivated By Session Id</th>
+<th>Reactivation Memo</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($subRecords as $subRecord)
+                    <tr>
+                        <td><a href="/client_bdt_devices/view/{{ $subRecord->uid }}"><i class="fas fa-share-square"></i></a></td>
+<td><?= $subRecord->client_id ?></td>
+<td><?= $subRecord->device_id ?></td>
+<td><?= $subRecord->instructions ?></td>
+<td><?= $subRecord->internal_memo ?></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>
+<td><?= $subRecord->is_active ?></td>
+<td><?= friendly_date_time($subRecord->deactivated_at) ?></td>
+<td><?= $subRecord->deactivated_by_session_id ?></td>
+<td><?= $subRecord->deactivation_memo ?></td>
+<td><?= friendly_date_time($subRecord->reactivated_at) ?></td>
+<td><?= $subRecord->reactivated_by_session_id ?></td>
+<td><?= $subRecord->reactivation_memo ?></td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+
+    </div>
+
+@endsection

+ 22 - 5
routes/generated.php

@@ -98,6 +98,7 @@ Route::prefix('/clients/view/{uid}')->group(function () {
 	Route::get('SUB_client_sms_numbers', 'clients_SINGLE_Controller@SUB_client_sms_numbers')->name('clients_SINGLE-SUB_client_sms_numbers');
 	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('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');
@@ -107,6 +108,7 @@ Route::prefix('/clients/view/{uid}')->group(function () {
 	Route::get('ACTION_add_new_action_item', 'clients_SINGLE_Controller@ACTION_add_new_action_item')->name('clients_SINGLE-ACTION_add_new_action_item');
 	Route::get('ACTION_add_new_erx_action_item', 'clients_SINGLE_Controller@ACTION_add_new_erx_action_item')->name('clients_SINGLE-ACTION_add_new_erx_action_item');
 	Route::get('ACTION_add_new_client_document', 'clients_SINGLE_Controller@ACTION_add_new_client_document')->name('clients_SINGLE-ACTION_add_new_client_document');
+	Route::get('ACTION_add_new_client_bdt_device', 'clients_SINGLE_Controller@ACTION_add_new_client_bdt_device')->name('clients_SINGLE-ACTION_add_new_client_bdt_device');
 });
 
 // --- pro: notes --- //
@@ -496,6 +498,13 @@ Route::prefix('/client_documents/view/{uid}')->group(function () {
 	Route::get('SUB_dashboard', 'client_documents_SINGLE_Controller@SUB_dashboard')->name('client_documents_SINGLE-SUB_dashboard');
 });
 
+// --- admin: bdt_devices --- //
+Route::prefix('/bdt_devices')->group(function () {
+	Route::get('', 'bdt_devices_Controller@index')->name('bdt_devices-index');
+	Route::get('add_new', 'bdt_devices_Controller@add_new')->name('bdt_devices-add_new');
+	Route::get('view/{uid}', 'bdt_devices_Controller@view')->name('bdt_devices-view');
+});
+
 // --- admin: bdt_devices_SINGLE --- //
 Route::prefix('/bdt_devices/view/{uid}')->group(function () {
 	Route::get('ACTION_deactivate', 'bdt_devices_SINGLE_Controller@ACTION_deactivate')->name('bdt_devices_SINGLE-ACTION_deactivate');
@@ -504,9 +513,17 @@ 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: bdt_devices --- //
-Route::prefix('/bdt_devices')->group(function () {
-	Route::get('', 'bdt_devices_Controller@index')->name('bdt_devices-index');
-	Route::get('add_new', 'bdt_devices_Controller@add_new')->name('bdt_devices-add_new');
-	Route::get('view/{uid}', 'bdt_devices_Controller@view')->name('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');
+	Route::get('ACTION_reactivate', 'client_bdt_devices_SINGLE_Controller@ACTION_reactivate')->name('client_bdt_devices_SINGLE-ACTION_reactivate');
+	Route::get('ACTION_update', 'client_bdt_devices_SINGLE_Controller@ACTION_update')->name('client_bdt_devices_SINGLE-ACTION_update');
+	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');
 });