Codebase update

- Fix select sag to pay on multiple page not selected in checkout payment
- Fix marhun modal data not display
- Fix load upah tawarruq for jeniskeuntungan onepercent or asal
- Add exception when billplz credential is incorrectly entered
This commit is contained in:
Afiq Hamzah
2024-07-18 09:15:20 +08:00
parent f57f2da1c4
commit d4573d78ac
9 changed files with 145 additions and 44 deletions
@@ -85,8 +85,9 @@
{{ $t_akhir }}
</td>
@php
$upahtawarruq = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/'. $bayar['kodcaw'] . '/' . $bayar['norujukan'])->json();
$upahtawarruq = $bayar['upah_tawarruq'];
$upahtawarruq = floatval(str_replace(',','',$upahtawarruq));
$totalupahasal = $totalupahasal + $upahtawarruq;
+39 -7
View File
@@ -39,7 +39,7 @@
<form method="post" id="formtable" action="{{ route('payment.action') }}">
@csrf
@error('chkboxsag')
@error('totalSagInCart')
<script>
$.notify({
icon: 'fas fa-exclamation-triangle fa-2x',
@@ -136,12 +136,44 @@
"scrollX": true
});
// Add event listener to checkboxes to update total count customer wants to pay
document.querySelectorAll('input[type="checkbox"][name="chkboxsag[]"]').forEach(function(el) {
el.addEventListener('change', function(event) {
var total = document.querySelectorAll('input[type="checkbox"][name="chkboxsag[]"]:checked').length;
document.getElementById('totalsag').innerHTML = total;
});
let totalSagInCart = [];
let updateSagInCart = function(norujukan){
let isNorujukanIsAlreadyInCart = totalSagInCart.includes(norujukan);
if(isNorujukanIsAlreadyInCart){
totalSagInCart = totalSagInCart.filter(x => x != norujukan);
}
if(! isNorujukanIsAlreadyInCart){
totalSagInCart.push(norujukan);
}
};
// Add event listener to checkboxes to update total count customer wants to pay
$('#main-table').on('input', 'input[type="checkbox"][name="chkboxsag[]"]', function(el) {
let norujukan = el.target.dataset.norujukan;
let isNorujukanIsChecked = el.target.checked;
updateSagInCart(norujukan);
document.getElementById('totalsag').innerHTML = totalSagInCart.length;
});
document.querySelector('form#formtable').addEventListener('submit', function(event){
event.preventDefault();
// create new input
let totalSagInCartInput = document.createElement('input');
totalSagInCartInput.type = 'hidden';
totalSagInCartInput.name = 'totalSagInCartInput';
totalSagInCartInput.value = JSON.stringify(totalSagInCart);
event.target.appendChild(totalSagInCartInput);
event.target.submit();
});
</script>
@endsection
@@ -12,7 +12,7 @@
@foreach ($pembiayaan as $data)
<tr>
<td>
<input type="checkbox" onclick="tickfunc(this)" name="chkboxsag[]" value="{{ $data->norujukan }}"
<input type="checkbox" name="chkboxsag[]" value="{{ $data->norujukan }}"
id="sag-{{ $loop->iteration }}" data-norujukan="{{ $data->norujukan }}"
{{ $data->disabled_payment ? 'disabled' : '' }} />
</td>
@@ -14,7 +14,7 @@
@foreach ($pembiayaan as $data)
<tr>
<td>
<input type="checkbox" onclick="tickfunc(this)" name="chkboxsag[]" value="{{ $data->norujukan }}"
<input type="checkbox" name="chkboxsag[]" value="{{ $data->norujukan }}"
id="sag-{{ $loop->iteration }}" data-norujukan="{{ $data->norujukan }}"
{{ $data->disabled_payment ? 'disabled' : '' }} />
</td>
@@ -26,7 +26,7 @@
</td>
<td class="hide-xs">{{ $data->tempoh }}</td>
<td>{{ $data->tarikh_akhir }}</td>
<td>{{ $data->keuntungan_formatted }}</td>
<td>{{ $data->upah_tawarruq_formatted }}</td>
<td class="hide-xs">{{ $data->cawangan_name }}</td>
</tr>
@endforeach