Commit f491005f authored by Oky Rahmanto's avatar Oky Rahmanto
Browse files

Merge branch 'feature/zone-admin-page-rev' into 'development'

Feature/zone admin page rev

See merge request !23
parents 5d57aea8 900eb0a6
Pipeline #23697 passed with stage
in 31 seconds
......@@ -231,6 +231,7 @@ class Master extends CI_Controller {
'result' => json_decode($result),
);
$data['lokasi']=$this->location();
$data['jenisRate']=$this->rate_get();
return $data;
}
......@@ -262,12 +263,14 @@ class Master extends CI_Controller {
function zone_save(){
$name = $this->input->post('name');
$locationid = $this->input->post('location');
$rateid = $this->input->post('jenisRate');
//create a new cURL resource
$ch = curl_init($this->url_zone);
// //setup request to send json via POST
$data = array(
'name' => $name,
'locationId' => $locationid,
'rateId' => $rateid,
);
$param = json_encode($data);
......@@ -355,6 +358,7 @@ class Master extends CI_Controller {
$id = $this->input->post('id');
$name = $this->input->post('name');
$locationid = $this->input->post('location');
$rateid = $this->input->post('jenisRate');
//create a new cURL resource
$ch = curl_init($this->url_zone);
......@@ -366,6 +370,7 @@ class Master extends CI_Controller {
'id' => $id,
'name' => $name,
'locationId' => $locationid,
'rateId' => $rateid,
);
$param = json_encode($data);
......
......@@ -36,6 +36,7 @@
<th>NO</th>
<th>ZONE NAME</th>
<th>LOCATION NAME</th>
<th>RATE/PRICE</th>
<th>ACTION</th>
</tr>
</thead>
......@@ -51,6 +52,7 @@
<td><?php echo ++$start;?></td>
<td><?php echo $value->name;?></td>
<td><?php echo $location->name;?></td>
<td><?php echo $value->price;?></td>
<td>
<a class="btn btn-warning btn-xs" href="#" onclick="function_edit('<?= $value->id;?>')"><i class="fa fa-edit"></i></a>
......@@ -117,7 +119,26 @@
?>
</select>
</div>
<div class="form-group col-md-6">
<label>Jenis Rate</label>
<select class="form-control" name="jenisRate" onchange="function_getPrice(this.value)" id="jenisRateId">
<?php
foreach ($jenisRate['result'] as $opsirate) {
?>
<option value = "<?php echo $opsirate->id;?>"> <?php echo $opsirate->description;?>
</option>
<?php
}
?>
</select>
</div>
<div class="form-group col-md-6" id="labelPrice">
<label>Price</label>
<input readonly type="text" class="form-control" name="price" id="priceId">
</div>
<div class="form-group col-md-12">
<br>
<button type="submit" id="btn_simpan_arsip" name="btn_simpan_arsip" class="btn btn-sm btn-primary"><i class="fa fa-check"></i>Simpan Data</button>
......@@ -154,6 +175,7 @@ function function_add(){
$('#form_zone').attr('action',"<?php echo base_url()?>master/zone/save");
$('#myModalLabel').text('Add Zone');
$('#labelId').hide();
function_getPrice($('#jenisRateId').val());
}
function function_edit(id){
......@@ -165,7 +187,15 @@ function function_edit(id){
response=JSON.parse(response);
$('#id').val(response.id);
$('#name').val(response.name);
$('#priceId').val(response.price);
$('[name="location"]>[value="'+response.location.id+'"]').attr("selected",true);
});
}
function function_getPrice(id){
$.get("<?php echo site_url('master/rate/id');?>/"+id).done(function(response){
response=JSON.parse(response);
$('#priceId').val(response.price);
});
}
</script>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment