This commit is contained in:
2026-05-28 18:27:38 +03:30
parent 550db47b88
commit d678b6c699
5 changed files with 36 additions and 31 deletions
@@ -33,11 +33,11 @@
<app-amount-percentage-input
[percentageControl]="form.controls.discount_percentage"
[amountControl]="form.controls.discount"
[amountControl]="form.controls.discount_amount"
[baseAmount]="baseAmountForDiscountCalculation()"
[minAmount]="0"
[maxAmount]="baseAmountForDiscountCalculation()"
name="discount"
name="discount_amount"
label="تخفیف">
<ng-template #labelSuffix>
<p-selectButton
@@ -55,7 +55,7 @@
<pos-form-dialog-amount-card-template
[totalAmount]="totalAmount()"
[baseTotalAmount]="baseTotalAmount()"
[discountAmount]="form.controls.discount.value || 0"
[discountAmount]="form.controls.discount_amount.value || 0"
[taxAmount]="taxAmount()" />
<button pButton class="w-full sm:w-auto" (click)="submit()">{{ preparedCTAText() }}</button>
</div>
@@ -88,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_amount || 0],
discount_amount: [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]],
@@ -107,13 +107,13 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
form.controls.payload.controls.profit.valueChanges.pipe(takeUntilDestroyed()).subscribe(() => {
// if ((form.controls.discount_amount.value || 0) > (value || 0)) {
form.controls.discount.setValue(0, { emitEvent: false });
form.controls.discount_amount.setValue(0, { emitEvent: false });
// }
});
form.controls.payload.controls.profit_percentage.valueChanges
.pipe(takeUntilDestroyed())
.subscribe(() => {
form.controls.discount.setValue(0, { emitEvent: false });
form.controls.discount_amount.setValue(0, { emitEvent: false });
});
return form;
@@ -127,7 +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,
discount_amount: this.form.value.discount_amount || 0,
payload: {
commission: this.form.controls.payload.controls.commission.value || 0,
karat: this.form.controls.payload.controls.karat.value as TGoldKarat,
@@ -37,9 +37,9 @@ export class CatalogTaxProviderStatusTagComponent {
case 'NOT_SEND':
return 'ارسال نشده';
case 'QUEUED':
return 'در صف ارسال به معتمد';
return 'در صف ارسال';
case 'FISCAL_QUEUED':
return 'در صف ارسال به مالیات';
return 'در انتظار تایید سازمان';
case 'SEND_FAILURE':
return 'خطا در ارسال';
default:
@@ -87,9 +87,6 @@
<app-card-data cardTitle="کالاهای خریداری شده" [editable]="false">
<app-page-data-list
[columns]="columns"
[expandColumns]="expandableColumns"
[expandable]="true"
expandableItemKey="payload"
[items]="invoice.items"
[loading]="loading"
pageTitle=""
@@ -273,6 +273,33 @@ export class SharedSaleInvoiceSingleViewComponent {
return `${item.quantity} ${item.measure_unit_text}`;
},
},
{
field: 'commission',
header: 'کارمزد',
type: 'nested',
nestedOption: {
path: 'payload.commission',
type: 'price',
}
},
{
field: 'wages',
header: 'اجرت',
type: 'nested',
nestedOption: {
path: 'payload.wages',
type: 'price',
}
},
{
field: 'profit',
header: 'سود',
type: 'nested',
nestedOption: {
path: 'payload.profit',
type: 'price',
}
},
{
field: 'discount_amount',
header: 'مبلغ تخفیف',
@@ -288,28 +315,9 @@ export class SharedSaleInvoiceSingleViewComponent {
header: 'مبلغ قابل پرداخت',
type: 'price',
},
];
expandableColumns: IColumn[] = [
{
field: 'commission',
header: 'کارمزد',
type: 'price',
},
{
field: 'wages',
header: 'اجرت',
type: 'price',
},
{
field: 'profit',
header: 'سود',
type: 'price',
},
];
expandedRows: { [key: string]: boolean } = {};
refresh() {
this.onRefresh.emit();
}