wip
This commit is contained in:
63
resources/js/vendor/nova/js/additional.js
vendored
63
resources/js/vendor/nova/js/additional.js
vendored
@@ -3,6 +3,69 @@ function csrf_token()
|
||||
return document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
|
||||
}
|
||||
|
||||
async function fetchLoanHistory(containerID, passport_serie, passport_id) {
|
||||
if (! passport_serie || ! passport_id) {
|
||||
Nova.error('Maglumat ýetmezçiligi bar');
|
||||
return;
|
||||
}
|
||||
|
||||
let cardHistoryDetailContainer = document.getElementById(containerID);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/json');
|
||||
|
||||
var formdata = new FormData();
|
||||
formdata.append('passport_serie', passport_serie);
|
||||
formdata.append('passport_id', passport_id);
|
||||
|
||||
Nova.$progress.start()
|
||||
|
||||
fetch('/api/fetch-loan-history', {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: formdata,
|
||||
redirect: 'follow'
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
console.log({result: result})
|
||||
if (result.errCode != 0) {
|
||||
Nova.error(result.message)
|
||||
}
|
||||
|
||||
// cardHistoryDetailContainer.innerHTML = `
|
||||
// <h4>Müşderi: <strong>${result.clientName}</strong></h4>
|
||||
// <h4>Şahamça: <strong>${result.depName}</strong></h4>
|
||||
// <h4 class="mb-4">Şertnama belgisi: <strong>${result.cardAccountNumber}</strong></h4>
|
||||
|
||||
// <p>
|
||||
// <ul>
|
||||
// ${Array.from(result.transactions).map(transaction => {
|
||||
// return `<li style="background: #a3c1f5;color: black;" class="p-3 relative rounded-lg">
|
||||
// <strong>${transaction['actionName']}</strong> <strong>${transaction['opersum']}</strong> <strong>${transaction['currency']}</strong>
|
||||
|
||||
// <strong style="top: 0; right: 0;" class="absolute p-2">${transaction['opername']}</strong>
|
||||
|
||||
// <p><strong>${
|
||||
// new Date(transaction['trandate']).toLocaleDateString('en-GB', {
|
||||
// year: 'numeric',
|
||||
// month: '2-digit',
|
||||
// day: '2-digit',
|
||||
// }).replaceAll('/', '.')
|
||||
// }</strong></p>
|
||||
// </li>`;
|
||||
// })}
|
||||
// </ul>
|
||||
// </p>
|
||||
// `;
|
||||
|
||||
})
|
||||
.catch(error => console.log('error', error))
|
||||
.finally(() => {
|
||||
Nova.$progress.done()
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchCardHistory(passport_serie, passport_id, card_number, card_expiry_date, containerID) {
|
||||
if (! passport_serie || ! passport_id || ! card_number || ! card_expiry_date) {
|
||||
Nova.error('Maglumat ýetmezçiligi bar');
|
||||
|
||||
Reference in New Issue
Block a user