<script>
    $(document).ready(function (){
        $('#requisition-list').select2();
        $('#insurer-listings').select2();
        $('#debit-list').select2();
        $('#currency-option').select2();
        $('#insurer-list').select2();
        $('#product-list').select2();
        $('#agent-list').select2();
        $('#month-list').select2();
        $('#year-list').select2();
        $('#agent-incentives-list').select2();

        /**Anytime we Chose a Requisition Type, Display affected ledgers**/
        $('#requisition-list').change(function (){
            let type = $(this).val();
            $('#insurer-list-div').hide();
            $("#debit-list option[value !='']").remove();
            $('#requisition-details').hide();
            $('#remit-premium-requisition-div').hide();
            $('#agent-commission-requisition-div').hide();
            $('#office-stationary-requisition-div').hide();
            $('#kitchen-consumables-requisition-div').hide();
            $('#premium-refund-requisition-div').hide();
            $('#windscreen-replacement-requisition-div').hide();
            $('#policy-excess-requisition-div').hide();
            $('#agent-incentives-requisition-div').hide();
            if(type != ""){
                /**At this Point, show the other Details of the Requisition**/
                $('#requisition-details').show();
                $('#my-button-1').show();
                if(type == 'remit-premium'){
                    $('#remit-premium-requisition-div').show();
                    $('#requisition-details').hide();
                    $('#my-button-1').hide();
                }else if(type == 'agent-commission'){
                    $('#agent-commission-requisition-div').show();
                }else if(type == 'premium-refund'){
                    $('#premium-refund-requisition-div').show();
                }else if(type == 'office-stationary'){
                    $('#office-stationary-requisition-div').show();
                }else if(type == 'kitchen-consumables'){
                    $('#kitchen-consumables-requisition-div').show();
                }else if(type == 'windscreen-replacement'){
                    $('#windscreen-replacement-requisition-div').show();
                }else if(type == 'policy-excess'){
                    $('#policy-excess-requisition-div').show();
                }else if(type == 'agent-incentives'){
                    $('#agent-incentives-requisition-div').show();
                }

                if(type == 'remit-premium'){
                    $('#insurer-list-div').show();
                }
                $.ajax({
                    method: 'GET',
                    url: '/requisition-debit-accounts/'+type,
                    data: type,
                    success: function (res){
                        if(res != ""){
                            $('#debit-list').append(res);
                        }
                    }
                });
            }
        });

        {{--CHANGING CURRENCY SECTION--}}
        $('#currency-option').on('change',function (){
            var currencySelected = $(this).val();
            $('#conversion-rate-div').hide();

            $.ajax({
                method: 'GET',
                url: '/currency-conversion-rate/'+currencySelected,
                data: currencySelected,
                success: function (res){
                    if(res != ""){
                        $('#conversion-rate-div').show();
                        $('#conversion-rate-field').html(res);

                    }else{
                        $('#conversion-rate-div').hide();
                    }
                }
            });
        });

        /**Anytime someone searches for a vehicle to Remit premium, do as below**/
        $('#filter-certificates').click( function (){
            let insurer = $('#insurer-list').val();
            let regNo = $('#reg-no').val();
            $('#my-certificates').html('<div style="text-align: center; margin: 20px 0 20px 0;"><img src="{{asset('images/loads/loader.gif')}}" border=0></div>');
            if(insurer != ""){
                if(regNo != ""){
                    /**Using AJAX, get the Certificates Issued on this Vehicle**/
                    $.ajax({
                        method: 'GET',
                        url: '/get-issued-certificates-on-vehicle/'+insurer+'/'+regNo,
                        success: function (res){
                            if(res != "exists"){
                                $('#my-certificates').html(res);
                            }else{
                                alert('There was a System Error. Please Filter the Report again');
                                return false;
                            }
                        }
                    });
                }else{
                    alert('Please Enter Vehicle Registration Number to Proceed');
                    return false;
                }
            }else{
                alert('Please Select an Insurer to Proceed');
                return false;
            }
        });

        /**Anytime someone searches a Vehicle to Create a Windscreen Replacement requisition, perform as below**/
        $('#search-vehicle-for-windscreen-replacement').click( function (){
            let regNo = $('#windscreen-reg-no').val();
            $('#my-vehicle-instances').html('<div style="text-align: center; margin: 20px 0 20px 0;"><img src="{{asset('images/loads/loader.gif')}}" border=0></div>');
            if(regNo != ""){
                /**Using AJAX, get the Policies Issued on with this Vehicle**/
                $.ajax({
                    method: 'GET',
                    url: '/get-available-polies-on-vehicle/'+regNo,
                    success: function (res){
                        if(res != "exists"){
                            $('#my-vehicle-instances').html(res);
                        }else{
                            alert('There was a System Error. Please Filter the Report again');
                            return false;
                        }
                    }
                });
            }else{
                alert('Please Enter Vehicle Registration Number to Proceed');
                return false;
            }
        });

        /**Anytime someone searches a Vehicle to Create a Pay Policy Excess Premium requisition, perform as below**/
        $('#search-vehicle-for-policy-excess').click( function (){
            let regNo = $('#policy-excess-reg-no').val();
            $('#my-policy-excess-instances').html('<div style="text-align: center; margin: 20px 0 20px 0;"><img src="{{asset('images/loads/loader.gif')}}" border=0></div>');
            if(regNo != ""){
                /**Using AJAX, get the Policies Issued on with this Vehicle**/
                $.ajax({
                    method: 'GET',
                    url: '/get-available-polies-on-vehicle/'+regNo,
                    success: function (res){
                        if(res != "exists"){
                            $('#my-policy-excess-instances').html(res);
                        }else{
                            alert('There was a System Error. Please Filter the Report again');
                            return false;
                        }
                    }
                });
            }else{
                alert('Please Enter Vehicle Registration Number to Proceed');
                return false;
            }
        });

        /**Anytime someone searches for a Risk Note Number to Refund Premium, do as below**/
        $('#refund-premium').click( function (){
            let dnNo = $('#dn-no').val();
            $('#my-policy-details').html('<div style="text-align: center; margin: 20px 0 20px 0;"><img src="{{asset('images/loads/loader.gif')}}" border=0></div>');
            if(dnNo != ""){
                /**Using AJAX, get the DN Number Details**/
                $.ajax({
                    method: 'GET',
                    url: '/get-policy-premium-balance-for-refund/'+dnNo,
                    success: function (res){
                        if(res != "exists"){
                            $('#my-policy-details').html(res);
                        }else{
                            alert('There was a System Error. Please Filter the Report again');
                            return false;
                        }
                    }
                });
            }else{
                alert('Please Enter Debit Note Number to Proceed');
                return false;
            }
        });

        /**Anytime someone searches for an Agent to Pay Incentives, do as below**/
        $('#filter-agent-incentives').click( function (){
            let agent = $('#agent-incentives-list').val();
            let month = $('#month-list').val();
            let year = $('#year-list').val();
            $('#my-agent-incentives-instance').html('<div style="text-align: center; margin: 20px 0 20px 0;"><img src="{{asset('images/loads/loader.gif')}}" border=0></div>');
            if(agent != ""){
                /**Using AJAX, get the DN Number Details**/
                $.ajax({
                    method: 'GET',
                    url: '/get-agent-incentives-payable/'+agent+'/'+month+'/'+year,
                    success: function (res){
                        if(res != "exists"){
                            $('#my-agent-incentives-instance').html(res);
                        }else{
                            alert('There was a System Error. Please Filter the Report again');
                            return false;
                        }
                    }
                });
            }else{
                alert('Please Enter Debit Note Number to Proceed');
                return false;
            }
        });

        /**Anytime a User selects a new Insurer, by default change the value of dr-id depending on what has been selected**/
        $('#insurer-list').change(function (){
            $('#dr-id-listing').val(this.value);
        });


        /**Anytime a User clicks an office Item to requisition for, activate the Quantity and price input boxes**/
        $('.activatorItem').click(function (){
            if($(this).is(':checked')){
                $(this).closest('.stationary-row').find('.quantityRow').attr('readonly', false);
                $(this).closest('.stationary-row').find('.priceRow').attr('readonly', false);
            }else{
                $(this).closest('.stationary-row').find('.quantityRow').attr('readonly', true);
                $(this).closest('.stationary-row').find('.priceRow').attr('readonly', true);
            }
        });

        /**Anytime the user changes the Value of Quantity, get the total price**/
        $(document).on('input paste change', ".quantityRow,.priceRow",function (){
            var totalPrice =0;
            var currentQuantity = $(this).closest('.stationary-row').find('.quantityRow').val();
            var currentPrice = $(this).closest('.stationary-row').find('.priceRow').val();

            totalPrice = currentQuantity * currentPrice;

            //Update the Total Premium Hidden field with the automated entry
            $(this).closest('.stationary-row').find('.totalPriceRow').val(totalPrice).trigger('change');

        });

        /**For Office Stationery Requisition, sum up the total amounts to form Requisition AMount**/
        $(document).on('change',".totalPriceRow",function (){
            var totalAmount =0;

            $('.totalPriceRow').each(function (){
                totalAmount += parseFloat($(this).val());
            });
            $('#total-alloc-amount-entered').val(totalAmount).addClass('error').css('font-weight','bold').attr('readonly', false);
            if(totalAmount > 0){
                $('#total-alloc-amount-entered').attr('readonly', true);
            }
        });


        /**Anytime a User clicks a Kitchen Consumable Item to requisition for, activate the Quantity and price input boxes**/
        $('.activatorKitchenItem').click(function (){
            if($(this).is(':checked')){
                $(this).closest('.kitchen-consumables-row').find('.kitchenQuantityRow').attr('readonly', false);
                $(this).closest('.kitchen-consumables-row').find('.kitchenPriceRow').attr('readonly', false);
            }else{
                $(this).closest('.kitchen-consumables-row').find('.kitchenQuantityRow').attr('readonly', true);
                $(this).closest('.kitchen-consumables-row').find('.kitchenPriceRow').attr('readonly', true);
            }
        });

        /**Anytime the user changes the Value of Quantity, get the total price**/
        $(document).on('input paste change', ".kitchenQuantityRow,.kitchenPriceRow",function (){
            var totalPrice =0;
            var currentQuantity = $(this).closest('.kitchen-consumables-row').find('.kitchenQuantityRow').val();
            var currentPrice = $(this).closest('.kitchen-consumables-row').find('.kitchenPriceRow').val();

            totalPrice = currentQuantity * currentPrice;

            //Update the Total Premium Hidden field with the automated entry
            $(this).closest('.kitchen-consumables-row').find('.kitchenTotalPriceRow').val(totalPrice).trigger('change');

        });

        /**For Kitchen Consumables Requisition, sum up the total amounts to form Requisition Amount**/
        $(document).on('change',".kitchenTotalPriceRow",function (){
            var totalAmount =0;

            $('.kitchenTotalPriceRow').each(function (){
                totalAmount += parseFloat($(this).val());
            });
            $('#total-alloc-amount-entered').val(totalAmount).addClass('error').css('font-weight','bold').attr('readonly', false);
            if(totalAmount > 0){
                $('#total-alloc-amount-entered').attr('readonly', true);
            }
        });
    });
