@extends('template.app')

@section('title', 'Invoice Patial Payment')

@section('content')
<div class="row">
    <div class="col-12 payment">
        <div class="card card-box">
            <div class="card-head text-black" style="background-color:#3FCC7E;">
                <header>Invoice - {{ $id->id }} : Partial Payment Collection</header>
            </div>
            <div class="card-body">
                <div class="row">
                    {!! Form::open(['route' => ['admin.sale.partial.payment','id' => $id->id,'status' => $id->payment_type],'method' => 'POST']) !!}
                        <div class="row">
                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="purpose_head">Select PurposeHead</label>
                                    <select name="purposehead_id" id="purpose_head" class="form-control select2">
                                        @foreach ($purposeHeads as $purposeHead)
                                            <option value="{{ $purposeHead->id }}">{{ $purposeHead->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="payment_amount">Payment Amount</label>
                                    <input type="number" name="payment_amount" class="form-control" id="payment_amount" max="{{ $id->due }}" value="{{ $id->due }}" autocomplete="off" required>
                                </div>
                                <div class="form-group">
                                    <label for="reference">Reference / Bill / Receipt No</label>
                                    <input type="text" name="reference" class="form-control" id="reference" value="{{ old('reference') }}" autocomplete="off">
                                </div>
                                
                            </div>
                            
                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="simpleFormEmail">Received By</label>
                                    <input type="text" name="received_by" class="form-control" id="simpleFormEmail" value="{{ auth()->user()->name }}">
                                </div>
                                <div class="form-group">
                                    <label class="">Payment Date</label>
                                    <div class="input-group date form_date" data-date="{{ \Carbon\Carbon::now() }}" data-date-format="dd MM yyyy" data-link-field="dtp_input1">
                                        <input class="form-control" size="16" type="text" name="payment_date" value="{{ \Carbon\Carbon::now()->format('d M Y') }}">
                                        <span class="input-group-addon ml-2">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                    </div>
                                    <input type="hidden" id="dtp_input1" value="" />
                                </div>
                                <div class="form-group">
                                    <label for="payment_gateway">Select Payment Gateway</label>
                                    <select name="payment_gateway" id="payment_gateway" class="form-control select2">
                                        @foreach( \App\Models\PaymentGateway::get() as $gateway ) 
                                            <option value="{{ $gateway->id }}">{{ $gateway->gateway_name }}({{ $gateway->gateway_account_number }})</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12">
                                {!! Form::submit('Collect',['class' => 'btn btn-success pull-right']) !!}
                            </div>
                        </div>

                    {!! Form::close() !!}
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
