From 594bbaa33d8bcf663ca94ea2785cb5792218c4bc Mon Sep 17 00:00:00 2001 From: bitbucket Date: Sat, 22 Jan 2022 16:36:15 +0530 Subject: [PATCH] template alignment --- .../start-pd/start-pd2/start-pd2.component.ts | 2 +- .../pd-service/pd-triger.service.ts | 13 ++++++ .../edit-template.component.html | 20 +++++----- .../edit-template/edit-template.component.ts | 40 ++++++++++++++++--- .../selection-list-view.component.html | 6 +-- 5 files changed, 61 insertions(+), 20 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd2/start-pd2.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd2/start-pd2.component.ts index 18f9835ff..4f4c9ce75 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd2/start-pd2.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd2/start-pd2.component.ts @@ -114,7 +114,7 @@ export class StartPd2Component implements OnInit, OnDestroy { // load templates details loadTemplates(startID:string,type:number,randomString:string){ // console.log('start pd component inside - loadTemplates params are,',startID,type,randomString); - this._pd.loadPDTemplates(startID,randomString).subscribe( + this._pd.loadPDTemplates2(startID,randomString).subscribe( data => { console.log("after reponse = ", data); console.log("after reponse = ", data.records.pdmaster_details); diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 1135059c1..df10390a9 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -383,6 +383,19 @@ export class PdTrigerService { //load pd template details loadPDTemplates(pdId: string,randomString): Observable { + let httpParams = new HttpParams().set('pd_id', pdId); + httpParams = httpParams.append('random_string',randomString); + // console.log('loadFullTemplate api load httpParams are',httpParams); + const options = pdId ? { params: httpParams } : {}; + console.log(options) + return this._http.get(this.apiUrl + "loadFullTemplate", options) + //return this._http.get(this.apiUrl + "loadFullTemplateV2", options) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + loadPDTemplates2(pdId: string,randomString): Observable { + let httpParams = new HttpParams().set('pd_id', pdId); httpParams = httpParams.append('random_string',randomString); // console.log('loadFullTemplate api load httpParams are',httpParams); diff --git a/ng6-seed/src/app/template2/edit-template/edit-template.component.html b/ng6-seed/src/app/template2/edit-template/edit-template.component.html index f3317cf1f..b8f1f57b3 100644 --- a/ng6-seed/src/app/template2/edit-template/edit-template.component.html +++ b/ng6-seed/src/app/template2/edit-template/edit-template.component.html @@ -10,15 +10,15 @@
-
- --> + @@ -39,14 +39,14 @@ - - + + {{node.item}} + (change)="todoLeafItemSelectionToggle(node,checklistSelection.isSelected(node))"> {{node.item}} @@ -66,7 +66,7 @@ {{node.item}} + (change)="todoItemSelectionToggle(node,descendantsAllSelected(node))"> {{node.item}} diff --git a/ng6-seed/src/app/template2/edit-template/edit-template.component.ts b/ng6-seed/src/app/template2/edit-template/edit-template.component.ts index 4e035ce07..3306ff3c7 100644 --- a/ng6-seed/src/app/template2/edit-template/edit-template.component.ts +++ b/ng6-seed/src/app/template2/edit-template/edit-template.component.ts @@ -2,7 +2,7 @@ import {SelectionModel} from '@angular/cdk/collections'; import {FlatTreeControl} from '@angular/cdk/tree'; -import {Component, Injectable} from '@angular/core'; +import {Component, Injectable, ViewChild} from '@angular/core'; import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; import {BehaviorSubject} from 'rxjs'; import { MasterService } from '../master.service'; @@ -10,6 +10,7 @@ import { NotifierService } from 'angular-notifier'; import { ActivatedRoute, Router, Params } from '@angular/router'; import { FocusTrap } from '@angular/cdk/a11y'; import { LenderListComponent } from '../lender-list/lender-list.component'; +import { LoaderService } from 'app/shared/loaderService/loader.service'; /** * Node for to-do item */ @@ -37,11 +38,13 @@ export class TodoItemFlatNode { */ @Injectable() export class ChecklistDatabase { + @ViewChild('tree') tree; dataChange = new BehaviorSubject([]); val: any; g: any=[]; checked:any=true; myModel = true; + section_name: any=[]; get data(): TodoItemNode[] { return this.dataChange.value; } constructor( private masterService: MasterService) { @@ -76,6 +79,8 @@ export class ChecklistDatabase { } //question_json = JSON.parse(data.json) console.log(question_json) + console.log(question_json.section_name) + // let dd = JSON.parse(JSON.stringify(data)) // console.log(dd) @@ -310,10 +315,13 @@ export class ChecklistDatabase { styleUrls: ['./edit-template.component.scss'], providers: [ChecklistDatabase] }) + export class EditTemplateComponent { + /** Map from flat node to nested node. This helps us finding the nested node to be modified */ flatNodeMap = new Map(); + /** Map from nested node to flattened node. This helps us to keep the same object for selection */ nestedNodeMap = new Map(); @@ -335,9 +343,10 @@ export class EditTemplateComponent { result: any[]; errorMessage: string; form_id: any; + section_name: any; constructor(private database: ChecklistDatabase, private masterService: MasterService, private notifier: NotifierService , private route: ActivatedRoute, - private router: Router, private LenderListComponent: LenderListComponent,) { + private router: Router, private LenderListComponent: LenderListComponent,private loaderService:LoaderService) { this.treeFlattener = new MatTreeFlattener(this.transformer, this.getLevel, this.isExpandable, this.getChildren); this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable); @@ -346,10 +355,11 @@ export class EditTemplateComponent { database.dataChange.subscribe(data => { this.dataSource.data = data; }); - + this.loaderService.showMatSpinnerDialog("") this.masterService.list_3_observable$.subscribe(res=> { console.log("nav list 3",res) - + + this.section_name = res.form_name this.form_id = res.form_id; this.val = JSON.parse(res.json) @@ -357,6 +367,11 @@ export class EditTemplateComponent { }) } + // ngOnInit() { + // setTimeout(()=>{ + // this.tree.treeControl.expandAll(); + // }, 1000); + // } getLevel = (node: TodoItemFlatNode) => node.level; isExpandable = (node: TodoItemFlatNode) => node.expandable; @@ -365,6 +380,9 @@ getLevel = (node: TodoItemFlatNode) => node.level; hasChild = (_: number, _nodeData: TodoItemFlatNode) => _nodeData.expandable; + @ViewChild('tree') tree; + + hasNoContent = (_: number, _nodeData: TodoItemFlatNode) => _nodeData.item === ''; /** @@ -391,7 +409,15 @@ getLevel = (node: TodoItemFlatNode) => node.level; ); return descAllSelected; } - + ngAfterViewInit() { + + setTimeout(()=>{ + + this.tree.treeControl.expandAll(); + this.loaderService.closeMatSpinnerDialog() + }, 500); + + } /** Whether part of the descendants are selected */ descendantsPartiallySelected(node: TodoItemFlatNode): boolean { const descendants = this.treeControl.getDescendants(node); @@ -743,7 +769,9 @@ getLevel = (node: TodoItemFlatNode) => node.level; } - + + + } diff --git a/ng6-seed/src/app/template2/selection-list-view/selection-list-view.component.html b/ng6-seed/src/app/template2/selection-list-view/selection-list-view.component.html index 813dead23..2d37d370b 100644 --- a/ng6-seed/src/app/template2/selection-list-view/selection-list-view.component.html +++ b/ng6-seed/src/app/template2/selection-list-view/selection-list-view.component.html @@ -8,6 +8,7 @@ (click)="loadPdViewCompoent()">close + - - +