refactor: reorganize component files and update import paths; add PsItem and PsProduct interfaces

This commit is contained in:
Vincent Guillet
2025-11-12 12:34:58 +01:00
parent f063a245b9
commit bcc71b965b
92 changed files with 1694 additions and 2815 deletions

View File

@@ -0,0 +1,78 @@
<h2 mat-dialog-title>{{ mode === 'create' ? 'Nouveau produit' : 'Modifier le produit' }}</h2>
<div mat-dialog-content class="grid" [formGroup]="form">
<mat-form-field class="col-6">
<mat-label>Nom du produit</mat-label>
<input matInput formControlName="name" autocomplete="off">
</mat-form-field>
<mat-form-field class="col-6">
<mat-label>Catégorie</mat-label>
<mat-select formControlName="categoryId">
<mat-option [value]="null" disabled>Choisir…</mat-option>
@for (c of categories; track c.id) {
<mat-option [value]="c.id">{{ c.name }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field class="col-6">
<mat-label>Marque</mat-label>
<mat-select formControlName="manufacturerId">
<mat-option [value]="null" disabled>Choisir…</mat-option>
@for (m of manufacturers; track m.id) {
<mat-option [value]="m.id">{{ m.name }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field class="col-6">
<mat-label>Fournisseur</mat-label>
<mat-select formControlName="supplierId">
<mat-option [value]="null" disabled>Choisir…</mat-option>
@for (s of suppliers; track s.id) {
<mat-option [value]="s.id">{{ s.name }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field class="col-12">
<mat-label>Description</mat-label>
<textarea matInput rows="4" formControlName="description"></textarea>
</mat-form-field>
<div class="col-12 flags">
<mat-checkbox formControlName="complete">Complet</mat-checkbox>
<mat-checkbox formControlName="hasManual">Notice</mat-checkbox>
</div>
<div class="col-12">
<label for="fileInput">Images du produit</label>
<input type="file" multiple (change)="onFiles($event)">
</div>
<div class="col-12" *ngIf="mode==='edit' && existingImageUrls.length">
<div class="thumbs">
@for (url of existingImageUrls; track url) {
<img [src]="url" alt="Produit">
}
</div>
</div>
<mat-form-field class="col-4">
<mat-label>Prix TTC (€)</mat-label>
<input matInput type="number" step="0.01" min="0" formControlName="priceTtc">
</mat-form-field>
<mat-form-field class="col-4">
<mat-label>Quantité</mat-label>
<input matInput type="number" step="1" min="0" formControlName="quantity">
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button (click)="close()">Annuler</button>
<button mat-raised-button color="primary" (click)="save()" [disabled]="form.invalid">
{{ mode === 'create' ? 'Créer' : 'Enregistrer' }}
</button>
</div>