<?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>Awaiting completion by HCP</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