</script>
{!! Form::open(['action'=>'Payments\RequisitionController@storeCreateMyOwnRequisition', 'id'=>'create-my-own-requisition', 'method'=>'POST']) !!}
<div class="error" style="text-align: center;">On this Window, You can Create a New Requisition</div>
<div class="guestDetails_inputDivider"></div>
<button type="submit" disabled style="display: none" aria-hidden="true"></button>
<div class="guestDetails_inputDivider1"></div>
<div class="guestDetails_input">
    <div class="guestDetails_inputLabel">
        Select a Requisition Type <span class="error">*</span>
    </div>
    <div class="guestDetails_input">
        <select name="requisition-type" style="width: 660px" id="requisition-list">
            <option value="">--Select an Item--</option>
            @if(app('UserCreates')->remit_premium_requisition == 1)
                <option value="remit-premium">REMIT PREMIUM</option>
            @endif
            @if(app('UserCreates')->agent_commission_requisition == 1)
                <option value="agent-commission">PAY AGENT COMMISSION</option>
            @endif
            @if(app('UserCreates')->premium_refund_requisition == 1)
                <option value="premium-refund">PREMIUM REFUNDS</option>
            @endif
            @if(app('UserCreates')->office_stationary_requisition == 1)
                <option value="office-stationary">OFFICE STATIONARY</option>
            @endif
            @if(app('UserCreates')->kitchen_requisition == 1)
                <option value="kitchen-consumables">KITCHEN CONSUMABLES</option>
            @endif
            @if(app('UserCreates')->windscreen_replacement_requisition == 1)
                <option value="windscreen-replacement">WINDSCREEN REPLACEMENT</option>
            @endif
            @if(app('UserCreates')->policy_excess_requisition == 1)
                <option value="policy-excess">POLICY EXCESS</option>
            @endif
            @if(app('UserCreates')->agent_incentives_requisition == 1)
                <option value="agent-incentives">AGENT INCENTIVES</option>
            @endif
        </select>
    </div>
