Pārlūkot izejas kodu

Caremonth single - add time entry update

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
736ad0b0f6

+ 1 - 78
resources/views/app/patient/care-month/_matrix-v2.blade.php

@@ -40,84 +40,7 @@ foreach ($days as $k => $day) {
     @if($careMonth->is_client_enrolled_in_rm)
         <div class="d-flex align-items-center">
             <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
-            @if(!$activeRMBill)
-                <span class="mx-2 text-secondary">|</span>
-                <div moe large>
-                    <a start show class="py-0 mb-3">Add</a>
-                    <form url="/api/careMonthEntry/createForRm">
-                        <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
-                        <div class="mb-2">
-                            <div class="row">
-                                <div class="col-4 pr-0">
-                                    <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$pro->uid }}"
-                                            required>
-                                        <option value="">-- Select Pro --</option>
-                                        @foreach($pros as $iPro)
-                                            <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
-                                                    value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
-                                        @endforeach
-                                    </select>
-                                </div>
-                                <div class="col-4 pr-0">
-                                    <?php
-                                    $sD = strtotime($careMonth->start_date);
-                                    $y = date('Y', $sD);
-                                    $m = date('m', $sD);
-                                    $d = date('t', $sD);
-                                    $yCurrent = date('Y');
-                                    $mCurrent = date('m');
-                                    $isToday = false;
-                                    if($y === $yCurrent && $m === $mCurrent) {
-                                        $d = date('d');
-                                        $isToday = true;
-                                    }
-                                    ?>
-                                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
-                                           value="{{date('Y-m-d')}}"
-                                           class="form-control form-control-sm w-100" name="effectiveDate"
-                                           placeholder="Effective Date" required>
-                                </div>
-                                <div class="col-4">
-                                    <select name="timeInSeconds" class="form-control form-control-sm w-100 cm-time-value" required>
-                                        <option value="">-- Minutes --</option>
-                                        <option value="60">1 minute</option>
-                                        <option value="300">5 minutes</option>
-                                        <option value="600">10 minutes</option>
-                                        <option value="1200">20 minutes</option>
-                                    </select>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="mb-2 border border-info p-2 mt-2 bg-light">
-                            <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
-                            <div class="d-flex border-top mt-2">
-                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
-                                    <span>Yes</span>
-                                </label>
-                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
-                                    <span>No</span>
-                                </label>
-                            </div>
-                        </div>
-                        <div class="mb-2">
-                            <div class="row">
-                                <div class="col-12">
-                                    <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="d-flex align-items-center">
-                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                        </div>
-                    </form>
-                </div>
-            @else
-                <span class="mx-2 text-secondary">|</span>
-                <span class="text-secondary">Can't modify since a bill exists</span>
-            @endif
+            @include('app.practice-management.care_month_add_entry_form', ['right' => false])
         </div>
         <table class="table table-striped table-sm table-bordered mt-2 mb-0 table-hover">
             <thead>

+ 1 - 1
resources/views/app/patient/care-month/dashboard.blade.php

@@ -319,7 +319,7 @@
                                         <span class="ml-1 text-secondary text-sm font-weight-normal">(20 needed)</span>
                                     </b>
                                   
-                                    @include('app.practice-management.care_month_add_entry_form')
+                                    @include('app.practice-management.care_month_add_entry_form', ['right' => true])
                                 </div>
 
                                 @if($performer->pro->pro_type == 'ADMIN')

+ 85 - 50
resources/views/app/practice-management/care_month_add_entry_form.blade.php

