Skip to content

Commit 82c2e05

Browse files
authored
Merge pull request #4 from enterpriseShop/development
Development
2 parents f1b1fce + 4808614 commit 82c2e05

113 files changed

Lines changed: 6152 additions & 2352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/app/app.routes.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,28 @@ export const routes: Routes = [
1919
{
2020
path: 'catalog/products/new',
2121
loadComponent: () =>
22-
import('./features/catalog/product-create/product-create').then((m) => m.ProductCreateComponent),
22+
import('./features/catalog/products/product-create/product-create').then(
23+
(m) => m.ProductCreateComponent,
24+
),
2325
},
2426
{
2527
path: 'catalog/products/:id/edit',
2628
loadComponent: () =>
27-
import('./features/catalog/product-workspace/product-workspace').then(
29+
import('./features/catalog/products/product-workspace/product-workspace').then(
2830
(m) => m.ProductWorkspaceComponent,
2931
),
3032
},
3133
{
3234
path: 'catalog/products/:id/view',
3335
loadComponent: () =>
34-
import('./features/catalog/product-workspace/product-workspace').then(
36+
import('./features/catalog/products/product-workspace/product-workspace').then(
3537
(m) => m.ProductWorkspaceComponent,
3638
),
3739
},
3840
{
3941
path: 'catalog/products/:id',
4042
loadComponent: () =>
41-
import('./features/catalog/product-workspace/product-workspace').then(
43+
import('./features/catalog/products/product-workspace/product-workspace').then(
4244
(m) => m.ProductWorkspaceComponent,
4345
),
4446
},

src/app/app.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { ChangeDetectionStrategy, Component } from '@angular/core';
1+
import { afterNextRender, ChangeDetectionStrategy, Component, inject } from '@angular/core';
22
import { AppShellComponent } from './components/app-shell/app-shell';
3+
import { AppInitializerService } from './core/initialization/app-initializer.service';
34

45
@Component({
56
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -9,4 +10,12 @@ import { AppShellComponent } from './components/app-shell/app-shell';
910
templateUrl: './app.html',
1011
styleUrl: './app.css',
1112
})
12-
export class App {}
13+
export class App {
14+
private readonly initializer = inject(AppInitializerService);
15+
16+
constructor() {
17+
afterNextRender(() => {
18+
void this.initializer.initialize();
19+
});
20+
}
21+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { inject, Injectable } from '@angular/core';
2+
import { CategoryStore } from '../store/category-store/category-store';
3+
import { ManufacturerStore } from '../store/manufacturer-store/manufacturer-store';
4+
import { OemCodeStore } from '../store/oem-code-store/oem-code-store';
5+
import { StatusStore } from '../store/status-store/status-store';
6+
import { UnitSaleStore } from '../store/unit-sale/unit-sale-store';
7+
import { WarehouseStore } from '../store/warehouse/warehouse-store';
8+
import { PartOriginStore } from '../store/part-origin/part-origin-store';
9+
10+
@Injectable({
11+
providedIn: 'root',
12+
})
13+
export class AppInitializerService {
14+
private readonly statusStore = inject(StatusStore);
15+
private readonly oemCodeStore = inject(OemCodeStore);
16+
private readonly categoryStore = inject(CategoryStore);
17+
private readonly unitSaleStore = inject(UnitSaleStore);
18+
private readonly warehouseStore = inject(WarehouseStore);
19+
private readonly partOriginStore = inject(PartOriginStore);
20+
private readonly manufacturerStore = inject(ManufacturerStore);
21+
22+
async initialize(): Promise<void> {
23+
await Promise.all([
24+
this.oemCodeStore.loadInitial(),
25+
this.statusStore.hydrate(),
26+
this.unitSaleStore.hydrate(),
27+
this.categoryStore.hydrate(),
28+
this.warehouseStore.hydrate(),
29+
this.partOriginStore.hydrate(),
30+
this.manufacturerStore.hydrate(),
31+
]);
32+
}
33+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface ProductAdditionalCodeSummary {
2+
id: string;
3+
code: string;
4+
active: boolean;
5+
type: string; // remover possivelmente
6+
}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
export interface CategoryOptionsResponse {
2-
success: boolean;
3-
message: string;
4-
data: CategoryOption[];
5-
}
1+
import { GeneralOption } from '../generals/general-options-response.model';
62

7-
export interface CategoryOption {
8-
id: string;
9-
label: string;
10-
description: string;
3+
export interface CategoryOption extends GeneralOption {
114
icon: string;
5+
description: string;
126
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { AutocompleteOption } from '../design-system/auto-complete.model';
2+
import { getAllResponse } from '../generals/general-responses-list.model';
3+
import { GeneralOptionQuery } from '../generals/general-option-query.model';
4+
5+
export interface CategoryQueryCache {
6+
query: GeneralOptionQuery;
7+
response: getAllResponse<AutocompleteOption[]>;
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { GeneralOption } from '../generals/general-options-response.model';
2+
3+
export interface AutocompleteOption extends GeneralOption {
4+
icon: string;
5+
disabled: boolean;
6+
description: string;
7+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export interface DSelectOption {
2-
label: string;
3-
value: string | number;
4-
disabled?: boolean;
1+
import { GeneralOption } from '../generals/general-options-response.model';
2+
3+
export interface SelectOption extends GeneralOption {
4+
disabled: boolean;
55
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { EntityReference } from '../generals/entity-reference';
2+
3+
export interface ProductEquivalent {
4+
id: string;
5+
observation: string | null;
6+
product: EntityReference;
7+
equivalent_product: EntityReference;
8+
status?: boolean; // remover após produtos equivalentes
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface EntityReference {
2+
id: string;
3+
name: string;
4+
slug?: string;
5+
icon?: string;
6+
}

0 commit comments

Comments
 (0)