
<script>
    $(document).ready(function (){
        $('#ledger-lists').select2();

        $('#ledger-lists').on('change', function (){
            let account = $(this).val();

            $('#account-label').addClass('error');
            if(account != ""){
                $('#account-label').removeClass('error');
            }
        });
    });
</script>
{!! Form::open(['action'=>['LedgerMappingsController@updateMapLedger', 'id'=>$id], 'method'=>'POST', 'id'=>'map-ledger-account']) !!}
<div class="guestDetails_input">
    <div class="guestDetails_inputLabel">
        {!! Form::label('account', 'Select an Account to Map this Ledger:', ['id'=>'account-label', 'class'=>'error']) !!}
        <span class="error">*</span></div>
    <div class="guestDetails_input">
        <select name="account" id="ledger-lists" style="width: 450px">
            <option value="">--Select a Ledger--</option>
            @foreach($unMappedLedgers as $row)
                <option value="{{$row->id}}">{{$row->acc_name}}
                    @if($row->mainAccountDetails != null)
                         - {!! strtoupper($row->mainAccountDetails->name) !!}
                    @endif
                </option>
            @endforeach
        </select>
    </div>
</div>
{!! Form::close() !!}
