瀏覽代碼

Care month single - GENERIC RM bills

Vijayakrishnan 3 年之前
父節點
當前提交
0fbb7c9652

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

@@ -41,7 +41,7 @@
 <div class="mb-2">
     <?php
     if(!@$maxMinutes) {
-        $maxMinutes = 240;
+        $maxMinutes = 20;
     }
     ?>
     <label for="" class="text-secondary text-sm">Minutes</label>

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

@@ -739,6 +739,15 @@
                                 </div>
                             </div>
 
+                            @if(($daysDiff !== -1 && $daysDiff <= 90) &&
+                                $careMonth->number_of_days_with_remote_measurements >= 16 &&
+                                $careMonth->has_anyone_interacted_with_client_about_rm_outside_note &&
+                                $minsBilled >= 20)
+                                <div class="mt-2 border border-info p-2">
+                                    @include('app.rm-bills.inline', ['patient' => $patient, 'entityType' => 'CareMonth', 'entityUid' => $careMonth->uid, 'label' => 'RM'])
+                                </div>
+                            @endif
+
                             <div class="mt-2">
                                 {{-- rm reasons --}}
                                 <div class="mb-2">

+ 77 - 0
resources/views/app/rm-bills/add-bill-form/Note.blade.php

@@ -0,0 +1,77 @@
+<?php $genericPro = @$note && $note->allyPro ? $note->allyPro : $pro; ?>
+<?php $genericRates = $genericPro->genericRates(); ?>
+<?php $genericCompanyPro = $genericPro->defaultCompanyPro; ?>
+
+{{-- if no defaultCompanyPro on this pro, STOP --}}
+@if(!$genericPro->defaultCompanyPro)
+    <form url="/api/bill/createForGeneric">
+        <div class="border rounded bg-aliceblue p-2 text-nowrap">
+            <div class="mb-2 font-weight-bold">
+                <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                Cannot create bill!
+            </div>
+            Default company pro is not set.
+        </div>
+    </form>
+@else
+    {{-- if no generic rates for this pro, STOP --}}
+    @if(!$genericRates || !count($genericRates))
+        <form url="/api/bill/createForGeneric">
+            <div class="border rounded bg-aliceblue p-2 text-nowrap">
+                <div class="mb-2 font-weight-bold">
+                    <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                    Cannot create bill!
+                </div>
+                No admin. rates found for pro.
+            </div>
+        </form>
+    @else
+
+<form url="/api/bill/createForGeneric">
+    @if(hasActiveGenericBill($genericPro, @$patient, @$entityType, @$entityUid))
+        <div class="border rounded bg-aliceblue p-2 width-200px d-flex align-items-baseline">
+            <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+            <span>An uncancelled NA bill already exists for this note!</span>
+        </div>
+    @elseif($note && !$note->hasTreatmentServicesBillByHCP())
+        <div class="border rounded bg-aliceblue p-2 width-200px d-flex align-items-baseline">
+            <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+            <span>Pending HCP Signing of Treatment Services</span>
+        </div>
+    @else
+        @include('app.generic-bills.add-bill-form._default-fields')
+        <div class="mb-2 border px-2 pt-2 generic-bill-actions">
+            <p class="text-sm mb-1 text-secondary font-weight-bold">Please indicate the activities time was spent on:</p>
+            <input type="text" name="genericDescription" value="" class="zero-height-field m-0 p-0 border-0" required>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Note reviewed."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Note reviewed.</span>
+            </label>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Care coordinated."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Care coordinated.</span>
+            </label>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Admin. support for follow-up."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Admin. support for follow-up.</span>
+            </label>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Provided Patient w/ Visit-Related Education."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Provided Patient w/ Visit-Related Education.</span>
+            </label>
+        </div>
+        @include('app.generic-bills.add-bill-form._default-actions')
+    @endif
+</form>
+@include('app.generic-bills.add-bill-form._default-script')
+
+    @endif
+@endif

+ 4 - 0
resources/views/app/rm-bills/add-bill-form/_default-actions.blade.php

@@ -0,0 +1,4 @@
+<div class="">
+    <button class="btn btn-primary btn-sm" submit>Submit</button>
+    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+</div>

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

