Selaa lähdekoodia

Custom add-bill UI for Note entity

Vijayakrishnan 4 vuotta sitten
vanhempi
commit
e150483d64

+ 11 - 0
resources/views/app/generic-bills/add-bill-form/Note.blade.php

@@ -0,0 +1,11 @@
+<form url="/api/bill/createForGeneric">
+    @if(hasActiveGenericBill($pro, @$patient, @$entityType, @$entityUid))
+        <div class="border rounded bg-aliceblue p-2 width-200px">
+            <i class="fa fa-exclamation-triangle text-warning-mellow mr-1"></i>
+            An uncancelled NA bill already exists for this note!
+        </div>
+    @else
+        @include('app.generic-bills.add-bill-form._default-fields')
+    @endif
+</form>
+@include('app.generic-bills.add-bill-form._default-script')

+ 54 - 0
resources/views/app/generic-bills/add-bill-form/_default-fields.blade.php

@@ -0,0 +1,54 @@
+<div class="mb-2">
+    <label for="" class="text-secondary text-sm">Pro</label>
+    <input type="text" class="form-control form-control-sm" value="{{$pro->displayName()}}" readonly>
+</div>
+<input type="hidden" name="genericProUid" value="{{$pro->uid}}">
+@if(@$note)
+    <input type="hidden" name="optionalNoteUid" value="{{$note->uid}}">
+@endif
+@if(@$patient)
+    <input type="hidden" name="optionalClientUid" value="{{$patient->uid}}">
+@endif
+@if(@$entityType)
+    <input type="hidden" name="genericTargetEntityType" value="{{$entityType}}">
+@endif
+@if(@$entityUid)
+    <input type="hidden" name="genericTargetEntityUid" value="{{$entityUid}}">
+@endif
+<div class="mb-2">
+    <label for="" class="text-secondary text-sm">Service</label>
+    <select autofocus class="form-control" name="code" onchange="switchGenericRate(this)">
+        <option value="">-- Select Code --</option>
+        @foreach($pro->genericRates() as $genericRate)
+            <option data-amount="{{ $genericRate->amount }}" value="{{ $genericRate->code }}">
+                {{ $genericRate->code }} (${{ $genericRate->amount }})
+            </option>
+        @endforeach
+    </select>
+</div>
+<div class="mb-2">
+    <?php $maxMinutes = 240; ?>
+    <label for="" class="text-secondary text-sm">Minutes</label>
+    <div class="mb-2">
+        <select name="numberOfUnits" class="form-control form-control-sm"
+                onchange="calculateGenericBillAmount(this)">
+            <option value=""> -- select -- </option>
+            <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
+            <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
+            <?php } ?>
+        </select>
+    </div>
+    <div class="mb-2" calculated-generic-amount></div>
+</div>
+<div class="mb-2">
+    <label for="" class="text-secondary text-sm">Description</label>
+    <input type="text" name="genericDescription" class="form-control form-control-sm" value="">
+</div>
+<div class="mb-2">
+    <label for="" class="text-secondary text-sm">Effective Date</label>
+    <input type="date" name="effectiveDate" class="form-control form-control-sm" value="{{date('Y-m-d')}}" required>
+</div>
+<div class="">
+    <button class="btn btn-primary btn-sm" submit>Submit</button>
+    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+</div>

+ 23 - 0
resources/views/app/generic-bills/add-bill-form/_default-script.blade.php

@@ -0,0 +1,23 @@
+<script>
+    (function() {
+        let selectedGenericRate = 0;
+        window.switchGenericRate = function(_trigger) {
+            selectedGenericRate = 0;
+            if($(_trigger).find('option:selected').first().length) {
+                selectedGenericRate = +($(_trigger).find('option:selected').first().attr('data-amount'));
+            }
+            calculateGenericBillAmount($(_trigger).closest('form').find('[name="numberOfUnits"]'));
+        };
+        window.calculateGenericBillAmount = function(_trigger) {
+            debugger
+            _trigger = $(_trigger);
+            let amountTarget = _trigger.closest('form').find('[calculated-generic-amount]');
+            if(!_trigger.find('option:selected').length) {
+                amountTarget.text('');
+                return;
+            }
+            let hours = +_trigger.find('option:selected').attr('value');
+            amountTarget.html('<b>Reimbursable Amount:</b> $' + (hours * selectedGenericRate).toFixed(2));
+        }
+    }).call(window);
+</script>

+ 5 - 83
resources/views/app/generic-bills/add-bill-form/default.blade.php

