update sale invoice and payload forms of pos
This commit is contained in:
+3
-3
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="flex items-center justify-center gap-4">
|
<div class="flex items-center justify-center gap-4">
|
||||||
@if (['success', 'failure'].includes(saleInvoice.status.value.toLowerCase())) {
|
@if (['success'].includes(saleInvoice.status.value.toLowerCase())) {
|
||||||
<p-button
|
<p-button
|
||||||
label="ابطال"
|
label="ابطال"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
[loading]="sendingLoading()"
|
[loading]="sendingLoading()"
|
||||||
[disabled]="onAction()"></p-button>
|
[disabled]="onAction()"></p-button>
|
||||||
}
|
}
|
||||||
@if (saleInvoice.status.value.toLowerCase() === 'queued') {
|
@if (['queued', 'fiscal_queued'].includes(saleInvoice.status.value.toLowerCase())) {
|
||||||
<p-button
|
<p-button
|
||||||
label="استعلام وضعیت ارسال"
|
label="استعلام وضعیت ارسال"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
[loading]="gettingStatusLoading()"
|
[loading]="gettingStatusLoading()"
|
||||||
[disabled]="onAction()"></p-button>
|
[disabled]="onAction()"></p-button>
|
||||||
}
|
}
|
||||||
@if (saleInvoice.status.value.toLowerCase() === 'failure') {
|
@if (saleInvoice.status.value.toLowerCase() === 'send_failure') {
|
||||||
<p-button
|
<p-button
|
||||||
label="ارسال مجدد"
|
label="ارسال مجدد"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export class PosOrderSubmittedDialogComponent extends AbstractDialog {
|
|||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||||
this.sended.set(true);
|
this.sended.set(true);
|
||||||
|
this.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
name="wages"
|
name="wages"
|
||||||
label="اجرت" />
|
label="اجرت" />
|
||||||
|
|
||||||
{{ initialValues?.payload?.profit }}
|
|
||||||
<app-amount-percentage-input
|
<app-amount-percentage-input
|
||||||
[percentageControl]="form.controls.payload.controls.commission_percentage"
|
[percentageControl]="form.controls.payload.controls.commission_percentage"
|
||||||
[amountControl]="form.controls.payload.controls.commission"
|
[amountControl]="form.controls.payload.controls.commission"
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
|||||||
baseTotalAmount = signal<number>(0);
|
baseTotalAmount = signal<number>(0);
|
||||||
baseAmountForDiscountCalculation = signal<number>(0);
|
baseAmountForDiscountCalculation = signal<number>(0);
|
||||||
taxAmount = signal<number>(0);
|
taxAmount = signal<number>(0);
|
||||||
|
discountAmount = signal<number>(0);
|
||||||
totalAmount = signal<number>(0);
|
totalAmount = signal<number>(0);
|
||||||
|
|
||||||
goldDefaultUnitPrice = signal<number>(0);
|
goldDefaultUnitPrice = signal<number>(0);
|
||||||
@@ -87,7 +88,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
|||||||
[Validators.required, greaterThanValidator(0)],
|
[Validators.required, greaterThanValidator(0)],
|
||||||
],
|
],
|
||||||
quantity: [this.initialValues?.quantity || 0, [Validators.required, greaterThanValidator(0)]],
|
quantity: [this.initialValues?.quantity || 0, [Validators.required, greaterThanValidator(0)]],
|
||||||
discount: [this.initialValues?.discount || 0],
|
discount: [this.initialValues?.discount_amount || 0],
|
||||||
discount_percentage: [0, [Validators.max(100), Validators.min(0)]],
|
discount_percentage: [0, [Validators.max(100), Validators.min(0)]],
|
||||||
payload: this.fb.group({
|
payload: this.fb.group({
|
||||||
commission: [this.initialValues?.payload?.commission || 0, [Validators.required]],
|
commission: [this.initialValues?.payload?.commission || 0, [Validators.required]],
|
||||||
@@ -126,6 +127,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
|||||||
total_amount: this.totalAmount(),
|
total_amount: this.totalAmount(),
|
||||||
base_total_amount: this.baseTotalAmount(),
|
base_total_amount: this.baseTotalAmount(),
|
||||||
tax_amount: this.taxAmount(),
|
tax_amount: this.taxAmount(),
|
||||||
|
discount_amount: this.form.value.discount || 0,
|
||||||
payload: {
|
payload: {
|
||||||
commission: this.form.controls.payload.controls.commission.value || 0,
|
commission: this.form.controls.payload.controls.commission.value || 0,
|
||||||
karat: this.form.controls.payload.controls.karat.value as TGoldKarat,
|
karat: this.form.controls.payload.controls.karat.value as TGoldKarat,
|
||||||
@@ -138,7 +140,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
|||||||
updateCalculateAmount(payload: Partial<IPosOrderItem<any>>) {
|
updateCalculateAmount(payload: Partial<IPosOrderItem<any>>) {
|
||||||
const commissionAmount = Number(payload.payload?.commission ?? '0');
|
const commissionAmount = Number(payload.payload?.commission ?? '0');
|
||||||
const wageAmount = Number(payload.payload?.wages ?? '0');
|
const wageAmount = Number(payload.payload?.wages ?? '0');
|
||||||
const discountAmount = Number(payload.discount ?? '0');
|
const discountAmount = Number(payload.discount_amount ?? '0');
|
||||||
const profitAmount = Number(payload.payload?.profit ?? '0');
|
const profitAmount = Number(payload.payload?.profit ?? '0');
|
||||||
const unitPrice = Number(payload.unit_price ?? '0');
|
const unitPrice = Number(payload.unit_price ?? '0');
|
||||||
const quantity = Number(payload.quantity ?? '0');
|
const quantity = Number(payload.quantity ?? '0');
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class PosStandardPayloadFormComponent extends AbstractForm<
|
|||||||
[Validators.required, greaterThanValidator(0)],
|
[Validators.required, greaterThanValidator(0)],
|
||||||
],
|
],
|
||||||
quantity: [this.initialValues?.quantity || 0, [Validators.required, greaterThanValidator(0)]],
|
quantity: [this.initialValues?.quantity || 0, [Validators.required, greaterThanValidator(0)]],
|
||||||
discount_amount: [this.initialValues?.discount || 0, [Validators.min(0)]],
|
discount_amount: [this.initialValues?.discount_amount || 0, [Validators.min(0)]],
|
||||||
discount_percentage: [0, [Validators.min(0), Validators.max(100)]],
|
discount_percentage: [0, [Validators.min(0), Validators.max(100)]],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
optionValue="value" />
|
optionValue="value" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
v
|
|
||||||
<uikit-field label="تعداد مراحل پرداخت با پوز" name="pay_by_terminal_steps">
|
<uikit-field label="تعداد مراحل پرداخت با پوز" name="pay_by_terminal_steps">
|
||||||
<p-select
|
<p-select
|
||||||
[options]="payByTerminalSteps()"
|
[options]="payByTerminalSteps()"
|
||||||
|
|||||||
+5
-1
@@ -7,6 +7,8 @@ import { IPosOrderItem } from './types';
|
|||||||
|
|
||||||
export interface IPosOrderRequest {
|
export interface IPosOrderRequest {
|
||||||
total_amount: number;
|
total_amount: number;
|
||||||
|
discount_amount: number;
|
||||||
|
tax_amount: number;
|
||||||
invoice_date: string;
|
invoice_date: string;
|
||||||
settlement_type: 'CASH' | 'CREDIT' | 'MIXED';
|
settlement_type: 'CASH' | 'CREDIT' | 'MIXED';
|
||||||
payments: IPayment;
|
payments: IPayment;
|
||||||
@@ -23,7 +25,9 @@ export interface IPosOrderRawResponse {
|
|||||||
invoice_number: number;
|
invoice_number: number;
|
||||||
invoice_date: string;
|
invoice_date: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
total_amount: string;
|
total_amount: strung;
|
||||||
|
discount_amount: strung;
|
||||||
|
tax_amount: strung;
|
||||||
customer: ICustomer;
|
customer: ICustomer;
|
||||||
unknown_customer: IUnknownCustomer;
|
unknown_customer: IUnknownCustomer;
|
||||||
status: IEnumTranslate;
|
status: IEnumTranslate;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export interface IPosOrderItem<T = TPosOrderGoodPayload> {
|
|||||||
quantity: number;
|
quantity: number;
|
||||||
total_amount: number;
|
total_amount: number;
|
||||||
discount_amount: number;
|
discount_amount: number;
|
||||||
|
tax_amount: number;
|
||||||
measure_unit: ISummary;
|
measure_unit: ISummary;
|
||||||
good_id?: string;
|
good_id?: string;
|
||||||
service_id?: string;
|
service_id?: string;
|
||||||
@@ -15,8 +16,6 @@ export interface IPosOrderItem<T = TPosOrderGoodPayload> {
|
|||||||
payload: T;
|
payload: T;
|
||||||
|
|
||||||
base_total_amount: number;
|
base_total_amount: number;
|
||||||
discount: number;
|
|
||||||
tax_amount: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPosInOrderGood extends Omit<IPosOrderItem, 'good_id' | 'service_id' | 'notes'> {
|
export interface IPosInOrderGood extends Omit<IPosOrderItem, 'good_id' | 'service_id' | 'notes'> {
|
||||||
|
|||||||
@@ -272,6 +272,8 @@ export class PosLandingStore {
|
|||||||
payments: this.payments(),
|
payments: this.payments(),
|
||||||
settlement_type: this.state$().settlement_type,
|
settlement_type: this.state$().settlement_type,
|
||||||
total_amount: this.orderPricingInfo().totalAmount,
|
total_amount: this.orderPricingInfo().totalAmount,
|
||||||
|
discount_amount: this.orderPricingInfo().discountAmount,
|
||||||
|
tax_amount: this.orderPricingInfo().taxAmount,
|
||||||
};
|
};
|
||||||
|
|
||||||
// this.toastServices.info({
|
// this.toastServices.info({
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ export class CatalogTaxProviderStatusTagComponent {
|
|||||||
case 'SUCCESS':
|
case 'SUCCESS':
|
||||||
return 'success';
|
return 'success';
|
||||||
case 'FAILURE':
|
case 'FAILURE':
|
||||||
|
case 'SEND_FAILURE':
|
||||||
return 'danger';
|
return 'danger';
|
||||||
case 'NOT_SEND':
|
case 'NOT_SEND':
|
||||||
return 'warn';
|
return 'warn';
|
||||||
case 'QUEUED':
|
case 'QUEUED':
|
||||||
|
case 'FISCAL_QUEUED':
|
||||||
return 'info';
|
return 'info';
|
||||||
default:
|
default:
|
||||||
return 'secondary';
|
return 'secondary';
|
||||||
@@ -35,7 +37,11 @@ export class CatalogTaxProviderStatusTagComponent {
|
|||||||
case 'NOT_SEND':
|
case 'NOT_SEND':
|
||||||
return 'ارسال نشده';
|
return 'ارسال نشده';
|
||||||
case 'QUEUED':
|
case 'QUEUED':
|
||||||
return 'در صف ارسال';
|
return 'در صف ارسال به معتمد';
|
||||||
|
case 'FISCAL_QUEUED':
|
||||||
|
return 'در صف ارسال به مالیات';
|
||||||
|
case 'SEND_FAILURE':
|
||||||
|
return 'خطا در ارسال';
|
||||||
default:
|
default:
|
||||||
return 'نامشخص';
|
return 'نامشخص';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ export const TspProviderResponseStatus = {
|
|||||||
FAILURE: 'FAILURE',
|
FAILURE: 'FAILURE',
|
||||||
NOT_SEND: 'NOT_SEND',
|
NOT_SEND: 'NOT_SEND',
|
||||||
QUEUED: 'QUEUED',
|
QUEUED: 'QUEUED',
|
||||||
|
FISCAL_QUEUED: 'FISCAL_QUEUED',
|
||||||
|
SEND_FAILURE: 'SEND_FAILURE',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type TspProviderResponseStatus =
|
export type TspProviderResponseStatus =
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
|||||||
this.syncZIndex();
|
this.syncZIndex();
|
||||||
}
|
}
|
||||||
if (changes['visible']) {
|
if (changes['visible']) {
|
||||||
console.log('changed', this.visible);
|
|
||||||
|
|
||||||
this.toggleBodyScrollLock(this.visible);
|
this.toggleBodyScrollLock(this.visible);
|
||||||
}
|
}
|
||||||
@@ -140,8 +139,6 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
|||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.toggleBodyScrollLock(false);
|
this.toggleBodyScrollLock(false);
|
||||||
console.log('destroyed');
|
|
||||||
|
|
||||||
this.removeDrawer();
|
this.removeDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +168,6 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
private toggleBodyScrollLock(locked: boolean) {
|
private toggleBodyScrollLock(locked: boolean) {
|
||||||
console.log('locked', locked);
|
|
||||||
|
|
||||||
const body = this.document.body;
|
const body = this.document.body;
|
||||||
if (!body) return;
|
if (!body) return;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export interface ISaleInvoiceFullRawResponse {
|
|||||||
id: string;
|
id: string;
|
||||||
code: string;
|
code: string;
|
||||||
total_amount: string;
|
total_amount: string;
|
||||||
|
discount_amount: string;
|
||||||
|
tax_amount: string;
|
||||||
invoice_date: string;
|
invoice_date: string;
|
||||||
consumer_account: ConsumerAccount;
|
consumer_account: ConsumerAccount;
|
||||||
pos: Pos;
|
pos: Pos;
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||||
<div class="grid items-center gap-3 sm:grid-cols-2 sm:gap-4 md:grid-cols-3">
|
<div class="grid items-center gap-3 sm:grid-cols-2 sm:gap-4 md:grid-cols-3">
|
||||||
<app-key-value label="مجموع قابل پرداخت" [value]="invoice.total_amount" type="price" />
|
<app-key-value label="مجموع قابل پرداخت" [value]="invoice.total_amount" type="price" />
|
||||||
|
<app-key-value label="مبلغ تخفیف" [value]="invoice.discount_amount" type="price" />
|
||||||
|
<app-key-value label="مبلغ مالیات" [value]="invoice.tax_amount" type="price" />
|
||||||
@for (payment of invoice.payments; track $index) {
|
@for (payment of invoice.payments; track $index) {
|
||||||
<app-key-value
|
<app-key-value
|
||||||
[label]="`${payment.payment_method === 'SET_OFF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پوز' : 'نقدی/ کارتخوان دیگر/ کارت به کارت'}`"
|
[label]="`${payment.payment_method === 'SET_OFF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پوز' : 'نقدی/ کارتخوان دیگر/ کارت به کارت'}`"
|
||||||
|
|||||||
@@ -273,9 +273,19 @@ export class SharedSaleInvoiceSingleViewComponent {
|
|||||||
return `${item.quantity} ${item.measure_unit_text}`;
|
return `${item.quantity} ${item.measure_unit_text}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'discount_amount',
|
||||||
|
header: 'مبلغ تخفیف',
|
||||||
|
type: 'price',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'tax_amount',
|
||||||
|
header: 'مبلغ مالیات',
|
||||||
|
type: 'price',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'total_amount',
|
field: 'total_amount',
|
||||||
header: 'قیمت نهایی',
|
header: 'مبلغ قابل پرداخت',
|
||||||
type: 'price',
|
type: 'price',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Maybe } from '@/core';
|
import { Maybe } from '@/core';
|
||||||
import { jalaliToGregorian, nowJalali } from '@/utils';
|
import { nowJalali } from '@/utils';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import {
|
import {
|
||||||
AfterViewInit,
|
AfterViewInit,
|
||||||
@@ -60,8 +60,6 @@ export class UikitFlatpickrJalaliComponent implements AfterViewInit, OnDestroy {
|
|||||||
altFormat: 'Y/m/d',
|
altFormat: 'Y/m/d',
|
||||||
|
|
||||||
onChange: (selectedDates: Date[], dateStr: string) => {
|
onChange: (selectedDates: Date[], dateStr: string) => {
|
||||||
console.log('dateStr', jalaliToGregorian(dateStr));
|
|
||||||
|
|
||||||
this.valueChange.emit(dateStr);
|
this.valueChange.emit(dateStr);
|
||||||
if (this.control) this.control.setValue(dayjs(dateStr).toISOString());
|
if (this.control) this.control.setValue(dayjs(dateStr).toISOString());
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
// apiBaseUrl: 'https://psp-api.shift-am.ir',
|
// apiBaseUrl: 'https://psp-api.shift-am.ir',
|
||||||
apiBaseUrl: 'http://192.168.128.73:5002',
|
// apiBaseUrl: 'http://192.168.128.73:5002',
|
||||||
|
apiBaseUrl: 'http://localhost:5002',
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 5000,
|
port: 5000,
|
||||||
enableLogging: false,
|
enableLogging: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user