@@ -0,0 +1,68 @@
+@if($pro && $pro->pro_type === 'ADMIN')
+    <div class="mb-2 min-width-300px">
+        <label for="" class="text-secondary text-sm">Company Pro</label>
+        <div class="p-2 border bg-light rounded">{{$genericCompanyPro->pro->displayName()}} / {{$genericCompanyPro->company->name}}</div>
+    </div>
+@endif
+<input type="hidden" name="genericCompanyProUid" value="{{$genericCompanyPro->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
+@if(count($genericRates) === 1)
+    <input type="hidden" name="code"
+           data-entity-type="{{$entityType}}"
+           data-amount="{{ $genericRates[0]->amount }}"
+           value="{{$genericRates[0]->code}}">
+    <p class="mb-2">Service: <br><b>{{ $genericRates[0]->code }} (${{ $genericRates[0]->amount }}/hr)</b></p>
+@else
+    <div class="mb-2">
+        <label for="" class="text-secondary text-sm">Service</label>
+        <select autofocus class="form-control" name="code"
+                data-entity-type="{{$entityType}}"
+                onchange="switchGenericRate(this)">
+            <option value="">-- Select Code --</option>
+            @foreach($genericPro->genericRates() as $genericRate)
+                <option data-amount="{{ $genericRate->amount }}" value="{{ $genericRate->code }}">
+                    {{ $genericRate->code }} (${{ $genericRate->amount }})
+                </option>
+            @endforeach
+        </select>
+    </div>
+@endif
+<div class="mb-2">
+    <?php
+    if(!@$maxMinutes) {
+        $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 }} minutes</option>
+            <?php } ?>
+        </select>
+    </div>
+    <div class="mb-2" calculated-generic-amount></div>
+</div>
+@if($entityType !== 'Note')
+    <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>
+@endif
+<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>

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

@@ -0,0 +1,79 @@
+<script>
+    (function() {
+        function init() {
+            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'));
+                }
+                $(_trigger).closest('form').find('[name="numberOfUnits"]').val('');
+
+                @if($genericRates && count($genericRates) && count($genericRates) === 1)
+                    selectedGenericRate = {{ $genericRates[0]->amount }};
+                @endif
+
+                // max num units to limit at $15
+                if ($(_trigger).attr('data-entity-type') === 'Note') {
+                    let maxNABillableAmount = 30,
+                        amountPer5Minutes = selectedGenericRate / 12,
+                        maxNumberOf5Minutes = Math.ceil(maxNABillableAmount / amountPer5Minutes),
+                        maxHours = (maxNumberOf5Minutes * 5) / 60,
+                        unitsSelect = $(_trigger).closest('form').find('[name="numberOfUnits"]');
+
+                    // CRITERIA TO BILL UP TO 60 MINS. is note.hcp_pro_id == client.mcp_pro_id AND note.wasCmSetupPerformed IS TRUE
+                    $('.cm-setup-alert').remove();
+                    @if(@$note && @$patient && $note->hcp_pro_id === $patient->mcp_pro_id && $note->was_cm_setup_performed)
+                    maxHours = 1;
+                    @endif
+                    @if(@$note && @$patient && $note->hcp_pro_id === $patient->mcp_pro_id && !$note->was_cm_setup_performed)
+                    $('<div/>')
+                        .addClass('alert alert-warning my-2 cm-setup-alert border border-warning p-2')
+                        .html('<div class="mb-2">CCM setup may have been performed, but has not been marked as such in the note.</div>' +
+                            'Please ask the HCP if they need to do that, and then you can bill up to 60 mins. because patient needs education re: CM')
+                        .insertAfter(unitsSelect);
+                    @endif
+
+                    unitsSelect.find('option').each(function () {
+                        if (this.value) {
+                            if (+this.value > maxHours) {
+                                $(this).hide();
+                            }
+                            else {
+                                $(this).show();
+                            }
+                        }
+                        else {
+                            $(this).show();
+                        }
+                    });
+                }
+
+                calculateGenericBillAmount($(_trigger).closest('form').find('[name="numberOfUnits"]'));
+            };
+            window.calculateGenericBillAmount = function (_trigger) {
+                _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'),
+                    reimbursable = hours * selectedGenericRate;
+                if (isNaN(reimbursable)) reimbursable = 0;
+                amountTarget.html('<b>Reimbursable:</b> $' + reimbursable.toFixed(2));
+            };
+            window.updateGenericBillAction = function (_trigger) {
+                let actions = [];
+                $(_trigger).closest('.generic-bill-actions').find('.generic-bill-action:checked').each(function () {
+                    actions.push($(this).attr('data-action'));
+                });
+                $(_trigger).closest('.generic-bill-actions').find('[name="genericDescription"]').val(actions.join("<br>"));
+            };
+            @if($genericRates && count($genericRates) && count($genericRates) === 1)
+            switchGenericRate($('[name="code"][data-entity-type]'));
+            @endif
+        }
+        addMCInitializer('init-generic-add-bill', init);
+    }).call(window);
+</script>

