<?php
    use Carbon\Carbon;
?>


<?php $__env->startSection('title', 'Update - Farmer'); ?>

<?php $__env->startPush('css'); ?>
   <!--select2-->
   <link href="<?php echo e(asset('admin/assets/plugins/select2/css/select2.css')); ?>" rel="stylesheet" type="text/css" />
   <link href="<?php echo e(asset('admin/assets/plugins/select2/css/select2-bootstrap.min.css')); ?>" rel="stylesheet" type="text/css" />

   <!-- date time -->
   <link href="<?php echo e(asset('admin/assets/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css')); ?> " rel="stylesheet" media="screen">
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="page-bar">
        <div class="page-title-breadcrumb">
            
        </div>
    </div>
    <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>Update Farmer</header>
                </div>
                <div class="card-body " id="bar-parent">
                    <form method="post" action="<?php echo e(route('admin.farmer.update', $farmer->id)); ?>" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('PATCH'); ?>
                        <div class="row">
                            <div class="col-md-6 col-sm-6">

                                
                                <div class="form-group">
                                    <label for="name">Farmer Name</label>
                                    <input type="text" name="name" class="form-control" id="name" placeholder="Enter farmer name" value="<?php echo e($farmer->name); ?>">
                                </div>

                                
                                <div class="form-group">
                                    <label>Select Branch</label>
                                    <select name="branch" class="form-control  select2 " >
                                        <?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($branch->id); ?>"
                                                <?php echo e($branch->id == $farmer->branch->id ? 'selected' : ''); ?>>
                                                <?php echo e($branch->name); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>

                                
                                <div class="form-group">
                                    <label for="phone1">Phone</label>
                                    <input type="text" name="phone1" class="form-control" id="phone1" placeholder="Enter farmer phone number" value="<?php echo e($farmer->phone1); ?>">
                                </div>

                                
                                <div class="form-group">
                                    <label for="phone2">Alternative Phone</label>
                                    <input type="text" name="phone2" class="form-control" id="phone2" placeholder="Enter alternaive phone" value="<?php echo e($farmer->phone2); ?>">
                                </div>

                                
                                <div class="form-group">
                                    <label for="opening_balance">Opening Balance</label>
                                    <input type="text" name="opening_balance" class="form-control" id="opening_balance" placeholder="Enter farmer opening balance" value="<?php echo e($farmer->opening_balance); ?>" onkeyup="this.value=this.value.replace(/^\.|[^\d\.]/g,'')">
                                </div>

                                
                            </div>

                            <div class="col-md-6 col-sm-6">

                                 
                                 <div class="form-group">
                                    <label for="image">Image</label>
                                    <input type="file" name="image" class="form-control" id="image">
                                </div>

                                
                                <div class="form-group">
                                    <label for="address">Address</label> 
                                    <textarea name="address" id="address" class="form-control"><?php echo e($farmer->address); ?></textarea>
                                </div>

                                
                                <div class="form-group">
                                    <label class="">Starting Date</label>
                                    <div class="input-group date form_datetime" data-date="<?php echo e(Carbon::now()); ?>" data-date-format="dd MM yyyy HH:ii p" data-link-field="dtp_input1">
                                        <input class="form-control" size="16" type="text" name="starting_date" 
                                        value="<?php echo e(Carbon::parse($farmer->starting_date)->toDayDateTimeString()); ?>">
                                        <span class="input-group-addon ml-2">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                    </div>
                                </div>

                                
                                <div class="form-group">
                                    <label class="">Ending Date</label>
                                    <div class="input-group date form_datetime" data-date="<?php echo e(Carbon::now()); ?>" data-date-format="dd MM yyyy  HH:ii p" data-link-field="dtp_input1">
                                        <input class="form-control" size="16" type="text" name="ending_date" value="<?php echo e(old('ending_date')); ?>">
                                        <span class="input-group-addon ml-2">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                    </div>
                                </div>

                                
                                <div class="form-group">
                                    <label for="simpleFormEmail">Status</label>
                                     <select class="form-control" name="status">
                                        <?php $__currentLoopData = ["active" => "Active", "inactive" => "Inactive", "disabled" => "Disabled"]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                        <option value="<?php echo e($key); ?>" <?php echo e($farmer->status == $key ? "selected" : ""); ?>><?php echo e($value); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        
                        <a class="btn deepPink-bgcolor m-t-15 waves-effect" href="<?php echo e(route('admin.farmer.index')); ?>">BACK</a>
                        <button type="submit" class="btn btn-success m-t-15 waves-effect">UPDATE</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <!--select2-->
    <script src="<?php echo e(asset('admin/assets/plugins/select2/js/select2.js')); ?>" ></script>
    <script src="<?php echo e(asset('admin/assets/js/pages/select2/select2-init.js')); ?>" ></script>

    <!-- data time -->
    <script src="<?php echo e(asset('admin/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js')); ?>"  charset="UTF-8"></script>
    <script src="<?php echo e(asset('admin/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker-init.js')); ?>"  charset="UTF-8"></script>
<?php $__env->stopPush(); ?>





<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\farm\resources\views/admin/farmer/edit.blade.php ENDPATH**/ ?>