Contract Drafts modules
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import {ContractsModule} from "./views/contracts/contracts.module";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -29,6 +30,11 @@ const routes: Routes = [
|
||||
loadChildren: () =>
|
||||
import('./views/templates/templates.module').then((m) => m.TemplatesModule)
|
||||
},
|
||||
{
|
||||
path: 'contract-drafts',
|
||||
loadChildren: () =>
|
||||
import('./views/contracts/contracts.module').then((m) => m.ContractsModule)
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -31,6 +31,11 @@ export class SidenavComponent {
|
||||
link: "/templates/contracts",
|
||||
icon: IconNamesEnum.FileCodeFill
|
||||
},
|
||||
{
|
||||
title: "Contracts Drafts",
|
||||
link: "/contract-drafts",
|
||||
icon: IconNamesEnum.PencilSquare
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { DraftCardComponent, DraftListComponent, DraftNewComponent } from "./drafts.component";
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
data: {
|
||||
title: 'Entities',
|
||||
},
|
||||
children: [
|
||||
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
||||
{
|
||||
path: 'list',
|
||||
component: DraftListComponent,
|
||||
data: {
|
||||
title: 'List',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: DraftNewComponent,
|
||||
data: {
|
||||
title: 'New',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: DraftCardComponent,
|
||||
data: {
|
||||
title: 'Card',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class ContractsRoutingModule {}
|
||||
23
front/app/src/app/views/contracts/contracts.module.ts
Normal file
23
front/app/src/app/views/contracts/contracts.module.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { ContractsRoutingModule } from './contracts-routing.module';
|
||||
import { CrudModule } from '@common/crud/crud.module'
|
||||
import { DraftCardComponent, DraftListComponent, DraftNewComponent } from "./drafts.component";
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
CrudModule,
|
||||
ContractsRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
DraftListComponent,
|
||||
DraftNewComponent,
|
||||
DraftCardComponent,
|
||||
]
|
||||
})
|
||||
export class ContractsModule {
|
||||
}
|
||||
39
front/app/src/app/views/contracts/drafts.component.ts
Normal file
39
front/app/src/app/views/contracts/drafts.component.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||
|
||||
|
||||
export class BaseEntitiesComponent {
|
||||
protected resource: string = "contract-draft";
|
||||
protected schema: string = "ContractDraft";
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: '<crud-list [resource]="this.resource" [schema]="this.schema" [columns]="this.columns"></crud-list>'
|
||||
})
|
||||
export class DraftListComponent extends BaseEntitiesComponent {
|
||||
columns = ['label', 'address', 'entity_data.type']
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: '<crud-card [resource]="this.resource" [schema]="this.schema"></crud-card>'
|
||||
})
|
||||
export class DraftNewComponent extends BaseEntitiesComponent {
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: '<crud-card [resource]="this.resource" [resource_id]="this.resource_id" [schema]="this.schema"></crud-card>'
|
||||
})
|
||||
export class DraftCardComponent extends BaseEntitiesComponent implements OnInit {
|
||||
|
||||
resource_id: string | null = null;
|
||||
|
||||
constructor(private route: ActivatedRoute,) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.paramMap.subscribe((params: ParamMap) => {
|
||||
this.resource_id = params.get('id')
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user