{ "tech": "angularnew", "object_type": "form", "sub_object_type": "only header", "example_entity": "Product", "git_repo": "http://157.66.191.31:3000/risadmin_prod/authsec_testangular.git", "git_branch": "main", "ref_folder": "frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/io8.ref", "targets": [ { "profile": "route", "file": "frontend/angular-clarity-master/src/app/modules/main/main-routing.module.ts", "anchor": "// buildercomponents", "dedup": "{{Table}}Component", "import_tpl": "import { {{Table}}Component } from './BuilderComponents/{{repo}}/{{Table}}/{{Table}}.component';", "body_tpl": " { path: '{{table_lower}}', component: {{Table}}Component },", "add": "{ path: '{{table_lower}}', component: {{Table}}Component }," }, { "profile": "plain", "file": "frontend/angular-clarity-master/src/app/modules/main/main.module.ts", "anchor": "// buildercomponents", "dedup": "{{Table}}Component", "import_tpl": "import { {{Table}}Component } from './BuilderComponents/{{repo}}/{{Table}}/{{Table}}.component';", "body_tpl": " {{Table}}Component,", "add": " {{Table}}Component," } ], "files": [ { "source_ref": "frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/io8.ref/product/Product.component.ts", "path_tpl": "frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/{{REPO}}/{{TABLE}}/{{TABLE}}.component.ts", "description": "Component TypeScript file", "content_tpl": "import { Component, OnInit } from '@angular/core';\nimport { ToastrService } from 'ngx-toastr';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { {{TABLE}}Service } from './{{TABLE}}.service';\nimport { ApiRequestService } from 'src/app/services/api/api-request.service';\n\n@Component({\n selector: 'app-{{TABLE_LOWER}}',\n templateUrl: './{{TABLE}}.component.html',\n styleUrls: ['./{{TABLE}}.component.scss']\n})\nexport class {{TABLE}}Component implements OnInit {\n rowSelected: any = {};\n modaldelete = false;\n modalEdit = false;\n modalAdd = false;\n loading = false;\n items: any[] = [];\n selected: any[] = [];\n error: string;\n/* {{RELATION_DECLARATIONS}} */\n\n constructor(\n private mainService: {{TABLE}}Service,\n private apiRequest: ApiRequestService,\n private toastr: ToastrService,\n private router: Router,\n private route: ActivatedRoute\n ) { }\n\n ngOnInit(): void {\n this.getData();\n/* {{RELATION_LOADERS}} */\n }\n\n getColumns(): string[] {\n if (!this.items || this.items.length === 0) {\n return [];\n }\n return Object.keys(this.items[0]).filter(k => k !== 'id');\n }\n\n getData() {\n this.loading = true;\n this.mainService.getAll().subscribe((data) => {\n this.loading = false;\n this.items = data || [];\n if (this.items.length === 0) {\n this.error = 'No Data Available';\n }\n }, (error) => {\n this.loading = false;\n this.error = 'Server Error';\n });\n }\n\n goToAdd() {\n this.rowSelected = {};\n this.modalAdd = true;\n }\n\n onEdit(row: any) {\n this.rowSelected = Object.assign({}, row);\n this.modalEdit = true;\n }\n\n onDelete(row: any) {\n this.rowSelected = row;\n this.modaldelete = true;\n }\n\n delete(id: number) {\n this.modaldelete = false;\n this.mainService.delete(id).subscribe(() => {\n this.toastr.success('Deleted successfully');\n this.getData();\n }, (error) => {\n this.toastr.error('Failed to delete');\n });\n }\n\n onCreate() {\n this.modalAdd = false;\n this.mainService.create(this.rowSelected).subscribe(() => {\n this.toastr.success('Added successfully');\n this.getData();\n }, (error) => {\n this.toastr.error('Failed to add');\n });\n }\n\n onUpdate(id: number) {\n this.modalEdit = false;\n this.mainService.update(id, this.rowSelected).subscribe(() => {\n this.toastr.success('Updated successfully');\n this.getData();\n }, (error) => {\n this.toastr.error('Failed to update');\n });\n }\n}\n" }, { "source_ref": "frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/io8.ref/product/Product.component.html", "path_tpl": "frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/{{REPO}}/{{TABLE}}/{{TABLE}}.component.html", "description": "Component HTML template", "content_tpl": "
\n\nAre you sure you want to delete this record (ID: {{rowSelected.id}})?
\nAre you sure you want to delete this record (ID: {{rowSelected.id}})?
\n