datamanagemnet

This commit is contained in:
string 2025-08-13 11:05:11 +05:30
parent 01a0a2f959
commit 006f503e27
4 changed files with 897 additions and 850 deletions

View File

@ -1,7 +1,7 @@
<ol class="breadcrumb breadcrumb-arrow font-trirong"> <ol class="breadcrumb breadcrumb-arrow font-trirong">
<li><a href="javascript://" [routerLink]="['/cns-portal/dashboard/order']"><clr-icon shape="home"></clr-icon></a></li> <li><a href="javascript://" [routerLink]="['/cns-portal/dashboard/order']"><clr-icon shape="home"></clr-icon></a></li>
<li><a href="" >Data Management</a></li> <li><a href="">Data Management</a></li>
<li><a href="" > Data Management</a></li> <li><a href=""> Data Management</a></li>
</ol> </ol>
<div class="dg-wrapper"> <div class="dg-wrapper">
@ -17,14 +17,15 @@
<button class="btn btn-outline" (click)="onExport()"> <button class="btn btn-outline" (click)="onExport()">
<clr-icon shape="export"></clr-icon> xlsx <clr-icon shape="export"></clr-icon> xlsx
</button> </button>
<button id="add" class="btn btn-primary" (click)="goToAdd()" > <button id="add" class="btn btn-primary" (click)="goToAdd()">
<clr-icon shape="plus"></clr-icon>ADD <clr-icon shape="plus"></clr-icon>ADD
</button> </button>
</div> </div>
</div> </div>
<clr-datagrid [clrDgLoading]="loading" > <clr-datagrid [clrDgLoading]="loading">
<clr-dg-placeholder><ng-template #loadingSpinner><clr-spinner>Loading ... </clr-spinner></ng-template> <clr-dg-placeholder><ng-template #loadingSpinner><clr-spinner>Loading ... </clr-spinner></ng-template>
<div *ngIf="error;else loadingSpinner">{{error}}</div></clr-dg-placeholder> <div *ngIf="error;else loadingSpinner">{{error}}</div>
</clr-dg-placeholder>
<clr-dg-column [clrDgField]="''"><ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="''"><ng-container *clrDgHideableColumn="{hidden: false}">
Go To Go To
@ -36,20 +37,22 @@
<ng-container *clrDgHideableColumn="{hidden: false}"> <ng-container *clrDgHideableColumn="{hidden: false}">
Entity Name Entity Name
</ng-container> </ng-container>
</clr-dg-column > </clr-dg-column>
<clr-dg-column [clrDgField]="'subject'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'subject'"> <ng-container *clrDgHideableColumn="{hidden: false}">
File Name File Name
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="''" style="width: 220px;"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="''" style="width: 220px;"> <ng-container *clrDgHideableColumn="{hidden: false}">
Action Action
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-row *clrDgItems="let user of data?.reverse()?.slice();" [clrDgItem]="user" > <clr-dg-row *clrDgItems="let user of data?.reverse()?.slice();" [clrDgItem]="user">
<clr-dg-cell><span class="label label-light-blue" style="display: inline;margin-left: 10px; cursor: pointer;" (click)="work(user.id)">Workflow</span></clr-dg-cell> <clr-dg-cell><span class="label label-light-blue" style="display: inline;margin-left: 10px; cursor: pointer;"
<clr-dg-cell>{{user.entityName}}</clr-dg-cell> (click)="work(user.id)">Workflow</span></clr-dg-cell>
<clr-dg-cell>{{user.entity_name}}</clr-dg-cell>
<clr-dg-cell>{{user.file_name}}</clr-dg-cell> <clr-dg-cell>{{user.file_name}}</clr-dg-cell>
<clr-dg-cell> <clr-dg-cell>
<a href="javascript:void(0)" role="tooltip" aria-haspopup="true" class="tooltip tooltip-sm tooltip-top-left"> <a href="javascript:void(0)" role="tooltip" aria-haspopup="true" class="tooltip tooltip-sm tooltip-top-left">
<span style="cursor: pointer;"><clr-icon shape="trash" (click)="onDelete(user)" class="red is-error" style="color: red;"></clr-icon></span> <span style="cursor: pointer;"><clr-icon shape="trash" (click)="onDelete(user)" class="red is-error"
style="color: red;"></clr-icon></span>
<span class="tooltip-content">Delete</span> <span class="tooltip-content">Delete</span>
</a> </a>
</clr-dg-cell> </clr-dg-cell>
@ -108,7 +111,7 @@
<br> <br>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="modalEdit = false">Cancel</button> <button type="button" class="btn btn-outline" (click)="modalEdit = false">Cancel</button>
<button type="submit" class="btn btn-primary" >UPDATE</button> <button type="submit" class="btn btn-primary">UPDATE</button>
</div> </div>
</form> </form>
</div> </div>
@ -122,7 +125,7 @@
<h2 class="heading">{{rowSelected.id}}</h2> <h2 class="heading">{{rowSelected.id}}</h2>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="modaldelete = false">Cancel</button> <button type="button" class="btn btn-outline" (click)="modaldelete = false">Cancel</button>
<button type="button" (click)="delete(rowSelected.id)" class="btn btn-primary" >Delete</button> <button type="button" (click)="delete(rowSelected.id)" class="btn btn-primary">Delete</button>
</div> </div>
</div> </div>
</clr-modal> </clr-modal>
@ -164,10 +167,10 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="modalAdd = false">Cancel</button> <button type="button" class="btn btn-outline" (click)="modalAdd = false">Cancel</button>
<button type="submit" class="btn btn-primary" >ADD</button> <button type="submit" class="btn btn-primary">ADD</button>
</div> </div>
</form> </form>
</div> </div>
</clr-modal> </clr-modal>

View File

