
<?php $__env->startSection('title'); ?> কয়েন প্যাকেজ ক্রয় <?php $__env->stopSection(); ?>
<?php $__env->startSection('coin-purchase'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('coin-purchase.create'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('admin_content'); ?>

<!-- BEGIN: Content-->
<div class="app-content content ">
    <div class="card">

        <div class="card-header p-1">
            <div class="head-label">
                <h4>কয়েন প্যাকেজ ক্রয়</h4>
            </div>
        </div>

        <div class="card-body">
            <form action="<?php echo e(route('coin-purchase.store')); ?>" method="post">
                <?php echo csrf_field(); ?>
                <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
                    <div class="row">

                        <div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6">
                            <div class="form-group">
                                <label for="name">রোল <span class=" text-danger">(required)</span> </label>
                                <select id="role_id" name="role_id" class="form-select select2" required>
                                    <option value="" selected disabled> রোল সিলেক্ট করুন </option>
                                    <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($role->name); ?>"><?php echo e(Str::title($role->name)); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>

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

                        <div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6">
                            <div class="form-group">
                                <label for="name">ইউজার <span class="text-danger">(required)</span> </label>
                                <select id="user_id" name="user_id" class="form-select select2" required>
                                    <option value="" selected disabled> ইউজার সিলেক্ট করুন </option>

                                </select>
                            </div>

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


                        <div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6 mt-2">
                            <div class="form-group">
                                <label for="name">কয়েন প্যাকেজ <span class=" text-danger">(required)</span> </label>
                                <select id="coin_package_id" name="coin_package_id" class="form-select select2" required>
                                    <option value="" selected disabled> কয়েন প্যাকেজ সিলেক্ট করুন </option>
                                    <?php $__currentLoopData = $coinPackages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $coinPackage): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($coinPackage->id); ?>"><?php echo e($coinPackage->coin_package_name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>

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


                        <div class="col-12 col-sm-12 col-md-2 col-lg-2 col-xl-2 d-flex align-items-center"
                            style="margin-top: 35px;">
                            <input type="submit" name="submit" class="btn btn btn-success" value="Save">
                        </div>

                    </div>

                </div>
            </form>
        </div>

    </div>

</div>
<!-- END: Content-->


<?php $__env->stopSection(); ?>

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

<script>
    $(document).ready(function(){
         $('select[name="role_id"]').on('change',function(){
            var role_id = $(this).val();
            if(role_id){
            $.ajax({
            url: "<?php echo e(url('/get_user/')); ?>/" + role_id,
            type:"GET",
            dataType:"json",
            success:function(data){
                $("#user_id").empty();
                $("#user_id").append('<option value="" selected disabled>ইউজার সিলেক্ট করুন</option>');
                $.each(data,function(key,value){
                    
                    $("#user_id").append('<option value="'+value.id+'">'+value.name+'</option>');
                });
              },
            });
            }else{
                alert('danger');
            }   
            
        }); 
            
        });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Project\Personal-Project\Office-Project\update\test-paper-final\resources\views/admin/coinPurchase/create.blade.php ENDPATH**/ ?>