<?php $__env->startSection('title'); ?>
    Cash Advance
<?php $__env->stopSection(); ?>

<?php $__env->startSection('style'); ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" />
    
    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
    <link href="https://cdn.jsdelivr.net/npm/select2@4.0.12/dist/css/select2.min.css" rel="stylesheet" />

    <style>
        .select2{
                width: 100% !important;
            }
        .select2-container, .select2-dropdown, .select2-search, .select2-results {
        -webkit-transition: none !important;
        -moz-transition: none !important;
        -ms-transition: none !important;
        -o-transition: none !important;
        transition: none !important;
        }
    </style>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="content-wrapper" >
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <span class="fa fa-user-plus"></span> Edit Cash Advance
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-user-plus"></i> Admin Panel</a></li>
                <li class="active">Edit Cash Advance</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content" style=" padding-bottom: 1%;">
            <div class="page-header">
                <a href="<?php echo e(route('advances')); ?>" class="btn btn-primary"><i class="fa fa-backward"></i> Back</a>
            </div>
            <form method="post" action="<?php echo e(route('advances.update')); ?>">
                <input type='hidden' class="form-control" id="id_" name="id_" value="<?php echo e($adv->id); ?>" />
                <div class="col-md-6">
                    <div class="form-group has-feedback <?php if($errors->has('ca_date')): ?> has-error <?php endif; ?>">
                        <label for="ca_date" class="control-label">Date Applied:</label>
                        <div class="input-group date datetimepicker1" id="datetimepicker1">
                            <input type='text' class="form-control" id="ca_date" name="ca_date" value="<?php echo e(date("m/d/Y", strtotime($adv->ca_date))); ?>" />
                            <span class="input-group-addon">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </div>
                        <?php if($errors->has('ca_date')): ?> <span class="help-block"><?php echo e($errors->first('ca_date')); ?></span> <?php endif; ?>
                    </div>

                    <div class="form-group has-feedback <?php if($errors->has('agent_id')): ?> has-error <?php endif; ?>">
                        <label for="agent_id" class="control-label">Agent</label>
                        <select name="agent_id" id="agent_id" class="form-control">
                            <option value="">Select Agent</option>
                            <?php $__currentLoopData = $agents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($adv->agent_id == $agent->id): ?>
                                    <option value="<?php echo e($agent->id); ?>" selected="selected"><?php echo e($agent->fullname); ?></option>
                               <?php else: ?>
                                    <option value="<?php echo e($agent->id); ?>"> <?php echo e($agent->fullname); ?> </option>
                               <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <?php if($errors->has('agent_id')): ?> <span class="help-block"><?php echo e($errors->first('agent_id')); ?></span> <?php endif; ?>
                    </div>

                    <div class="form-group has-feedback <?php if($errors->has('amount')): ?> has-error <?php endif; ?>">
                        <label for="amount" class="control-label">Cash Amount</label>
                        <input type="number" name="amount" id="amount" class="form-control" value="<?php echo e($adv->amount); ?>" style="text-align: right;">
                        <span class="glyphicon glyphicon-book form-control-feedback"></span>
                        <?php if($errors->has('amount')): ?> <span class="help-block"><?php echo e($errors->first('amount')); ?></span> <?php endif; ?>
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="form-group has-feedback <?php if($errors->has('remarks')): ?> has-error <?php endif; ?>">
                        <label for="remarks" class="control-label">Remarks</label>
                        <textarea class="form-control txt" rows="5" name="remarks" id="remarks" placeholder=""><?php echo e($adv->remarks); ?></textarea>
                        <?php if($errors->has('remarks')): ?> <span class="help-block"><?php echo e($errors->first('remarks')); ?></span> <?php endif; ?>
                    </div>

                    <div class="form-group has-feedback <?php if($errors->has('status')): ?> has-error <?php endif; ?>">
                        <label for="status" class="control-label">Status</label>
                        <select name="status" id="status" class="form-control">
                            <option value="">Select Status</option>
                            <?php $__currentLoopData = $status; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $st): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($adv->status == $st): ?>
                                    <option value="<?php echo e($st); ?>" selected="selected"><?php echo e($st); ?></option>
                               <?php else: ?>
                                    <option value="<?php echo e($st); ?>"> <?php echo e($st); ?> </option>
                               <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <?php if($errors->has('status')): ?> <span class="help-block"><?php echo e($errors->first('status')); ?></span> <?php endif; ?>
                    </div>

                </div>

                <div class="form-group" style="padding: 10px;">
                    <button type="submit" class="btn btn-success btn-s"> <i class="fa fa-floppy-o" aria-hidden="true"></i> Update </button>
                </div>
                <?php echo e(csrf_field()); ?>

            </form>

        </section>
        <?php if(Session('info')): ?>
            <div class="row">
            <div class="col-md-6 col-md-offset-3 text-center">
            <div class="tem alert alert-success navbar-fixed-bottom"><span class="glyphicon glyphicon-ok-circle"></span> <?php echo e(Session('info')); ?></div>
            </div>
            </div>
        <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>

    
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/select2@4.0.12/dist/js/select2.min.js"></script>

<script>
    $(document).ready(function () {
        $('#agent_id').select2();
        $('#datetimepicker1').datetimepicker({
             format: 'MM/DD/YYYY'
        });
        /*$('.datetimepicker1').datetimepicker({
                format: 'MM/DD/YYYY'
        });*/
    });
    /*$(function() {
        $("#ca_date").datetimepicker();
    });*/

</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>