diff --git a/src/app/core/theme/user/user.component.html b/src/app/core/theme/user/user.component.html index 6e2fe3f..8cfba8f 100644 --- a/src/app/core/theme/user/user.component.html +++ b/src/app/core/theme/user/user.component.html @@ -49,30 +49,25 @@ translate Theme.Translates - + business Theme.Commerces - - branding_watermark - Theme.Brands - - - percent - Theme.Discounts - list_alt Theme.Orders - photo_camera - Theme.Portfolios + routerLink="/commercestores" class="nav__burger-link" (click)="hideSidebar()"> + store + Theme.Stores + + + home + Theme.Warehouses @@ -85,9 +80,9 @@ Theme.Services - store - Theme.Stores + routerLink="/commerceportfolios" class="nav__burger-link" (click)="hideSidebar()"> + photo_camera + Theme.Portfolios @@ -95,9 +90,14 @@ Theme.Tags - home - Theme.Warehouses + routerLink="/commercebrands" class="nav__burger-link" (click)="hideSidebar()"> + branding_watermark + Theme.Brands + + + percent + Theme.Discounts diff --git a/src/app/modules/commerce/pages/commerces/commerces.component.ts b/src/app/modules/commerce/pages/commerces/commerces.component.ts index 48e8b2f..64eaf6a 100644 --- a/src/app/modules/commerce/pages/commerces/commerces.component.ts +++ b/src/app/modules/commerce/pages/commerces/commerces.component.ts @@ -55,11 +55,59 @@ export class CommercesComponent { }, buttons: [ { - icon: 'shopping_bag', + icon: 'list_alt', + hrefFunc: (doc: Commerce): string => { + return '/commerceorders/' + doc._id; + } + }, + { + icon: 'store', + hrefFunc: (doc: Commerce): string => { + return '/commercestores/' + doc._id; + } + }, + { + icon: 'home', + hrefFunc: (doc: Commerce): string => { + return '/commercewarehouses/' + doc._id; + } + }, + { + icon: 'production_quantity_limits', hrefFunc: (doc: Commerce): string => { return '/commerceproducts/' + doc._id; } }, + { + icon: 'room_service', + hrefFunc: (doc: Commerce): string => { + return '/commerceservices/' + doc._id; + } + }, + { + icon: 'photo_camera', + hrefFunc: (doc: Commerce): string => { + return '/commerceportfolios/' + doc._id; + } + }, + { + icon: 'style', + hrefFunc: (doc: Commerce): string => { + return '/commercetag/' + doc._id; + } + }, + { + icon: 'branding_watermark', + hrefFunc: (doc: Commerce): string => { + return '/commercebrand/' + doc._id; + } + }, + { + icon: 'percent', + hrefFunc: (doc: Commerce): string => { + return '/commercediscounts/' + doc._id; + } + }, { icon: 'cloud_download', click: (doc: Commerce): void => { diff --git a/src/app/modules/commercebrand/interfaces/commercebrand.interface.ts b/src/app/modules/commercebrand/interfaces/commercebrand.interface.ts index cd52e65..68c8946 100644 --- a/src/app/modules/commercebrand/interfaces/commercebrand.interface.ts +++ b/src/app/modules/commercebrand/interfaces/commercebrand.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commercebrand extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commercebrand/pages/commercebrands/commercebrands.component.ts b/src/app/modules/commercebrand/pages/commercebrands/commercebrands.component.ts index dd2a15b..aaf4626 100644 --- a/src/app/modules/commercebrand/pages/commercebrands/commercebrands.component.ts +++ b/src/app/modules/commercebrand/pages/commercebrands/commercebrands.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commercebrandFormComponents } from '../../formcomponents/commercebrand.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commercebrands.component.html', @@ -15,6 +16,10 @@ import { commercebrandFormComponents } from '../../formcomponents/commercebrand. export class CommercebrandsComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commercebrands/') + ? this._router.url.replace('/commercebrands/', '') + : ''; + form: FormInterface = this._form.getForm('commercebrand', commercebrandFormComponents); config = { @@ -22,6 +27,9 @@ export class CommercebrandsComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commercebrand).commerce = this.commerce; + } this._commercebrandService.create(created as Commercebrand); close(); @@ -84,8 +92,9 @@ export class CommercebrandsComponent { private _commercebrandService: CommercebrandService, private _alert: AlertService, private _form: FormService, - private _core: CoreService - ) {} + private _core: CoreService, + private _router: Router + ) { } private _bulkManagement(create = true): () => void { return (): void => { @@ -94,6 +103,9 @@ export class CommercebrandsComponent { .then((commercebrands: Commercebrand[]) => { if (create) { for (const commercebrand of commercebrands) { + if (this.commerce) { + commercebrand.commerce = this.commerce; + } this._commercebrandService.create(commercebrand); } } else { @@ -115,7 +127,10 @@ export class CommercebrandsComponent { this._commercebrandService.update(localCommercebrand); } else { - commercebrand.__created = false; + if (this.commerce) { + commercebrand.commerce = this.commerce; + } + commercebrand.__created = false; this._commercebrandService.create(commercebrand); } diff --git a/src/app/modules/commercebrand/pages/commercebrands/commercebrands.module.ts b/src/app/modules/commercebrand/pages/commercebrands/commercebrands.module.ts index ab2f07f..14e88bb 100644 --- a/src/app/modules/commercebrand/pages/commercebrands/commercebrands.module.ts +++ b/src/app/modules/commercebrand/pages/commercebrands/commercebrands.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommercebrandsComponent + }, + { + path: ':commerce_id', + component: CommercebrandsComponent } ]; diff --git a/src/app/modules/commercediscount/interfaces/commercediscount.interface.ts b/src/app/modules/commercediscount/interfaces/commercediscount.interface.ts index 1962340..20011da 100644 --- a/src/app/modules/commercediscount/interfaces/commercediscount.interface.ts +++ b/src/app/modules/commercediscount/interfaces/commercediscount.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commercediscount extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.component.ts b/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.component.ts index 5ed6e7d..0bf94c3 100644 --- a/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.component.ts +++ b/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commercediscountFormComponents } from '../../formcomponents/commercediscount.formcomponents'; +import { Route, Router } from '@angular/router'; @Component({ templateUrl: './commercediscounts.component.html', @@ -15,6 +16,10 @@ import { commercediscountFormComponents } from '../../formcomponents/commercedis export class CommercediscountsComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commercediscounts/') + ? this._router.url.replace('/commercediscounts/', '') + : ''; + form: FormInterface = this._form.getForm('commercediscount', commercediscountFormComponents); config = { @@ -22,6 +27,9 @@ export class CommercediscountsComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commercediscount).commerce = this.commerce; + } this._commercediscountService.create(created as Commercediscount); close(); @@ -84,8 +92,9 @@ export class CommercediscountsComponent { private _commercediscountService: CommercediscountService, private _alert: AlertService, private _form: FormService, - private _core: CoreService - ) {} + private _core: CoreService, + private _router: Router + ) { } private _bulkManagement(create = true): () => void { return (): void => { @@ -94,6 +103,9 @@ export class CommercediscountsComponent { .then((commercediscounts: Commercediscount[]) => { if (create) { for (const commercediscount of commercediscounts) { + if (this.commerce) { + commercediscount.commerce = this.commerce; + } this._commercediscountService.create(commercediscount); } } else { @@ -115,7 +127,10 @@ export class CommercediscountsComponent { this._commercediscountService.update(localCommercediscount); } else { - commercediscount.__created = false; + if (this.commerce) { + commercediscount.commerce = this.commerce; + } + commercediscount.__created = false; this._commercediscountService.create(commercediscount); } diff --git a/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.module.ts b/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.module.ts index 3129a52..bf1d074 100644 --- a/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.module.ts +++ b/src/app/modules/commercediscount/pages/commercediscounts/commercediscounts.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommercediscountsComponent + }, + { + path: ':commerce_id', + component: CommercediscountsComponent } ]; diff --git a/src/app/modules/commerceorder/interfaces/commerceorder.interface.ts b/src/app/modules/commerceorder/interfaces/commerceorder.interface.ts index 7e6e113..e08a60b 100644 --- a/src/app/modules/commerceorder/interfaces/commerceorder.interface.ts +++ b/src/app/modules/commerceorder/interfaces/commerceorder.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commerceorder extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commerceorder/pages/commerceorders/commerceorders.component.ts b/src/app/modules/commerceorder/pages/commerceorders/commerceorders.component.ts index 3f30d4f..07f057e 100644 --- a/src/app/modules/commerceorder/pages/commerceorders/commerceorders.component.ts +++ b/src/app/modules/commerceorder/pages/commerceorders/commerceorders.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commerceorderFormComponents } from '../../formcomponents/commerceorder.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commerceorders.component.html', @@ -15,6 +16,10 @@ import { commerceorderFormComponents } from '../../formcomponents/commerceorder. export class CommerceordersComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commerceorders/') + ? this._router.url.replace('/commerceorders/', '') + : ''; + form: FormInterface = this._form.getForm('commerceorder', commerceorderFormComponents); config = { @@ -22,6 +27,9 @@ export class CommerceordersComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commerceorder).commerce = this.commerce; + } this._commerceorderService.create(created as Commerceorder); close(); @@ -84,7 +92,8 @@ export class CommerceordersComponent { private _commerceorderService: CommerceorderService, private _alert: AlertService, private _form: FormService, - private _core: CoreService + private _core: CoreService, + private _router: Router ) { } private _bulkManagement(create = true): () => void { @@ -94,6 +103,9 @@ export class CommerceordersComponent { .then((commerceorders: Commerceorder[]) => { if (create) { for (const commerceorder of commerceorders) { + if (this.commerce) { + commerceorder.commerce = this.commerce; + } this._commerceorderService.create(commerceorder); } } else { @@ -115,6 +127,9 @@ export class CommerceordersComponent { this._commerceorderService.update(localCommerceorder); } else { + if (this.commerce) { + commerceorder.commerce = this.commerce; + } commerceorder.__created = false; this._commerceorderService.create(commerceorder); diff --git a/src/app/modules/commerceorder/pages/commerceorders/commerceorders.module.ts b/src/app/modules/commerceorder/pages/commerceorders/commerceorders.module.ts index 8f0d168..0665161 100644 --- a/src/app/modules/commerceorder/pages/commerceorders/commerceorders.module.ts +++ b/src/app/modules/commerceorder/pages/commerceorders/commerceorders.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommerceordersComponent + }, + { + path: ':commerce_id', + component: CommerceordersComponent } ]; diff --git a/src/app/modules/commerceportfolio/interfaces/commerceportfolio.interface.ts b/src/app/modules/commerceportfolio/interfaces/commerceportfolio.interface.ts index 0e2eb36..b68fcec 100644 --- a/src/app/modules/commerceportfolio/interfaces/commerceportfolio.interface.ts +++ b/src/app/modules/commerceportfolio/interfaces/commerceportfolio.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commerceportfolio extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.component.ts b/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.component.ts index b740f59..4853299 100644 --- a/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.component.ts +++ b/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commerceportfolioFormComponents } from '../../formcomponents/commerceportfolio.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commerceportfolios.component.html', @@ -15,6 +16,10 @@ import { commerceportfolioFormComponents } from '../../formcomponents/commercepo export class CommerceportfoliosComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commerceportfolios/') + ? this._router.url.replace('/commerceportfolios/', '') + : ''; + form: FormInterface = this._form.getForm('commerceportfolio', commerceportfolioFormComponents); config = { @@ -22,6 +27,9 @@ export class CommerceportfoliosComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commerceportfolio).commerce = this.commerce; + } this._commerceportfolioService.create(created as Commerceportfolio); close(); @@ -84,7 +92,8 @@ export class CommerceportfoliosComponent { private _commerceportfolioService: CommerceportfolioService, private _alert: AlertService, private _form: FormService, - private _core: CoreService + private _core: CoreService, + private _router: Router ) { } private _bulkManagement(create = true): () => void { @@ -94,6 +103,9 @@ export class CommerceportfoliosComponent { .then((commerceportfolios: Commerceportfolio[]) => { if (create) { for (const commerceportfolio of commerceportfolios) { + if (this.commerce) { + commerceportfolio.commerce = this.commerce; + } this._commerceportfolioService.create(commerceportfolio); } } else { @@ -115,6 +127,9 @@ export class CommerceportfoliosComponent { this._commerceportfolioService.update(localCommerceportfolio); } else { + if (this.commerce) { + commerceportfolio.commerce = this.commerce; + } commerceportfolio.__created = false; this._commerceportfolioService.create(commerceportfolio); diff --git a/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.module.ts b/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.module.ts index 56691eb..b24b659 100644 --- a/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.module.ts +++ b/src/app/modules/commerceportfolio/pages/commerceportfolios/commerceportfolios.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommerceportfoliosComponent + }, + { + path: ':commerce_id', + component: CommerceportfoliosComponent } ]; diff --git a/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.component.ts b/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.component.ts index 63ef9cf..5aab111 100644 --- a/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.component.ts +++ b/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.component.ts @@ -15,13 +15,13 @@ import { Router } from '@angular/router'; }) export class CommerceproductsComponent { columns = ['name', 'description']; - + commerce = this._router.url.includes('/commerceproducts/') - ? this._router.url.replace('/commerceproducts/', '') - : ''; - + ? this._router.url.replace('/commerceproducts/', '') + : ''; + form: FormInterface = this._form.getForm('commerceproduct', commerceproductFormComponents); - + config = { create: (): void => { this._form.modal(this.form, { @@ -93,7 +93,7 @@ export class CommerceproductsComponent { private _form: FormService, private _core: CoreService, private _router: Router - ) {} + ) { } private _bulkManagement(create = true): () => void { return (): void => { @@ -102,6 +102,9 @@ export class CommerceproductsComponent { .then((commerceproducts: Commerceproduct[]) => { if (create) { for (const commerceproduct of commerceproducts) { + if (this.commerce){ + commerceproduct.commerce = this.commerce; + } this._commerceproductService.create(commerceproduct); } } else { @@ -123,7 +126,10 @@ export class CommerceproductsComponent { this._commerceproductService.update(localCommerceproduct); } else { - commerceproduct.__created = false; + if (this.commerce){ + commerceproduct.commerce = this.commerce; + } + commerceproduct.__created = false; this._commerceproductService.create(commerceproduct); } diff --git a/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.module.ts b/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.module.ts index 2bcfdfa..b26ebe3 100644 --- a/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.module.ts +++ b/src/app/modules/commerceproduct/pages/commerceproducts/commerceproducts.module.ts @@ -8,10 +8,12 @@ const routes: Routes = [ { path: '', component: CommerceproductsComponent - }, { + }, + { path: ':commerce_id', component: CommerceproductsComponent - }]; + } +]; @NgModule({ imports: [RouterModule.forChild(routes), CoreModule], diff --git a/src/app/modules/commerceservice/interfaces/commerceservice.interface.ts b/src/app/modules/commerceservice/interfaces/commerceservice.interface.ts index 7c0b33a..571d67f 100644 --- a/src/app/modules/commerceservice/interfaces/commerceservice.interface.ts +++ b/src/app/modules/commerceservice/interfaces/commerceservice.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commerceservice extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commerceservice/pages/commerceservices/commerceservices.component.ts b/src/app/modules/commerceservice/pages/commerceservices/commerceservices.component.ts index d8268fd..37768cb 100644 --- a/src/app/modules/commerceservice/pages/commerceservices/commerceservices.component.ts +++ b/src/app/modules/commerceservice/pages/commerceservices/commerceservices.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commerceserviceFormComponents } from '../../formcomponents/commerceservice.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commerceservices.component.html', @@ -15,6 +16,10 @@ import { commerceserviceFormComponents } from '../../formcomponents/commerceserv export class CommerceservicesComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commerceservices/') + ? this._router.url.replace('/commerceservices/', '') + : ''; + form: FormInterface = this._form.getForm('commerceservice', commerceserviceFormComponents); config = { @@ -22,6 +27,9 @@ export class CommerceservicesComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commerceservice).commerce = this.commerce; + } this._commerceserviceService.create(created as Commerceservice); close(); @@ -84,7 +92,8 @@ export class CommerceservicesComponent { private _commerceserviceService: CommerceserviceService, private _alert: AlertService, private _form: FormService, - private _core: CoreService + private _core: CoreService, + private _router: Router ) { } private _bulkManagement(create = true): () => void { @@ -94,6 +103,9 @@ export class CommerceservicesComponent { .then((commerceservices: Commerceservice[]) => { if (create) { for (const commerceservice of commerceservices) { + if (this.commerce) { + commerceservice.commerce = this.commerce; + } this._commerceserviceService.create(commerceservice); } } else { @@ -115,6 +127,9 @@ export class CommerceservicesComponent { this._commerceserviceService.update(localCommerceservice); } else { + if (this.commerce) { + commerceservice.commerce = this.commerce; + } commerceservice.__created = false; this._commerceserviceService.create(commerceservice); diff --git a/src/app/modules/commerceservice/pages/commerceservices/commerceservices.module.ts b/src/app/modules/commerceservice/pages/commerceservices/commerceservices.module.ts index 08ae42b..4b91366 100644 --- a/src/app/modules/commerceservice/pages/commerceservices/commerceservices.module.ts +++ b/src/app/modules/commerceservice/pages/commerceservices/commerceservices.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommerceservicesComponent + }, + { + path: ':commerce_id', + component: CommerceservicesComponent } ]; diff --git a/src/app/modules/commercestore/interfaces/commercestore.interface.ts b/src/app/modules/commercestore/interfaces/commercestore.interface.ts index ad6d194..462219b 100644 --- a/src/app/modules/commercestore/interfaces/commercestore.interface.ts +++ b/src/app/modules/commercestore/interfaces/commercestore.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commercestore extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commercestore/pages/commercestores/commercestores.component.ts b/src/app/modules/commercestore/pages/commercestores/commercestores.component.ts index 62f220a..04aa00f 100644 --- a/src/app/modules/commercestore/pages/commercestores/commercestores.component.ts +++ b/src/app/modules/commercestore/pages/commercestores/commercestores.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commercestoreFormComponents } from '../../formcomponents/commercestore.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commercestores.component.html', @@ -15,6 +16,10 @@ import { commercestoreFormComponents } from '../../formcomponents/commercestore. export class CommercestoresComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commercestores/') + ? this._router.url.replace('/commercestores/', '') + : ''; + form: FormInterface = this._form.getForm('commercestore', commercestoreFormComponents); config = { @@ -22,6 +27,9 @@ export class CommercestoresComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commercestore).commerce = this.commerce; + } this._commercestoreService.create(created as Commercestore); close(); @@ -84,7 +92,8 @@ export class CommercestoresComponent { private _commercestoreService: CommercestoreService, private _alert: AlertService, private _form: FormService, - private _core: CoreService + private _core: CoreService, + private _router: Router ) { } private _bulkManagement(create = true): () => void { @@ -94,6 +103,9 @@ export class CommercestoresComponent { .then((commercestores: Commercestore[]) => { if (create) { for (const commercestore of commercestores) { + if (this.commerce){ + commercestore.commerce = this.commerce; + } this._commercestoreService.create(commercestore); } } else { @@ -115,6 +127,9 @@ export class CommercestoresComponent { this._commercestoreService.update(localCommercestore); } else { + if (this.commerce){ + commercestore.commerce = this.commerce; + } commercestore.__created = false; this._commercestoreService.create(commercestore); diff --git a/src/app/modules/commercestore/pages/commercestores/commercestores.module.ts b/src/app/modules/commercestore/pages/commercestores/commercestores.module.ts index d97916e..d1a7987 100644 --- a/src/app/modules/commercestore/pages/commercestores/commercestores.module.ts +++ b/src/app/modules/commercestore/pages/commercestores/commercestores.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommercestoresComponent + }, + { + path: ':commerce_id', + component: CommercestoresComponent } ]; diff --git a/src/app/modules/commercetag/interfaces/commercetag.interface.ts b/src/app/modules/commercetag/interfaces/commercetag.interface.ts index ea623f0..e47506a 100644 --- a/src/app/modules/commercetag/interfaces/commercetag.interface.ts +++ b/src/app/modules/commercetag/interfaces/commercetag.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commercetag extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commercetag/pages/commercetags/commercetags.component.ts b/src/app/modules/commercetag/pages/commercetags/commercetags.component.ts index 59784ba..67ac588 100644 --- a/src/app/modules/commercetag/pages/commercetags/commercetags.component.ts +++ b/src/app/modules/commercetag/pages/commercetags/commercetags.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commercetagFormComponents } from '../../formcomponents/commercetag.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commercetags.component.html', @@ -15,6 +16,10 @@ import { commercetagFormComponents } from '../../formcomponents/commercetag.form export class CommercetagsComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commercetags/') + ? this._router.url.replace('/commercetags/', '') + : ''; + form: FormInterface = this._form.getForm('commercetag', commercetagFormComponents); config = { @@ -22,6 +27,9 @@ export class CommercetagsComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commercetag).commerce = this.commerce; + } this._commercetagService.create(created as Commercetag); close(); @@ -84,7 +92,8 @@ export class CommercetagsComponent { private _commercetagService: CommercetagService, private _alert: AlertService, private _form: FormService, - private _core: CoreService + private _core: CoreService, + private _router: Router ) { } private _bulkManagement(create = true): () => void { @@ -94,6 +103,9 @@ export class CommercetagsComponent { .then((commercetags: Commercetag[]) => { if (create) { for (const commercetag of commercetags) { + if (this.commerce) { + commercetag.commerce = this.commerce; + } this._commercetagService.create(commercetag); } } else { @@ -115,6 +127,9 @@ export class CommercetagsComponent { this._commercetagService.update(localCommercetag); } else { + if (this.commerce) { + commercetag.commerce = this.commerce; + } commercetag.__created = false; this._commercetagService.create(commercetag); diff --git a/src/app/modules/commercetag/pages/commercetags/commercetags.module.ts b/src/app/modules/commercetag/pages/commercetags/commercetags.module.ts index 482657d..332968f 100644 --- a/src/app/modules/commercetag/pages/commercetags/commercetags.module.ts +++ b/src/app/modules/commercetag/pages/commercetags/commercetags.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommercetagsComponent + }, + { + path: ':commerce_id', + component: CommercetagsComponent } ]; diff --git a/src/app/modules/commercewarehouse/interfaces/commercewarehouse.interface.ts b/src/app/modules/commercewarehouse/interfaces/commercewarehouse.interface.ts index 95d27f7..84d2ccc 100644 --- a/src/app/modules/commercewarehouse/interfaces/commercewarehouse.interface.ts +++ b/src/app/modules/commercewarehouse/interfaces/commercewarehouse.interface.ts @@ -3,4 +3,5 @@ import { CrudDocument } from 'wacom'; export interface Commercewarehouse extends CrudDocument { name: string; description: string; + commerce: string; } diff --git a/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.component.ts b/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.component.ts index 3e60cf6..9e7259f 100644 --- a/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.component.ts +++ b/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.component.ts @@ -6,6 +6,7 @@ import { FormService } from 'src/app/core/modules/form/form.service'; import { TranslateService } from 'src/app/core/modules/translate/translate.service'; import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; import { commercewarehouseFormComponents } from '../../formcomponents/commercewarehouse.formcomponents'; +import { Router } from '@angular/router'; @Component({ templateUrl: './commercewarehouses.component.html', @@ -15,6 +16,10 @@ import { commercewarehouseFormComponents } from '../../formcomponents/commercewa export class CommercewarehousesComponent { columns = ['name', 'description']; + commerce = this._router.url.includes('/commercewarehouses/') + ? this._router.url.replace('/commercewarehouses/', '') + : ''; + form: FormInterface = this._form.getForm('commercewarehouse', commercewarehouseFormComponents); config = { @@ -22,6 +27,9 @@ export class CommercewarehousesComponent { this._form.modal(this.form, { label: 'Create', click: (created: unknown, close: () => void) => { + if (this.commerce) { + (created as Commercewarehouse).commerce = this.commerce; + } this._commercewarehouseService.create(created as Commercewarehouse); close(); @@ -84,7 +92,8 @@ export class CommercewarehousesComponent { private _commercewarehouseService: CommercewarehouseService, private _alert: AlertService, private _form: FormService, - private _core: CoreService + private _core: CoreService, + private _router: Router ) { } private _bulkManagement(create = true): () => void { @@ -94,6 +103,9 @@ export class CommercewarehousesComponent { .then((commercewarehouses: Commercewarehouse[]) => { if (create) { for (const commercewarehouse of commercewarehouses) { + if (this.commerce) { + commercewarehouse.commerce = this.commerce; + } this._commercewarehouseService.create(commercewarehouse); } } else { @@ -115,6 +127,9 @@ export class CommercewarehousesComponent { this._commercewarehouseService.update(localCommercewarehouse); } else { + if (this.commerce){ + commercewarehouse.commerce = this.commerce; + } commercewarehouse.__created = false; this._commercewarehouseService.create(commercewarehouse); diff --git a/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.module.ts b/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.module.ts index c716131..b2a5aa2 100644 --- a/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.module.ts +++ b/src/app/modules/commercewarehouse/pages/commercewarehouses/commercewarehouses.module.ts @@ -7,6 +7,10 @@ const routes: Routes = [ { path: '', component: CommercewarehousesComponent + }, + { + path: ':commerce_id', + component: CommercewarehousesComponent } ];