<?php $__env->startSection('site_title', formatTitle([__('New'), __('Coupon'), config('settings.title')])); ?>

<?php echo $__env->make('shared.breadcrumbs', ['breadcrumbs' => [
    ['url' => route('admin.dashboard'), 'title' => __('Admin')],
    ['url' => route('admin.coupons'), 'title' => __('Coupons')],
    ['title' => __('New')],
]], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<h1 class="h2 mb-3 d-inline-block"><?php echo e(__('New')); ?></h1>

<div class="card border-0 shadow-sm">
    <div class="card-header"><div class="font-weight-medium py-1"><?php echo e(__('Coupon')); ?></div></div>
    <div class="card-body">
        <?php echo $__env->make('shared.message', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

        <form action="<?php echo e(route('admin.coupons.new')); ?>" method="post" enctype="multipart/form-data" id="form-coupon">
            <?php echo csrf_field(); ?>

            <div class="form-group">
                <label for="i-type"><?php echo e(__('Type')); ?></label>
                <select name="type" id="i-type" class="custom-select<?php echo e($errors->has('type') ? ' is-invalid' : ''); ?>">
                    <?php $__currentLoopData = [0 => __('Discount'), 1 => __('Redeemable')]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($key); ?>" <?php if(old('type') == $key): ?> selected <?php endif; ?>><?php echo e($value); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
                <?php if($errors->has('type')): ?>
                    <span class="invalid-feedback d-block" role="alert">
                        <strong><?php echo e($errors->first('type')); ?></strong>
                    </span>
                <?php endif; ?>
            </div>

            <div class="form-group">
                <label for="i-name"><?php echo e(__('Name')); ?></label>
                <input type="text" name="name" id="i-name" class="form-control<?php echo e($errors->has('name') ? ' is-invalid' : ''); ?>" value="<?php echo e(old('name')); ?>">
                <?php if($errors->has('name')): ?>
                    <span class="invalid-feedback" role="alert">
                        <strong><?php echo e($errors->first('name')); ?></strong>
                    </span>
                <?php endif; ?>
            </div>

            <div class="form-group">
                <label for="i-code"><?php echo e(__('Code')); ?></label>
                <div class="input-group">
                    <input type="text" name="code" id="i-code" class="form-control<?php echo e($errors->has('code') ? ' is-invalid' : ''); ?>" value="<?php echo e(old('code')); ?>">
                    <div class="input-group-append">
                        <div class="btn btn-primary" data-tooltip-copy="true" title="<?php echo e(__('Copy')); ?>" data-text-copy="<?php echo e(__('Copy')); ?>" data-text-copied="<?php echo e(__('Copied')); ?>" data-clipboard="true" data-clipboard-target="#i-code"><?php echo e(__('Copy')); ?></div>
                    </div>
                </div>
                <?php if($errors->has('code')): ?>
                    <span class="invalid-feedback d-block" role="alert">
                        <strong><?php echo e($errors->first('code')); ?></strong>
                    </span>
                <?php endif; ?>
            </div>

            <div class="form-group <?php echo e((old('type') == 1 ? '' : 'd-none')); ?>" id="form-group-redeemable">
                <label for="i-days"><?php echo e(__('Days')); ?></label>
                <input type="number" name="days" id="i-days" class="form-control<?php echo e($errors->has('days') ? ' is-invalid' : ''); ?>" value="<?php echo e(old('days') ?? 0); ?>">
                <?php if($errors->has('days')): ?>
                    <span class="invalid-feedback" role="alert">
                        <strong><?php echo e($errors->first('days')); ?></strong>
                    </span>
                <?php endif; ?>
            </div>

            <div class="form-group <?php echo e(((old('type') == 0 && old('type') !== null) || old('type') == null ? '' : 'd-none')); ?>" id="form-group-discount">
                <label for="i-percentage"><?php echo e(__('Percentage off')); ?></label>
                <div class="input-group">
                    <input type="text" name="percentage" id="i-percentage" class="form-control<?php echo e($errors->has('percentage') ? ' is-invalid' : ''); ?>" value="<?php echo e(old('percentage')); ?>"  <?php echo e(((old('type') == 0 && old('type') !== null) || old('type') == null ? '' : 'disabled')); ?>>
                    <div class="input-group-append">
                        <span class="input-group-text">%</span>
                    </div>
                </div>
                <?php if($errors->has('percentage')): ?>
                    <span class="invalid-feedback d-block" role="alert">
                        <strong><?php echo e($errors->first('percentage')); ?></strong>
                    </span>
                <?php endif; ?>
            </div>

            <div class="form-group">
                <label for="i-quantity"><?php echo e(__('Quantity')); ?></label>
                <input type="text" name="quantity" id="i-quantity" class="form-control<?php echo e($errors->has('quantity') ? ' is-invalid' : ''); ?>" value="<?php echo e(old('quantity')); ?>">
                <?php if($errors->has('quantity')): ?>
                    <span class="invalid-feedback d-block" role="alert">
                        <strong><?php echo e($errors->first('quantity')); ?></strong>
                    </span>
                <?php endif; ?>
                <small class="form-text text-muted"><?php echo __(':value for unlimited.', ['value' => '<code class="badge badge-secondary">-1</code>']); ?> <?php echo __(':value for none.', ['value' => '<code class="badge badge-secondary">0</code>']); ?> <?php echo __(':value for number.', ['value' => '<code class="badge badge-secondary">N</code>']); ?></small>
            </div>

            <button type="submit" name="submit" class="btn btn-primary"><?php echo e(__('Save')); ?></button>
        </form>
    </div>
</div>
<?php /**PATH /home/seodean/public_html/resources/views/admin/coupons/new.blade.php ENDPATH**/ ?>