<?php $__env->startSection('content'); ?>
<div class="container-fluid mt-1">
	<div class="row">
		<div class="col-12 col-sm-12 offset-sm-0">
			<div class="card bg-dark text-white">
				<div class="card-header">
					<h3 class="text-center"><i class="fa fa-pencil"></i> Create Form of <code><b>Police Station Name</b></code> </h3>
				</div>
				<div class="card-body">
			  		<!-- <?php echo $__env->make('police_station._form', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?> -->

<?php if(isset($policeStation)): ?>
    <?php echo Form::model($policeStation, ['url' => "police-station/$policeStation->id", 'method' => 'put', 'class' => 'form-horizontal']); ?>

<?php else: ?>
    <?php echo Form::open(['url' => 'police-station', 'method' => 'post', 'class' => 'form-horizontal']); ?>

<?php endif; ?>
<div class="form-group required <?php echo e($errors->has('division_id') ? 'has-error' : ''); ?>">
    <div class="row"> 
        <?php echo Form::label('division_id', 'Select Division Name', ['class' => 'control-label col-sm-3 col-3']); ?>

        <div class="col-9 col-sm-9">
        	<div class="col-12 col-sm-12">
    	        <?php echo Form::select('division_id', $divisionList, null, ['class' => 'form-control', 'placeholder' => 'Select Division Name', 'id' => 'division_id']); ?>

    	        <span class="text-danger">
    	            <?php echo e($errors->first('division_id')); ?>

    	        </span>
            </div>
        </div>
    </div>
</div>

<div id="hide_district" class="form-group required <?php echo e($errors->has('district_id') ? 'has-error' : ''); ?>">
    <div class="row"> 
        <?php echo Form::label('district_id', 'Select District Name', ['class' => 'control-label col-sm-3 col-3']); ?>

        <div class="col-9 col-sm-9">
            <div class="col-12 col-sm-12">
                <?php echo Form::select('district_id', $districtList, null, ['class' => 'form-control bg-danger text-white', 'placeholder' => 'Select District Name (at first select Division)', 'disabled' => 'disabled']); ?>

                <span class="text-danger">
                    <?php echo e($errors->first('district_id')); ?>

                </span>
            </div>
        </div>
    </div>
</div>

<span id="division_district_show"></span>

<div class="required form-group <?php echo e($errors->has('name') ? 'has-error' : ''); ?>">
    <div class="row"> 
        <?php echo Form::label('name', 'Police Station Name', ['class' => 'col-3 col-sm-3 control-label']); ?>

        <div class="col-9 col-sm-9">
        	<div class="col-12 col-sm-12">
    	        <?php echo Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Enter Police Station Name', 'autocomplete' => 'off']); ?>

    	        <span class="text-danger">
    			    <?php echo e($errors->first('name')); ?>

    		    </span>
    		</div>
        </div>
    </div>
</div>

<div class="form-group">
    <div class="row">
        <?php echo Form::submit('Submit', ['class' => 'btn btn-outline-primary btn-block text-white']); ?>

    </div>
</div>
<?php echo Form::close(); ?>




			  		


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

<?php $__env->startSection('script'); ?>
	<script type="text/javascript">
		$(document).ready(function(){
		    $("#division_id").change(function(){
		        var divisionId = $("#division_id").val();
		        var url = '<?php echo e(url("/division-district-show")); ?>';
		        $.get(url+'?division_id='+divisionId, function (data) {
		        	$("#hide_district").hide();
	            	$('#division_district_show').html(data);
	        	});
		    });
		});
	</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>