<?php
    use Carbon\Carbon;
?>
@extends('template.app')

@section('title', 'Create - Collection')

@push('css')
   <link href="{{ asset('admin/assets/plugins/select2/css/select2.css') }}" rel="stylesheet" type="text/css" />
   <link href="{{ asset('admin/assets/plugins/select2/css/select2-bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
   <link href="{{ asset('admin/assets/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css') }} " rel="stylesheet" media="screen">
@endpush

@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>Create Collection</header>
                </div>
                <div class="card-body" id="bar-parent">
                    <form method="post" action="{{ route('admin.collection.store') }}">
                        @csrf
                        <div class="row">
                            <div class="col-md-6 col-sm-6">
                                <div class="form-group">
                                    <label for="collection_type">Collect In</label>
                                    <select name="collection_type" class="form-control  select2 " id="collection_type">
                                        @foreach( \App\Models\PaymentGateway::get() as $gateway ) 
                                            <option value="{{ $gateway->id }}">{{ $gateway->gateway_name }}({{ $gateway->gateway_account_number }})</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="collect_type">Purpose Head</label>
                                    <select name="collect_type" class="form-control  select2 " id="collect_type">
                                        @foreach ($purposeheads as $purposehead)
                                            <option value="{{ $purposehead->id }}">{{ $purposehead->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group farmer">
                                    <label>Select Farmer</label>
                                    <select name="farmer_id" class="form-control  select2 " >
                                        @foreach ($farmers as $farmer)
                                            <option></option>
                                            <option value="{{ $farmer->id }}">{{ $farmer->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="collection_amount">Collection Amount</label>
                                    <input type="text" name="collection_amount" class="form-control" id="collection_amount" placeholder="Enter collection Amount" value="{{ old('collection_amount') }}">
                                </div>
                            </div>

                            <div class="col-md-6 col-sm-6">
                                <div class="form-group">
                                    <label for="given_by">Given By</label>
                                    <input type="text" name="given_by" class="form-control" id="given_by" placeholder="Enter giver name" value="{{ old('given_by') }}">
                                </div>
                                <div class="form-group">
                                    <label for="reference">Reference / Bill / Receipt No</label>
                                    <input type="text" name="reference" class="form-control" id="reference" placeholder="Enter reference" value="{{ old('reference') }}">
                                </div>
                                <div class="form-group">
                                    <label for="remarks">Remarks</label>
                                    <textarea name="remarks" id="remarks" class="form-control">{{old('remarks')}}</textarea>
                                </div>
                                <div class="form-group">
                                    <label class="">Collection Date</label>
                                    <div class="input-group date form_date" data-date="{{ Carbon::now() }}" data-date-format="dd MM yyyy" data-link-field="dtp_input1">
                                        <input class="form-control" size="16" type="text" name="collection_date" value="{{ old('collection_date') }}">
                                        <span class="input-group-addon ml-2">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                    </div>
                                    <input type="hidden" id="dtp_input1" value="" />
                                </div>
                            </div>
                        </div>
                        <a class="btn deepPink-bgcolor m-t-15 waves-effect" href="{{ route('admin.collection.index') }}">BACK</a>
                        <button type="submit" class="btn btn-success m-t-15 waves-effect">SUBMIT</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection

@push('js')
    <script src="{{ asset('js/collection-form.js') }}"></script>
    <script src="{{ asset('admin/assets/plugins/select2/js/select2.js') }}" ></script>
    <script src="{{ asset('admin/assets/js/pages/select2/select2-init.js') }}" ></script>
    <script src="{{ asset('admin/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js') }}"  charset="UTF-8"></script>
    <script src="{{ asset('admin/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker-init.js') }}"  charset="UTF-8"></script>
@endpush
