wip
This commit is contained in:
51
resources/js/vendor/nova/js/additional.js
vendored
51
resources/js/vendor/nova/js/additional.js
vendored
@@ -1,3 +1,47 @@
|
|||||||
|
async function postData(url, data) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const result = await response.json();
|
||||||
|
} else {
|
||||||
|
console.error();
|
||||||
|
Nova.error('Error: ' + response.status + ' ' + response.statusText)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Nova.error('Error: ' + error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchCardHistory() {
|
||||||
|
let cardHistoryDetailContainer = document.getElementById('card-history-details');
|
||||||
|
|
||||||
|
postData('/fetch-card-history')
|
||||||
|
.then(response => {
|
||||||
|
if (response.errCode != 0) {
|
||||||
|
Nova.error('Barlap bolmady, tor näsazlygy')
|
||||||
|
}
|
||||||
|
|
||||||
|
cardHistoryDetailContainer.innerHTML = `
|
||||||
|
<p>Şahamça: <strong>${response.depName}</strong></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<ul>
|
||||||
|
${Array.from(response.transactions).map(transaction => {
|
||||||
|
return 'hello';
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
`;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// window.LaravelNovaWizardStore = {
|
// window.LaravelNovaWizardStore = {
|
||||||
// data: {
|
// data: {
|
||||||
// steps: 0,
|
// steps: 0,
|
||||||
@@ -166,10 +210,3 @@
|
|||||||
|
|
||||||
// // when app is booting
|
// // when app is booting
|
||||||
// Nova.booting((app, store) => {})
|
// Nova.booting((app, store) => {})
|
||||||
|
|
||||||
async function fetchCardHistory() {
|
|
||||||
let response = await fetch('/fetch-card-history');
|
|
||||||
let data = await response.json();
|
|
||||||
|
|
||||||
console.log(data)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -44,4 +44,7 @@
|
|||||||
<div class="expiry-date text-white">{{ $resource->card_month }}/{{ $resource->card_year }}</div>
|
<div class="expiry-date text-white">{{ $resource->card_month }}/{{ $resource->card_year }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="card-history-details">
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user