update invoice filter and paginator

This commit is contained in:
2026-06-01 16:22:20 +03:30
parent d44004d555
commit ae963a60ce
10 changed files with 83 additions and 57 deletions
@@ -7,9 +7,9 @@
header="فیلتر صورت‌حساب‌ها"
styleClass="w-full md:w-[28rem]"
(visibleChange)="visibleChange.emit($event)">
<div class="flex h-full flex-col overflow-y-auto">
<div class="flex h-full flex-col">
<hr />
<form class="grow py-4" [formGroup]="form" (ngSubmit)="submit()">
<form class="grow py-0" [formGroup]="form" (ngSubmit)="submit()">
<app-input label="شماره صورت‌حساب" [control]="form.controls.invoice_number" name="invoice_number" />
<app-enum-select type="fiscalResponseStatus" [control]="form.controls.status" />
@@ -23,12 +23,26 @@
type="nationalId" />
<app-input label="شناسه اقتصادی" [control]="form.controls.customer_economic_code" name="customer_economic_code" />
<!-- <div class="grid grid-cols-2 gap-2">
<uikit-datepicker label="از تاریخ صورت‌حساب‌" [control]="form.controls.invoice_date_from" name="invoice_date_from" />
<uikit-datepicker label="تا تاریخ صورت‌حساب‌" [control]="form.controls.invoice_date_to" name="invoice_date_to" />
</div>
<app-datepicker
label="از تاریخ صورت‌حساب‌"
[control]="form.controls.invoice_date_from"
[max]="form.controls.invoice_date_to.value || now"
name="invoice_date_from" />
<app-datepicker
label="تا تاریخ صورت‌حساب‌"
[control]="form.controls.invoice_date_to"
[min]="form.controls.invoice_date_from.value || undefined"
[max]="now"
name="invoice_date_to" />
<div class="grid grid-cols-2 gap-2">
<app-datepicker
label="از تاریخ ایجاد"
[control]="form.controls.created_at_from"
[max]="form.controls.invoice_date_to.value || now"
name="created_at_from" />
<app-datepicker label="تا تاریخ ایجاد" [control]="form.controls.created_at_to" [max]="now" name="created_at_to" />
<!-- <div class="grid grid-cols-2 gap-2">
<uikit-datepicker label="از تاریخ صدور" [control]="form.controls.created_at_from" name="created_at_from" />
<uikit-datepicker label="تا تاریخ صدور" [control]="form.controls.created_at_to" name="created_at_to" />
</div> -->
@@ -38,7 +52,7 @@
<app-input label="تا مبلغ" [control]="form.controls.total_amount_to" name="total_amount_to" type="price" />
</div>
</form>
<div class="bg-surface-card sticky bottom-0 mt-auto shrink-0">
<div class="bg-surface-card mt-auto shrink-0 pb-4">
<hr />
<div class="grid grid-cols-2 gap-2 pt-2">
<button pButton type="button" outlined label="حذف" (click)="clear()"></button>
@@ -2,6 +2,8 @@ import { Maybe } from '@/core';
import { EnumSelectComponent } from '@/shared/apiEnum/select.component';
import { TspProviderResponseStatus } from '@/shared/catalog';
import { InputComponent } from '@/shared/components';
import { DatepickerComponent } from '@/uikit';
import { nowGregorian } from '@/utils';
import {
Component,
EventEmitter,
@@ -29,6 +31,7 @@ import { IPosSaleInvoicesFilterDto } from '../models';
ButtonDirective,
EnumSelectComponent,
InputComponent,
DatepickerComponent,
],
})
export class PosSaleInvoicesFilterDrawerComponent implements OnChanges {
@@ -40,6 +43,8 @@ export class PosSaleInvoicesFilterDrawerComponent implements OnChanges {
@Output() visibleChange = new EventEmitter<boolean>();
@Output() apply = new EventEmitter<IPosSaleInvoicesFilterDto>();
readonly now = nowGregorian();
readonly form = this.fb.group({
page: this.fb.control<number | null>(null),
perPage: this.fb.control<number | null>(null),
@@ -160,6 +160,7 @@ export class PosSaleInvoiceListComponent {
}
private syncFiltersToQueryParams() {
this.filters.update((val) => ({ ...val, page: 1 }));
const queryParams = Object.entries(this.filters()).reduce<Record<string, string>>(
(acc, [key, value]) => {
if (value !== undefined && value !== null && value !== '') {
@@ -6,16 +6,16 @@
<div class="absolute top-0 right-0 h-full w-1" [style.backgroundColor]="preparedInfo().borderColor"></div>
<div class="text-surface-700 flex items-center justify-between gap-2">
<div class="text-surface-700 flex items-center gap-2">
<span
class="text-surface-700 flex h-8 w-8 items-center justify-center rounded-full border"
<!-- <span
class="text-surface-700 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border"
[style.borderColor]="preparedInfo().borderColor"
[style.backgroundColor]="preparedInfo().borderColor + '33'">
<i class="text-sm" [ngClass]="'pi pi-' + preparedInfo().icon" [style.color]="preparedInfo().borderColor"></i>
</span>
</span> -->
<span class="text-surface-700 text-sm font-semibold">{{ preparedInfo().title }}</span>
</div>
<span
class="text-surface-700 rounded-full border px-2 py-1 text-xs font-bold"
class="text-surface-700 shrink-0 rounded-full border px-2 py-1 text-xs font-bold"
[style.borderColor]="preparedInfo().borderColor">
{{ count || 0 }} عدد
</span>
@@ -57,7 +57,7 @@ export class PosStatisticsInvoiceTypeCardComponent {
};
case 'pending':
return {
title: 'انتظار ارسال',
title: taxProviderStatusTranslatorUtil('FISCAL_QUEUED'),
icon: 'clock',
bgColor: '#3B82F61A',
borderColor: '#3B82F6',
@@ -62,11 +62,11 @@ export class PosStatisticsRootComponent {
case 'failure':
queryParams.status = 'FAILURE';
break;
case 'notSended':
case 'not_send':
queryParams.status = 'NOT_SEND';
break;
case 'pending':
queryParams.status = 'QUEUED';
queryParams.status = 'FISCAL_QUEUED';
break;
}
const queryString = new URLSearchParams(queryParams as Record<string, string>).toString();