@extends('layout::admin.master')
@section('title','country')
@section('style')
@endsection
@section('body')
<div class="x_content">
@if($layout == "create")
{{ Form::open(array('role' => 'form', 'route'=>array('city.store'), 'method' => 'post', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal form-label-left', 'id' => 'user-form','novalidate' => 'novalidate')) }}
@elseif($layout == "edit")
{{ Form::open(array('role' => 'form', 'route'=>array('city.update',$data->id), 'method' => 'put', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal form-label-left', 'id' => 'user-form','novalidate' => 'novalidate')) }}
@endif
<div class="box-header with-border mar-bottom20">
{{ Form::button('<i class="fa fa-save"></i> Save', array('type' => 'submit', 'id' => 'submit_btn', 'name' => 'submit_cat' , 'value' => 'Edit_Product' , 'class' => 'mybuttn btn btn-sm btn-dafault pull-right')) }}
<a class="btn btn-default btn-sm pull-right btn-right-spacing" href="{{route('city.index')}}" ><i class="glyphicon glyphicon-arrow-left"></i> Back</a>
{{ Form::button('<i class="glyphicon glyphicon-refresh"></i> Clear', ['type' => 'reset','class' => 'mybuttn btn btn-sm btn-dafault pull-right btn-right-spacing']) }}
</div>
<span class="section">City Info</span>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
{{Form::text('name',@$data->name,array('id'=>"name",'class'=>"form-control col-md-7 col-xs-12" ,
'data-validate-length-range'=>"6",'placeholder'=>"City Name",'required'=>"required"))}}
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Country<span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
{{Form::select('country_id',$countries,@$country_id,array('id'=>"country_id",'class'=>"form-control col-md-7 col-xs-12" ,
'data-validate-length-range'=>"6",'placeholder'=>"Country Name",'required'=>"required"))}}
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">State<span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
{{Form::select('state_id',($states ?? []),@$data->state_id,array('id'=>"state_id",'class'=>"form-control col-md-7 col-xs-12" ,
'data-validate-length-range'=>"6",'placeholder'=>"State Name",'required'=>"required"))}}
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="status">Status <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
{{ Form::select('status',array("1"=>"Enable","0"=>"Disable"),@$data->status ,
array('id'=>'status','class' => 'form-control','required' => 'required' )) }}
</div>
</div>
</div>
{{Form::close()}}
</div>
@endsection
@section('script')
<!-- validator -->
{!! Cms::script("theme/vendors/validator/validator.js") !!}
<script>
$(document).ready(function(){
$('#country_id').on('change',function(){
var country_id = $(this).val();
if(country_id!='') {
$.ajax({
url: '{{url("/")}}/locations/get-states/'+country_id,
type: "GET"
}).then(function (res) {
$('#state_id').html('');
var html = '';
$.each(res,function(k,v){
html+='<option value="'+k+'">'+v+'</option>';
});
$('#state_id').html(html);
})
}
})
});
</script>
@endsection
|