Merge branch 'pipiv2' into 'new-master'
kemaskini aliran tunai button See merge request online-sistem1/kaunter!124
This commit is contained in:
@@ -124,7 +124,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
{{-- <button type="button" onclick="kemaskiniupah()" class="btn btn-primary float-right">Kemaskini</button> --}}
|
||||
<button type="button" onclick="periksaalirantunai();" class="btn btn-primary float-right">Kemaskini</button>
|
||||
<nav>
|
||||
<div class="nav nav-tabs mb-4" id="nav-tab" role="tablist">
|
||||
<a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Tunai</a>
|
||||
@@ -146,6 +146,19 @@
|
||||
<th>Nota</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(is_object($addtunai) || is_array($addtunai))
|
||||
@foreach($addtunai as $at)
|
||||
<tr>
|
||||
<td> {{ $loop->iteration }} </td>
|
||||
<td> {{ $at['tarikh'] }} </td>
|
||||
<td> {{ number_format($at['tambah'],2) }} </td>
|
||||
<td> {{ number_format($at['kurang'],2) }} </td>
|
||||
<td> {{ $at['nota'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
@@ -270,53 +283,6 @@
|
||||
|
||||
var tele = "{{ $auth_user['name'] }}";
|
||||
|
||||
$(document).ready( function () {
|
||||
var api = '{{ $api_url }}';
|
||||
var kodcaw = "{{ $auth_user['cawangan'] }}";
|
||||
|
||||
function getData(){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: api + '/api/getAddTunai/' + kodcaw + '/kodlaluan/',
|
||||
data: { "kodlaluan" : tele },
|
||||
success: function(data){
|
||||
gettable(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getData();
|
||||
setInterval(function () {
|
||||
getData();
|
||||
}, 10000);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
function gettable(datala)
|
||||
{
|
||||
var counter = 1;
|
||||
tableaddtunai.clear().draw();
|
||||
|
||||
$.each(datala, function(index,arr){
|
||||
|
||||
var urlroute = "{{ route('pendahuluan.serah', ':no_id') }}";
|
||||
|
||||
urlroute = urlroute.replace(':no_id', arr['no']);
|
||||
|
||||
tableaddtunai.row.add([
|
||||
counter,
|
||||
arr['tarikh'],
|
||||
'RM ' + formatter.format(arr['tambah']),
|
||||
'RM ' + formatter.format(arr['kurang']),
|
||||
arr['nota']
|
||||
]).draw();
|
||||
counter = counter + 1;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// function kemaskiniupah()
|
||||
// {
|
||||
// $.ajax({
|
||||
@@ -347,6 +313,83 @@
|
||||
|
||||
// }
|
||||
|
||||
|
||||
function periksaalirantunai()
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "{{ route('periksa.alirantunai') }}",
|
||||
success: function(balasbalik){
|
||||
console.log(balasbalik);
|
||||
if(balasbalik == 'sama')
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Peringatan',
|
||||
text: 'Aliran tunai selari dengan sistem!'
|
||||
});
|
||||
|
||||
}else{
|
||||
|
||||
Swal.fire({
|
||||
title: 'Kemaskini aliran tunai?',
|
||||
html:
|
||||
'<div class="col-12"><h4 class="btn btn-success col-12 mr-2 font-weight-bold">Pendahuluan : RM ' + formatter.format(balasbalik['pendahuluan']) + '</h4>' +
|
||||
'<h4 class="btn btn-danger col-12 font-weight-bold">Serahan : RM ' + formatter.format(balasbalik['serahan']) + '</h4></div>' +
|
||||
'<div class="col-12"><h4 class="btn btn-success col-12 mr-2 font-weight-bold">Tebus : RM ' + formatter.format(balasbalik['penebusan']) + '</h4>' +
|
||||
'<h4 class="btn btn-danger col-12 font-weight-bold">Gadai : RM ' + formatter.format(balasbalik['gadaian']) + '</h4></div>' +
|
||||
'<h4 class="btn btn-info font-weight-bold col-12">Baki : RM ' + formatter.format(balasbalik['bakisemasa']) + '</h4>',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: `Kemaskini`,
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "{{ route('kemaskini.alirantunai') }}",
|
||||
data: { "bakiakhir" : balasbalik['bakisemasa'],
|
||||
"pendahuluan" : balasbalik['pendahuluan'],
|
||||
"serahan" : balasbalik['serahan'],
|
||||
"gadaian" : balasbalik['gadaian'],
|
||||
"penebusan" : balasbalik['penebusan']
|
||||
},
|
||||
success: function(balas){
|
||||
console.log(balas);
|
||||
if(balas == 'berjaya')
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya',
|
||||
text: 'Kemaskini Berjaya!',
|
||||
closeOnClickOutside: false
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
}else{
|
||||
Swal.fire({
|
||||
icon: 'danger',
|
||||
title: 'Tidak Berjaya',
|
||||
text: 'Kemaskini tidak berjaya!',
|
||||
closeOnClickOutside: false
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
let pusherenv = "{{ env('PUSHER_APP_KEY') }}";
|
||||
let laporanroute = "{{ route('laporan.serahanteller') }}";
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user