Ajouts et modifications de models

This commit is contained in:
Rampeur
2025-08-29 16:04:20 +02:00
parent ed6104ed21
commit 452475b26e
6 changed files with 95 additions and 31 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
import { Profile } from './profile.model';
import { PageLinks, PageMeta } from './shared.model'; import { PageLinks, PageMeta } from './shared.model';
import { Tag } from './tag.model'; import { Profile, Tag } from '.';
export interface Article { export interface Article {
slug: string; slug: string;
+7
View File
@@ -0,0 +1,7 @@
export interface Brand {
id: number;
name: string;
description: string;
createdAt: string;
updatedAt: string;
}
+9
View File
@@ -0,0 +1,9 @@
export interface Category {
id: number;
slug: string;
name: string;
description: string;
parent?: Category;
createdAt: string;
updatedAt: string;
}
+3
View File
@@ -6,8 +6,10 @@ export * from './article-list-config.model';
export * from './application.model'; export * from './application.model';
export * from './application-list.model'; export * from './application-list.model';
export * from './application-list-config.model'; export * from './application-list-config.model';
export * from './brand.model';
export * from './calculator.model'; export * from './calculator.model';
export * from './canopy.model'; export * from './canopy.model';
export * from './category.model';
export * from './chart.model'; export * from './chart.model';
export * from './dropzone.model'; export * from './dropzone.model';
export * from './errors.model'; export * from './errors.model';
@@ -15,6 +17,7 @@ export * from './jump.model';
export * from './jump-list.model'; export * from './jump-list.model';
export * from './jump-list-config.model'; export * from './jump-list-config.model';
export * from './menu.model'; export * from './menu.model';
export * from './packaging.model';
export * from './product.model'; export * from './product.model';
export * from './product-list.model'; export * from './product-list.model';
export * from './product-list-config.model'; export * from './product-list-config.model';
+7
View File
@@ -0,0 +1,7 @@
export interface Packaging {
id: number;
name: string;
description: string;
createdAt: string;
updatedAt: string;
}
+68 -29
View File
@@ -1,28 +1,44 @@
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { ColumnDefinition, PageLinks, PageMeta } from './shared.model'; import { ColumnDefinition, PageLinks, PageMeta } from './shared.model';
import { Brand, Category, Packaging, Profile, Tag } from '.';
export interface Product { export interface Product {
id: number;
slug: string; slug: string;
eancode: string;
name: string; name: string;
numero: number; description: string;
barcode: number; stock: number;
poid?: number; weightGross?: number;
sachets?: string; weightNet?: number;
molecules?: string; priceBuy?: number;
isSelected?: boolean; priceRetail?: number;
priceTaxe?: number;
tags?: Tag[];
brand: Brand;
packaging: Packaging;
owner: Profile;
productCategories: Category[];
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
isSelected?: boolean;
} }
export interface ProductForm { export interface ProductForm {
slug: FormControl<string>; slug: FormControl<string>;
eancode: FormControl<string>;
name: FormControl<string>; name: FormControl<string>;
numero: FormControl<number>; description: FormControl<string>;
barcode: FormControl<number>; stock: FormControl<number>;
poid: FormControl<number>; weightGross: FormControl<number>;
sachets: FormControl<Array<number>>; weightNet: FormControl<number>;
molecules: FormControl<Array<string>>; priceBuy: FormControl<number>;
priceRetail: FormControl<number>;
priceTaxe: FormControl<number>;
tags: FormControl<Array<string>>;
brandId: FormControl<number>;
ownerId: FormControl<string>;
packagingId: FormControl<number>;
} }
export interface ProductPageData { export interface ProductPageData {
@@ -33,6 +49,8 @@ export interface ProductPageData {
export interface ProductsPageData { export interface ProductsPageData {
products: Array<Product>; products: Array<Product>;
count: number;
category?: Category;
_links: PageLinks; _links: PageLinks;
_meta: PageMeta; _meta: PageMeta;
} }
@@ -51,36 +69,57 @@ export const productColumns: Array<ColumnDefinition> = [
required: true required: true
}, },
{ {
key: 'numero', key: 'eancode',
type: 'numeric', type: 'text',
label: 'Numéro',
required: true,
min: 0,
step: 1
},
{
key: 'barcode',
type: 'numeric',
label: 'Code EAN13', label: 'Code EAN13',
required: true
},
{
key: 'stock',
type: 'numeric',
label: 'Stock',
required: true, required: true,
min: 0, min: 0,
step: 1 step: 1
}, },
{ {
key: 'poid', key: 'weightGross',
type: 'numeric', type: 'numeric',
label: 'Poid', label: 'Poid brut',
min: 0, min: 0,
step: 1 step: 1
}, },
{ {
key: 'sachets', key: 'weightNet',
type: 'text', type: 'numeric',
label: 'Sachets' label: 'Poid net',
min: 0,
step: 1
}, },
{ {
key: 'molecules', key: 'priceBuy',
type: 'numeric',
label: 'Prix achat',
min: 0,
step: 1
},
{
key: 'priceRetail',
type: 'numeric',
label: 'Prix vente',
min: 0,
step: 1
},
{
key: 'priceTaxe',
type: 'numeric',
label: 'TVA',
min: 0,
step: 1
},
{
key: 'tags',
type: 'text', type: 'text',
label: 'Molécules' label: 'Tags'
} }
]; ];