@@ -1,54 +1,89 @@
-<div moe large class="ml-2">
-    <a start show class="py-0 mb-3 text-sm">Add Entry</a>
-    <form url="/api/careMonthEntry/createForRm" right>
-        <input type="hidden" name="careMonthUid" value="{{$careMonth->uid }}">
-        <input type="hidden" name="proUid" value="{{ $performer->pro->uid }}">
-        <div class="mb-2">
-            <div class="row">
-                <div class="col-6 pr-0">
-                    <?php
-                    $sD = strtotime($careMonth->start_date);
-                    $y = date('Y', $sD);
-                    $m0 = date('m', $sD);
-                    $d = date('t', $sD);
-                    $defaultED = $sD >= strtotime(date('Y-m-d')) ? date('Y-m-d') : $careMonth->start_date;
-                    ?>
-                    <label class="text-sm text-secondary mb-1">Effective Date</label>
-                    <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
-                            value="{{$defaultED}}"
-                            class="form-control form-control-sm w-100" name="effectiveDate"
-                            placeholder="Effective Date" required>
+@if(!$activeRMBill)
+    <span class="mx-2 text-secondary">|</span>
+    <div moe large id="cm-entry-form">
+        <a start show class="py-0 mb-3">Add</a>
+        <form url="/api/careMonthEntry/createForRm" {{@$right ? 'right' : ''}}>
+            <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
+            <div class="mb-2">
+                <div class="row">
+                    <div class="col-4 pr-0">
+                        <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$pro->uid }}"
+                                required>
+                            <option value="">-- Select Pro --</option>
+                            @foreach($pros as $iPro)
+                                <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
+                                        value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
+                            @endforeach
+                        </select>
+                    </div>
+                    <div class="col-4 pr-0">
+                        <?php
+                        $sD = strtotime($careMonth->start_date);
+                        $y = date('Y', $sD);
+                        $m = date('m', $sD);
+                        $d = date('t', $sD);
+                        $yCurrent = date('Y');
+                        $mCurrent = date('m');
+                        $isToday = false;
+                        if($y === $yCurrent && $m === $mCurrent) {
+                            $d = date('d');
+                            $isToday = true;
+                        }
+                        ?>
+                        <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
+                               value="{{date('Y-m-d')}}"
+                               class="form-control form-control-sm w-100" name="effectiveDate"
+                               placeholder="Effective Date" required>
+                    </div>
+                    <div class="col-4">
+                        <input type="hidden" name="timeInSeconds">
+                        <input type="number" min="1" max="20" name="timeInMinutes" class="form-control form-control-sm w-100 cm-time-value"
+                               required>
+                    </div>
                 </div>
-                <div class="col-6">
-                    <label class="text-sm text-secondary mb-1">Seconds</label>
-                    <input type="number" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
-                            value="1200" placeholder="Time (secs.)" required>
+            </div>
+            <div class="mb-2 border border-info p-2 mt-2 bg-light">
+                <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
+                <div class="d-flex border-top mt-2">
+                    <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
+                        <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
+                        <span>Yes</span>
+                    </label>
+                    <label class="mt-2 mb-0 d-inline-flex align-items-center">
+                        <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
+                        <span>No</span>
+                    </label>
+                </div>
+            </div>
+            <div class="mb-2">
+                <div class="row">
+                    <div class="col-12">
+                        <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
+                    </div>
                 </div>
             </div>
-        </div>
-
-        <div class="mb-2 border border-info p-2 mt-2 bg-light">
-            <span>I have had interactive communication with <b>{{$careMonth->client->displayName()}}</b>.</span>
-            <div class="d-flex border-top mt-2">
-                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
-                    <span>Yes</span>
-                </label>
-                <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
-                    <span>No</span>
-                </label>
+            <div class="d-flex align-items-center">
+                <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
             </div>
-        </div>
-       
-        <div class="mb-2">
-            <label class="text-sm text-secondary mb-1">Memo</label>
-            <textarea class="form-control form-control-sm w-100" name="contentText"
-                        required>Interacted with the patient</textarea>
-        </div>
-        <div class="d-flex align-items-center">
-            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-        </div>
-    </form>
-</div>
+        </form>
+    </div>
+@else
+    <span class="mx-2 text-secondary">|</span>
+    <span class="text-secondary">Can't modify since a bill exists</span>
+@endif
+<script>
+    (function() {
+        function init() {
+            $(document)
+                .off('input change paste keyup', '[name="timeInMinutes"]')
+                .on('input change paste keyup', '[name="timeInMinutes"]', function() {
+                    let form = $(this).closest('form'), val = '' + $(this).val();
+                    if(!isNaN(val)) {
+                        form.find('[name="timeInSeconds"]').val(+val * 60);
+                    }
+                });
+        }
+        addMCInitializer('cm-entry-form', init, '#cm-entry-form');
+    }).call(window);
+</script>