@ -14,22 +14,22 @@ import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
styleUrls: ['./datamanagement.component.scss'] styleUrls: ['./datamanagement.component.scss']
}) })
export class DatamanagementComponent implements OnInit { export class DatamanagementComponent implements OnInit {
rowSelected :any= {}; rowSelected: any = {};
modaldelete=false; modaldelete = false;
modalEdit=false; modalEdit = false;
modalAdd= false; modalAdd = false;
public entryForm: FormGroup; public entryForm: FormGroup;
selected: any[] = []; selected: any[] = [];
error; error;
loading = false; loading = false;
data; data;
udata; udata;
selectedFile: File[]=[]; selectedFile: File[] = [];
entitydata; entitydata;
// tableList =['priority','impact','urgency','category','state','contact_type','customer','handler']; // tableList =['priority','impact','urgency','category','state','contact_type','customer','handler'];
tableList; tableList;
constructor( private excel: ExcelService, private datamservice:DatamanagementService, private toastr: ToastrService, constructor(private excel: ExcelService, private datamservice: DatamanagementService, private toastr: ToastrService,
private _fb: FormBuilder, private userservice:UsermaintanceService, private router: Router,private bulkimportService:BulkimportService, private _fb: FormBuilder, private userservice: UsermaintanceService, private router: Router, private bulkimportService: BulkimportService,
private route: ActivatedRoute,) { } private route: ActivatedRoute,) { }
ngOnInit(): void { ngOnInit(): void {
@ -38,51 +38,51 @@ export class DatamanagementComponent implements OnInit {
this.allentity(); this.allentity();
this.entitygetall(); this.entitygetall();
this.entryForm = this._fb.group({ this.entryForm = this._fb.group({
user_id:[null], user_id: [null],
file_name:[null], file_name: [null],
entityName:[null], entityName: [null],
// entity_name:[null], // entity_name:[null],
file_type:[null], file_type: [null],
}); });
// this.datamservice.getjson().subscribe((data)=>{ // this.datamservice.getjson().subscribe((data)=>{
// console.log(data); // console.log(data);
// }) // })
} }
getall(){ getall() {
this.datamservice.getall().subscribe((data)=>{ this.datamservice.getall().subscribe((data) => {
console.log(data); console.log('data managemnt ', data);
this.data=data; this.data = data;
if(this.data.length == 0){ if (this.data.length == 0) {
this.error="No data Available"; this.error = "No data Available";
console.log(this.error); console.log(this.error);
} }
},(error) => { }, (error) => {
console.log(error); console.log(error);
if(error){ if (error) {
this.error="No data Available OR server Error"; this.error = "No data Available OR server Error";
} }
}); });
} }
entitygetall(){ entitygetall() {
this.bulkimportService.getDetails().subscribe((data)=>{ this.bulkimportService.getDetails().subscribe((data) => {
console.log(data); console.log(data);
this.tableList=data; this.tableList = data;
},(error) => { }, (error) => {
console.log(error); console.log(error);
}); });
} }
getuserall(){ getuserall() {
this.userservice.getAll().subscribe((data)=>{ this.userservice.getAll().subscribe((data) => {
console.log(data); console.log(data);
this.udata=data; this.udata = data;
}) })
} }
allentity(){ allentity() {
// this.datamservice.getallentity().subscribe((data)=>{ // this.datamservice.getallentity().subscribe((data)=>{
// console.log(data); // console.log(data);
// this.entitydata=data; // this.entitydata=data;
@ -101,33 +101,33 @@ export class DatamanagementComponent implements OnInit {
} }
goToAdd() { goToAdd() {
this.modalAdd = true; this.modalAdd = true;
} }
onSubmit(){ onSubmit() {
console.log(this.entryForm.value); console.log(this.entryForm.value);
this.datamservice.create(this.selectedFile,this.entryForm.value.entityName).subscribe((data)=>{ this.datamservice.create(this.selectedFile, this.entryForm.value.entityName).subscribe((data) => {
console.log(data); console.log(data);
if(data.status===202){ if (data.status === 202) {
this.toastr.success("Added Succesfully"); this.toastr.success("Added Succesfully");
} }
setTimeout(() => { setTimeout(() => {
this.getall(); this.getall();
}, 1000); }, 1000);
this.getall(); this.getall();
}, (error: HttpErrorResponse)=>{ }, (error: HttpErrorResponse) => {
console.log(error); console.log(error);
if(error.status >=200 && error.status <= 299){ if (error.status >= 200 && error.status <= 299) {
this.toastr.success("Added Succesfully"); this.toastr.success("Added Succesfully");
setTimeout(() => { setTimeout(() => {
this.getall(); this.getall();
}, 1000); }, 1000);
} }
if(error.status===404){ if (error.status === 404) {
this.toastr.error("Not Added"); this.toastr.error("Not Added");
} }
this.ngOnInit(); this.ngOnInit();
}); });
this.modalAdd=false; this.modalAdd = false;
} }
onEdit(row) { onEdit(row) {
this.rowSelected = row; this.rowSelected = row;
@ -136,31 +136,30 @@ this.modalAdd=false;
onDelete(row) { onDelete(row) {
this.rowSelected = row; this.rowSelected = row;
this.modaldelete=true; this.modaldelete = true;
} }
delete(id) delete(id) {
{
this.modaldelete = false; this.modaldelete = false;
console.log("in delete "+id); console.log("in delete " + id);
this.datamservice.delete(id).subscribe( this.datamservice.delete(id).subscribe(
(data) => { (data) => {
console.log(data); console.log(data);
this.ngOnInit(); this.ngOnInit();
if(data.status >=200 && data.status <= 299 || data == null) { if (data.status >= 200 && data.status <= 299 || data == null) {
this.toastr.success("Delete Succesfully"); this.toastr.success("Delete Succesfully");
} }
}, (error: HttpHeaderResponse)=>{ }, (error: HttpHeaderResponse) => {
console.log(error); console.log(error);
if(error.status >=200 && error.status <= 299){ if (error.status >= 200 && error.status <= 299) {
this.toastr.success("Delete Succesfully"); this.toastr.success("Delete Succesfully");
} }
if(error.status >=400 && error.status <= 499){ if (error.status >= 400 && error.status <= 499) {
this.toastr.error("Not Delete"); this.toastr.error("Not Delete");
} }
if(error.status >=500 && error.status <= 599){ if (error.status >= 500 && error.status <= 599) {
this.toastr.error("Server Error"); this.toastr.error("Server Error");
} }
}); });
@ -168,10 +167,10 @@ this.modalAdd=false;
} }
onUpdate(id) { onUpdate(id) {
this.modalEdit = false; this.modalEdit = false;
this.datamservice.update(id,this.rowSelected,this.selectedFile).subscribe( this.datamservice.update(id, this.rowSelected, this.selectedFile).subscribe(
(data) => { (data) => {
console.log(data); console.log(data);
if(data.status===202){ if (data.status === 202) {
this.toastr.success("Updated Succesfully"); this.toastr.success("Updated Succesfully");
} }
@ -181,9 +180,9 @@ this.modalAdd=false;
} }
); );
this.ngOnInit(); this.ngOnInit();
} }
work(id:any){ work(id: any) {
console.log(id); console.log(id);
this.router.navigate(["../dataworkflow/"+ id], { relativeTo: this.route }); this.router.navigate(["../dataworkflow/" + id], { relativeTo: this.route });
} }
} }

View File

@ -1,4 +1,3 @@
<ol class="breadcrumb breadcrumb-arrow font-trirong"> <ol class="breadcrumb breadcrumb-arrow font-trirong">
<li><a href="javascript://" [routerLink]="['/']">Admin</a></li> <li><a href="javascript://" [routerLink]="['/']">Admin</a></li>
<li><a href="javascript://">Data Import </a></li> <li><a href="javascript://">Data Import </a></li>
@ -13,13 +12,15 @@
<span class="spacer"></span> <span class="spacer"></span>
<button class="btn btn-sm btn-primary" (click)="reset()">Reset</button> <button class="btn btn-sm btn-primary" (click)="reset()">Reset</button>
<button class="btn btn-sm btn-primary" (click)="changeToHorizonTal()" *ngIf="layout.direction === 'vertical'">HorizonTal Layout</button> <button class="btn btn-sm btn-primary" (click)="changeToHorizonTal()"
<button class="btn btn-sm btn-primary" (click)="changeToVertical()" *ngIf="layout.direction === 'horizontal'">Vertical Layout</button> *ngIf="layout.direction === 'vertical'">HorizonTal Layout</button>
<button class="btn btn-sm btn-primary" (click)="changeToVertical()" *ngIf="layout.direction === 'horizontal'">Vertical
Layout</button>
</div> </div>
<div class="clr-row" > <div class="clr-row">
<div [class]="layout.block1" > <div [class]="layout.block1">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="clr-row"> <div class="clr-row">
@ -33,28 +34,28 @@
<div class=" card-block container"> <div class=" card-block container">
<clr-timeline [clrLayout]="layout.direction" > <clr-timeline [clrLayout]="layout.direction">
<clr-timeline-step [clrState]="timelineStyle.step0.state"> <clr-timeline-step [clrState]="timelineStyle.step0.state">
<clr-timeline-step-header>Step 0</clr-timeline-step-header> <clr-timeline-step-header>Step 0</clr-timeline-step-header>
<clr-timeline-step-title> <span >Review</span> </clr-timeline-step-title> <clr-timeline-step-title> <span>Review</span> </clr-timeline-step-title>
</clr-timeline-step> </clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step1.state"> <clr-timeline-step [clrState]="timelineStyle.step1.state">
<clr-timeline-step-header>Step 1</clr-timeline-step-header> <clr-timeline-step-header>Step 1</clr-timeline-step-header>
<clr-timeline-step-title> <span> Table Mapping </span></clr-timeline-step-title> <clr-timeline-step-title> <span> Table Mapping </span></clr-timeline-step-title>
</clr-timeline-step> </clr-timeline-step>
<clr-timeline-step class="gemini-ignore" [clrState]="timelineStyle.step2.state"> <clr-timeline-step class="gemini-ignore" [clrState]="timelineStyle.step2.state">
<clr-timeline-step-header>Step 2</clr-timeline-step-header> <clr-timeline-step-header>Step 2</clr-timeline-step-header>
<clr-timeline-step-title> <span> Data Mapping </span></clr-timeline-step-title> <clr-timeline-step-title> <span> Data Mapping </span></clr-timeline-step-title>
</clr-timeline-step> </clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step3.state" > <clr-timeline-step [clrState]="timelineStyle.step3.state">
<clr-timeline-step-header>Step 3</clr-timeline-step-header> <clr-timeline-step-header>Step 3</clr-timeline-step-header>
<clr-timeline-step-title><span>Import</span></clr-timeline-step-title> <clr-timeline-step-title><span>Import</span></clr-timeline-step-title>
</clr-timeline-step> </clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step4.state" > <clr-timeline-step [clrState]="timelineStyle.step4.state">
<clr-timeline-step-header>Step 4</clr-timeline-step-header> <clr-timeline-step-header>Step 4</clr-timeline-step-header>
<clr-timeline-step-title>Download Excel</clr-timeline-step-title> <clr-timeline-step-title>Download Excel</clr-timeline-step-title>
@ -69,7 +70,7 @@
</div> </div>
</div> </div>
</div> </div>
<div [class]="layout.block2" > <div [class]="layout.block2">
<!--STEP 0--> <!--STEP 0-->
<div class="card" *ngIf="timelineStyle.step0.open"> <div class="card" *ngIf="timelineStyle.step0.open">
@ -78,7 +79,7 @@
<h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3> <h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3>
<div class="container"> <div class="container">
<br/> <br />
<!-- entry form--> <!-- entry form-->
<form #contactForm="ngForm" (ngSubmit)="onSave()"> <form #contactForm="ngForm" (ngSubmit)="onSave()">
@ -105,7 +106,7 @@
</div> --> </div> -->
<!-- end row --> <!-- end row -->
<div *ngFor="let sheetName of sheetNames" > <div *ngFor="let sheetName of sheetNames">
<h3>{{ sheetName }}</h3> <h3>{{ sheetName }}</h3>
<div style="max-width:fit-content; overflow-x:auto"> <div style="max-width:fit-content; overflow-x:auto">
<table class="table"> <table class="table">
@ -126,8 +127,10 @@
<div class="button"> <div class="button">
<!-- <button type="submit" class="btn btn-primary" [disabled]="!contactForm.valid">Submit</button> --> <!-- <button type="submit" class="btn btn-primary" [disabled]="!contactForm.valid">Submit</button> -->
<button type="button" class="btn btn-primary"(click)=" this.timelineStyle.step0 ={ state: 'success', open: false };this.timelineStyle.step1 ={ state: 'current', open: true }; this.getColumns(tableName); getColumnforstep1();" >Complete</button> <button type="button" class="btn btn-primary"
<button type="button" class="btn btn-primary" (click)=" this.timelineStyle.step0 ={state:'current',open:false};this.timelineStyle.step1 ={state:'not-started',open:true}">Next</button> (click)=" this.timelineStyle.step0 ={ state: 'success', open: false };this.timelineStyle.step1 ={ state: 'current', open: true }; this.getColumns(tableName); getColumnforstep1();">Complete</button>
<button type="button" class="btn btn-primary"
(click)=" this.timelineStyle.step0 ={state:'current',open:false};this.timelineStyle.step1 ={state:'not-started',open:true}">Next</button>
</div> </div>
@ -138,13 +141,14 @@
</div> </div>
</div></div> </div>
</div>
<!--STEP 1--> <!--STEP 1-->
<div class="card" *ngIf="timelineStyle.step1.open"> <div class="card" *ngIf="timelineStyle.step1.open">
<div class="card-header"> <div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Table Mapping</h3> <h3 style="text-align: center;" *ngIf="!appToUpdate">Table Mapping</h3>
<form #contactForm="ngForm" > <form #contactForm="ngForm">
<div class="container"> <div class="container">
<div class="clr-row fieldWrapper"> <div class="clr-row fieldWrapper">
@ -159,10 +163,12 @@
<tbody> <tbody>
<tr *ngFor="let data of columnJson; let i = index"> <tr *ngFor="let data of columnJson; let i = index">
<td class="left"> <td class="left">
<input type="text" [(ngModel)]="data.sheetName" [ngModelOptions]="{standalone: true}" name="sheetName" class="clr-input" readonly/> <input type="text" [(ngModel)]="data.sheetName" [ngModelOptions]="{standalone: true}"
name="sheetName" class="clr-input" readonly />
</td> </td>
<td> <td>
<input type="text" [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}" name="TableName" class="clr-input"/> <input type="text" [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}"
name="TableName" class="clr-input" />
<!-- <select [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}" name="TableName"> <!-- <select [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}" name="TableName">
<option *ngFor="let data of headerData" [value]="data">{{data}}</option> <option *ngFor="let data of headerData" [value]="data">{{data}}</option>
</select> --> </select> -->
@ -174,28 +180,33 @@
</div> </div>
<!-- <button type="submit" class="btn btn-primary" >Submit</button> --> <!-- <button type="submit" class="btn btn-primary" >Submit</button> -->
<button type="button" class="btn btn-primary" (click)="this.timelineStyle.step1 ={ state: 'success', open: false };this.timelineStyle.step2 ={ state: 'current', open: true }; this.getHeadersById(id,sheetNames[0]); this.rulechecking()">Complete</button> <button type="button" class="btn btn-primary"
<button class="btn btn-primary-outline" (click)="this.timelineStyle.step0 ={ state: 'success', open: true };this.timelineStyle.step1 ={ state: 'not-started', open: false };">Back</button> (click)="this.timelineStyle.step1 ={ state: 'success', open: false };this.timelineStyle.step2 ={ state: 'current', open: true }; this.getHeadersById(id,sheetNames[0]); this.rulechecking()">Complete</button>
<button class="btn btn-primary-outline"
(click)="this.timelineStyle.step0 ={ state: 'success', open: true };this.timelineStyle.step1 ={ state: 'not-started', open: false };">Back</button>
<button type="button" class="btn btn-primary" (click)="this.timelineStyle.step1 ={state:'not-started',open:false};this.timelineStyle.step2 ={state:'not-started',open:true}">Next</button> <button type="button" class="btn btn-primary"
(click)="this.timelineStyle.step1 ={state:'not-started',open:false};this.timelineStyle.step2 ={state:'not-started',open:true}">Next</button>
</div></form> </div>
</form>
<div class="container"> <div class="container">
<div class="clr-col-6"> <div class="clr-col-6">
</div> </div>
</div> </div>
<div class="container" > <div class="container">
</div> </div>
</div></div> </div>
</div>
<div class="card" *ngIf="timelineStyle.step2.open"> <div class="card" *ngIf="timelineStyle.step2.open">
<div class="card-header"> <div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Data Mapping</h3> <h3 style="text-align: center;" *ngIf="!appToUpdate">Data Mapping</h3>
<form #contactForm="ngForm" > <form #contactForm="ngForm">
<div class="container"> <div class="container">
<div class="clr-row"> <div class="clr-row">
@ -206,48 +217,61 @@
<textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea> <textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea>
</div> </div>
<div *ngIf="transform"> <div *ngIf="transform">
<label for="sequence" style="font-weight: bold;">Mapper Fields <span class="label label-light-green p7 lbutton" (click)="goFromMapper()">OPEN</span><span class="label label-light-green p7 lbutton" (click)="transReset()">RESET</span></label> <label for="sequence" style="font-weight: bold;">Mapper Fields <span
<textarea type="text" name="mapperText" style="height:150px;" [(ngModel)]="mapperText" readonly></textarea> class="label label-light-green p7 lbutton" (click)="goFromMapper()">OPEN</span><span
class="label label-light-green p7 lbutton" (click)="transReset()">RESET</span></label>
<textarea type="text" name="mapperText" style="height:150px;" [(ngModel)]="mapperText"
readonly></textarea>
</div> </div>
</div> </div>
<div class="horizontal1 clr-col-6"> <div class="horizontal1 clr-col-6">
<div *ngIf="checkRule"><!--*ngIf="checkRule"--> <div *ngIf="checkRule"><!--*ngIf="checkRule"-->
<div style="text-align: right; width: 100px;"> <span style="cursor: pointer;" class="label label-light-green p7 lbutton" (click)="checkRules()">Add Rule line</span></div> <div style="text-align: right; width: 100px;"> <span style="cursor: pointer;"
class="label label-light-green p7 lbutton" (click)="checkRules()">Add Rule line</span></div>
<!-- <label for="sequence" style="font-weight: bold; cursor: pointer;" (click)="goFromMapper()">Mapper Fields (Transform)&nbsp;&nbsp;<clr-icon shape="pop-out"></clr-icon></label> --> <!-- <label for="sequence" style="font-weight: bold; cursor: pointer;" (click)="goFromMapper()">Mapper Fields (Transform)&nbsp;&nbsp;<clr-icon shape="pop-out"></clr-icon></label> -->
<textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea> <textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea>
</div> </div>
<div *ngIf="Rule"> <div *ngIf="Rule">
<label for="sequence" style="font-weight: bold;"><span class="label label-light-green p7 lbutton" (click)="goFromRule()">OPEN</span><span class="label label-light-green p7 lbutton" (click)="resetRule()">RESET</span></label> <label for="sequence" style="font-weight: bold;"><span class="label label-light-green p7 lbutton"
<textarea type="text" name="RuleData" style="height:150px;" [(ngModel)]="RuleData" readonly></textarea> (click)="goFromRule()">OPEN</span><span class="label label-light-green p7 lbutton"
(click)="resetRule()">RESET</span></label>
<textarea type="text" name="RuleData" style="height:150px;" [(ngModel)]="RuleData"
readonly></textarea>
</div> </div>
</div> </div>
</div> </div>
<!-- <button type="submit" class="btn btn-primary" >Submit</button> --> <!-- <button type="submit" class="btn btn-primary" >Submit</button> -->
<button type="button" class="btn btn-primary" (click)="this.timelineStyle.step2 ={ state: 'success', open: false };this.timelineStyle.step3 ={ state: 'current', open: true }; ">Complete</button> <button type="button" class="btn btn-primary"
<button class="btn btn-primary-outline" (click)="this.timelineStyle.step1 ={ state: 'success', open: true };this.timelineStyle.step2 ={ state: 'not-started', open: false };">Back</button> (click)="this.timelineStyle.step2 ={ state: 'success', open: false };this.timelineStyle.step3 ={ state: 'current', open: true }; ">Complete</button>
<button class="btn btn-primary-outline"
(click)="this.timelineStyle.step1 ={ state: 'success', open: true };this.timelineStyle.step2 ={ state: 'not-started', open: false };">Back</button>
<button type="button" class="btn btn-primary" (click)="this.timelineStyle.step2 ={state:'not-started',open:false};this.timelineStyle.step3 ={state:'not-started',open:true}">Next</button> <button type="button" class="btn btn-primary"
(click)="this.timelineStyle.step2 ={state:'not-started',open:false};this.timelineStyle.step3 ={state:'not-started',open:true}">Next</button>
</div></form> </div>
</form>
<div class="container"> <div class="container">
<div class="clr-col-6"> <div class="clr-col-6">
</div> </div>
</div> </div>
<div class="container" > <div class="container">
</div> </div>
</div></div> </div>
<!--STEP 2--> </div>
<div class="card" *ngIf="timelineStyle.step3.open">
<!--STEP 2-->
<div class="card" *ngIf="timelineStyle.step3.open">
<div class="card-header"> <div class="card-header">
<h3 style="text-align: center;">Importing Data</h3> <h3 style="text-align: center;">Importing Data</h3>
<!-- <h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3> --> <!-- <h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3> -->
<div class="container"> <div class="container">
<div class="clr-row"> <div class="clr-row">
<div class="container" > <div class="container">
<div class="container" *ngIf="keychangeTable"> <div class="container" *ngIf="keychangeTable">
<!-- <table class="table"> <!-- <table class="table">
<thead> <thead>
@ -295,42 +319,59 @@
</div> </div>
</div> --> </div> -->
<button type="button" class="btn btn-primary"(click)="this.timelineStyle.step3 ={ state: 'success', open: false };this.timelineStyle.step4 ={ state: 'current', open: true }; this.downloadExcel(id);">Complete</button> <button type="button" class="btn btn-primary"
<button class="btn btn-primary-outline" (click)="this.timelineStyle.step2 ={ state: 'success', open: true };this.timelineStyle.step3 ={ state: 'not-started', open: false };">Back</button> (click)="this.timelineStyle.step3 ={ state: 'success', open: false };this.timelineStyle.step4 ={ state: 'current', open: true }; this.downloadExcel(id);">Complete</button>
<button class="btn btn-primary-outline"
(click)="this.timelineStyle.step2 ={ state: 'success', open: true };this.timelineStyle.step3 ={ state: 'not-started', open: false };">Back</button>
<button type="button" class="btn btn-primary" (click)="this.timelineStyle.step3 ={state:'not-started',open:false};this.timelineStyle.step4 ={state:'not-started',open:true}">Next</button> <button type="button" class="btn btn-primary"
</div></div></div></div></div> (click)="this.timelineStyle.step3 ={state:'not-started',open:false};this.timelineStyle.step4 ={state:'not-started',open:true}">Next</button>
<!--STEP 3--> </div>
<div class="card" *ngIf="timelineStyle.step4.open;"> </div>
</div>
</div>
</div>
<!--STEP 3-->
<div class="card" *ngIf="timelineStyle.step4.open;">
<div class="card-header"> <div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Download Excel</h3> <h3 style="text-align: center;" *ngIf="!appToUpdate">Download Excel</h3>
<div class="clr-row"> <div class="clr-row">
</div> </div>
<div class="container"> <div class="container">
<button type="button" class="btn btn-primary"(click)="this.timelineStyle.step4 ={ state: 'success', open: false };this.timelineStyle.step5 ={ state: 'current', open: true }; ">Complete</button> <button type="button" class="btn btn-primary"
<button class="btn btn-primary-outline" (click)="this.timelineStyle.step3 ={ state: 'success', open: true };this.timelineStyle.step4 ={ state: 'not-started', open: false };">Back</button> (click)="this.timelineStyle.step4 ={ state: 'success', open: false };this.timelineStyle.step5 ={ state: 'current', open: true }; ">Complete</button>
<button class="btn btn-primary-outline"
(click)="this.timelineStyle.step3 ={ state: 'success', open: true };this.timelineStyle.step4 ={ state: 'not-started', open: false };">Back</button>
<button type="button" class="btn btn-primary" (click)="this.timelineStyle.step4 ={state:'not-started',open:false};this.timelineStyle.step5 ={state:'not-started',open:true}" >Next</button> <button type="button" class="btn btn-primary"
</div></div></div> (click)="this.timelineStyle.step4 ={state:'not-started',open:false};this.timelineStyle.step5 ={state:'not-started',open:true}">Next</button>
<!--STEP 4--> </div>
<div class="card" *ngIf="timelineStyle.step5.open"> </div>
</div>
<!--STEP 4-->
<div class="card" *ngIf="timelineStyle.step5.open">
<div class="card-header"> <div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">File is Downloaded</h3> <h3 style="text-align: center;" *ngIf="!appToUpdate">File is Downloaded</h3>
<div class="container"> <div class="container">
<button class="btn btn-primary-outline" (click)="this.timelineStyle.step4 ={ state: 'current', open: true };this.timelineStyle.step5 ={ state: 'not-started', open: false };">Back</button> <button class="btn btn-primary-outline"
<button class="btn btn-primary" (click)="this.timelineStyle.step5 ={ state: 'success', open: false }; this.back()"> Finish</button> (click)="this.timelineStyle.step4 ={ state: 'current', open: true };this.timelineStyle.step5 ={ state: 'not-started', open: false };">Back</button>
<button class="btn btn-primary"
(click)="this.timelineStyle.step5 ={ state: 'success', open: false }; this.back()"> Finish</button>
</div></div></div> </div>
</div>
</div>
</div> </div>
<clr-modal [(clrModalOpen)]="mappperModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true"> <clr-modal [(clrModalOpen)]="mappperModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true">
<h3 class="modal-title"> MAPPER FORM</h3> <h3 class="modal-title"> MAPPER FORM</h3>
<div class="modal-body"> <div class="modal-body">
<form > <form>
<div class="clr-row" style="padding-left: 10px;"> <div class="clr-row" style="padding-left: 10px;">
<div *ngFor="let sheetName of sheetNames" > <div *ngFor="let sheetName of sheetNames">
<button class="btn btn-primary" (click)="getHeaderbybutton(id,sheetName)">{{sheetName}}</button> <button class="btn btn-primary" (click)="getHeaderbybutton(id,sheetName)">{{sheetName}}</button>
</div> </div>
<!-- <button class="btn btn-primary" (click)="checkData()">Check data</button> --> <!-- <button class="btn btn-primary" (click)="checkData()">Check data</button> -->
@ -347,7 +388,8 @@
<tbody> <tbody>
<tr *ngFor="let data of JsonHeader[selectedSheetName]; let i = index"> <tr *ngFor="let data of JsonHeader[selectedSheetName]; let i = index">
<td class="left"> <td class="left">
<input type="text" [(ngModel)]="data.headerName" [ngModelOptions]="{standalone: true}" name="headerName" class="clr-input" readonly/> <input type="text" [(ngModel)]="data.headerName" [ngModelOptions]="{standalone: true}"
name="headerName" class="clr-input" readonly />
</td> </td>
<td> <td>
<!-- <input type="text" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-input"/> --> <!-- <input type="text" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-input"/> -->
@ -370,13 +412,13 @@
</div> </div>
</form> </form>
</div> </div>
</clr-modal> </clr-modal>
<clr-modal [(clrModalOpen)]="ruleModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true"> <clr-modal [(clrModalOpen)]="ruleModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true">
<h3 class="modal-title">Add Rule Lines</h3> <h3 class="modal-title">Add Rule Lines</h3>
<div class="modal-body"> <div class="modal-body">
<form> <form>
<div class="clr-row fieldWrapper" > <div class="clr-row fieldWrapper">
<div class="clr-col-12"> <div class="clr-col-12">
<table class="table table-striped table-bordered" style="margin-top: 0px;"> <table class="table table-striped table-bordered" style="margin-top: 0px;">
<thead> <thead>
@ -395,32 +437,41 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of RuleHeader; let i = index"> <tr *ngFor="let data of RuleHeader; let i = index">
<td > <td>
<input type="text" [(ngModel)]="data.rulename" [ngModelOptions]="{standalone: true}" name="rulename" class="clr-input"> <input type="text" [(ngModel)]="data.rulename" [ngModelOptions]="{standalone: true}" name="rulename"
class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.fromsheet" [ngModelOptions]="{standalone: true}" name="fromsheet" class="clr-input"> <input type="text" [(ngModel)]="data.fromsheet" [ngModelOptions]="{standalone: true}"
name="fromsheet" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.fromColumn" [ngModelOptions]="{standalone: true}" name="fromcolomn" class="clr-input"> <input type="text" [(ngModel)]="data.fromColumn" [ngModelOptions]="{standalone: true}"
name="fromcolomn" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.validationTable" [ngModelOptions]="{standalone: true}" name="validationtable" class="clr-input"> <input type="text" [(ngModel)]="data.validationTable" [ngModelOptions]="{standalone: true}"
name="validationtable" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.checkColumn" [ngModelOptions]="{standalone: true}" name="checkcolumn" class="clr-input"> <input type="text" [(ngModel)]="data.checkColumn" [ngModelOptions]="{standalone: true}"
name="checkcolumn" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.useColumn" [ngModelOptions]="{standalone: true}" name="useColumn" class="clr-input"> <input type="text" [(ngModel)]="data.useColumn" [ngModelOptions]="{standalone: true}"
name="useColumn" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.replacementTable" [ngModelOptions]="{standalone: true}" name="replacementTable" class="clr-input"> <input type="text" [(ngModel)]="data.replacementTable" [ngModelOptions]="{standalone: true}"
name="replacementTable" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.replacementcolumn" [ngModelOptions]="{standalone: true}" name="replacementcolumn" class="clr-input"> <input type="text" [(ngModel)]="data.replacementcolumn" [ngModelOptions]="{standalone: true}"
name="replacementcolumn" class="clr-input">
</td> </td>
<td > <td>
<input type="text" [(ngModel)]="data.errormsg" [ngModelOptions]="{standalone: true}" name="errormsg" class="clr-input"> <input type="text" [(ngModel)]="data.errormsg" [ngModelOptions]="{standalone: true}" name="errormsg"
class="clr-input">
</td> </td>
<td style="width:40px;"> <td style="width:40px;">
<a (click)="deleteRow(i)"> <a (click)="deleteRow(i)">
@ -443,7 +494,4 @@
</div> </div>
</form> </form>
</div> </div>
</clr-modal> </clr-modal>

View File

@ -16,48 +16,48 @@ export class DatamananementworkflowComponent implements OnInit {
getbyiddata; getbyiddata;
id; id;
columns: any[]; columns: any[];
rows:any[]; rows: any[];
bodyrow:any[]=[]; bodyrow: any[] = [];
getHeaderData; getHeaderData;
JsonHeader = []; JsonHeader = [];
rowdata; rowdata;
transform:boolean = false; transform: boolean = false;
checkTransform:boolean = true; checkTransform: boolean = true;
mapperText:string = ''; mapperText: string = '';
changeKeyJson:any[]; changeKeyJson: any[];
tableName; tableName;
// Layout direction changing // Layout direction changing
layout = { layout = {
direction: "horizontal", direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container", block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container", block2: "clr-col-lg-12 clr-col-12 container",
} }
timelineStyle = { timelineStyle = {
step0: { state: "current", open: true, failed: false }, step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false }, step1: { state: "not-started", open: false, failed: false },
step2: { state: "not-started", open: false, failed: false }, step2: { state: "not-started", open: false, failed: false },
step3: { state: "not-started", open: false, failed: false }, step3: { state: "not-started", open: false, failed: false },
step4: { state: "not-started", open: false, failed: false }, step4: { state: "not-started", open: false, failed: false },
step5: { state: "not-started", open: false, failed: false }, step5: { state: "not-started", open: false, failed: false },
}; };
json: string = ""; json: string = "";
luisApp = luisApp =
{ {
name: '', name: '',
created: 1, created: 1,
trained: 1, trained: 1,
tested: 1, tested: 1,
updated:1, updated: 1,
published: 1, published: 1,
}; };
constructor( private excel: ExcelService, private datamservice:DatamanagementService, private toastr: ToastrService,private router: Router, constructor(private excel: ExcelService, private datamservice: DatamanagementService, private toastr: ToastrService, private router: Router,
private route: ActivatedRoute,public bulkUpload:BulkimportService) { } private route: ActivatedRoute, public bulkUpload: BulkimportService) { }
ngOnInit(): void { ngOnInit(): void {
this.id = this.route.snapshot.params["id"]; this.id = this.route.snapshot.params["id"];
@ -72,10 +72,10 @@ json: string = "";
} }
getall(){ getall() {
this.datamservice.getall().subscribe((data)=>{ this.datamservice.getall().subscribe((data) => {
console.log(data); console.log(data);
this.data=data; this.data = data;
}) })
} }
@ -88,15 +88,15 @@ json: string = "";
}); });
} }
headerData; headerData;
getColumns(table){ getColumns(table) {
console.log(table); console.log(table);
// console.log(this.getbyiddata.entityName); // console.log(this.getbyiddata.entityName);
this.bulkUpload.getColumnNames(table).subscribe((data) => { this.bulkUpload.getColumnNames(table).subscribe((data) => {
console.log(data); console.log(data);
this.headerData = data; this.headerData = data;
}); });
} }
getHeadersById(id){ getHeadersById(id) {
console.log(this.columnJson); console.log(this.columnJson);
this.bulkUpload.getHeader(id).subscribe((data) => { this.bulkUpload.getHeader(id).subscribe((data) => {
console.log(data); console.log(data);
@ -114,14 +114,14 @@ getHeadersById(id){
// "Site":[{"headerName":"balance","value":""},{"headerName":"city","value":""},{"headerName":"country","value":""},{"headerName":"credit_profile","value":""},{"headerName":"currency_code","value":""},{"headerName":"date_of_birth","value":""},{"headerName":"default_order_type","value":""},{"headerName":"dsa","value":""}]}` // "Site":[{"headerName":"balance","value":""},{"headerName":"city","value":""},{"headerName":"country","value":""},{"headerName":"credit_profile","value":""},{"headerName":"currency_code","value":""},{"headerName":"date_of_birth","value":""},{"headerName":"default_order_type","value":""},{"headerName":"dsa","value":""}]}`
// this.getHeaderData = json; // this.getHeaderData = json;
},(error) => { }, (error) => {
console.log(error); console.log(error);
}); });
} }
selectedSheetName: string | null = null; selectedSheetName: string | null = null;
getHeaderbybutton(id,sheetName){ getHeaderbybutton(id, sheetName) {
// this.bulkUpload.getHeader(id,sheetName).subscribe((data) => { // this.bulkUpload.getHeader(id,sheetName).subscribe((data) => {
// console.log(data); // console.log(data);
// this.getHeaderData = data; // this.getHeaderData = data;
@ -148,23 +148,23 @@ getHeadersById(id){
} }
checkData(){ checkData() {
console.log(this.JsonHeader); console.log(this.JsonHeader);
console.log(this.mapperText); console.log(this.mapperText);
} }
getkeychangesJson(){ getkeychangesJson() {
const jsonString = JSON.stringify(this.rows); const jsonString = JSON.stringify(this.rows);
console.log("body",jsonString); console.log("body", jsonString);
// const datajson = JSON.parse(this.datajson); // const datajson = JSON.parse(this.datajson);
// this.datajson = [datajson]; // this.datajson = [datajson];
// console.log(this.datajson); // console.log(this.datajson);
this.bulkUpload.changeKeysOfJson(this.datajson,jsonString).subscribe((data) => { this.bulkUpload.changeKeysOfJson(this.datajson, jsonString).subscribe((data) => {
console.log(data); console.log(data);
this.changeKeyJson = data.body; this.changeKeyJson = data.body;
},(error:HttpErrorResponse) => { }, (error: HttpErrorResponse) => {
console.log(error.error); console.log(error.error);
}); });
} }
@ -198,30 +198,30 @@ getHeadersById(id){
} }
return []; return [];
} }
// Change to Horizontal Layout // Change to Horizontal Layout
changeToHorizonTal() { changeToHorizonTal() {
this.layout = { this.layout = {
direction: "horizontal", direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container", block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container", block2: "clr-col-lg-12 clr-col-12 container",
} }
} }
// Change to Vertical Layout // Change to Vertical Layout
changeToVertical() { changeToVertical() {
this.layout = { this.layout = {
direction: "vertical", direction: "vertical",
block1: "clr-col-lg-3 clr-col-12 ", block1: "clr-col-lg-3 clr-col-12 ",
block2: "clr-col-lg-9 clr-col-12 ", block2: "clr-col-lg-9 clr-col-12 ",
} }
} }
reset() { reset() {
this.json = ""; this.json = "";
this.luisApp = this.luisApp =
{ {
name: '', name: '',
trained: 1, trained: 1,
tested: 1, tested: 1,
updated:1, updated: 1,
published: 1, published: 1,
@ -237,41 +237,38 @@ reset() {
step4: { state: "not-started", open: false, failed: false }, step4: { state: "not-started", open: false, failed: false },
step5: { state: "not-started", open: false, failed: false }, step5: { state: "not-started", open: false, failed: false },
}; };
} }
//dynamic table //dynamic table
sheetNames:any; sheetNames: any;
getSheetName(id){ getSheetName(id) {
this.bulkUpload.getSheetName(id).subscribe(data => { this.bulkUpload.getSheetName(id).subscribe(data => {
console.log(data); console.log(data);
this.sheetNames = data; this.sheetNames = data;
}); });
} }
getTableData(id){ getTableData(id) {
// console.log(this.getbyiddata.file_name); // console.log(this.getbyiddata.file_name);
this.bulkUpload.convertFileToJson(id).subscribe((data) => { this.bulkUpload.convertFileToJson(id).subscribe((data) => {
this.rows = data; this.rows = data;
// this.bodyrow = data; // this.bodyrow = data;
console.log(this.rows); console.log(this.rows);
this.rowdata= [this.rows]; this.rowdata = [this.rows];
this.rows = [this.rows] this.rows = [this.rows]
console.log(typeof this.rows); console.log(typeof this.rows);
if(data){ if (data) {
// this.toastr.success("Run Successfully") // this.toastr.success("Run Successfully")
} }
var j; var j;
var cart = []; var cart = [];
for(var i = 0; i < data.length; i++) for (var i = 0; i < data.length; i++) {
{
var columnsIn = data[i]; var columnsIn = data[i];
if(i==1) if (i == 1) {
{ for (var key in columnsIn) {
for(var key in columnsIn) j = { prop: key, name: key };
{
j={prop:key , name: key};
cart.push(j) cart.push(j)
} }
@ -279,73 +276,73 @@ this.rows = [this.rows]
} }
this.columns = cart; this.columns = cart;
}); });
} }
// sheetNames = ['Customer', 'Site']; // sheetNames = ['Customer', 'Site'];
getHeaders(sheetName: string) { getHeaders(sheetName: string) {
if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) { if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) {
// Assuming the first item in the array contains the keys. // Assuming the first item in the array contains the keys.
return Object.keys(this.rows[0][sheetName][0]); return Object.keys(this.rows[0][sheetName][0]);
} }
return []; return [];
} }
getData(sheetName: string) { getData(sheetName: string) {
if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) { if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) {
// Returning the array of data. // Returning the array of data.
return this.rows[0][sheetName]; return this.rows[0][sheetName];
} }
return []; return [];
} }
// getHeaders() { // getHeaders() {
// let headers: string[] = []; // let headers: string[] = [];
// this.rows= [] // this.rows= []
// if(this.rows) { // if(this.rows) {
// this.rows.forEach((value) => { // this.rows.forEach((value) => {
// Object.keys(value).forEach((key) => { // Object.keys(value).forEach((key) => {
// if(!headers.find((header) => header == key)){ // if(!headers.find((header) => header == key)){
// headers.push(key) // headers.push(key)
// } // }
// }) // })
// }) // })
// } // }
// return headers; // return headers;
// } // }
//data mapping //data mapping
checkTrans(){ checkTrans() {
console.log("transform open") console.log("transform open")
// console.log(this.storeData); // console.log(this.storeData);
if(this.getHeaderData){ if (this.getHeaderData) {
this.checkTransform = false; this.checkTransform = false;
this.transform = true; this.transform = true;
console.log(this.getHeaderData); console.log(this.getHeaderData);
if(this.mapperText === "undefined"){ this.mapperText= '';} if (this.mapperText === "undefined") { this.mapperText = ''; }
const currentText = this.mapperText; const currentText = this.mapperText;
let trnsfData = currentText + '' +this.getHeaderData; let trnsfData = currentText + '' + this.getHeaderData;
this.mapperText = trnsfData; this.mapperText = trnsfData;
}else { } else {
this.checkTransform = true; this.checkTransform = true;
this.transform = false; this.transform = false;
} }
} }
mappperModal = false; mappperModal = false;
goFromMapper(){ goFromMapper() {
this.mappperModal = true; this.mappperModal = true;
this.selectedSheetName = this.sheetNames[0]; this.selectedSheetName = this.sheetNames[0];
const tablename = this.columnJson[0].TableName; const tablename = this.columnJson[0].TableName;
this.getColumns(tablename) this.getColumns(tablename)
if(this.mapperText){ if (this.mapperText) {
try { try {
this.JsonHeader = JSON.parse(this.mapperText); this.JsonHeader = JSON.parse(this.mapperText);
console.log('Received data:', this.JsonHeader ); console.log('Received data:', this.JsonHeader);
} catch (e) { console.error('Invalid JSON:', this.mapperText);} } catch (e) { console.error('Invalid JSON:', this.mapperText); }
}else } else
if (this.getHeaderData) { if (this.getHeaderData) {
// try { // try {
// this.serverData = data.replace(/\[|\]|"/g, '').split(','); //(/\[|\]|'/g, '') //(/[\[\]"]/g, '') // this.serverData = data.replace(/\[|\]|"/g, '').split(','); //(/\[|\]|'/g, '') //(/[\[\]"]/g, '')
@ -353,8 +350,8 @@ goFromMapper(){
// } catch (e) { console.error('Invalid JSON:', data);} // } catch (e) { console.error('Invalid JSON:', data);}
try { try {
this.JsonHeader = JSON.parse(this.getHeaderData); this.JsonHeader = JSON.parse(this.getHeaderData);
console.log('Received data:', this.JsonHeader ); console.log('Received data:', this.JsonHeader);
} catch (e) { console.error('Invalid JSON:', this.getHeaderData);} } catch (e) { console.error('Invalid JSON:', this.getHeaderData); }
} }
//this.mappperclick = true; //this.mappperclick = true;
@ -363,77 +360,77 @@ goFromMapper(){
// if(this.mappperclick = true && this.datajson!= null){ // if(this.mappperclick = true && this.datajson!= null){
// this.nodeEditProperties.mappers = this.datajson; // this.nodeEditProperties.mappers = this.datajson;
// } // }
} }
transReset(){ transReset() {
this.mapperText = ''; this.mapperText = '';
this.transform = false; this.transform = false;
this.checkTransform = true; this.checkTransform = true;
} }
Rule:boolean = false; Rule: boolean = false;
checkRule:boolean = true; checkRule: boolean = true;
RuleData:string = ''; RuleData: string = '';
ruleModal = false; ruleModal = false;
RuleHeader = []; RuleHeader = [];
checkRules(){ checkRules() {
console.log("rule line open") console.log("rule line open")
this.ruleModal = true; this.ruleModal = true;
} }
rulechecking(){ rulechecking() {
if(this.RuleData){ if (this.RuleData) {
console.log(this.RuleData); console.log(this.RuleData);
this.checkRule = false; this.checkRule = false;
this.Rule = true; this.Rule = true;
}else{ } else {
this.Rule = false; this.Rule = false;
this.checkRule = true; this.checkRule = true;
} }
} }
mappperclick = false; mappperclick = false;
goFromRule(){ goFromRule() {
this.ruleModal = true; this.ruleModal = true;
if(this.RuleData){ if (this.RuleData) {
try { try {
this.RuleHeader = JSON.parse(this.RuleData); this.RuleHeader = JSON.parse(this.RuleData);
console.log('Received data:', this.RuleHeader ); console.log('Received data:', this.RuleHeader);
} catch (e) { console.error('Invalid JSON:', this.RuleData);} } catch (e) { console.error('Invalid JSON:', this.RuleData); }
} }
console.log(this.RuleHeader); console.log(this.RuleHeader);
} }
resetRule(){ resetRule() {
this.RuleData = undefined; this.RuleData = undefined;
this.RuleHeader = []; this.RuleHeader = [];
this.Rule = false; this.Rule = false;
this.checkRule = true; this.checkRule = true;
} }
onAddLines(){ onAddLines() {
this.RuleHeader.push({ this.RuleHeader.push({
rulename: "", rulename: "",
fromsheet:"", fromsheet: "",
fromColumn: "", fromColumn: "",
validationTable: "", validationTable: "",
checkColumn: "", checkColumn: "",
useColumn:"", useColumn: "",
replacementTable:"", replacementTable: "",
replacementcolumn:"", replacementcolumn: "",
errormsg:"" errormsg: ""
}); });
} }
deleteRow(index) { deleteRow(index) {
this.RuleHeader.splice(index, 1); this.RuleHeader.splice(index, 1);
} }
onRuleUpdate(){ onRuleUpdate() {
this.ruleModal = false; this.ruleModal = false;
console.log("rule",this.RuleHeader); console.log("rule", this.RuleHeader);
let serverData = JSON.stringify(this.RuleHeader); let serverData = JSON.stringify(this.RuleHeader);
// console.log(serverData); // console.log(serverData);
let product = JSON.stringify(serverData); let product = JSON.stringify(serverData);
@ -442,14 +439,14 @@ onRuleUpdate(){
try { try {
this.RuleData = JSON.parse(product); this.RuleData = JSON.parse(product);
console.log('Received rulejson data:', this.RuleData); console.log('Received rulejson data:', this.RuleData);
} catch (e) { console.error('Invalid JSON:', product);} } catch (e) { console.error('Invalid JSON:', product); }
this.rulechecking() this.rulechecking()
} }
datajson; datajson;
keychangeTable = false; keychangeTable = false;
onUpdate(){ onUpdate() {
this.mappperModal = false; this.mappperModal = false;
console.log(this.JsonHeader); console.log(this.JsonHeader);
let serverData = JSON.stringify(this.JsonHeader); let serverData = JSON.stringify(this.JsonHeader);
@ -460,7 +457,7 @@ onUpdate(){
try { try {
this.datajson = JSON.parse(product); this.datajson = JSON.parse(product);
console.log('Received Newjson data:', this.datajson); console.log('Received Newjson data:', this.datajson);
} catch (e) { console.error('Invalid JSON:', product);} } catch (e) { console.error('Invalid JSON:', product); }
this.mapperText = this.datajson; this.mapperText = this.datajson;
@ -472,23 +469,23 @@ onUpdate(){
// console.log(output); // console.log(output);
this.getkeychangesJson(); this.getkeychangesJson();
this.keychangeTable=true; this.keychangeTable = true;
} }
//download excel file //download excel file
selectedTable; selectedTable;
selectTable(val){ selectTable(val) {
this.selectedTable = val; this.selectedTable = val;
// this.downloadExcel(val); // this.downloadExcel(val);
} }
downloadExcel(id){ downloadExcel(id) {
console.log(this.changeKeyJson); console.log(this.changeKeyJson);
const jsonDataWithoutBrackets = this.changeKeyJson[0]; const jsonDataWithoutBrackets = this.changeKeyJson[0];
console.log(jsonDataWithoutBrackets); console.log(jsonDataWithoutBrackets);
console.log(this.RuleHeader); console.log(this.RuleHeader);
this.bulkUpload.downloadExcel(id,jsonDataWithoutBrackets,this.RuleHeader).subscribe( this.bulkUpload.downloadExcel(id, jsonDataWithoutBrackets, this.RuleHeader).subscribe(
(response: Blob) => { (response: Blob) => {
// Process the downloaded Excel file // Process the downloaded Excel file
console.log(response); console.log(response);
@ -521,9 +518,9 @@ downloadExcel(id){
} }
); );
} }
getSheet(id){ getSheet(id) {
this.bulkUpload.getSheet(id).subscribe( this.bulkUpload.getSheet(id).subscribe(
(response: Blob) => { (response: Blob) => {
// Process the downloaded Excel file // Process the downloaded Excel file
@ -536,15 +533,15 @@ getSheet(id){
link.click(); link.click();
}); });
} }
back(){ back() {
this.router.navigate(["../../datamanagement"], { relativeTo: this.route }); this.router.navigate(["../../datamanagement"], { relativeTo: this.route });
} }
////step 1 - mapping name ////step 1 - mapping name
columnJson =[] columnJson = []
getColumnforstep1(){ getColumnforstep1() {
const objectArray = this.sheetNames.map(key => ({ const objectArray = this.sheetNames.map(key => ({
sheetName: key, sheetName: key,