<?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

