Skip to content

Commit f78d13e

Browse files
committed
Update login mobile
1 parent f2d4243 commit f78d13e

File tree

27 files changed

+510
-152
lines changed

27 files changed

+510
-152
lines changed

frontend/ultima-ng-19.0.0/src/app/interface/CreateStockDto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export interface CreateStockDto {
77
delegationId?: number;
88
categorieId?: number;
99
observations?: string;
10+
qte?: number;
1011
}

frontend/ultima-ng-19.0.0/src/app/interface/StockResponseDto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export interface StockResponseDto {
2020
dateTraitement?: Date | string;
2121
username?: string;
2222
userFullName?: string;
23+
qte?: number;
2324
}

frontend/ultima-ng-19.0.0/src/app/interface/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ export interface IUser {
2525
agenceId?: number;
2626
delegationId?: number;
2727
pointventeId?: number;
28+
service?: string;
2829
}

frontend/ultima-ng-19.0.0/src/app/pages/auth/credit/demande-ind/demande-ind.component.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,6 @@ <h2 class="mb-0">
246246
required [disabled]="state().submitting" styleClass="w-full">
247247
</p-inputNumber>
248248
</div>
249-
<div class="col-12">
250-
<p-divider align="left">
251-
<div class="px-2">Nature du Client</div>
252-
</p-divider>
253-
</div>
254-
<div class="col-12">
255-
<p-divider align="left">
256-
<div class="px-2">Nature du Client</div>
257-
</p-divider>
258-
</div>
259-
260-
261249

262250
<!-- Row 5: Localisation administrative -->
263251
<div class="col-12">

frontend/ultima-ng-19.0.0/src/app/pages/dashboard/admin/create-user/create-user.component.html

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<form #userForm="ngForm" (ngSubmit)="createAccout(userForm)">
1616
<div class="grid grid-cols-12 gap-4">
1717
<!-- Role Selection -->
18-
<div class="mb-6 col-span-12">
18+
<div class="mb-6 col-span-12 md:col-span-6">
1919
<label for="role" class="font-medium text-surface-900 dark:text-surface-0 mb-2 block">
2020
Roles *
2121
</label>
@@ -42,6 +42,29 @@
4242
}
4343
</div>
4444

