@extends('template.app')

@section('title','Company due payment paid')
=

@section('content')
    <div class="row ">
        <div class="col-md-12 col-sm-12">
            <div class="card card-box">
                <div class="card-head text-white " style="background-color:#3FCC7E;">
                    <header>Pay {{ $company->name }}'s due payment</header>
                </div>
                <div class="card-body" id="bar-parent">
                    <div class="card-body">
                <div class="row">
                    {!! Form::open(['route' => ['admin.company.due.pay','company' => $company->slug]]) !!}
                        <div class="row">
                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="expensehead_id">Select Expense Head</label>
                                    <select name="expensehead_id" id="expensehead_id" class="form-control select2">
                                        @foreach (\App\Models\ExpenseHead::get() as $expenseHead)
                                            <option value="{{ $expenseHead->id }}">{{ $expenseHead->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="{{ $amount_to_pay }}" value="{{ $amount_to_pay }}" readonly 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>
                                @foreach($invoices as $invoiceId) 
                                    <input type="hidden" name="invoices[]" class="bulk-select" value="{{ $invoiceId }}"/>
                                @endforeach
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12">
                                {!! Form::submit('Pay',['class' => 'btn btn-success pull-right']) !!}
                            </div>
                        </div>

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