feat: add product management features and integrate role selection

- Added PRODUCTS_ROUTES to app routing.
- Removed roles.const.ts and related references to central-auth-roles.
- Updated login component to remove role selection logic.
- Integrated ToastService for success notifications in customer, inventory, product brand, product category, supplier, and user forms.
- Implemented product and category selection fields in product form.
- Created reusable select components for product brands and categories.
- Enhanced user form with password validation and role selection.
- Established roles service for fetching roles from the API.
This commit is contained in:
2025-12-06 11:09:06 +03:30
parent 0419ff2fc7
commit 70f39de9d8
47 changed files with 436 additions and 90 deletions
@@ -1,3 +1,4 @@
import { ToastService } from '@/core/services/toast.service';
import { InputComponent } from '@/shared/components';
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
import { Component, effect, EventEmitter, inject, Input, Output, signal } from '@angular/core';
@@ -27,7 +28,10 @@ export class InventoryFormComponent {
@Output() onSubmit = new EventEmitter<IInventoryResponse>();
private fb = inject(FormBuilder);
constructor(private service: InventoriesService) {
constructor(
private service: InventoriesService,
private toastService: ToastService,
) {
effect(() => {
const v = this.visibleSignal();
if (!v) this.form.reset();
@@ -49,6 +53,10 @@ export class InventoryFormComponent {
this.submitLoading.set(true);
this.service.create(this.form.value as IInventoryRequest).subscribe({
next: (res) => {
this.toastService.success({
text: `انبار ${this.form.value.name} با موفقیت ایجاد شد`,
});
this.close();
this.submitLoading.set(false);
this.form.enable();
this.form.reset();
@@ -22,7 +22,6 @@ export class InventoriesComponent {
{ field: 'name', header: 'نام' },
{ field: 'location', header: 'موقعیت' },
{ field: 'isActive', header: 'فعال' },
{ field: 'actions' },
] as IColumn[];
loading = signal(false);