feat: enhance inner pages header with back button functionality and emit event on back click
fix: update total price info handling in correction form and ensure accurate calculations refactor: streamline sale invoice single view component by extracting info card into a separate component style: adjust button sizes in payment forms for better UI consistency feat: implement season picker navigation controls to prevent out-of-bounds selection fix: improve price formatting utility to handle undefined values gracefully chore: update environment configuration for API base URL feat: add navigation service to manage routing history and back navigation
This commit is contained in:
@@ -11,22 +11,17 @@
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_national_id"
|
||||
name="customer_national_id"
|
||||
label="نمایش کد ملی خریدار"
|
||||
/>
|
||||
label="نمایش کد ملی خریدار" />
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_postal_code"
|
||||
name="customer_postal_code"
|
||||
label="نمایش کد پستی خریدار"
|
||||
/>
|
||||
label="نمایش کد پستی خریدار" />
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_economic_code"
|
||||
name="customer_economic_code"
|
||||
label="نمایش شناسهملی / اقتصادی خریدار"
|
||||
/>
|
||||
label="نمایش شناسهملی / اقتصادی خریدار" />
|
||||
<app-checkbox [control]="form.controls.payment_type" name="payment_type" label="نمایش نوع پرداخت" />
|
||||
<app-checkbox [control]="form.controls.show_payment_info" name="show_payment_info" label="نمایش جزییات پرداخت" />
|
||||
<app-checkbox [control]="form.controls.show_items" name="show_items" label="نمایش کالاهای خریداری شده" />
|
||||
|
||||
<app-form-footer-actions (onCancel)="close()" />
|
||||
</form>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { AbstractForm } from '@/shared/abstractClasses';
|
||||
import { AppCheckboxComponent } from '@/shared/components/checkbox/checkbox.component';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { IPosConfigPrintRequestPayload, IPosConfigPrintResponse } from './models';
|
||||
@@ -9,7 +8,7 @@ import { PosConfigPrintService } from './services/main.service';
|
||||
@Component({
|
||||
selector: 'pos-config-print-form',
|
||||
templateUrl: 'form.component.html',
|
||||
imports: [ReactiveFormsModule, AppCheckboxComponent, FormFooterActionsComponent],
|
||||
imports: [ReactiveFormsModule, AppCheckboxComponent],
|
||||
})
|
||||
export class PosConfigPrintFormComponent extends AbstractForm<
|
||||
IPosConfigPrintRequestPayload,
|
||||
@@ -37,6 +36,10 @@ export class PosConfigPrintFormComponent extends AbstractForm<
|
||||
show_items: [false],
|
||||
});
|
||||
|
||||
form.valueChanges.subscribe(() => {
|
||||
this.submitForm();
|
||||
});
|
||||
|
||||
return form;
|
||||
};
|
||||
|
||||
@@ -52,7 +55,7 @@ export class PosConfigPrintFormComponent extends AbstractForm<
|
||||
|
||||
override submitForm() {
|
||||
const formValue = this.form.value as IPosConfigPrintRequestPayload;
|
||||
this.toastService.success({ text: 'تغییرات با موفقیت اعمال شد.' });
|
||||
// this.toastService.success({ text: 'تغییرات با موفقیت اعمال شد.' });
|
||||
return this.service.submit(formValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,17 +15,15 @@ export interface IPosConfigPrintRequestPayload {
|
||||
payment_type: boolean;
|
||||
show_payment_info: boolean;
|
||||
show_items: boolean;
|
||||
items: {
|
||||
name: boolean;
|
||||
sku: boolean;
|
||||
quantity: boolean;
|
||||
base_amount: boolean;
|
||||
tax: boolean;
|
||||
discount: boolean;
|
||||
karat: boolean;
|
||||
profit: boolean;
|
||||
commission: boolean;
|
||||
wage: boolean;
|
||||
total_amount: boolean;
|
||||
};
|
||||
item_name: boolean;
|
||||
item_sku: boolean;
|
||||
item_quantity: boolean;
|
||||
item_base_amount: boolean;
|
||||
item_tax: boolean;
|
||||
item_discount: boolean;
|
||||
item_karat: boolean;
|
||||
item_profit: boolean;
|
||||
item_commission: boolean;
|
||||
item_wage: boolean;
|
||||
item_total_amount: boolean;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,12 @@ export class PosConfigPrintService {
|
||||
get(): IPosConfigPrintResponse {
|
||||
const data = window.localStorage.getItem(LOCAL_STORAGE_KEYS.POS_CONFIG_PRINT);
|
||||
if (data) {
|
||||
return JSON.parse(data) as IPosConfigPrintResponse;
|
||||
const dataObject = JSON.parse(data) as Record<keyof IPosConfigPrintResponse, string>;
|
||||
return Object.keys(dataObject).reduce((prev, curr) => {
|
||||
const key = curr as keyof IPosConfigPrintResponse;
|
||||
prev[key] = dataObject[key] === 'true';
|
||||
return prev;
|
||||
}, {} as IPosConfigPrintResponse);
|
||||
}
|
||||
const defaultData = {
|
||||
business_name: true,
|
||||
@@ -23,25 +28,37 @@ export class PosConfigPrintService {
|
||||
customer_economic_code: true,
|
||||
payment_type: true,
|
||||
show_payment_info: true,
|
||||
show_items: false,
|
||||
items: {
|
||||
name: false,
|
||||
sku: false,
|
||||
quantity: false,
|
||||
base_amount: false,
|
||||
tax: false,
|
||||
discount: false,
|
||||
karat: false,
|
||||
profit: false,
|
||||
commission: false,
|
||||
wage: false,
|
||||
total_amount: false,
|
||||
},
|
||||
show_items: true,
|
||||
|
||||
item_name: false,
|
||||
item_sku: false,
|
||||
item_quantity: false,
|
||||
item_base_amount: false,
|
||||
item_tax: false,
|
||||
item_discount: false,
|
||||
item_karat: false,
|
||||
item_profit: false,
|
||||
item_commission: false,
|
||||
item_wage: false,
|
||||
item_total_amount: false,
|
||||
};
|
||||
this.submit(defaultData);
|
||||
return defaultData;
|
||||
}
|
||||
|
||||
getVisibleItems() {
|
||||
const items = this.get();
|
||||
return Object.keys(items).reduce((result, key) => {
|
||||
const itemKey = key as keyof IPosConfigPrintRequestPayload;
|
||||
|
||||
if (items[itemKey]) {
|
||||
result[itemKey] = items[itemKey];
|
||||
}
|
||||
|
||||
return result;
|
||||
}, {} as Partial<IPosConfigPrintRequestPayload>);
|
||||
}
|
||||
|
||||
submit(data: IPosConfigPrintRequestPayload) {
|
||||
window.localStorage.setItem(LOCAL_STORAGE_KEYS.POS_CONFIG_PRINT, JSON.stringify(data));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user