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