浏览代码

Generic bills - support for entity specific add modals

Vijayakrishnan 4 年之前
父节点
当前提交
e536e10b9b

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

@@ -0,0 +1,83 @@
+<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>

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

@@ -1,84 +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>
-<!--            <input type="text" name="code" class="form-control form-control-sm" value="" autofocus required>-->
-            <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 = 60; ?>
-            <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>
+@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