first commit
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<div class="row">
|
||||
<?php if ($this->session->flashdata('error')) { ?>
|
||||
<div class="col-12">
|
||||
<div class="alert alert-danger alert-dismissible bg-danger text-white border-0 fade show" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong>Error - </strong> <?php echo $this->session->flashdata('error') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group mb-3 <?php echo form_error('city') ? 'has-error' : '' ?>">
|
||||
<label for="city">City</label>
|
||||
<?php if (isset($editing) && $editing) { ?>
|
||||
<input class="form-control" type="text" value="<?php echo $item['city_name'] ?>" disabled />
|
||||
<?php } else { ?>
|
||||
<select name="city" id="city_selection"
|
||||
class="form-control <?php echo form_error('city') ? 'is-invalid' : ''; ?>"
|
||||
data-toggle="select2"
|
||||
>
|
||||
<?php
|
||||
if (!empty($item) && !empty($item['city']) && !empty($item['city_name'])) {
|
||||
echo '<option value="' . $item['city'] . '"' . 'selected >' . $item['city_name'] . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('city') ? form_error('city') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="city">City hero image</label>
|
||||
<input class="form-control" type="text" name="image_url" value="<?php echo $item['image_url'] ?? ''?>" />
|
||||
<?php
|
||||
if(!empty($item) && !empty($item['image_url'])) {
|
||||
$image_src = strpos($item['image_url'], 'http') >= 0 ? $item['image_url'] : ($storage . $item['image_url']);
|
||||
echo '<img class="city-img" src="' . $image_src . '" style="max-width: 100%; max-height: 300px;">';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group mb-3 <?php echo form_error('status') ? 'has-error' : '' ?>">
|
||||
<label for="country_code">Status</label>
|
||||
<select name="status"
|
||||
class="form-control <?php echo form_error('status') ? 'is-invalid' : ''; ?>"
|
||||
data-toggle="select2">
|
||||
<?php
|
||||
foreach($cityStatus as $name => $value) {
|
||||
$selected = set_value('status', $item['status']) == $value ? 'selected' : '';
|
||||
echo '<option value="' . $value . '"' . $selected . '>' . $name . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('status') ? form_error('status') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/js/plugins/forms/selects/select2.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('load', function () {
|
||||
$('#city_selection').select2({
|
||||
placeholder: "Search by city",
|
||||
allowClear: true,
|
||||
maximumSelectionSize: 1,
|
||||
minimumInputLength: 2,
|
||||
ajax: {
|
||||
url: "/geofence_area_city/getcityAjax",
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
const query = {
|
||||
city_name: params.term,
|
||||
page: params.page || 1,
|
||||
per_page: 20,
|
||||
};
|
||||
return query;
|
||||
},
|
||||
processResults: function(res, params) {
|
||||
const { data, total } = res;
|
||||
params.page = params.page || 1;
|
||||
return {
|
||||
results: data.map(item => ({ id: item.id, text: item.city })),
|
||||
pagination: {
|
||||
more: params.page * 20 < +total
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user