<?php $rmRates = $careMonth->mcp->rmRates();  //TODO: revert ?>
@if(!$careMonth->is_bill_closed && !$careMonth->is_billing_marked_done)
    <span class="mx-2 text-secondary">|</span>
    <div moe wide class="">
        <a class="" href="" show start>Create Bill</a>
        <form url="/api/careMonth/generateBillForRm">
            <input type="hidden" name="uid" value="{{$careMonth->uid}}">
            <div class="mb-2">
                <select autofocus class="form-control" name="rmCode">
                    <option value="">-- Select Code --</option>
                    @foreach($rmRates as $rmRate)
                        <option data-amount="{{ $rmRate->amount }}" value="{{ $rmRate->code }}">
                            {{ $rmRate->code }} (${{ $rmRate->amount }})
                        </option>
                    @endforeach
                </select>
            </div>

            <div class="my-3">
                <input type="checkbox" name="signAndMarkBillingDone">&nbsp;Sign and Mark Billing Done
            </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>
@endif
@if($careMonth->is_bill_closed)
    <b class="ml-2 text-info">[BILLING CLOSED]</b>
@endif
@if($pro->pro_type === 'ADMIN')
    @if(!$careMonth->is_bill_closed)
        <span class="mx-2 text-secondary">|</span>
        <span class="d-block" moe>
            <a class="text-danger" href="" show start>Close Billing</a>
            <form url="/api/careMonth/closeBilling">
                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
                <p>Close billing?</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>
        </span>
    @elseif($careMonth->is_bill_closed)
        <span class="mx-2 text-secondary">|</span>
        <span class="d-block" moe>
            <a class="text-danger" href="" show start>Reopen Billing</a>
            <form url="/api/careMonth/reopenBilling">
                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
                <p>Reopen billing?</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>
        </span>
    @endif
@endif
@if(!$careMonth->is_billing_marked_done)
    <span class="mx-2 text-secondary">|</span>
    <span class="d-block" moe>
        <a class="text-danger" href="" show start>Mark Billing Done</a>
        <form url="/api/careMonth/setIsBillingMarkedDoneToTrue">
            <input type="hidden" name="uid" value="{{$careMonth->uid}}">
            <p>Mark billing on this care month as done?</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>
    </span>
@else
    <span class="mx-2 text-secondary">|</span>
    <span class="d-block" moe>
        <i class="fa fa-check"></i>
        <a class="text-danger" href="" show start>Undo Mark Billing Done</a>
        <form url="/api/careMonth/setIsBillingMarkedDoneToFalse">
            <input type="hidden" name="uid" value="{{$careMonth->uid}}">
            <p>Mark billing on this care month as not done?</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>
    </span>
@endif

