buat upah buat ubah wakil

This commit is contained in:
MUHD HAFIFIE
2021-04-18 15:50:18 +08:00
parent 6a193465a8
commit f01f2615dd
4 changed files with 434 additions and 213 deletions
+52 -2
View File
@@ -124,12 +124,13 @@
<div class="card-body">
<button type="button" onclick="kemaskiniupah()" class="btn btn-primary float-right" disabled>Kemaskini</button>
<button type="button" onclick="kemaskiniupah()" 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>
<a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">Gadai / Tebus</a>
<a class="nav-item nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab" aria-controls="nav-contact" aria-selected="false">Tuntut Baki</a>
<a class="nav-item nav-link" id="nav-upah-tab" data-toggle="tab" href="#nav-upah" role="tab" aria-controls="nav-upah" aria-selected="false">Upah Lama</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
@@ -214,6 +215,33 @@
</table>
</div>
<div class="tab-pane fade" id="nav-upah" role="tabpanel" aria-labelledby="nav-upah-tab">
<table class="table table-striped table-hover text-center" id="tableupahlama">
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>Tarikh</th>
<th>Norujukan</th>
<th>Upah Dibayar (RM)</th>
</tr>
</thead>
<tbody>
{{-- {{ dd($advansur) }} --}}
@if(is_object($advansur) || is_array($advansur))
@foreach($advansur as $ansur)
<tr>
<td> {{ $loop->iteration }} </td>
<td> {{ $ansur['tarikh'] }} </td>
<td> {{ $ansur['norujukan'] }} </td>
<td> {{ number_format($ansur['upahdibayar'],2) }} </td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>
@@ -235,6 +263,11 @@
var tabletuntutbaki = $('#tabletuntutbaki').DataTable({
// "scrollX": true
});
var tableupahlama = $('#tableupahlama').DataTable({
// "scrollX": true
});
var tele = "{{ $auth_user['name'] }}";
$(document).ready( function () {
@@ -289,9 +322,26 @@
$.ajax({
type: 'get',
url: "{{ route('kemaskini.upah') }}",
data: { "namateller" : tele },
// data: { "namateller" : tele },
success: function(data){
console.log(data);
if(data == 1)
{
Swal.fire({
icon: 'success',
title: 'Kemaskini!',
text: 'Proses Kemaskini!'
}).then(function() {
location.reload();
});
}else{
Swal.fire({
icon: 'warning',
title: 'Peringatan',
text: 'Telah Dikemaskini!'
});
}
}
});
+128 -14
View File
@@ -8,6 +8,7 @@
@section('content')
@include('modal.historytebus')
@include('modal.wakil')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 col-lg-12">
@@ -756,6 +757,49 @@
});
}
function daftarwakilfunction(nokp)
{
$('#nokp').val(nokp);
$.ajax({
method:'GET',
url: "{{ route('wakil.caricustomer') }}",
data:{ "icno" : nokp },
success:function(data){
$('#WakilModal').modal();
$('#nama').val('');
$('#alamat').val(data['']);
$('#notel').val(data['']);
//get first wakil
$.ajax({
method:'GET',
url: "{{ route('wakil.first') }}",
success:function(getfirstwakil)
{
let firstwakil = parseInt(getfirstwakil);
$('#nowakil').val(firstwakil+1);
}
});
if(data != 'no-data')
{
$('#nama').val(data['nama']);
$('#alamat').val(data['alamat1']);
$('#notel').val(data['telefon']);
$('#nopelanggan').val(data['nopelanggan']);
}
},error: function (request, status, error) {
console.log(request.responseText);
}
});
}
function ubahfunc(e){
@@ -835,7 +879,7 @@
let mohon = "Ubah Wakil";
let norujukan = $('input[name="sudahtebus"]:checked').val();
console.log(mohon + ' ' + norujukan);
// console.log(mohon + ' ' + norujukan);
$.ajax({
method:'post',
@@ -853,6 +897,7 @@
}
});
var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", {
cluster: 'ap1',
encrypted: true
@@ -861,7 +906,7 @@
var channel = pusher.subscribe('notice-ubahhapus');
channel.bind('my-ubahhapus', function(data) {
if(data.norujukan == ubahid)
if(data.norujukan == norujukan)
{
if(data.kelulusan == 'lulus')
{
@@ -897,23 +942,92 @@
if(amaun)
{
$.ajax({
method:'post',
method:'get',
url: api_url + '/api/getwakil/' + kodcaw + '/' + amaun,
data: {
// "_token": "{{ csrf_token() }}",
// "norujukan" : ubahid,
// "mohon" : mohon
},
success:function(data){
if(data.length > 0)
{
let namawakilsedia = data[0]['nama'];
let nokpwakilsedia = data[0]['nokp'];
let nowakilsedia = data[0]['nowakil'];
console.log(data[0]['nama']);
console.log(data[0]['nokp']);
const PengesahanAkhirWakil = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success ml-1',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
});
PengesahanAkhirWakil.fire({
title: 'Pengesahan Akhir Wakil!',
html: '<b class="text-danger">' + namawakilsedia + '</b><br><b class="text-danger">' + nokpwakilsedia + '</b>',
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Benar',
cancelButtonText: 'Salah',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
method:'put',
async:false,
url: api_url + '/api/ubahwakil/' + kodcaw,
data:{ 'nowakil' : nowakilsedia,
'norujukan' : norujukan},
success:function(data){
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
if(data === 1)
{
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Penukaran Wakil berjaya'
}).then(async function(){
return true;
location.reload();
});
}else{
Swal.fire({
icon: 'info',
title: 'Pemberitahuan!',
text: 'Wakil telah didaftarkan dengan IC tersebut!'
}).then(async function(){
return true;
location.reload();
});
}
}
});
}else if (result.dismiss === Swal.DismissReason.cancel){
PengesahanAkhirWakil.fire(
'Batal',
'Tidak Berjaya Mengesahkan Wakil!',
'error'
)
}
});
}else{
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Daftar Wakil!',
icon: 'info',
title: 'Maklumat anda tiada dalam senarai wakil! Tekan button Daftar untuk mendaftar!'
}).then(function(){
daftarwakilfunction(amaun);
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
});