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:
2026-04-27 21:53:11 +03:30
parent c085104976
commit 822bf96966
235 changed files with 4007 additions and 1260 deletions
+1
View File
@@ -3,3 +3,4 @@ export { AuthService } from './auth.service';
export { ErrorHandlerService } from './error-handler.service';
export { ConfigService } from './config.service';
export * from './breadcrumb.service';
export * from './native-bridge.service';
@@ -0,0 +1,88 @@
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
interface INativeBridgeHost {
pay?: (payload: string) => unknown;
print?: (payload: string) => unknown;
}
export interface INativePayRequest {
amount: number;
totalAmount: number;
invoiceDate: string;
}
export interface INativePrintRequest {
invoiceId?: string;
code?: string;
}
export interface INativeBridgeResult<T = unknown> {
success: boolean;
data?: T;
error?: string;
}
@Injectable({ providedIn: 'root' })
export class NativeBridgeService {
private get host(): INativeBridgeHost | undefined {
const globalWindow = window as unknown as {
AndroidBridge?: INativeBridgeHost;
Android?: INativeBridgeHost;
};
return globalWindow.AndroidBridge || globalWindow.Android;
}
isEnabled(): boolean {
return !!environment.enableNativeBridge;
}
canPay(): boolean {
return this.isEnabled() && typeof this.host?.pay === 'function';
}
canPrint(): boolean {
return this.isEnabled() && typeof this.host?.print === 'function';
}
pay(request: INativePayRequest): INativeBridgeResult {
return this.invoke('pay', request);
}
print(request: INativePrintRequest): INativeBridgeResult {
return this.invoke('print', request);
}
private invoke(method: 'pay' | 'print', payload: object): INativeBridgeResult {
if (!this.isEnabled()) {
return { success: false, error: 'Native bridge is disabled for this tenant.' };
}
const fn = this.host?.[method];
if (typeof fn !== 'function') {
return { success: false, error: `Native method "${method}" is not available.` };
}
try {
const raw = fn(JSON.stringify(payload));
const parsed = this.tryParse(raw);
if (parsed && typeof parsed === 'object' && 'success' in parsed) {
return parsed as INativeBridgeResult;
}
return { success: true, data: parsed ?? raw };
} catch (error) {
return { success: false, error: (error as Error).message };
}
}
private tryParse(value: unknown): unknown {
if (typeof value !== 'string') return value;
try {
return JSON.parse(value);
} catch {
return value;
}
}
}