Skip to content
Snippets Groups Projects
Commit 900eb0a6 authored by Iswahyudi's avatar Iswahyudi
Browse files

Penambahan kolom price di daftar/list zone, pemilihan jenis rate saat add/edit zone

parent 5d57aea8
3 merge requests!32Feature/view available slot,!26View slot by plat,!23Feature/zone admin page rev
Pipeline #23695 passed with stages
in 6 minutes and 30 seconds
...@@ -231,6 +231,7 @@ class Master extends CI_Controller { ...@@ -231,6 +231,7 @@ class Master extends CI_Controller {
'result' => json_decode($result), 'result' => json_decode($result),
); );
$data['lokasi']=$this->location(); $data['lokasi']=$this->location();
$data['jenisRate']=$this->rate_get();
return $data; return $data;
} }
...@@ -262,12 +263,14 @@ class Master extends CI_Controller { ...@@ -262,12 +263,14 @@ class Master extends CI_Controller {
function zone_save(){ function zone_save(){
$name = $this->input->post('name'); $name = $this->input->post('name');
$locationid = $this->input->post('location'); $locationid = $this->input->post('location');
$rateid = $this->input->post('jenisRate');
//create a new cURL resource //create a new cURL resource
$ch = curl_init($this->url_zone); $ch = curl_init($this->url_zone);
// //setup request to send json via POST // //setup request to send json via POST
$data = array( $data = array(
'name' => $name, 'name' => $name,
'locationId' => $locationid, 'locationId' => $locationid,
'rateId' => $rateid,
); );
$param = json_encode($data); $param = json_encode($data);
...@@ -355,6 +358,7 @@ class Master extends CI_Controller { ...@@ -355,6 +358,7 @@ class Master extends CI_Controller {
$id = $this->input->post('id'); $id = $this->input->post('id');
$name = $this->input->post('name'); $name = $this->input->post('name');
$locationid = $this->input->post('location'); $locationid = $this->input->post('location');
$rateid = $this->input->post('jenisRate');
//create a new cURL resource //create a new cURL resource
$ch = curl_init($this->url_zone); $ch = curl_init($this->url_zone);
...@@ -366,6 +370,7 @@ class Master extends CI_Controller { ...@@ -366,6 +370,7 @@ class Master extends CI_Controller {
'id' => $id, 'id' => $id,
'name' => $name, 'name' => $name,
'locationId' => $locationid, 'locationId' => $locationid,
'rateId' => $rateid,
); );
$param = json_encode($data); $param = json_encode($data);
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<th>NO</th> <th>NO</th>
<th>ZONE NAME</th> <th>ZONE NAME</th>
<th>LOCATION NAME</th> <th>LOCATION NAME</th>
<th>RATE/PRICE</th>
<th>ACTION</th> <th>ACTION</th>
</tr> </tr>
</thead> </thead>
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
<td><?php echo ++$start;?></td> <td><?php echo ++$start;?></td>
<td><?php echo $value->name;?></td> <td><?php echo $value->name;?></td>
<td><?php echo $location->name;?></td> <td><?php echo $location->name;?></td>
<td><?php echo $value->price;?></td>
<td> <td>
<a class="btn btn-warning btn-xs" href="#" onclick="function_edit('<?= $value->id;?>')"><i class="fa fa-edit"></i></a> <a class="btn btn-warning btn-xs" href="#" onclick="function_edit('<?= $value->id;?>')"><i class="fa fa-edit"></i></a>
...@@ -117,7 +119,26 @@ ...@@ -117,7 +119,26 @@
?> ?>
</select> </select>
</div> </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"> <div class="form-group col-md-12">
<br> <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> <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(){ ...@@ -154,6 +175,7 @@ function function_add(){
$('#form_zone').attr('action',"<?php echo base_url()?>master/zone/save"); $('#form_zone').attr('action',"<?php echo base_url()?>master/zone/save");
$('#myModalLabel').text('Add Zone'); $('#myModalLabel').text('Add Zone');
$('#labelId').hide(); $('#labelId').hide();
function_getPrice($('#jenisRateId').val());
} }
function function_edit(id){ function function_edit(id){
...@@ -165,7 +187,15 @@ function function_edit(id){ ...@@ -165,7 +187,15 @@ function function_edit(id){
response=JSON.parse(response); response=JSON.parse(response);
$('#id').val(response.id); $('#id').val(response.id);
$('#name').val(response.name); $('#name').val(response.name);
$('#priceId').val(response.price);
$('[name="location"]>[value="'+response.location.id+'"]').attr("selected",true); $('[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> </script>
\ No newline at end of file
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