+ 37 - 0
resources/views/app/rm-bills/add-bill-form/default.blade.php

@@ -0,0 +1,37 @@
+<?php $genericPro = @$note && $note->allyPro ? $note->allyPro : $pro; ?>
+<?php $genericRates = $genericPro->genericRates(); ?>
+<?php $genericCompanyPro = $genericPro->defaultCompanyPro; ?>
+
+{{-- if no defaultCompanyPro on this pro, STOP --}}
+@if(!$genericCompanyPro)
+    <form url="/api/bill/createForGeneric">
+        <div class="border rounded bg-aliceblue p-2 text-nowrap">
+            <div class="mb-2 font-weight-bold">
+                <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                Cannot create bill!
+            </div>
+            Default company pro is not set.
+        </div>
+    </form>
+@else
+    {{-- if no generic rates for this pro, STOP --}}
+    @if(!$genericRates || !count($genericRates))
+        <form url="/api/bill/createForGeneric">
+            <div class="border rounded bg-aliceblue p-2 text-nowrap">
+                <div class="mb-2 font-weight-bold">
+                    <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                    Cannot create bill!
+                </div>
+                No admin. rates found for pro.
+            </div>
+        </form>
+    @else
+        <form url="/api/bill/createForGeneric" right>
+            <p class="mb-2 font-weight-bold">Create RM Bill</p>
+            @include('app.generic-bills.add-bill-form._default-fields')
+            @include('app.generic-bills.add-bill-form._default-actions')
+        </form>
+        @include('app.generic-bills.add-bill-form._default-script')
+    @endif
+@endif
+

+ 71 - 0
resources/views/app/rm-bills/context.blade.php

@@ -0,0 +1,71 @@
+<?php
+switch ($bill->generic_target_entity_type) {
+    case 'Ticket':
+        $ticket = \App\Models\Ticket::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Ticket > {{strtoupper($ticket->category)}}
+            <a class="ml-2"
+               native target="_blank"
+               open-in-stag-popup
+               mc-initer="patient-tickets"
+               popup-style="tall"
+               title="Ticket Details"
+               href="/patients/view/{{$ticket->patient->uid}}/tickets/{{$ticket->category}}/{{$ticket->uid}}">
+                View
+            </a>
+        </div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $ticket->patient])}}">{{$ticket->patient->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($ticket->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    case 'Appointment':
+        $appointment = \App\Models\Appointment::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Appointment
+            <a class="ml-2"
+               native target="_blank"
+               href="/patients/view/{{$appointment->client->uid}}/calendar/{{$appointment->uid}}">
+                View
+            </a>
+        </div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $appointment->client])}}">{{$appointment->client->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Pro: {{$appointment->pro->displayName()}}</div>
+            <div class="text-secondary mb-1">Date: <b>{{friendlier_date_time($appointment->raw_start_time)}}</b></div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($appointment->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    case 'ClientBDTDevice':
+        $device = \App\Models\ClientBDTDevice::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Device > {{strtoupper($device->device->category)}}</div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $device->client])}}">{{$device->client->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($device->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    case 'Note':
+        $note = \App\Models\Note::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Note
+            <a class="ml-2"
+               native target="_blank"
+               href="/patients/view/{{$note->client->uid}}/notes/view/{{$note->uid}}">
+                View
+            </a>
+        </div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $note->client])}}">{{$note->client->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Eff. Date: {{friendlier_date_time($note->effective_dateest, false)}}</div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($note->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    default:
+        echo $bill->generic_target_entity_type ? $bill->generic_target_entity_type : '-';
+}
+?>

+ 8 - 0
resources/views/app/rm-bills/create_generic-bill.blade.php

@@ -0,0 +1,8 @@
+<div moe wide relative class="">
+    <a class="" href="" show start>Create {{@$label ? $label : 'Admin.'}} Bill</a>
+    @if (!!@$entityType && file_exists(resource_path('views/app/rm-bills/add-bill-form/' . $entityType . '.blade.php')))
+        @include('app.rm-bills.add-bill-form.' . $entityType)
+    @else
+        @include('app.rm-bills.add-bill-form.default')
+    @endif
+</div>

