<?php $__env->startSection('content'); ?>
    <div class="card card-default">
        <div class="card-body">

            <form action="<?php echo e(route('resellers.store')); ?>" method="POST" enctype="multipart/form-data" id="resellerForm">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="form-group col-md-4">
                        <label for="name" class="block text-sm font-medium text-gray-700">
                            Manager Name*
                        </label>
                        <input type="text" name="name" id="name" value="<?php echo e(old('name')); ?>" class="form-control"
                            required placeholder="Manager Name" autocomplete="off">
                        <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="alert alert-danger"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="form-group col-md-4">
                        <label for="name" class="block text-sm font-medium text-gray-700">
                            Manager Type*
                        </label>
                        <select name="reseller_type" id="reseller_type" class="select2 form-control" required>
                            <option value="">Select Type</option>
                            <option value="other">Other</option>
                            <option value="own">Own</option>
                        </select>
                        <?php $__errorArgs = ['reseller_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="alert alert-danger"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="form-group col-md-4">
                        <label for="contact" class="block text-sm font-medium text-gray-700">
                            Contact*
                        </label>

                        <input type="text" name="contact" id="contact" class="form-control" placeholder="Contact"
                            required value="<?php echo e(old('contact')); ?>" autocomplete="off">
                        <?php $__errorArgs = ['contact'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="alert alert-danger">
                                <?php echo e($message); ?>

                            </div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="form-group col-md-4">
                        <label for="address" class="block text-sm font-medium text-gray-700">
                            Address*
                        </label>

                        <input type="text" name="address" id="address" class="form-control" placeholder="Address"
                            required value="<?php echo e(old('address')); ?>" autocomplete="off">

                        <?php $__errorArgs = ['address'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="alert alert-danger"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="form-group col-md-4">
                        <label for="remark" class="block text-sm font-medium text-gray-700">
                            Remark
                        </label>
                        <div class=" flex rounded-md shadow-sm">

                            <input type="text" name="remark" id="remark" class="form-control" placeholder="remark"
                                value="<?php echo e(old('remark')); ?>" autocomplete="off">
                        </div>
                        <?php $__errorArgs = ['remark'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="alert alert-dangers">
                                <?php echo e($message); ?>

                            </div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="form-group d-none">
                        <label for="billable" class="block text-sm font-medium text-gray-700">
                            Billable
                        </label>
                        <div class="mt-1 flex rounded-md shadow-sm">

                            <select name="billable" id="billable">
                                <option value="yes">YES</option>
                                <option value="no">No</option>
                            </select>
                        </div>
                        <?php $__errorArgs = ['billable'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-red-500 mt-2 text-sm">
                                <?php echo e($message); ?>

                            </div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                    <?php if(checkSettings('reseller-image') == 'enable'): ?>
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('reseller-image-upload')): ?>
                            <div class="form-group col-md-4">
                                <label for="name" class="block text-sm font-medium text-gray-700">
                                    Upload File
                                </label>
                                <input type="file" name="img_url" value="<?php echo e(old('img_url')); ?>" class="form-control"
                                    placeholder="image" autocomplete="off" accept="image/*">
                                <?php $__errorArgs = ['img_url'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="alert alert-danger"><?php echo e($message); ?></div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        <?php endif; ?>
                    <?php endif; ?>
                    <?php if(checkSettings('manager-commission-percentage') === 'enable'): ?>
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('set-manager-commission')): ?>
                            <div class="form-group col-md-4">
                                <label for="remark" class="block text-sm font-medium text-gray-700">
                                    Manager Miscellaneous Expense
                                </label>
                                <div class=" flex rounded-md shadow-sm">

                                    <input type="number" step=".01" name="commission_percentage" id="commission_percentage"
                                        class="form-control" placeholder="Commission in percentage"
                                        value="<?php echo e(old('commission_percentage')); ?>" autocomplete="off">
                                </div>
                                <?php $__errorArgs = ['commission_percentage'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="alert alert-dangers">
                                        <?php echo e($message); ?>

                                    </div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        <?php endif; ?>
                    <?php endif; ?>

                    <?php if(checkSettings('vat_deduct_from_payment_for_commission_calculation') === 'enable'): ?>
                        <div class="form-group col-md-4">
                            <label for="vat" class="block text-sm font-medium text-gray-700">
                                VAT (%)
                            </label>
                            <div class=" flex rounded-md shadow-sm">
                                <input type="number" step=".01" name="vat" id="vat" class="form-control"
                                    placeholder="VAT Percentage" value="<?php echo e(old('vat', 0)); ?>" autocomplete="off">
                            </div>
                            <?php $__errorArgs = ['vat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="alert alert-danger">
                                    <?php echo e($message); ?>

                                </div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    <?php endif; ?>
                    <?php if(checkSettings('manager_bank_info') === 'enable'): ?>
                        <div class="form-group col-md-4">
                            <label for="bank_name" class="block text-sm font-medium text-gray-700">
                                Bank Name
                            </label>
                            <div class=" flex rounded-md shadow-sm">
                                <input type="text" name="bank_name" id="bank_name" class="form-control"
                                    placeholder="Bank Name" value="<?php echo e(old('bank_name')); ?>" autocomplete="off">
                            </div>
                            <?php $__errorArgs = ['bank_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="alert alert-danger">
                                    <?php echo e($message); ?>

                                </div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group col-md-4">
                            <label for="branch_name" class="block text-sm font-medium text-gray-700">
                                Branch Name
                            </label>
                            <div class=" flex rounded-md shadow-sm">
                                <input type="text" name="branch_name" id="branch_name" class="form-control"
                                    placeholder="Branch Name" value="<?php echo e(old('branch_name')); ?>" autocomplete="off">
                            </div>
                            <?php $__errorArgs = ['branch_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="alert alert-danger">
                                    <?php echo e($message); ?>

                                </div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group col-md-4">
                            <label for="routing_number" class="block text-sm font-medium text-gray-700">
                                Routing Number
                            </label>
                            <div class=" flex rounded-md shadow-sm">
                                <input type="text" name="routing_number" id="routing_number" class="form-control"
                                    placeholder="Routing Number" value="<?php echo e(old('routing_number')); ?>" autocomplete="off">
                            </div>
                            <?php $__errorArgs = ['routing_number'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="alert alert-danger">
                                    <?php echo e($message); ?>

                                </div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group col-md-4">
                            <label for="bank_account_no" class="block text-sm font-medium text-gray-700">
                                Bank Account No
                            </label>
                            <div class=" flex rounded-md shadow-sm">
                                <input type="text" name="bank_account_no" id="bank_account_no" class="form-control"
                                    placeholder="Bank Account No" value="<?php echo e(old('bank_account_no')); ?>" autocomplete="off">
                            </div>
                            <?php $__errorArgs = ['bank_account_no'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="alert alert-danger">
                                    <?php echo e($message); ?>

                                </div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group col-md-4">
                            <label for="account_name" class="block text-sm font-medium text-gray-700">
                                Account Name
                            </label>
                            <div class=" flex rounded-md shadow-sm">
                                <input type="text" name="account_name" id="account_name" class="form-control"
                                    placeholder="Account Name" value="<?php echo e(old('account_name')); ?>" autocomplete="off">
                            </div>
                            <?php $__errorArgs = ['account_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="alert alert-danger">
                                    <?php echo e($message); ?>

                                </div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    <?php endif; ?>


                </div>

                <hr>
                <?php if(checkSettings('reseller-online-recharge') == 'enable'): ?>
                    <div class="form-group col-md-4">
                        <label for="payment_charges">Gateway Charges In %</label>

                        <table class="table table-responsive table-condensed">
                            <tr>
                                <td>Bkash</td>
                                <td>
                                    <input type="number" step="any" name="bkash_charges" id="bkash_charges"
                                        class="form-control" placeholder="Bkash Charges"
                                        value="<?php echo e(old('bkash_charges')); ?>" autocomplete="off">
                                </td>
                            </tr>
                            <tr>
                                <td>Nagad</td>
                                <td>
                                    <input type="number" step="any" name="nagad_charges" id="nagad_charges"
                                        class="form-control" placeholder="Nagad Charges"
                                        value="<?php echo e(old('nagad_charges')); ?>" autocomplete="off">
                                </td>
                            </tr>
                            <tr>
                                <td>Upay</td>
                                <td>
                                    <input type="number" step="any" name="upay_charges" id="upay_charges"
                                        class="form-control" placeholder="Upay Charges"
                                        value="<?php echo e(old('upay_charges')); ?>" autocomplete="off">
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php endif; ?>

                
                <div class="col-sm-12">


                    <div class="form-group float-right">
                        <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
                        <button class="btn btn-info" type="reset" id="reset">Reset</button>
                    </div>

                </div>


            </form>


        </div>


    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('ajax'); ?>
    <script>
        $(document).ready(function() {
            $('#resellerForm').on('submit', function(e) {
                e.preventDefault();
                var formData = new FormData(this);

                let resellerType = $('#reseller_type').val();

                // Validate commission if type is own (commented out - validation in controller)
                // if (resellerType === 'own' &&
                //     <?php echo e(auth()->user()->can('set-manager-commission') ? 'true' : 'false'); ?> &&
                //     <?php echo e(checkSettings('manager-commission-percentage') === 'enable' ? 'true' : 'false'); ?>) {
                //     let commission = $('#commission_percentage').val();
                //     if (!commission || commission <= 0) {
                //         $('#commission_percentage').focus();
                //         toastr.error('For Own type, Manager Miscellaneous Expense must be greater than 0.');
                //         return;
                //     }
                // }

                // submit the form if validation passes not using ajax
                this.submit();

            });
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/mondol/radius-circle/resources/views/reseller/create.blade.php ENDPATH**/ ?>