</div>

{{--REMIT PREMIUM REQUISITION--}}
<div id="remit-premium-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    &nbsp;
                </div>
                <div class="guestDetails_input">
                    <button type="button" name="search" style="cursor: pointer;float: right; height: 22px" id="filter-certificates"><i class="fa fa-search" aria-hidden="true"></i></button>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('reg-number', 'Enter REG Number') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    {!! Form::text('reg-no', $search['regNo'] ?? '', ['size'=>20,'class'=>'input-text-height', 'id'=>'reg-no','autocomplete'=>'off']) !!}
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('insurer', 'Select Insurance Company') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    <select name="insurer" id="insurer-list" style="width: 200px">
                        {{--@if($search['insurerId'] != null)
                            <option value="{{$search['insurerId']}}">{{$search['insurerName']}}</option>
                        @endif--}}
                        <option value="">--Select Insurer--</option>
                        @foreach(app('Insurers') as $insurer)
                            <option value="{{$insurer['ins_id']}}">{{$insurer['nm']}}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="guestDetails_inputDividerNone"></div>
            <div id="my-certificates"></div>
        </div>
    </div>
</div>

{{--WINDSCREEN REPLACEMENT REQUISITION--}}
<div id="windscreen-replacement-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    &nbsp;
                </div>
                <div class="guestDetails_input">
                    <button type="button" name="search" style="cursor: pointer;float: right; height: 22px" id="search-vehicle-for-windscreen-replacement"><i class="fa fa-search" aria-hidden="true"></i></button>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('reg-number', 'Enter REG Number') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    {!! Form::text('windscreen-reg-no', $search['regNo'] ?? '', ['size'=>20,'class'=>'input-text-height', 'id'=>'windscreen-reg-no','autocomplete'=>'off']) !!}
                </div>
            </div>
            <div class="guestDetails_inputDividerNone"></div>
            <div id="my-vehicle-instances"></div>
        </div>
    </div>