+ 224 - 0
resources/views/app/rm-bills/inline.blade.php

@@ -0,0 +1,224 @@
+<?php
+
+use App\Models\Note;
+use App\Models\Pro;
+use App\Models\Client;
+
+/** @var Note $note */
+/** @var Pro $genericPro */
+/** @var Pro $pro */
+/** @var Client $patient */
+/** @var $entityType */
+/** @var $entityUid */
+
+$genericBills = genericBills($pro, @$patient, @$entityType, @$entityUid);
+?>
+
+@if(!count($genericBills))
+    <div class="{{@$class ? $class : ''}} d-flex align-items-center">
+        <p class="font-weight-bold mb-0">No {{@$label ? $label : 'Admin.'}} Bills</p>
+        <span class="mx-2 text-secondary">|</span>
+        @include('app.rm-bills.create_generic-bill')
+    </div>
+@else
+    <div class="{{@$class ? $class : ''}}">
+        <div class="d-flex align-items-center mb-2">
+            <p class="font-weight-bold m-0">{{@$label ? $label : 'Admin.'}} Bills</p>
+            @if(!@$noCreate)
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.rm-bills.create_generic-bill')
+            @endif
+        </div>
+            <table class="table table-sm table-striped mb-0 table-bordered">
+                <thead class="bg-light">
+                <tr class="text-secondary">
+                    @if(@$adminView)
+                        <th class="border-bottom-0">Context</th>
+                    @endif
+                    <th class="border-bottom-0">Service</th>
+                    <th class="border-bottom-0">Billable</th>
+                    <th class="border-bottom-0">Sign</th>
+                    <th class="border-bottom-0">Cancel</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach ($genericBills as $bill)
+                    <tr class="{{$bill->is_cancelled ? 'bg-light text-secondary' : ''}}">
+                        @if(@$adminView)
+                            <td>
+                                @include('app.rm-bills.context')
+                            </td>
+                        @endif
+                        <td>{{$bill->code}}
+                            @if($bill->generic_description)
+                                <pre class="max-width-300px text-wrap mb-0 text-sm text-secondary font-italic">{!! preg_replace('#<br\s*/?>#i', "\n", $bill->generic_description) !!}</pre>
+                            @endif
+                            @if(!$bill->is_signed_by_generic_pro)
+                                <div moe wide relative class="d-block">
+                                    <a href="#" start show class="text-nowrap text-sm">Edit Description</a>
+                                    <form url="/api/bill/putGenericDescription" right>
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Edit Description</p>
+                                        <div class="mb-2">
+                                                <textarea class="text form-control form-control-sm"
+                                                          rows="5"
+                                                          name="genericDescription"
+                                                          placeholder="">{{$bill->generic_description ? preg_replace('#<br\s*/?>#i', "\n", $bill->generic_description) : ''}}</textarea>
+                                        </div>
+                                        <div>
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+                            <div class="text-nowrap screen-only">
+                                <span class="text-secondary">Paid: </span>
+                                <span>{{ $bill->has_generic_pro_been_paid ? 'Yes' : 'No' }}</span>
+                            </div>
+                            @if(!$bill->has_generic_pro_been_paid)
+                                <div class="text-nowrap screen-only">
+                                    <span class="text-secondary">Expected: </span>
+                                    <span class="font-weight-bold">${{ round($bill->total_expected, 2) }}</span>
+                                </div>
+                            @else
+                                <div class="text-nowrap screen-only">
+                                    <span class="text-secondary">Amount: </span>
+                                    <span class="font-weight-bold">${{ round($bill->total_paid, 2) }}</span>
+                                </div>
+                            @endif
+                        </td>
+                        <td class="">
+                            <?php
+                            $totalSeconds = $bill->number_of_units * 3600;
+                            $remainder = $totalSeconds % 60;
+                            if ($remainder !== 0) {
+                                if ($remainder < 30) {
+                                    $totalSeconds = $totalSeconds - $remainder;
+                                }
+                                else {
+                                    $totalSeconds = $totalSeconds + (60 - $remainder);
+                                }
+                            }
+                            ?>
+                            {{ time_in_hrminsec($totalSeconds) }}
+                            <div>
+                                @if($bill->has_generic_pro_been_paid)
+                                    <span class="text-secondary">Paid. </span>
+                                    <span class="font-weight-bold">${{ round($bill->total_paid, 2) }}</span>
+                                @else
+                                    <span class="text-secondary">Exp. </span>
+                                    <span class="font-weight-bold">{{ $bill->total_expected ? '$' . round($bill->total_expected, 2) : '-' }}</span>
+                                @endif
+                            </div>
+                        </td>
+                        <td>
+                            @if(!$bill->is_cancelled)
+                                @if($bill->is_signed_by_generic_pro)
+                                    <div class="d-block text-secondary text-nowrap">
+                                        <i class="fa fa-check"></i>
+                                        Pro Signed
+                                    </div>
+                                @else
+                                    <div moe relative
+                                          class="d-block {{ $bill->generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                                          title="{{ $bill->generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
+                                        <a class="text-nowrap" href="" show start>Sign</a>
+                                        <form url="/api/bill/signAsGenericPro" right>
+                                            <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                            <p>Sign this bill?</p>
+                                            <div class="mb-0">
+                                                <button class="btn btn-success btn-sm" submit>Sign</button>
+                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
+                            @endif
+                        </td>
+                        <td>  <!-- cancellation -->
+                            @if($bill->is_cancelled)
+                                <div class="text-warning-mellow font-weight-bold">Cancelled</div>
+                                @if($bill->cancellation_memo)
+                                    <div class="text-dark text-sm font-italic my-1">{{$bill->cancellation_memo}}</div>
+                                @endif
+                                @if($bill->is_cancelled_by_administrator)
+                                    <div class="text-secondary text-sm text-nowrap">(by Administrator)</div>
+                                @endif
+                                <div moe class="mt-1">
+                                    <a class="text-nowrap" href="" show start>Update Memo</a>
+                                    <form url="/api/bill/updateCancellationMemo">
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Update Cancellation Memo</p>
+                                        <div class="mb-2">
+                                            <textarea class="text form-control form-control-sm" name="cancellationMemo"
+                                                      placeholder="">{{$bill->cancellation_memo ? $bill->cancellation_memo : ($pro->pro_type === 'ADMIN' ? 'Please contact billing.' : '')}}</textarea>
+                                        </div>
+                                        <div>
+                                            <button class="btn btn-success btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @else
+                                <div class="d-block" moe relative="">
+                                    <a class="text-danger" href="" show start>Cancel</a>
+                                    <form url="/api/bill/markCancelled" right="">
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p class="mb-2">Cancel this bill?</p>
+                                        <div class="mb-2">
+                                            <label class="mb-1 text-secondary">Cancellation Memo</label>
+                                            <textarea type="text" name="memo" placeholder="Memo" class="form-control form-control-sm">@if($pro->pro_type === 'ADMIN')Please contact billing.@endif</textarea>
+                                        </div>
+                                        <div class="mb-0">
+                                            <button class="btn btn-danger btn-sm" submit>Yes</button>
+                                            <button class="btn btn-default border btn-sm" cancel>No</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+
+                            @if($bill->is_cancelled && !$bill->is_cancellation_acknowledged)
+                                <div class="mt-2 text-secondary text-nowrap">
+                                    <i class="fa fa-exclamation-triangle"></i>
+                                    Not Ack.
+                                </div>
+                                <div class="d-block mt-1" moe>
+                                    <a class="text-nowrap" href="" show start>Ack. Cancellation</a>
+                                    <form url="/api/bill/acknowledgeCancellation">
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Acknowledge Cancellation?</p>
+                                        <div class="mb-0">
+                                            {{--<input type="text" class="text form-control form-control-sm" name="cancellationMemo" value="{{$bill->cancellation_memo}}" placeholder=""><br>--}}
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+
+                            @if($bill->is_cancellation_acknowledged)
+                                <div class="mt-2 text-secondary">
+                                    <i class="fa fa-check"></i>
+                                    Ack.
+                                </div>
+                                <div class="d-block mt-1" moe>
+                                    <a class="text-nowrap" href="" show start>Undo Cancellation Ack.</a>
+                                    <form url="/api/bill/undoAcknowledgeCancellation">
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Undo Acknowledge Cancellation?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-success btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+    </div>
+@endif

+ 8 - 0
resources/views/app/rm-bills/modal.blade.php

@@ -0,0 +1,8 @@
+<a native target="_blank"
+   open-in-stag-popup
+   class="text-nowrap"
+   popup-style="tall"
+   title="{{@$label ? $label : 'Admin'}} bills"
+   href="{{route('generic-bill-view', ['entityType' => @$entityType, 'entityUid' => @$entityUid])}}">
+    {{@$label ? $label : 'Admin'}} bills
+</a>