parent
cc5b1e4ba9
commit
22858a2f49
@ -73,12 +73,34 @@ export class OrdersComponent implements OnInit {
|
|||||||
this.lastViewOrder = 3;
|
this.lastViewOrder = 3;
|
||||||
switch (dateFilter.filterType) {
|
switch (dateFilter.filterType) {
|
||||||
case 'between':
|
case 'between':
|
||||||
this.filteredOfDatePurchases = this.purchases.filter((value) => {
|
this.ordersLoadingStatus = true;
|
||||||
return moment(value.transactionCreateDate).isBetween(
|
this.filteredOfDatePurchases = []
|
||||||
dateFilter.from,
|
const token = this.cookiesService.getItem('token')
|
||||||
moment(dateFilter.to).add(1, 'day')
|
this.wpJsonService.getTransactionsBetween(environment.systemId, token || '', environment.icardProxy, {
|
||||||
);
|
date_from: dateFilter.from?.toLocaleString() || '',
|
||||||
});
|
date_to: dateFilter.to?.toLocaleString() || ''
|
||||||
|
}).subscribe({
|
||||||
|
next: (value) => {
|
||||||
|
this.filteredOfDatePurchases = Object.values(value)[0] as Purchase[]
|
||||||
|
this.ordersLoadingStatus = false
|
||||||
|
this.purchasesShortArray = this.filteredOfDatePurchases.slice(
|
||||||
|
0,
|
||||||
|
this.lastViewOrder
|
||||||
|
);
|
||||||
|
console.log(value);
|
||||||
|
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
console.error(err);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.filteredOfDatePurchases = this.purchases.filter((value) => {
|
||||||
|
// return moment(value.transactionCreateDate).isBetween(
|
||||||
|
// dateFilter.from,
|
||||||
|
// moment(dateFilter.to).add(1, 'day')
|
||||||
|
// );
|
||||||
|
// });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'currentMonth':
|
case 'currentMonth':
|
||||||
|
|||||||
@ -58,6 +58,10 @@ export class WpJsonService {
|
|||||||
return this._request(`trans/${systemId}/${token}/`, 'GET', null, false, url)
|
return this._request(`trans/${systemId}/${token}/`, 'GET', null, false, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTransactionsBetween(systemId: string, token: string, url: string, body: {date_from: string, date_to: string}): Observable<any> {
|
||||||
|
return this._request(`trans/${systemId}/${token}/`, 'POST', body, false, url)
|
||||||
|
}
|
||||||
|
|
||||||
getTransactionsInfo(systemId: string, token: string, url: string, delta: number): Observable<any> {
|
getTransactionsInfo(systemId: string, token: string, url: string, delta: number): Observable<any> {
|
||||||
return this._request(`purchase/${systemId}/${token}/`, 'GET', null, false, url)
|
return this._request(`purchase/${systemId}/${token}/`, 'GET', null, false, url)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user