update sale invoices models and some ui fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export * from './devices';
|
||||
export * from './guild';
|
||||
export * from './invoiceTypes';
|
||||
export * from './providers';
|
||||
export * from './taxProviderStatus';
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './invoice-type-tag.component';
|
||||
export * from './type';
|
||||
@@ -0,0 +1 @@
|
||||
<p-tag [severity]="severity" size="large" [value]="translate || label"></p-tag>
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Tag } from 'primeng/tag';
|
||||
import { InvoiceTypes } from './type';
|
||||
|
||||
@Component({
|
||||
selector: 'catalog-invoice-type-tag',
|
||||
templateUrl: './invoice-type-tag.component.html',
|
||||
imports: [Tag],
|
||||
})
|
||||
export class CatalogInvoiceTypeTagComponent {
|
||||
@Input({ required: true }) status!: InvoiceTypes;
|
||||
@Input() translate!: string;
|
||||
|
||||
get severity() {
|
||||
switch (this.status) {
|
||||
case 'ORIGINAL':
|
||||
return 'success';
|
||||
case 'CORRECTION':
|
||||
return 'warn';
|
||||
case 'REVOKE':
|
||||
return 'danger';
|
||||
}
|
||||
}
|
||||
|
||||
get label() {
|
||||
switch (this.status) {
|
||||
case 'ORIGINAL':
|
||||
return 'اصلی';
|
||||
case 'CORRECTION':
|
||||
return 'اصلاحی';
|
||||
case 'REVOKE':
|
||||
return 'ابطالی';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export const InvoiceTypes = {
|
||||
ORIGINAL: 'ORIGINAL',
|
||||
CORRECTION: 'CORRECTION',
|
||||
REVOKE: 'REVOKE',
|
||||
} as const;
|
||||
|
||||
export type InvoiceTypes = (typeof InvoiceTypes)[keyof typeof InvoiceTypes];
|
||||
@@ -1,4 +1,11 @@
|
||||
<div class="flex justify-end gap-2">
|
||||
<p-button [label]="cancelLabel" severity="secondary" (click)="cancel()" />
|
||||
<p-button [label]="submitLabel" type="submit" [disabled]="disabled" [loading]="loading" (onClick)="submit()" />
|
||||
<button pButton [label]="cancelLabel" severity="secondary" (click)="cancel()"></button>
|
||||
<button
|
||||
pButton
|
||||
[label]="submitLabel"
|
||||
type="submit"
|
||||
class="min-w-28"
|
||||
[disabled]="disabled"
|
||||
[loading]="loading"
|
||||
(onClick)="submit()"></button>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Button } from 'primeng/button';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-footer-actions',
|
||||
templateUrl: './form-footer-actions.component.html',
|
||||
imports: [Button],
|
||||
imports: [ButtonDirective],
|
||||
})
|
||||
export class FormFooterActionsComponent {
|
||||
@Input() submitLabel = 'تایید';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Maybe } from '@/core';
|
||||
import ISummary from '@/core/models/summary';
|
||||
import { TspProviderResponseStatus } from '@/shared/catalog';
|
||||
import { InvoiceTypes, TspProviderResponseStatus } from '@/shared/catalog';
|
||||
import { IEnumTranslate } from '@/shared/models/enum_translate.type';
|
||||
|
||||
export interface ISaleInvoiceFullRawResponse {
|
||||
@@ -11,11 +12,16 @@ export interface ISaleInvoiceFullRawResponse {
|
||||
pos: Pos;
|
||||
payments: Payment[];
|
||||
items: Item[];
|
||||
invoice_number: number;
|
||||
type: IEnumTranslate<InvoiceTypes>;
|
||||
created_at: string;
|
||||
notes?: string;
|
||||
customer?: Customer;
|
||||
unknown_customer?: UnknownCustomer;
|
||||
status: IEnumTranslate<TspProviderResponseStatus>;
|
||||
main_id: Maybe<string>;
|
||||
tax_id: Maybe<string>;
|
||||
reference_invoice: Maybe<string>;
|
||||
notes: Maybe<string>;
|
||||
}
|
||||
|
||||
export interface ISaleInvoiceFullResponse extends ISaleInvoiceFullRawResponse {}
|
||||
|
||||
@@ -17,14 +17,17 @@
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="listKeyValue">
|
||||
<app-key-value label="کد رهگیری" [value]="invoice.code" />
|
||||
<app-key-value label="شماره صورتحساب" [value]="invoice.invoice_number" />
|
||||
<app-key-value label="تاریخ فاکتور" [value]="invoice.invoice_date" type="dateTime" />
|
||||
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice.created_at" type="dateTime" />
|
||||
<app-key-value label="نوع صورتحساب">
|
||||
<catalog-invoice-type-tag [status]="invoice.type.value" />
|
||||
</app-key-value>
|
||||
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
||||
<catalog-tax-provider-status-tag [status]="invoice.status.value" [translate]="invoice.status.translate" />
|
||||
</app-key-value>
|
||||
<div class="col-span-full">
|
||||
<app-key-value label="توضیحات" [value]="invoice.notes" />
|
||||
<app-key-value label="توضیحات" [value]="invoice.notes || '----'" />
|
||||
</div>
|
||||
</div>
|
||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||
|
||||
@@ -3,7 +3,10 @@ import { NativeBridgeService } from '@/core/services';
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { PosConfigPrintService } from '@/domains/pos/modules/configs/components/print/services/main.service';
|
||||
import { PosInfoStore } from '@/domains/pos/store';
|
||||
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||
import {
|
||||
CatalogInvoiceTypeTagComponent,
|
||||
CatalogTaxProviderStatusTagComponent,
|
||||
} from '@/shared/catalog';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { ISaleInvoiceFullResponse } from '@/shared/components/invoices/sale-invoice-full-response.model';
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
@@ -45,6 +48,7 @@ export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos';
|
||||
UikitEmptyStateComponent,
|
||||
PriceMaskDirective,
|
||||
CatalogTaxProviderStatusTagComponent,
|
||||
CatalogInvoiceTypeTagComponent,
|
||||
],
|
||||
})
|
||||
export class SharedSaleInvoiceSingleViewComponent {
|
||||
|
||||
@@ -88,12 +88,12 @@ export class KeyValueComponent {
|
||||
}
|
||||
switch (this.type) {
|
||||
case 'simple':
|
||||
return this.value || '-';
|
||||
return this.value || '-----';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
valueType = computed(() =>
|
||||
this.variant || ['boolean', 'has', 'active'].includes(this.type) ? 'tag' : 'text',
|
||||
this.variant || ['boolean', 'has', 'active'].includes(this.type) ? 'tag' : 'text'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user