Переписала фильтрацию в списке заказов
This commit is contained in:
parent
917eb7416a
commit
35fa921b20
@ -23,8 +23,8 @@
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th></th>
|
||||
<th><p-columnFilter type="text" field="status_h"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="address.name"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="status_h" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="address.name" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
@ -53,7 +53,7 @@
|
||||
|
||||
<ng-template #order_v>
|
||||
<div>
|
||||
<button (click)="listOrders()">К списку заказов</button>
|
||||
<button (click)="listOrders()">К списку</button>
|
||||
<h1>Заказ: {{order[0].id}}</h1>
|
||||
<p-table [value]="order">
|
||||
<ng-template pTemplate="header">
|
||||
|
||||
@ -5,7 +5,7 @@ import { MessageService } from "primeng/api";
|
||||
import { Order, Products, Delivery_address, Notification, Refund } from "src/app/interface/data";
|
||||
import { ClientsComponent } from "../clients/clients.component";
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
||||
/*import { SwPush, NewsletterService } from '@angular/service-worker*/
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ export class OrdersComponent implements OnInit {
|
||||
public sumRef0: any = 0;
|
||||
public sumRef1: any = 0;
|
||||
public sumRef2: any = 0;
|
||||
public matchModeOptions!: SelectItem[];
|
||||
|
||||
|
||||
public statuses = [
|
||||
@ -58,7 +59,8 @@ export class OrdersComponent implements OnInit {
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private clientsComponent: ClientsComponent,
|
||||
private confirmationService: ConfirmationService
|
||||
private confirmationService: ConfirmationService,
|
||||
private filterService: FilterService
|
||||
) {
|
||||
}
|
||||
|
||||
@ -73,7 +75,27 @@ export class OrdersComponent implements OnInit {
|
||||
setInterval(() => this.getOrders(), 60000);
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
const customFilterName = "custom-contains";
|
||||
this.filterService.register(customFilterName, (value: any, filter: any): boolean => {
|
||||
if (filter === undefined || filter === null || filter.trim() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value === undefined || value === null) {
|
||||
return false;
|
||||
}
|
||||
let det = value.toString()
|
||||
let det2 = det.toLowerCase()
|
||||
return det2.includes(filter.toString()) || det.includes(filter.toString());
|
||||
|
||||
});
|
||||
|
||||
this.matchModeOptions = [
|
||||
{ label: 'Содержит', value: customFilterName },
|
||||
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
||||
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
notif() {
|
||||
|
||||
@ -94,6 +94,11 @@ export class TerminalsComponent implements OnInit {
|
||||
setTimeout(() => document.getElementsByTagName("input")[1].value = division_id, 100);
|
||||
this.jsonRpcService.changeId = id;
|
||||
this.getAreas()
|
||||
for (let i = 0; i < this.areas.length; i++) {
|
||||
if (this.areas[i].name == area_types) {
|
||||
this.areas[i].selected = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateTerminal() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user