
{{-- <button type="button" class="btn btn-danger float-right paymentButton" data-toggle="modal" data-target="#modal-fund-transfer">
    Make Payment
</button> --}}
<button data-id="{{$r->id}}" data-userid="{{ $r->userid }}" data-package_rate="{{ $r->package_rate ?? 0 }}" data-billing_type = "{{getBillingType()}}" style="margin: 5px"
    data-amount="{{ $r->dueAmount > 0 ? $r->dueAmount : 0 }}" type="button" class="btn btn-danger btn-sm float-right ajaxPayment" data-toggle="modal" data-target="#paymentModal">
    Make  Payment
</button>





<div class="modal fade" id="modal-fund-transfer">
    <div class="modal-dialog">
        <form id="paid_form" class="form" role="form" enctype="multipart/form-data" method="post"  action="{{ route('paymentprocess', $r->id) }}">
            @method('post')
            @csrf
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="text-center">Payment</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="text-center" id="modalAlert"></div>

                    <div class="row">



                        <input type="hidden" name="client_id" value="{{ $r->id }}">

                        <input type="hidden" name="details" value="{{ serialize($r) }}">

                        <input type="hidden" name="monthsms" id="monthsms" value="">

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label>Payment Date</label>
                                    <input class="form-control datepicker" value="{{ now() }}" type="text" id=""
                                        readonly="">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label>Payment Month </label>
                                    <select name="month" class="form-control" id="payment_month">
                                        <option value="">Select Month</option>
                                        <option value="January">January</option>
                                        <option value="February">February</option>
                                        <option value="March">March</option>
                                        <option value="April">April</option>
                                        <option value="May">May</option>
                                        <option value="June">June</option>
                                        <option value="July">July</option>
                                        <option value="August">August</option>
                                        <option value="September">September</option>
                                        <option value="October">October</option>
                                        <option value="November">November</option>
                                        <option value="December">December</option>
                                    </select>

                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group">
                                    <label>Payment Description</label>
                                    <textarea name="description" id="description" class="form-control"  placeholder="Enter Description..."></textarea>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label>Collected By </label>
                                    <select name="collected_by" class="form-control" id="collected_by" required>
                                        <option value="">Select Employee</option>
                                        @foreach ($employees as $employee)
                                            <option value="{{ $employee->id }}">{{ $employee->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label>Payment Type</label>
                                    <select name="payment_type" class="form-control" id="payment_type" required>
                                        <option value="">Select Type</option>
                                        @if (config('app.only_monthly_bill_show') == true)
                                            @foreach ($incomeHead as $head)
                                                @if (in_array($head->id, [5]))
                                                    <option value="{{ $head->id }}">{{ $head->name }}</option>
                                                @endif
                                            @endforeach
                                        @else

                                            @foreach ($incomeHead as $head)
                                                @if (in_array($head->id, [1, 2, 3, 4, 5, 6, 11]))
                                                    <option value="{{ $head->id }}">{{ $head->name }}</option>
                                                @endif
                                            @endforeach

                                        @endif
                                    </select>
                                </div>
                            </div>
                            @can('payment-discount')
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>Discount(optional)</label>
                                        <input class="form-control" min="0" placeholder="Bonus(optional)"  onkeypress="return numbersOnly(event)" type="number" name="discount">
                                    </div>
                                </div>
                            @else

                                <div class="col-md-6"></div>
                            @endcan


                            <div class="col-md-6">
                                <div class="form-group">
                                    <label>Payment Amount</label>
                                    <input id="in_amount" min="0" class="form-control" onkeypress="return numbersOnly(event)"
                                        type="number" name="amount" required="">
                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group">
                                    <label>Money Receipt ID</label>
                                    <input class="form-control" placeholder="Receipt ID" type="text"
                                        name="money_receipt_number">
                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group mt-2">
                                    <label><input type="checkbox" class="checkbox" name="sms" value="1"
                                            @if (checkSettings('auto-payment-sms-send') == 'enable')
                                                checked
                                            @endif
                                        ><b> Send SMS Notification</b> </label>
                                </div>
                            </div>


                        </div>

                    </div>


                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button class="btn btn-primary buttonHide" type="submit" id="modalSave">Submit</button>
                </div>

            </div>
            <!-- /.modal-content -->
        </form>
    </div>
    <!-- /.modal-dialog -->
</div>