45+
<!-- Service Selection -->
46+
<div class="mb-6 col-span-12 md:col-span-6">
47+
<label for="service" class="font-medium text-surface-900 dark:text-surface-0 mb-2 block">
48+
Service
49+
</label>
50+
<p-dropdown [(ngModel)]="selectedService" name="service" [options]="services"
51+
optionLabel="label" [filter]="true" filterBy="label" [showClear]="true"
52+
placeholder="Sélectionner un service" [disabled]="state().submitting" styleClass="w-full"
53+
dataKey="value" appendTo="body" (onChange)="onServiceChange($event.value)">
54+
<ng-template pTemplate="selectedItem" let-service>
55+
<div class="flex items-center">
56+
<span>{{ service?.label }}</span>
57+
</div>
58+
</ng-template>
59+
<ng-template pTemplate="item" let-service>
60+
<div class="flex items-center">
61+
<span>{{ service.label }}</span>
62+
<span class="ml-2 text-xs text-gray-500">({{ service.value }})</span>
63+
</div>
64+
</ng-template>
65+
</p-dropdown>
66+
</div>
67+
4568
<!-- Conditional Location Fields -->
4669
@if(state().selectedRole && shouldShowLocationFields(state().selectedRole?.name!)) {
4770
<!-- Delegation Field -->
@@ -260,7 +283,7 @@
260283
[disabled]="userForm && userForm.invalid || state().submitting || !canSubmitForm()"
261284
class="w-auto mt-3"></button>
262285
<button pButton pRipple type="button" label="Annuler" icon="pi pi-times"
263-
(click)="userForm.resetForm()" [disabled]="state().submitting"
286+
(click)="userForm.resetForm(); selectedService = null" [disabled]="state().submitting"
264287
class="p-button-secondary w-auto mt-3"></button>
265288
</div>
266289

@@ -275,6 +298,7 @@
275298
@if(state().selectedRole) {
276299
<div class="mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs">
277300
<p><strong>Role sélectionné:</strong> {{ state().selectedRole?.name }}</p>
301+
<p><strong>Service:</strong> {{ state().selectedServiceValue || 'Non sélectionné' }}</p>
278302
<p><strong>Délégation ID:</strong> {{ state().selectedDelegationId || 'Non sélectionné' }}
279303
</p>
280304
<p><strong>Agence ID:</strong> {{ state().selectedAgenceId || 'Non sélectionné' }}</p>

frontend/ultima-ng-19.0.0/src/app/pages/dashboard/admin/create-user/create-user.component.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import { RippleModule } from 'primeng/ripple';
2323
import { TextareaModule } from 'primeng/textarea';
2424
import { debounceTime, distinctUntilChanged, Subject } from 'rxjs';
2525

26+
// Service interface
27+
interface Service {
28+
label: string;
29+
value: string;
30+
}
31+
2632
@Component({
2733
selector: 'app-create-user',
2834
imports: [CommonModule, InputText, TextareaModule, FileUploadModule, FormsModule, ButtonModule, InputGroupModule, RippleModule, MessageModule, ProgressSpinnerModule, PasswordModule, DropdownModule],
@@ -33,6 +39,22 @@ export class CreateUserComponent {
3339
selectedDelegation: Delegation | null = null;
3440
selectedAgence: Agence | null = null;
3541
selectedPointVente: PointVente | null = null;
42+
selectedService: Service | null = null;
43+
44+
// Service options
45+
services: Service[] = [
46+
{ label: 'Direction Système Information', value: 'DSIG' },
47+
{ label: 'Direction Exploitation', value: 'DE' },
48+
{ label: 'Direction Inspection', value: 'DI' },
49+
{ label: 'Direction Financière', value: 'DF' },
50+
{ label: 'Direction Commerciale', value: 'DC' },
51+
{ label: 'Direction Resource Humaine', value: 'DRH' },
52+
{ label: 'Logistique', value: 'Logistique' },
53+
{ label: 'Contrôle', value: 'Contrôle' },
54+
{ label: 'Audit', value: 'Audit' },
55+
{ label: 'Partenariat', value: 'Partenariat' }
56+
];
57+
3658
state = signal<{
3759
roles?: IRole[];
3860
delegations?: Delegation[];
@@ -42,6 +64,7 @@ export class CreateUserComponent {
4264
selectedDelegationId?: number;
4365
selectedAgenceId?: number;
4466
selectedPointVenteId?: number;
67+
selectedServiceValue?: string;
4568
usuario?: SG_USUARIOS;
4669
usernameValidation?: {
4770
isValid: boolean;
@@ -65,6 +88,7 @@ export class CreateUserComponent {
6588
loadingPointVentes: false,
6689
message: undefined,
6790
error: undefined,
91+
selectedServiceValue: undefined,
6892
usernameValidation: {
6993
isValid: false,
7094
isActive: false,
@@ -135,6 +159,14 @@ export class CreateUserComponent {
135159
});
136160
}
137161

162+
// Handle service selection
163+
onServiceChange(service: Service): void {
164+
this.state.update((state) => ({
165+
...state,
166+
selectedServiceValue: service?.value
167+
}));
168+
}
169+
138170
// Handle role selection change
139171
onRoleChange(selectedRole: IRole): void {
140172
this.state.update((state) => ({
@@ -320,15 +352,14 @@ export class CreateUserComponent {
320352
shouldShowAgenceField(roleName: string): boolean {
321353
// DR only needs delegation, not agence
322354
// AGENT_CREDIT, CAISSE, AGENT_CORRECTEUR, DA and RA need agence
323-
return roleName === 'AGENT_CREDIT' || roleName === 'CAISSE' || roleName === 'AGENT_CORRECTEUR' || roleName === 'DA' || roleName === 'RA'; // ✅ AJOUTÉ
355+
return roleName === 'AGENT_CREDIT' || roleName === 'CAISSE' || roleName === 'AGENT_CORRECTEUR' || roleName === 'DA' || roleName === 'RA';
324356
}
325357

326358
// Check if role requires point vente field
327359
shouldShowPointVenteField(roleName: string): boolean {
328360
// AGENT_CREDIT, CAISSE and AGENT_CORRECTEUR need point de vente
329361
// DA and RA do NOT need point de vente
330362
return roleName === 'AGENT_CREDIT' || roleName === 'CAISSE' || roleName === 'AGENT_CORRECTEUR';
331-
// RA n'est PAS ajouté ici (comme DA)
332363
}
333364

334365
// Load delegations
@@ -556,12 +587,14 @@ export class CreateUserComponent {
556587
const delegationId = this.state().selectedDelegationId || this.selectedDelegation?.id || null;
557588
const agenceId = this.state().selectedAgenceId || this.selectedAgence?.id || null;
558589
const pointventeId = this.state().selectedPointVenteId || this.selectedPointVente?.id || null;
590+
const serviceValue = this.state().selectedServiceValue || this.selectedService?.value || null;
559591

560592
// Log the IDs for debugging
561593
console.log('Creating user with location IDs:', {
562594
delegationId,
563595
agenceId,
564596
pointventeId,
597+
service: serviceValue,
565598
role: selectedRole.name
566599
});
567600

@@ -611,6 +644,7 @@ export class CreateUserComponent {
611644
phone: form.value.phone,
612645
password: form.value.password,
613646
bio: form.value.bio,
647+
service: serviceValue,
614648
roleName: selectedRole.name,
615649
roleId: selectedRole.role_id,
616650
// Add location-based IDs
@@ -638,6 +672,7 @@ export class CreateUserComponent {
638672
this.selectedDelegation = null;
639673
this.selectedAgence = null;
640674
this.selectedPointVente = null;
675+
this.selectedService = null;
641676
this.router.navigate(['/dashboards']);
642677
},
643678
error: (error) => {

frontend/ultima-ng-19.0.0/src/app/pages/dashboard/agent-credit/list-stock/list-stock.component.html

Lines changed: 48 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,18 @@
5959
<td colspan="8">
6060
<div class="detail-container">
6161
<div class="grid">
62-
<div class="col-12 lg:col-6">
62+
63+
64+
<!-- Section Informations Complètes de la Commande -->
65+
<div class="col-12">
6366
<div class="detail-card">
6467
<div class="detail-header">
6568
<i class="pi pi-info-circle"></i>
66-
<span>Informations Générales</span>
69+
<span>Informations Complètes de la Commande</span>
6770
</div>
6871
<table class="detail-table">
6972
<tbody>
70-
<tr>
71-
<td class="label-cell">
72-
<i class="pi pi-hashtag mini-icon"></i>
73-
ID Commande
74-
</td>
75-
<td class="value-cell">{{ stock.idCmd }}</td>
76-
</tr>
73+
7774
<tr>
7875
<td class="label-cell">
7976
<i class="pi pi-user mini-icon"></i>
@@ -82,35 +79,7 @@
8279
<td class="value-cell">{{ stock.userFullName || stock.username
8380
}}</td>
8481
</tr>
85-
<tr *ngIf="stock.dateTraitement">
86-
<td class="label-cell">
87-
<i class="pi pi-calendar mini-icon"></i>
88-
Date de traitement
89-
</td>
90-
<td class="value-cell">{{ formatDate(stock.dateTraitement) }}
91-
</td>
92-
</tr>
93-
<tr *ngIf="stock.traitePar">
94-
<td class="label-cell">
95-
<i class="pi pi-user-edit mini-icon"></i>
96-
Traité par
97-
</td>
98-
<td class="value-cell">ID: {{ stock.traitePar }}</td>
99-
</tr>
100-
</tbody>
101-
</table>
102-
</div>
103-
</div>
10482

105-
<!-- Section Organisation -->
106-
<div class="col-12 lg:col-6">
107-
<div class="detail-card">
108-
<div class="detail-header">
109-
<i class="pi pi-building"></i>
110-
<span>Organisation</span>
111-
</div>
112-
<table class="detail-table">
113-
<tbody>
11483
<tr>
11584
<td class="label-cell">
11685
<i class="pi pi-map-marker mini-icon"></i>
@@ -132,37 +101,52 @@
132101
</td>
133102
<td class="value-cell">{{ stock.pointventeLibele || '-' }}</td>
134103
</tr>
104+
<tr>
105+
<td class="label-cell">
106+
<i class="pi pi-file-text mini-icon"></i>
107+
Description
108+
</td>
109+
<td class="value-cell">
110+
<div
111+
*ngIf="parseDetails(stock.detailBonCommande) as details">
112+
<p *ngIf="details.detailStandard">
113+
{{ details.detailStandard }}
114+
</p>
115+
<div *ngIf="!details.detailStandard">
116+
<div *ngFor="let key of Object.keys(details)"
117+
class="mb-1">
118+
<strong>{{ key }}:</strong> {{ details[key] }}
119+
</div>
120+
</div>
121+
</div>
122+
</td>
123+
</tr>
124+
<tr>
125+
<td class="label-cell">
126+
<i class="pi pi-sort-numeric-up mini-icon"></i>
127+
Quantité commandée
128+
</td>
129+
<td class="value-cell">{{ stock.qte || 0 }}</td>
130+
</tr>
131+
<tr *ngIf="stock.dateTraitement">
132+
<td class="label-cell">
133+
<i class="pi pi-calendar mini-icon"></i>
134+
Date de traitement
135+
</td>
136+
<td class="value-cell">{{ formatDate(stock.dateTraitement) }}
137+
</td>
138+
</tr>
139+
<tr *ngIf="stock.traitePar">
140+
<td class="label-cell">
141+
<i class="pi pi-user-edit mini-icon"></i>
142+
Traité par
143+
</td>
144+
<td class="value-cell">ID: {{ stock.traitePar }}</td>
145+
</tr>
135146
</tbody>
136147
</table>
137148
</div>
138149
</div>
139-
140-
<!-- Section Description -->
141-
<div class="col-12">
142-
<div class="detail-card">
143-
<div class="detail-header">
144-
<i class="pi pi-file-text"></i>
145-
<span>Description</span>
146-
</div>
147-
<div class="description-content">
148-
<div *ngIf="parseDetails(stock.detailBonCommande) as details">
149-
<div class="description-box">
150-
<p *ngIf="details.detailStandard" class="description-text">
151-
{{ details.detailStandard }}
152-
</p>
153-
<div *ngIf="!details.detailStandard" class="description-items">
154-
<div *ngFor="let key of Object.keys(details)"
155-
class="description-item">
156-
<span class="item-key">{{ key }}:</span>
157-
<span class="item-value">{{ details[key] }}</span>
158-
</div>
159-
</div>
160-
</div>
161-
</div>
162-
</div>
163-
</div>
164-
</div>
165-
166150
<!-- Section Observations et Motifs -->
167151
<div class="col-12" *ngIf="stock.observations || stock.motif">
168152
<div class="detail-card">

0 commit comments

Comments
 (0)