</div>

{{--POLICY EXCESS REQUISITION--}}
<div id="policy-excess-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    &nbsp;
                </div>
                <div class="guestDetails_input">
                    <button type="button" name="search" style="cursor: pointer;float: right; height: 22px" id="search-vehicle-for-policy-excess"><i class="fa fa-search" aria-hidden="true"></i></button>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('reg-number', 'Enter REG Number') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    {!! Form::text('policy-excess-reg-no', $search['regNo'] ?? '', ['size'=>20,'class'=>'input-text-height', 'id'=>'policy-excess-reg-no','autocomplete'=>'off']) !!}
                </div>
            </div>
            <div class="guestDetails_inputDividerNone"></div>
            <div id="my-policy-excess-instances"></div>
        </div>
    </div>
</div>

{{--AGENT COMMISSION REQUISITION--}}
<div id="agent-commission-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    &nbsp;
                </div>
                <div class="guestDetails_input">
                    <button type="button" name="search" style="cursor: pointer;float: right; height: 22px" id="filter-certificates"><i class="fa fa-search" aria-hidden="true"></i></button>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('product', 'Select a Product/Risk Class') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    <select name="product" id="product-list" style="width: 150px">
                        {{--@if($search['insurerId'] != null)
                            <option value="{{$search['insurerId']}}">{{$search['insurerName']}}</option>
                        @endif--}}
                        <option value="">--Select Risk/Product--</option>
                        @foreach(app('Products') as $product)
                            <option value="{{$product['prod_id']}}">{{$product['lgnm']}}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('agents', 'Select an Agent') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    <select name="agent" id="agent-list" style="width: 250px">
                        <option value="">--Select an Agent--</option>
                        {{--@foreach(\App\Models\SubAgent::orderBy('contact_person', 'asc')->get() as $agent)
                            <option value="{{$agent['stamp']}}">{{$agent['agent_code']." ".$agent['contact_person']."(".$agent['company'].")"}}</option>
                        @endforeach--}}
                    </select>
                </div>
            </div>
            <div class="guestDetails_inputDividerNone"></div>
            <div id="my-certificates"></div>
        </div>
    </div>
</div>

