 
<?php $__env->startSection('title', 'ART Center Master'); ?>
<?php $__env->startSection('content'); ?>

<?php 
    $getstatecodedata = DB::table('state_master')->get();
    $getdistrictcodedata = DB::table('district_master')->get();
?>
    <div class="container-fluid">
        <div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                        <i class="ik ik-edit bg-blue"></i>
                        <div class="d-inline">
                            <h5><?php echo e(__('ART Center Master')); ?></h5>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="<?php echo e(route('dashboard')); ?>"><i class="ik ik-home"></i></a>
                            </li>
                            <li class="breadcrumb-item"><a href="#"><?php echo e(__('Forms')); ?></a></li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-md-7 mx-auto">
                <div class="card">
                    <div class="card-header"><h3><?php echo e(__('ART Center Master Form')); ?></h3></div>
                    <div class="card-body">
                        <form class="forms-sample" method='POST' <?php if(!empty($showdata)): ?> action='<?php echo e(url('updateartcenter')); ?>' <?php else: ?> action='<?php echo e(url('artcenterinsert')); ?>' <?php endif; ?> name='artcenteremaster'>
                            <?php echo csrf_field(); ?>
                            
                            <?php if(!empty($showdata)): ?>
                            <input type='hidden' name='artcenterid' value='<?php echo e($showdata[0]->id); ?>'>
                            <?php endif; ?>
                            
                            <div class="form-group">
                                <label for="emp_code"><?php echo e(__('Art Center Code')); ?></label>
                                <input type="text" class="form-control" id="artcenter_code" name='artcenter_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->art_centre_code); ?>' <?php } ?> placeholder="Enter Art Center Code" required>
                            </div>
                            <div class="form-group">
                                <label for="artcenter_name"><?php echo e(__('ART Center Name')); ?></label>
                                <input type="text" class="form-control" id="artcenter_name" name='artcenter_name' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->name_of_artc); ?>' <?php } ?> placeholder="Enter Art Center Name" required>
                            </div>
                            <div class="form-group">
                                <label for="dist_code"><?php echo e(__('District Code')); ?></label>
                                <select name='dist_code'  class='form-control' value='Select Option' id="dist_code" required>
                                    <option value="">Select District Code</option>
                                    <?php foreach($getdistrictcodedata as $getdistrictcode){ ?>
                                     <option value='<?php echo $getdistrictcode->district_code; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->dist_code == $getdistrictcode->district_code ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $getdistrictcode->district_code; ?></option>
                                     <?php } ?>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="state_code"><?php echo e(__('State Code')); ?></label>
                                <input type="text" class="form-control" id="state_code" name='state_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->state_code); ?>' <?php } ?> placeholder="Enter State Code" readonly>
                            </div>
                            <div class="form-group">
                                <label for="status"><?php echo e(__('State Status')); ?></label>
                                <select name='status'  class='form-control' value='Select Option'>
                                    <option>Select Status</option>
                                    <option value="Yes" <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->status == "Yes" ? 'selected' : ''); ?> <?php endif; ?> >Yes</option>
                                    <option value="No" <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->status == "No" ? 'selected' : ''); ?> <?php endif; ?> >No</option>
                                </select>
                            </div>
                            <br><br>
                            <button type="submit" class="btn btn-primary mr-2"><?php echo e(__('Submit')); ?></button>
                            <?php if(empty($showdata)): ?>
                            <a href='<?php echo e('artcenter-master'); ?>' class="btn btn-light"><?php echo e(__('Cancel')); ?></a>
                            <?php endif; ?>
                          </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- push external js -->
    <?php $__env->startPush('script'); ?>
        <script src="<?php echo e(asset('js/form-components.js')); ?>"></script>
        <script type="text/javascript">
            $( "#dist_code" ).change(function() { 
                var dist_code = $(this).val();
                $.ajax({
                    type: "POST",
                    url: "<?php echo e(url('getstatecode')); ?>",
                    data: {dist_code:dist_code, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "json",
                    success: function(res) { 
                        var state_code = res.showdata.state_code;
                        $('#state_code').val(state_code);
                    },
                    error: function (jqXHR, exception) {
        
                    }
                });
            });
        </script>
    <?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/virutha/treatbuddy.virutha.xyz/resources/views/pages/artcenter-master.blade.php ENDPATH**/ ?>