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:
@@ -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 SupplierFormComponent {
|
||||
@Output() onSubmit = new EventEmitter<ISupplierResponse>();
|
||||
|
||||
private fb = inject(FormBuilder);
|
||||
constructor(private service: SuppliersService) {
|
||||
constructor(
|
||||
private service: SuppliersService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
effect(() => {
|
||||
const v = this.visibleSignal();
|
||||
if (!v) this.form.reset();
|
||||
@@ -55,6 +59,10 @@ export class SupplierFormComponent {
|
||||
this.submitLoading.set(true);
|
||||
this.service.create(this.form.value as ISupplierRequest).subscribe({
|
||||
next: (res) => {
|
||||
this.toastService.success({
|
||||
text: `تأمینکننده ${this.form.value.firstName} ${this.form.value.lastName} با موفقیت ایجاد شد`,
|
||||
});
|
||||
this.close();
|
||||
this.submitLoading.set(false);
|
||||
this.form.enable();
|
||||
this.form.reset();
|
||||
|
||||
@@ -30,7 +30,6 @@ export class SuppliersComponent {
|
||||
{ field: 'isActive', header: 'فعال' },
|
||||
{ field: 'createdAt', header: 'تاریخ ایجاد' },
|
||||
{ field: 'updatedAt', header: 'تاریخ بهروزرسانی' },
|
||||
{ field: 'actions' },
|
||||
] as IColumn[];
|
||||
|
||||
loading = signal(false);
|
||||
|
||||
Reference in New Issue
Block a user