{{--AGENT INCNENTIVES REQUISITION--}}
<div id="agent-incentives-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    &nbsp;
                </div>
                <div class="guestDetails_input">
                    <button type="button" name="search" style="cursor: pointer;float: right; height: 22px" id="filter-agent-incentives"><i class="fa fa-search" aria-hidden="true"></i></button>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('year', 'Year') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    <select name="search-year" id="year-list" style="width: 100px">
                        @for($x=date('Y'); $x>=app('CompanySetup')->version_from; $x--)
                            <option value="{{$x}}">{{$x}}</option>
                        @endfor
                    </select>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('month', 'Select a Month') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    <select name="month" id="month-list" style="width: 100px">
                        <option value="01">Jan</option>
                        <option value="02">Feb</option>
                        <option value="03">March</option>
                        <option value="04">April</option>
                        <option value="05">May</option>
                        <option value="06">June</option>
                        <option value="07">July</option>
                        <option value="08">August</option>
                        <option value="09">September</option>
                        <option value="10">October</option>
                        <option value="11">November</option>
                        <option value="12">December</option>
                    </select>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('agents', 'Select an Agent') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    <select name="agent" id="agent-incentives-list" style="width: 250px">
                        <option value="">--Select an Agent--</option>
                        {{--@foreach(\App\Models\SubAgent::orderBy('contact_person', 'asc')->get() as $agent)
                            <option value="{{$agent['stamp']}}">{{$agent['agent_code']." ".$agent['contact_person']."(".$agent['company'].")"}}</option>
                        @endforeach--}}
                    </select>
                </div>
            </div>
            <div class="guestDetails_inputDividerNone"></div>
            <div id="my-agent-incentives-instance"></div>
        </div>
    </div>
</div>

{{--PREMIUM REFUNDS REQUISITION--}}
<div id="premium-refund-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    &nbsp;
                </div>
                <div class="guestDetails_input">
                    <button type="button" name="search" style="cursor: pointer;float: right; height: 22px" id="refund-premium"><i class="fa fa-search" aria-hidden="true"></i></button>
                </div>
            </div>
            <div class="guestDetails_input_right">
                <div class="guestDetails_inputLabel">
                    {!! Form::label('dn-number', 'Enter Debit Note Number') !!}<span class="error">*</span>
                </div>
                <div class="guestDetails_input">
                    {!! Form::text('dn-no', $search['dnNo'] ?? '', ['size'=>20,'class'=>'input-text-height', 'id'=>'dn-no','autocomplete'=>'off']) !!}
                </div>
            </div>
            <div class="guestDetails_inputDividerNone"></div>
            <div id="my-policy-details"></div>
        </div>
    </div>
</div>

{{--OFFICE STATIONERY REQUISITION--}}
<div id="office-stationary-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            {{--Show All Items from the Database of Items that can be Requisitioned FOr as Office Stationaries--}}
            <table style="width: 100%; border-collapse: collapse">
                @foreach(\App\Models\OfficeStationery::where('status', 1)->orderBy('name', 'asc')->get() as $row)
                    <tr class="stationary-row" >
                        <td style="width: 5%">{!! Form::checkbox('activatorOfficeStationery['.$row->id.']', $row->id,false,['class'=>'activatorItem']) !!}</td>
                        <td style="width: 20%"><b>{!! $row->name !!}</b></td>
                        <td style="width: 25%"> Quantity<span class="error">*</span> {!! Form::number('quantity['.$row->id.']', '0',['style'=>'width:80px','class'=>'input-text-height quantityRow', 'readonly'=>true]) !!}</td>
                        <td style="width: 25%">Unit Price<span class="error">*</span> {!! Form::number('price['.$row->id.']', '0',['style'=>'width:80px','class'=>'input-text-height priceRow', 'readonly'=>true]) !!}</td>
                        <td style="width: 25%">Total Price<span class="error">*</span> {!! Form::text('total['.$row->id.']', '0',['style'=>'width:80px','class'=>'input-text-height totalPriceRow', 'readonly'=>true]) !!}</td>
                    </tr>
                @endforeach
            </table>
            <div class="guestDetails_inputDividerNone"></div>
        </div>
    </div>
</div>

