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

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/js/bootstrap-select.min.js"></script>

<main id="main" class="main">
    <?php if( Session::get('permissions.user_type') == 'A' || Session::get('permissions.user_type') == 'SA'): ?>
        <div class="page-breadcrumb">
            <div class="row">
                <div class="col-12 d-flex no-block align-items-center justify-content-between px-4 mb-2">
                    <h4 class="page-title">Edit Coupon</h4>
                    <div class="ml-auto text-right">
                        <a href="<?php echo e(url('admin/coupon/list/')); ?>/<?php echo e($siteId); ?>" class="btn btn-outline-info">Back</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="container-fluid">
		    <div class="row">
		        <div class="col-12">
		            <div class="card">
		                <?php $__currentLoopData = ['danger', 'warning', 'success', 'info']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $msg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
		                    <?php if(Session::has('alert-' . $msg)): ?>
		                        <h4 class="font-weight-light alert alert-<?php echo e($msg); ?>"><?php echo e(Session::get('alert-' . $msg)); ?></h4>
		                    <?php endif; ?>
		                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
		                <form action="<?php echo e(route('admin.coupon.edit', base64_encode($dataDetails->id))); ?>" method="POST" class="form-horizontal" id="formadd">
		                    <?php echo csrf_field(); ?>
		                    <input type="hidden" name="formid" value="<?php echo $dataDetails->id; ?>">
		                    <input type="hidden" name="site_id" value="<?php echo $dataDetails->site_id; ?>">
		                    <div class="card-body">
		                        <h4 class="card-title">Coupon Edit</h4>

		                        <div class="form-group m-t-20">
		                            <label>Coupon Code<span style="color:red;">*</span></label>
		                            <input type="text" class="form-control" id="coupon_code" name="coupon_code" placeholder="Enter Coupon Code" value="<?php echo e($dataDetails->coupon_code); ?>" required>
		                        </div>
		                        
		                        <div class="form-group m-t-20">
		                            <label>Discount Type<span style="color:red;">*</span></label><br>
		                            <span><input type="radio" name="discount_type" class="discount_type" value="F" <?php if($dataDetails->type=="F"): ?> checked <?php endif; ?>>Flat</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		                            <span><input type="radio" name="discount_type" class="discount_type" value="P" <?php if($dataDetails->type=="P"): ?> checked <?php endif; ?>>Percent</span>
		                        </div>

		                        <div class="form-group m-t-20">
		                            <label>Related To<span style="color:red;">*</span></label><br>
		                            <span><input type="radio" name="related_to" class="related_to" value="C" <?php if($dataDetails->related_to=="C"): ?> checked <?php endif; ?>>Cart</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		                            <span><input type="radio" name="related_to" class="related_to" value="U" <?php if($dataDetails->related_to=="U"): ?> checked <?php endif; ?>>User</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		                            <span><input type="radio" name="related_to" class="related_to" value="O" <?php if($dataDetails->related_to=="O"): ?> checked <?php endif; ?>>Occasion</span>
		                        </div>

		                        <div class="form-group m-t-20">
		                            <label>Amount<span style="color:red;">*</span></label>
		                            <input type="text" class="form-control" id="amount" name="amount" placeholder="Amount" value="<?php echo e($dataDetails->amount); ?>" required>
		                        </div>
		                       
		                        <?php
		                            $str = $dataDetails->start_date;
		                            $arr = explode(" ",$str);
		                            $str1 = $dataDetails->end_date;
		                            $arr1 = explode(" ",$str1);
		                        ?>
		                        <div class="form-group m-t-20">
		                            <label>Start Date<span style="color:red;">*</span></label>
		                            <input type="datetime-local" class="form-control" id="start_date" name="start_date" placeholder="Start Date" value="<?php echo e($arr[0]); ?> <?php echo e($arr[1]); ?>" required>
		                        </div>
		                        
		                        <div class="form-group m-t-20">
		                            <label>End Date<span style="color:red;">*</span></label>
		                            <input type="datetime-local" class="form-control" id="end_date" name="end_date" placeholder="End Date" value="<?php echo e($arr1[0]); ?> <?php echo e($arr1[1]); ?>" required>
		                        </div>
		                        
		                        <div class="form-group m-t-20">
		                            <label>Minimum Cart Amount<span style="color:red;">*</span></label>
		                            <input type="text" class="form-control" id="minimum_cart_amount" name="minimum_cart_amount" placeholder="End Date" value="<?php echo e($dataDetails->minimum_cart_amount); ?>" required>
		                        </div>
		                        
		                    </div>
		                    <div class="border-top">
		                        <div class="card-body">
		                            <input class="btn btn-primary" type="submit" value="UPDATE">
		                        </div>
		                    </div>
		                </form>
		            </div>
		        </div>
		    </div>
		</div>
    <?php endif; ?>
</main>    

<script type="text/javascript">
    $.validator.setDefaults({
	    submitHandler: function(form) {
	        form.submit();
	    }
    });

    $(function() {
        // validate the comment form when it is submitted
        $("#formadd").validate({
            ignore: [],
            errorPlacement: function(label, element) {
                label.addClass('mt-2 text-danger');
                label.insertAfter(element);
            },
            highlight: function(element, errorClass) {
                $(element).parents('.form-group').addClass('has-danger')
                $(element).addClass('form-control-danger')
            }
          });
    });

</script>     

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/rightflorist/public_html/ofadmin.rightflorist.org/resources/views/admin/coupon/edit.blade.php ENDPATH**/ ?>