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,5 +0,0 @@
import rolesConst from '@/core/constants/roles.const';
export const CENTRAL_AUTH_ROLES = [
...Object.values(rolesConst).filter((role) => role.key !== 'ADMIN'),
];
@@ -1,15 +1,4 @@
<form [formGroup]="loginForm" class="w-full flex flex-col gap-4" (ngSubmit)="submit()">
@if (!defaultRole) {
<div class="flex items-center gap-4 justify-center mb-10">
@for (role of centralAuthRoles; track role.key) {
<div class="flex items-center gap-1">
<p-radiobutton [inputId]="role.key" name="role" [value]="role.key" formControlName="role" size="small" />
<uikit-label [name]="role.key" class="cursor-pointer">{{ role.title }}</uikit-label>
</div>
}
</div>
}
<uikit-field name="username" pSize="large" [control]="loginForm.controls.username" label="نام کاربری">
<input
pInputText
@@ -16,7 +16,7 @@ import { Password } from 'primeng/password';
import { ProgressSpinnerModule } from 'primeng/progressspinner';
import { RadioButtonModule } from 'primeng/radiobutton';
import { CaptchaService } from 'src/app/core/services/captcha.service';
import { CENTRAL_AUTH_ROLES } from '../../constants/central-auth-roles.const';
// import { CENTRAL_AUTH_ROLES } from '../../constants/central-auth-roles.const';
@Component({
selector: 'app-login',
@@ -56,14 +56,14 @@ export class LoginComponent {
readonly isCaptchaExpired = this.captchaService.captchaIsExpired;
readonly isCaptchaLoading = this.captchaService.loading;
readonly captchaImageSrc = this.captchaService.captchaImageSrc;
readonly centralAuthRoles = CENTRAL_AUTH_ROLES;
// readonly centralAuthRoles = CENTRAL_AUTH_ROLES;
readonly loginForm = this.fb.group({
username: ['', [Validators.required]],
password: ['', [Validators.required]],
rememberMe: [false],
captcha: ['', [Validators.required]],
role: [this.defaultRole || this.centralAuthRoles[0].key, [Validators.required]],
role: [this.defaultRole, [Validators.required]],
});
selectedRole = signal<TRoles>('SCHOOL');