@@ -1,83 +1,5 @@
-<span class="mx-2 text-secondary">|</span>
-<div moe wide relative class="">
-    <a class="" href="" show start>Create {{@$label ? $label : 'Generic'}} Bill</a>
-    <form url="/api/bill/createForGeneric">
-        <div class="mb-2">
-            <label for="" class="text-secondary text-sm">Pro</label>
-            <input type="text" class="form-control form-control-sm" value="{{$pro->displayName()}}" readonly>
-        </div>
-        <input type="hidden" name="genericProUid" value="{{$pro->uid}}">
-        @if(@$note)
-            <input type="hidden" name="optionalNoteUid" value="{{$note->uid}}">
-        @endif
-        @if(@$patient)
-            <input type="hidden" name="optionalClientUid" value="{{$patient->uid}}">
-        @endif
-        @if(@$entityType)
-            <input type="hidden" name="genericTargetEntityType" value="{{$entityType}}">
-        @endif
-        @if(@$entityUid)
-            <input type="hidden" name="genericTargetEntityUid" value="{{$entityUid}}">
-        @endif
-        <div class="mb-2">
-            <label for="" class="text-secondary text-sm">Service</label>
-            <select autofocus class="form-control" name="code" onchange="switchGenericRate(this)">
-                <option value="">-- Select Code --</option>
-                @foreach($pro->genericRates() as $genericRate)
-                    <option data-amount="{{ $genericRate->amount }}" value="{{ $genericRate->code }}">
-                        {{ $genericRate->code }} (${{ $genericRate->amount }})
-                    </option>
-                @endforeach
-            </select>
-        </div>
-        <div class="mb-2">
-            <?php $maxMinutes = 240; ?>
-            <label for="" class="text-secondary text-sm">Minutes</label>
-            <div class="mb-2">
-                <select name="numberOfUnits" class="form-control form-control-sm"
-                        onchange="calculateGenericBillAmount(this)">
-                    <option value=""> -- select -- </option>
-                    <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
-                    <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
-                    <?php } ?>
-                </select>
-            </div>
-            <div class="mb-2" calculated-generic-amount></div>
-        </div>
-        <div class="mb-2">
-            <label for="" class="text-secondary text-sm">Description</label>
-            <input type="text" name="genericDescription" class="form-control form-control-sm" value="">
-        </div>
-        <div class="mb-2">
-            <label for="" class="text-secondary text-sm">Effective Date</label>
-            <input type="date" name="effectiveDate" class="form-control form-control-sm" value="{{date('Y-m-d')}}" required>
-        </div>
-        <div class="">
-            <button class="btn btn-primary btn-sm" submit>Submit</button>
-            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-        </div>
-    </form>
-</div>
-<script>
-    (function() {
-        let selectedGenericRate = 0;
-        window.switchGenericRate = function(_trigger) {
-            selectedGenericRate = 0;
-            if($(_trigger).find('option:selected').first().length) {
-                selectedGenericRate = +($(_trigger).find('option:selected').first().attr('data-amount'));
-            }
-            calculateGenericBillAmount($(_trigger).closest('form').find('[name="numberOfUnits"]'));
-        };
-        window.calculateGenericBillAmount = function(_trigger) {
-            debugger
-            _trigger = $(_trigger);
-            let amountTarget = _trigger.closest('form').find('[calculated-generic-amount]');
-            if(!_trigger.find('option:selected').length) {
-                amountTarget.text('');
-                return;
-            }
-            let hours = +_trigger.find('option:selected').attr('value');
-            amountTarget.html('<b>Reimbursable Amount:</b> $' + (hours * selectedGenericRate).toFixed(2));
-        }
-    }).call(window);
-</script>
+<form url="/api/bill/createForGeneric">
+    @include('app.generic-bills.add-bill-form._default-fields')
+</form>
+@include('app.generic-bills.add-bill-form._default-script')
+

+ 9 - 5
resources/views/app/generic-bills/create_generic-bill.blade.php

@@ -1,5 +1,9 @@
-@if (!!@$entityType && file_exists(resource_path('views/app/generic-bills/add-bill-form/' . $entityType . '.blade.php')))
-    @include('app.generic-bills.add-bill-form.' . $entityType)
-@else
-    @include('app.generic-bills.add-bill-form.default')
-@endif
+<span class="mx-2 text-secondary">|</span>
+<div moe wide relative class="">
+    <a class="" href="" show start>Create {{@$label ? $label : 'Generic'}} Bill</a>
+    @if (!!@$entityType && file_exists(resource_path('views/app/generic-bills/add-bill-form/' . $entityType . '.blade.php')))
+        @include('app.generic-bills.add-bill-form.' . $entityType)
+    @else
+        @include('app.generic-bills.add-bill-form.default')
+    @endif
+</div>