<?php $__env->startSection('content'); ?>
    <div class="card" id="vue_app">
        <div class="card-body">
            <form action="<?php echo e(route('sub-packages.store')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="form-group col-md-4">
                        <label for="reseller_id" class="block text-sm font-medium text-gray-700">
                            Manager Name <span class=" text-danger">(require)</span>
                        </label>
                        <select @change="fetch_package" v-model="reseller_id" name="reseller_id" id="reseller_id"
                            class="form-control" required>
                            <option value="">Select Manager</option>
                            <?php $__currentLoopData = $resellers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reseller): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($reseller->id); ?>"><?php echo e($reseller->name); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>

                        <?php $__errorArgs = ['reseller_id'];
$__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="package_id" class="block text-sm font-medium text-gray-700">
                            Package Name <span class=" text-danger">(require)</span>
                        </label>
                        <select name="package_id" id="package_id" class="form-control" required>
                            <option value="">Select Package</option>
                            <option :value="row.id" v-for="row in packages" v-html="row.package_name"></option>
                        </select>

                        <?php $__errorArgs = ['package_id'];
$__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">
                            Name <span class=" text-danger">(require)</span>
                        </label>
                        <input type="text" name="name" id="name" class="form-control" placeholder="Name"
                            value="<?php echo e(old('name')); ?>" autocomplete="off" required>
                        <?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="rate" class="block text-sm font-medium text-gray-700">
                            Rate <span class=" text-danger">(require)</span>
                        </label>
                        <input type="number" name="rate" id="rate" class="form-control" placeholder="Rate"
                            value="<?php echo e(old('rate')); ?>" autocomplete="off" required>

                        <?php $__errorArgs = ['rate'];
$__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 if(checkSettings('sub-package-commission') == 'enable'): ?>
                        <div class="form-group col-md-4">
                            <label for="rate" class="block text-sm font-medium text-gray-700">
                                Commission
                            </label>
                            <input type="number" name="commission" id="commission" class="form-control"
                                placeholder="commission" value="<?php echo e(old('commission') ?? 0); ?>" autocomplete="off">

                            <?php $__errorArgs = ['commission'];
$__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('ResellerClientOnlineRecharge') == 'enable' && checkSettings('setClientPaymentAmountToClient') != 'enable' ): ?>
                        <div class="form-group col-md-4">
                            <label for="pool_name" class="block text-sm font-medium text-gray-700">
                                Client payment amount
                            </label>
                            <input type="number" name="client_payment_amount" id="client_payment_amount"
                                class="focus:ring-indigo-500 focus:border-indigo-500 form-control"
                                placeholder=" Client payment amount" value="<?php echo e(old('client_payment_amount')); ?>" autocomplete="off">
                            <?php $__errorArgs = ['client_payment_amount'];
$__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>
                <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>


            </form>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <script src="<?php echo e(asset('vue-js/vue/dist/vue.js')); ?>"></script>
    <script src="<?php echo e(asset('vue-js/axios/dist/axios.min.js')); ?>"></script>
    <script src="<?php echo e(asset('vue-js/bootstrap-select/dist/js/bootstrap-select.min.js')); ?>"></script>
    <script src="<?php echo e(URL::asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js')); ?>"></script>
    <script>
        $(document).ready(function() {
            var vue = new Vue({
                el: '#vue_app',
                data: {
                    config: {

                        get_reseller_wise_package_url: "<?php echo e(url('admin/fetch-package-by-reseller-id')); ?>",
                    },
                    reseller_id: '',
                    package_id: '',

                    packages: [],

                },
                methods: {


                    fetch_package() {
                        var vm = this;
                        var slug = vm.reseller_id;
                        vm.packages = '';
                        if (slug) {
                            axios.get(this.config.get_reseller_wise_package_url + '/' + slug).then(function(
                                response) {
                                vm.packages = response.data.Packages;
                                console.log(vm.packages);
                            }).catch(function(error) {
                                toastr.error('Something went to wrong', {
                                    closeButton: true,
                                    progressBar: true,
                                });
                                return false;
                            });
                        }
                    }
                },
                updated() {
                    $('.bSelect').selectpicker('refresh');
                }
            });

            $('.bSelect').selectpicker({
                liveSearch: true,
                size: 5
            });
            $('.datepicker').datepicker({
                format: 'dd-mm-yyyy'
            });

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

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