Commit 07f87997 authored by ayu's avatar ayu

add feature payment parking

parent e498bf27
Pipeline #25772 passed with stages
in 6 minutes and 56 seconds
......@@ -11,6 +11,7 @@ class Cashier extends CI_Controller {
private $url_slot = 'https://api.easy-parking.ourcode.site/api/slot/';
private $url_parking = 'http://api.easy-parking.ourcode.site/api/parking/transaction/';
private $url_stop_park = 'http://api.easy-parking.ourcode.site/api/parking/transaction/stop/';
private $url_search_park = 'http://api.easy-parking.ourcode.site/api/parking/transaction/active';
function __construct(){
parent::__construct();
......@@ -159,7 +160,30 @@ class Cashier extends CI_Controller {
<b>$message !</b>
</div>");
redirect(base_url('cashier/park_stop'));
redirect(base_url("cashier/park_pay/".$licensePlate.""));
}
function park_pay($licensePlat){
//create a new cURL resource
$ch = curl_init($this->url_search_park."/".$licensePlat);
//set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
//return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//execute the POST request
$result = curl_exec($ch);
//close cURL resource
curl_close($ch);
// echo 'HTTP code: ' . $httpcode;
$data = array(
'result' => json_decode($result),
);
$this->load->view('menu/header-menu.php');
$this->load->view('cashier/park_pay.php',$data);
}
}
?>
\ No newline at end of file
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<?php $this->load->view('main/header.php')?>
<!-- Left side column. contains the logo and sidebar -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Parking Pay Set
<small>
<?php $this->view('main/viewdate.php')
?>
</small>
</h1>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-lg-12">
<!-- Default box -->
<div class="col-lg-6">
<div class="box box-success">
<!-- Callout -->
<div class="callout callout">
<h2>PLAT NOMOR <strong><?php echo $result->licensePlate;?></strong>
</h2>
<p></p>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="box box-warning">
<!-- Callout -->
<div class="callout callout">
<h2>TOTAL BAYAR <strong><?php echo $result->total;?></strong>
</h2>
<p></p>
</div>
</div>
</div>
<div class="col-lg-12 box">
<div class="box-header">
<!-- Flash Notifikasi -->
<?php echo $this->session->flashdata('notifikasi');?>
</div>
<div class="box-body">
<div style="max-width: auto; overflow-x: auto;">
<table id="example1" class="table table-bordered table-striped small">
<thead>
<tr>
<th>SLOT NAME</th>
<th>LICENSE PLATE</th>
<th>START TIME</th>
<th>STOP TIME</th>
<th>DURATION</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $result->slot->name;?></td>
<td><?php echo $result->licensePlate;?></td>
<td><?php echo $result->startTime;?></td>
<td><?php echo $result->stopTime;?></td>
<td><?php echo "day ".$result->duration->days." / hour ".$result->duration->hours.":".$result->duration->minutes.":".$result->duration->seconds;?></td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
</div>
<!-- /.box-body -->
<!-- /.box-footer-->
</div>
<!-- /.box -->
</div>
</div>
</section>
<!-- /.content -->
<!-- MODAL SLOT -->
<div class="modal fade" id="modal_slot" role="dialog" aria-labelledby="largeModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 class="modal-title" id="myModalLabel">Stop Park</h3>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<form id="form_slot" enctype="multipart/form-data" method="POST">
<div class="form-group col-md-12" id="labelId">
<label>License Plate</label>
<input type="text" class="form-control" name="licensePlate" id="licensePlate">
<input type="hidden" class="form-control" name="inputedById" id="inputedById" value="128e64bf-884b-4507-81c0-b18e8dde81b9">
</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-danger"><i class="fa fa-car"></i> Stop</button>
</div>
</form>
</div>
</div>
<!-- -->
<br>
</div>
</div>
</div>
</div>
<!-- END MODAL -->
</div>
<?php $this->load->view('main/footer')?>
<!-- Control Sidebar -->
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div>
</body>
</html>
<script>
function function_edit(licensePlate){
$('#modal_slot').modal('show');
$('#licensePlate').val(licensePlate);
$('#form_slot').attr('action',"<?php echo base_url()?>cashier/stop");
}
</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