{{--KITCHEN CONSUMABLE REQUISITION--}}
<div id="kitchen-consumables-requisition-div" style="display: none" >
    <div class="guestDetails_inputDivider1"></div>
    <div class="inputDivider" style="background-color: lightcyan">
        <div class="fields" >
            {{--Show All Items from the Database of Items that can be Requisitioned FOr as Office Stationaries--}}
            <table style="width: 100%; border-collapse: collapse">
                @foreach(\App\Models\KitchenConsumable::where('status', 1)->orderBy('name', 'asc')->get() as $row)
                    <tr class="kitchen-consumables-row" >
                        <td style="width: 5%">{!! Form::checkbox('activatorKitchenConsumable['.$row->id.']', $row->id,false,['class'=>'activatorKitchenItem']) !!}</td>
                        <td style="width: 20%"><b>{!! $row->name !!}</b></td>
                        <td style="width: 25%"> Quantity<span class="error">*</span> {!! Form::number('kitchen-quantity['.$row->id.']', '0',['style'=>'width:80px','class'=>'input-text-height kitchenQuantityRow', 'readonly'=>true]) !!}</td>
                        <td style="width: 25%">Unit Price<span class="error">*</span> {!! Form::number('kitchen-price['.$row->id.']', '0',['style'=>'width:80px','class'=>'input-text-height kitchenPriceRow', 'readonly'=>true]) !!}</td>
                        <td style="width: 25%">Total Price<span class="error">*</span> {!! Form::text('kitchen-total['.$row->id.']', '0',['style'=>'width:80px','class'=>'input-text-height kitchenTotalPriceRow', 'readonly'=>true]) !!}</td>
                    </tr>
                @endforeach
            </table>
            <div class="guestDetails_inputDividerNone"></div>
        </div>
    </div>
</div>

<div id="requisition-details" style="display: none">
    <div class="guestDetails_inputDivider1"></div>

    <div class="guestDetails_input">
        <div class="guestDetails_inputLabel">
            Payee <span class="error">*</span>
        </div>
        <div class="guestDetails_input">
            {!! Form::text('payee', '', ['class'=>'input-text-height', 'size'=>120]) !!}
        </div>
    </div>
    {!! Form::hidden('dr-id', '', ['id'=>'dr-id-listing']) !!}

    <div class="guestDetails_inputDivider1"></div>
    <div class="guestDetails_input">
        <div class="guestDetails_inputLabel">
            Debited Account (DR) <span class="error">*</span>
        </div>
        <div class="guestDetails_input">
            <select name="debit-type" style="width: 250px" id="debit-list">
                <option value="">--Select Account to Pay To--</option>
            </select>
        </div>
    </div>
    <div class="guestDetails_input">
        <div class="guestDetails_inputLabel">
            Requisition Amount <span class="error">*</span>
        </div>
        <div class="guestDetails_input">
            {!! Form::text('req-amount', '', ['class'=>'input-text-height','id'=>'total-alloc-amount-entered', 'size'=>15, 'readonly'=> auth()->user()->id ==3 ? false : true ]) !!}
        </div>
    </div>
    <div class="guestDetails_input">
        <div class="guestDetails_inputLabel">
            Currency <span class="error">*</span>
        </div>
        <div class="guestDetails_input">
            <select name="currency" style="width: 120px" id="currency-option">
                <option value="{{app('BaseCurrency')->id}}">{!! app('BaseCurrency')->abbr !!}</option>
                @foreach(app('OtherCurrency') as $other)
                    <option value="{!! $other->id !!}">{!! $other->abbr !!}</option>
                @endforeach
            </select>
        </div>
    </div>
    <div class="guestDetails_input" id="conversion-rate-div" style="display: none">
        <div class="guestDetails_inputLabel">
            <i class="" id="conversion-rate-label">Conversion Rate:</i> <span class="error">*</span>
        </div>
        <div class="guestDetails_input" id="conversion-rate-field"></div>
    </div>
    <div class="guestDetails_input">
        <div class="guestDetails_inputLabel">
            Requisition Date <span class="error">*</span>
        </div>
        <div class="guestDetails_input">
            {!! Form::date('req-date', '', ['class'=>'input-text-height', 'style'=>'width:90px']) !!}
        </div>
    </div>
    <div class="guestDetails_inputDivider1"></div>
    <div class="guestDetails_input">
        <div class="guestDetails_inputLabel">
            {!! Form::label('narration', 'Narration') !!} <span class="error">*</span>
        </div>
        <div class="guestDetails_input">
            {!! Form::textarea('narration', '',['style'=>'width:660px; height:60px']) !!}
        </div>
    </div>
</div>
{!! Form::close() !!}
