feat: add new form field components for company details and consumer management
- Implemented CompanyNameComponent, DescriptionComponent, DeviceIdComponent, EconomicCodeComponent, EmailComponent, FirstNameComponent, FiscalCodeComponent, GuildIdComponent, LastNameComponent, LegalNameComponent, LicenseStartsAtComponent, MobileComponent, MobileNumberComponent, ModelComponent, NameComponent, NationalCodeComponent, NationalIdComponent, PartnerTokenComponent, PosTypeComponent, PostalCodeComponent, ProviderIdComponent, QuantityComponent, RegistrationCodeComponent, RegistrationNumberComponent, SerialNumberComponent, SetOffComponent, SkuComponent, TerminalComponent, UnitPriceComponent, UsernameComponent. - Added field control configurations for new fields in the form. - Updated routing and branding configurations for TIS tenant. - Created consumer type models for handling individual and legal consumer data.
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
||||
<p-dialog [(visible)]="visible" header="اطلاعات مشتری" [modal]="true" [style]="{ width: '560px' }">
|
||||
<shared-dialog [(visible)]="visible" header="اطلاعات مشتری" [modal]="true" [style]="{ width: '560px' }">
|
||||
<div class="card p-2! flex justify-center">
|
||||
<p-selectbutton [options]="customerTypes" [(ngModel)]="selectedCustomerType" optionValue="value">
|
||||
<ng-template #item let-item>
|
||||
@@ -13,4 +13,4 @@
|
||||
} @else if (selectedCustomerType() === "LEGAL") {
|
||||
<pos-customer-legal-form (onSubmit)="onSubmitCustomer()" (onClose)="close()" />
|
||||
}
|
||||
</p-dialog>
|
||||
</shared-dialog>
|
||||
|
||||
+2
-2
@@ -2,18 +2,18 @@ import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
|
||||
import { Component, EventEmitter, inject, Output, signal } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { SelectButton } from 'primeng/selectbutton';
|
||||
import { PosLandingStore } from '../../store/main.store';
|
||||
import { CustomerIndividualFormComponent } from './individual/form.component';
|
||||
import { CustomerLegalFormComponent } from './legal/form.component';
|
||||
import { CustomerUnknownFormComponent } from './unknown/form.component';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-order-customer-dialog',
|
||||
templateUrl: './customer-dialog.component.html',
|
||||
imports: [
|
||||
Dialog,
|
||||
SharedDialogComponent,
|
||||
CustomerIndividualFormComponent,
|
||||
FormsModule,
|
||||
CustomerLegalFormComponent,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<p-dialog
|
||||
<shared-dialog
|
||||
[(visible)]="visible"
|
||||
[header]="preparedTitle()"
|
||||
[modal]="true"
|
||||
@@ -17,4 +17,4 @@
|
||||
/>
|
||||
}
|
||||
}
|
||||
</p-dialog>
|
||||
</shared-dialog>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { IGoodResponse } from '@/domains/pos/models/good.io';
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { Component, computed, EventEmitter, inject, Input, Output, signal } from '@angular/core';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { IGoldPayload, IPosOrderItem, IStandardPayload, TPosOrderGoodPayload } from '../models';
|
||||
import { PosLandingStore } from '../store/main.store';
|
||||
import { PosGoldPayloadFormComponent } from './payloads/gold/form.component';
|
||||
import { PosStandardPayloadFormComponent } from './payloads/standard/form.component';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-payload-form-dialog',
|
||||
templateUrl: './payload-form.component.html',
|
||||
imports: [PosGoldPayloadFormComponent, Dialog, PosStandardPayloadFormComponent],
|
||||
imports: [PosGoldPayloadFormComponent, SharedDialogComponent, PosStandardPayloadFormComponent],
|
||||
})
|
||||
export class PayloadFormDialogComponent extends AbstractDialog {
|
||||
@Input({ required: true }) good!: IGoodResponse;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<form [formGroup]="form">
|
||||
<app-input [control]="form.controls.unit_price" name="unit_price" label="قیمت پایه هر گرم" type="price" />
|
||||
<app-input [control]="form.controls.quantity" name="quantity" label="مقدار" type="number" suffix="گرم" />
|
||||
<app-enum-select [control]="form.controls.payload.controls.karat" type="goldKarat" />
|
||||
<app-enum-select [control]="form.controls.payload.controls.karat" type="goldKarat" name="karat" />
|
||||
|
||||
<app-amount-percentage-input
|
||||
[percentageControl]="form.controls.payload.controls.wages_percentage"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<p-dialog
|
||||
<shared-dialog
|
||||
[(visible)]="visible"
|
||||
header="اطلاعات پرداخت"
|
||||
[modal]="true"
|
||||
@@ -45,4 +45,4 @@
|
||||
(onCancel)="close()"
|
||||
/>
|
||||
</form>
|
||||
</p-dialog>
|
||||
</shared-dialog>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { AbstractFormDialog } from '@/shared/abstractClasses';
|
||||
import { InputComponent, KeyValueComponent } from '@/shared/components';
|
||||
@@ -5,10 +6,10 @@ import { FormFooterActionsComponent } from '@/shared/components/formFooterAction
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { catchError, throwError } from 'rxjs';
|
||||
import { IPayment, TOrderPaymentTypes } from '../../models';
|
||||
import { PosLandingStore } from '../../store/main.store';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-payment-form-dialog',
|
||||
@@ -19,11 +20,12 @@ import { PosLandingStore } from '../../store/main.store';
|
||||
FormFooterActionsComponent,
|
||||
KeyValueComponent,
|
||||
ButtonDirective,
|
||||
Dialog,
|
||||
SharedDialogComponent,
|
||||
],
|
||||
})
|
||||
export class PosPaymentFormDialogComponent extends AbstractFormDialog<IPayment, IPayment> {
|
||||
private readonly store = inject(PosLandingStore);
|
||||
private readonly nativeBridge = inject(NativeBridgeService);
|
||||
private readonly toastServices = inject(ToastService);
|
||||
|
||||
readonly totalAmount = computed(() => this.store.orderPricingInfo().totalAmount);
|
||||
@@ -100,6 +102,21 @@ export class PosPaymentFormDialogComponent extends AbstractFormDialog<IPayment,
|
||||
}
|
||||
|
||||
const payment = this.form.value as IPayment;
|
||||
|
||||
if (payment.terminal > 0 && this.nativeBridge.isEnabled()) {
|
||||
const payResult = this.nativeBridge.pay({
|
||||
amount: payment.terminal,
|
||||
totalAmount: this.totalAmount(),
|
||||
invoiceDate: new Date().toISOString(),
|
||||
});
|
||||
|
||||
if (!payResult.success) {
|
||||
return this.toastServices.warn({
|
||||
text: payResult.error || 'پرداخت با دستگاه انجام نشد. لطفا دوباره تلاش کنید.',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.store.setPayment(payment);
|
||||
|
||||
this.store
|
||||
@@ -109,7 +126,13 @@ export class PosPaymentFormDialogComponent extends AbstractFormDialog<IPayment,
|
||||
return throwError(() => err);
|
||||
}),
|
||||
)
|
||||
.subscribe(() => {
|
||||
.subscribe((res) => {
|
||||
if (this.nativeBridge.isEnabled()) {
|
||||
this.nativeBridge.print({
|
||||
invoiceId: res?.id,
|
||||
code: res?.code,
|
||||
});
|
||||
}
|
||||
this.close();
|
||||
this.toastServices.success({
|
||||
text: 'فاکتور شما با موفقیت ایجاد شد',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<p-dialog
|
||||
<shared-dialog
|
||||
[(visible)]="visible"
|
||||
header="پیش فاکتور"
|
||||
[modal]="true"
|
||||
@@ -8,4 +8,4 @@
|
||||
>
|
||||
<form [formGroup]="form"></form>
|
||||
<uikit-datepicker [control]="form.controls.invoiceDate" label="تاریخ فاکتور" />
|
||||
</p-dialog>
|
||||
</shared-dialog>
|
||||
|
||||
@@ -2,13 +2,13 @@ import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { UikitFlatpickrJalaliComponent } from '@/uikit';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { PosLandingStore } from '../store/main.store';
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-pre-invoice-dialog',
|
||||
templateUrl: './pre-invoice-dialog.component.html',
|
||||
imports: [Dialog, UikitFlatpickrJalaliComponent, ReactiveFormsModule],
|
||||
imports: [SharedDialogComponent, UikitFlatpickrJalaliComponent, ReactiveFormsModule],
|
||||
})
|
||||
export class PosPreInvoiceDialogComponent extends AbstractDialog {
|
||||
private readonly store = inject(PosLandingStore);
|
||||
|
||||
+4
-1
@@ -14,5 +14,8 @@ export interface IPosOrderRequest {
|
||||
customer?: ICustomer;
|
||||
}
|
||||
|
||||
export interface IPosOrderRawResponse {}
|
||||
export interface IPosOrderRawResponse {
|
||||
id?: string;
|
||||
code?: string;
|
||||
}
|
||||
export interface IPosOrderResponse extends IPosOrderRawResponse {}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { IGoodCategoryResponse, IGoodResponse } from '@/domains/pos/models/good.
|
||||
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
|
||||
import { createUUID, JALALI_DATE_FORMATS, nowJalali, parseJalali } from '@/utils';
|
||||
import { computed, inject, Injectable, signal } from '@angular/core';
|
||||
import { catchError, finalize, map, Observable } from 'rxjs';
|
||||
import { catchError, finalize, map, throwError } from 'rxjs';
|
||||
import { ICustomer, IPayment, IPosOrderRequest, IPosOrderResponse } from '../models';
|
||||
import { IPosInOrderGood, IPosOrderItem } from '../models/types';
|
||||
import { PosService } from '../services/main.service';
|
||||
@@ -228,9 +228,7 @@ export class PosLandingStore {
|
||||
finalize(() => {
|
||||
this.setState({ submitOrderLoading: false });
|
||||
}),
|
||||
catchError(() => {
|
||||
return new Observable((observer) => observer.error());
|
||||
}),
|
||||
catchError((error) => throwError(() => error)),
|
||||
|
||||
map((_res) => {
|
||||
if (_res) {
|
||||
|
||||
Reference in New Issue
Block a user