feat: add stock keeping units list component and related services
feat: implement checkbox component with label and hint support feat: create sale invoice full response model for invoice details feat: add single view component for displaying sale invoice details feat: define various list configurations for account, business activity, and consumer management feat: establish list configurations for managing devices, goods, and licenses feat: create list configurations for managing partners and their accounts feat: implement user management list configuration
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<form [formGroup]="form" (submit)="submit()">
|
||||
<app-checkbox [control]="form.controls.business_name" name="business_name" label="نمایش عنوان کسبوکار" />
|
||||
<app-checkbox [control]="form.controls.complex_name" name="complex_name" label="نمایش عنوان شعبه" />
|
||||
<app-checkbox [control]="form.controls.pos_name" name="pos_name" label="نمایش عنوان پایانه فروش" />
|
||||
<app-checkbox [control]="form.controls.invoice_template" name="invoice_template" label="نمایش الگوی صورتحساب" />
|
||||
<app-checkbox [control]="form.controls.fiscal_id" name="fiscal_id" label="نمایش شماره منحصر به فرد مالیاتی" />
|
||||
<app-checkbox [control]="form.controls.economic_code" name="economic_code" label="نمایش شماره اقتصادی" />
|
||||
<app-checkbox [control]="form.controls.customer_name" name="customer_name" label="نمایش عنوان خریدار" />
|
||||
<app-checkbox [control]="form.controls.customer_mobile" name="customer_mobile" label="نمایش شماره موبایل خریدار" />
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_national_id"
|
||||
name="customer_national_id"
|
||||
label="نمایش کد ملی خریدار"
|
||||
/>
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_postal_code"
|
||||
name="customer_postal_code"
|
||||
label="نمایش کد پستی خریدار"
|
||||
/>
|
||||
<app-checkbox
|
||||
[control]="form.controls.customer_economic_code"
|
||||
name="customer_economic_code"
|
||||
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 (onSubmit)="submit()" (onCancel)="close()" />
|
||||
</form>
|
||||
@@ -0,0 +1,47 @@
|
||||
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 } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { IPosConfigPrintRequestPayload, IPosConfigPrintResponse } from './models';
|
||||
import { PosConfigPrintService } from './services/main.service';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-config-print-form',
|
||||
templateUrl: 'form.component.html',
|
||||
imports: [ReactiveFormsModule, AppCheckboxComponent, FormFooterActionsComponent],
|
||||
})
|
||||
export class PosConfigPrintFormComponent extends AbstractForm<
|
||||
IPosConfigPrintRequestPayload,
|
||||
IPosConfigPrintResponse
|
||||
> {
|
||||
private readonly service = inject(PosConfigPrintService);
|
||||
|
||||
initForm = () => {
|
||||
const form = this.fb.group({
|
||||
business_name: [true, []],
|
||||
complex_name: [false],
|
||||
pos_name: [false],
|
||||
invoice_template: [false],
|
||||
fiscal_id: [false],
|
||||
economic_code: [false],
|
||||
customer_name: [false],
|
||||
customer_mobile: [false],
|
||||
customer_national_id: [false],
|
||||
customer_postal_code: [false],
|
||||
customer_economic_code: [false],
|
||||
payment_type: [false],
|
||||
show_payment_info: [false],
|
||||
show_items: [false],
|
||||
});
|
||||
|
||||
return form;
|
||||
};
|
||||
|
||||
form = this.initForm();
|
||||
|
||||
submitForm() {
|
||||
const formValue = this.form.value as IPosConfigPrintRequestPayload;
|
||||
return this.service.submit(formValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
export interface IPosConfigPrintResponse extends Partial<IPosConfigPrintRequestPayload> {}
|
||||
|
||||
export interface IPosConfigPrintRequestPayload {
|
||||
business_name: boolean;
|
||||
complex_name: boolean;
|
||||
pos_name: boolean;
|
||||
invoice_template: boolean;
|
||||
fiscal_id: boolean;
|
||||
economic_code: boolean;
|
||||
customer_name: boolean;
|
||||
customer_mobile: boolean;
|
||||
customer_national_id: boolean;
|
||||
customer_postal_code: boolean;
|
||||
customer_economic_code: boolean;
|
||||
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;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { LOCAL_STORAGE_KEYS } from 'src/assets/constants';
|
||||
import { IPosConfigPrintRequestPayload, IPosConfigPrintResponse } from '../models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
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 defaultData = {
|
||||
business_name: true,
|
||||
complex_name: true,
|
||||
pos_name: true,
|
||||
invoice_template: true,
|
||||
fiscal_id: true,
|
||||
economic_code: true,
|
||||
customer_name: true,
|
||||
customer_mobile: true,
|
||||
customer_national_id: true,
|
||||
customer_postal_code: true,
|
||||
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,
|
||||
},
|
||||
};
|
||||
this.submit(defaultData);
|
||||
return defaultData;
|
||||
}
|
||||
|
||||
submit(data: IPosConfigPrintRequestPayload) {
|
||||
window.localStorage.setItem(LOCAL_STORAGE_KEYS.POS_CONFIG_PRINT, JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './routes/index';
|
||||
@@ -0,0 +1,19 @@
|
||||
import { NamedRoutes } from '@/core';
|
||||
import { Routes } from '@angular/router';
|
||||
import config from 'src/config';
|
||||
|
||||
export type TPosConfigRouteNames = 'config';
|
||||
const baseRoute = `${config.isPosApplication ? '' : '/pos'}/config`;
|
||||
|
||||
export const posConfigNamedRoutes: NamedRoutes<TPosConfigRouteNames> = {
|
||||
config: {
|
||||
path: 'config',
|
||||
loadComponent: () => import('../../views/root.component').then((m) => m.PosConfigPageComponent),
|
||||
meta: {
|
||||
title: 'تنظیمات',
|
||||
pagePath: () => baseRoute,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const POS_CONFIG_ROUTES: Routes = [posConfigNamedRoutes.config];
|
||||
@@ -0,0 +1 @@
|
||||
export * from './root.component';
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="w-full h-full flex items-center justify-center p-4">
|
||||
<app-card-data cardTitle="تنظیمات فاکتور" class="w-full">
|
||||
<p-message variant="text" severity="info" icon="pi pi-info-circle">
|
||||
هریک از موارد زیر را که میخواهید در چاپ فاکتور نمایش داده شوند را انتخاب کنید
|
||||
</p-message>
|
||||
<pos-config-print-form class="block w-full mt-6" (onClose)="returnToMainPage()" (onSubmit)="returnToMainPage()" />
|
||||
</app-card-data>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
import { AppCardComponent } from '@/shared/components';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Message } from 'primeng/message';
|
||||
import { PosConfigPrintFormComponent } from '../components/print/form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-config-page',
|
||||
templateUrl: './root.component.html',
|
||||
imports: [PosConfigPrintFormComponent, AppCardComponent, Message],
|
||||
})
|
||||
export class PosConfigPageComponent {
|
||||
private readonly router = inject(Router);
|
||||
returnToMainPage() {
|
||||
this.router.navigateByUrl('/');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user