Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
adnan
EasyParking
Commits
e362e1fa
Commit
e362e1fa
authored
Apr 13, 2020
by
Oky Rahmanto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/exit_parking' into 'development'
add feature exit parking See merge request
!36
parents
75352fa5
a829c751
Pipeline
#25059
passed with stage
in 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
309 additions
and
1 deletion
+309
-1
frontendManagement/application/controllers/Cashier.php
frontendManagement/application/controllers/Cashier.php
+165
-0
frontendManagement/application/views/cashier/park_stop.php
frontendManagement/application/views/cashier/park_stop.php
+143
-0
frontendManagement/application/views/menu/header-menu.php
frontendManagement/application/views/menu/header-menu.php
+1
-1
No files found.
frontendManagement/application/controllers/Cashier.php
0 → 100644
View file @
e362e1fa
<?php
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
class
Cashier
extends
CI_Controller
{
//API URL
//private $url = 'https://easyparking-api.azurewebsites.net/api/location/';
//private $url_zone = 'https://easyparking-api.azurewebsites.net/api/zona/';
//private $url_slot = 'https://easyparking-api.azurewebsites.net/api/slot/';
private
$url
=
'https://api.easy-parking.ourcode.site/api/location/'
;
private
$url_zone
=
'https://api.easy-parking.ourcode.site/api/zona/'
;
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/'
;
function
__construct
(){
parent
::
__construct
();
}
function
location
(){
//create a new cURL resource
$ch
=
curl_init
(
$this
->
url
);
//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
),
);
return
$data
;
}
function
zone
(){
//create a new cURL resource
$ch
=
curl_init
(
$this
->
url_zone
);
//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
),
);
$data
[
'lokasi'
]
=
$this
->
location
();
return
$data
;
}
function
get_data_area
(){
//create a new cURL resource
$ch
=
curl_init
(
$this
->
url_slot
);
//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
),
);
$data
[
'zona'
]
=
$this
->
zone
();
$data
[
'lokasi'
]
=
$this
->
location
();
return
$data
;
}
function
get_parking
(){
//create a new cURL resource
$ch
=
curl_init
(
$this
->
url_parking
);
//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
),
);
return
$data
;
}
function
park_stop
(){
$data
[
'slot'
]
=
$this
->
get_data_area
();
$data
[
'parking'
]
=
$this
->
get_parking
();
$this
->
load
->
view
(
'menu/header-menu.php'
);
$this
->
load
->
view
(
'cashier/park_stop.php'
,
$data
);
}
function
stop
(){
$licensePlate
=
$this
->
input
->
post
(
'licensePlate'
);
$inputedById
=
$this
->
input
->
post
(
'inputedById'
);
//create a new cURL resource
$ch
=
curl_init
(
$this
->
url_stop_park
);
// //setup request to send json via POST
$data
=
array
(
'licensePlate'
=>
$licensePlate
,
'inputedById'
=>
$inputedById
,
);
$param
=
json_encode
(
$data
);
//curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
// //attach encoded JSON string to the POST fields
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$param
);
//set the content type to application/json
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
'Content-Type:application/json'
,
'Content-Length: '
.
strlen
(
$param
)));
//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
);
$responseCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
//close cURL resource
curl_close
(
$ch
);
$alert
=
'alert-success'
;
$message
=
'Data Berhasil Disimpan'
;
if
(
$responseCode
!=
200
)
{
$message
=
$result
;
$alert
=
'alert-danger'
;
}
$this
->
session
->
set_flashdata
(
"notifikasi"
,
"<div class='alert
$alert
alert-dismissable'>
<i class='fa fa-info'></i>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<b>
$message
!</b>
</div>"
);
redirect
(
base_url
(
'cashier/park_stop'
));
}
}
?>
\ No newline at end of file
frontendManagement/application/views/cashier/park_stop.php
0 → 100644
View file @
e362e1fa
<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>
Exit Parking
<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=
"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>
NO
</th>
<th>
SLOT NAME
</th>
<th>
LICENSE PLATE
</th>
<th>
START TIME
</th>
<th>
STOP TIME
</th>
<th>
ACTION
</th>
</tr>
</thead>
<tbody>
<?php
if
(
count
(
$parking
[
'result'
])
>
0
){
$start
=
0
;
foreach
(
$parking
[
'result'
]
as
$value
)
{
?>
<tr>
<td>
<?php
echo
++
$start
;
?>
</td>
<td>
<?php
echo
$value
->
slot
->
name
;
?>
</td>
<td>
<?php
echo
$value
->
licensePlate
;
?>
</td>
<td>
<?php
echo
$value
->
startTime
;
?>
</td>
<td>
<?php
echo
$value
->
stopTime
;
?>
</td>
<td>
<a
class=
"btn btn-warning btn-xs"
href=
"#"
onclick=
"function_edit('
<?php
echo
$value
->
licensePlate
;
?>
')"
><i
class=
"fa fa-car"
></i>
Stop
</a>
</a>
</td>
</tr>
<?php
}
}
?>
</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
frontendManagement/application/views/menu/header-menu.php
View file @
e362e1fa
...
...
@@ -174,7 +174,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</a>
<ul
class=
"treeview-menu"
>
<li>
<a
href=
"
#
"
>
<a
href=
"
<?php
echo
base_url
()
?>
cashier/park_stop
"
>
<i
class=
'fa fa-money'
></i>
<span>
Exit Parking
</span>
</a>
</li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment