Skip to content

Commit 756b09f

Browse files
committed
Refactor OEM codes models, service and compatibility UI
Introduce unified OemCode model and manufacturer helpers; replace legacy ProductOemCode with OemCode in product responses. Add ManufacturerSummaryResponse, ManufacturerOptionsQuery and ProductSummaryResponse models. Implement OemCodeService with endpoints for listing, options and product-scoped OEMs. Revamp compatibility tab template and component to support search, manufacturer filters, selection, pagination and new outputs/events. Wire OEM fetching and manufacturer-by-product options in ProductWorkspace; add unit sale service usage in ProductCreate. Minor API-model field adjustments and small logging added. Improves OEM UI/UX and backend integration.
1 parent 703d6ec commit 756b09f

17 files changed

Lines changed: 651 additions & 204 deletions

src/app/core/models/additional-codes/additional-codes-product.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export interface ProductAdditionalCodeSummary {
22
id: string;
33
code: string;
44
active: boolean;
5+
type: string; // remover possivelmente
56
}

src/app/core/models/equivalent/equivalent-products.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export interface ProductEquivalent {
55
observation: string | null;
66
product: EntityReference;
77
equivalent_product: EntityReference;
8+
status?: boolean; // remover após produtos equivalentes
89
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface ManufacturerSummaryResponse {
2+
id: string;
3+
name: string;
4+
slug: string;
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface ManufacturerOptionsQuery {
2+
search: string | null;
3+
page: number | null;
4+
per_page: number | null;
5+
manufacturer_id: string | null;
6+
}

src/app/core/models/oem-codes/oem-codes-product.model.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { EntityReference } from '../generals/entity-reference';
33
export interface ProductOemCode {
44
id: string;
55
oem_code: string;
6-
manufacturer?: EntityReference;
7-
product?: EntityReference;
8-
created_at: string;
9-
updated_at: string;
10-
is_primary: boolean;
6+
manufacturer: EntityReference;
7+
product: EntityReference;
118
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ProductSummaryResponse } from '../products/product-summary-response';
2+
import { ManufacturerSummaryResponse } from '../manufactureres/manufaturer-summary-response.model';
3+
4+
export interface OemCode {
5+
id: string;
6+
label: string;
7+
product: ProductSummaryResponse;
8+
manufacturer: ManufacturerSummaryResponse;
9+
created_at: string;
10+
updated_at: string;
11+
}

src/app/core/models/products/product-create.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export function toProductGeneralFormData(source: ProductGeneralFormSource): Prod
140140
}
141141

142142
export function toCreateProductPayload(source: ProductGeneralFormSource): CreateProductPayload {
143+
console.log('[CHEGAMOS AQUI PAYLOAD]', source);
143144
return {
144145
category_id: source.category_id,
145146
manufacturer_id: source.manufacturer_id,

src/app/core/models/products/product-response.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { ProductVehicleApplication } from '../vehicle-application/vehicle-application-product.model';
22
import { ProductEquivalent } from '../equivalent/equivalent-products.model';
33
import { EntityReference } from '../generals/entity-reference';
4-
import { ProductOemCode } from '../oem-codes/oem-codes-product.model';
54
import { ProductStatus } from '../status/status-product.model';
65
import { ProductSupplier } from '../suppliers/suppliers-product.model';
76
import { ProductPricing } from '../pricing/pricing-product-model';
@@ -10,6 +9,7 @@ import { ProductUnitSale } from '../units-sale/unit-sale-product.model';
109
import { ProductPartOrigin } from '../part-origin/part-origin-product.model';
1110
import { ProductAdditionalCodeSummary } from '../additional-codes/additional-codes-product.model';
1211
import { ProductTag } from '../tags/tags-product.model';
12+
import { OemCode } from '../oem-codes/oem-codes.model';
1313

1414
export interface ProductSummaryResponse {
1515
id: string;
@@ -56,7 +56,7 @@ export interface ProductResponse extends ProductSummaryResponse {
5656
part_origin: ProductPartOrigin | null;
5757

5858
tags: ProductTag[];
59-
oem_codes: ProductOemCode[];
59+
oem_codes: OemCode[];
6060
suppliers: ProductSupplier[];
6161
equivalents: ProductEquivalent[];
6262
applications: ProductVehicleApplication[];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface ProductSummaryResponse {
2+
id: string;
3+
name: string;
4+
slug: string;
5+
internal_code: string;
6+
}

src/app/core/models/vehicle-application/vehicle-application-product.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export interface ProductVehicleApplication {
1010
details: string | null;
1111
created_at?: string;
1212
updated_at?: string;
13+
status?: boolean; // remover possivelmente
1314
}

0 commit comments

Comments
 (0)