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">
<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>
<div class="dg-wrapper">
@ -14,21 +14,22 @@
<button class="btn btn-outline" (click)="getall()">
<clr-icon shape="refresh"></clr-icon> Reload
</button>
<button class="btn btn-outline" (click)="onExport()">
<button class="btn btn-outline" (click)="onExport()">
<clr-icon shape="export"></clr-icon> xlsx
</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
</button>
</div>
</div>
<clr-datagrid [clrDgLoading]="loading" >
<clr-datagrid [clrDgLoading]="loading">
<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
</ng-container></clr-dg-column>
</ng-container></clr-dg-column>
<!-- <clr-dg-column [clrDgField]="'name'"> <ng-container *clrDgHideableColumn="{hidden: false}">
User Name
</ng-container></clr-dg-column> -->
@ -36,25 +37,27 @@
<ng-container *clrDgHideableColumn="{hidden: false}">
Entity Name
</ng-container>
</clr-dg-column >
</clr-dg-column>
<clr-dg-column [clrDgField]="'subject'"> <ng-container *clrDgHideableColumn="{hidden: false}">
File Name
</ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="''" style="width: 220px;"> <ng-container *clrDgHideableColumn="{hidden: false}">
Action
File Name
</ng-container></clr-dg-column>
<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>{{user.entityName}}</clr-dg-cell>
<clr-dg-column [clrDgField]="''" style="width: 220px;"> <ng-container *clrDgHideableColumn="{hidden: false}">
Action
</ng-container></clr-dg-column>
<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>{{user.entity_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">
<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 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>
</a>
</clr-dg-cell>
<clr-dg-action-overflow>
<button class="action-item" (click)="onEdit(user)">Edit</button>
<button class="action-item" (click)="onEdit(user)">Edit</button>
</clr-dg-action-overflow>
@ -94,7 +97,7 @@
<div class="clr-col-md-4 clr-col-sm-12">
<label for="email">Entity Name</label>
<!-- <input type="text" list="config" class="clr-dropdown" name="file_type" [(ngModel)]="rowSelected.file_type"> -->
<select name="entityName" [(ngModel)]="rowSelected.entityName" class="clr-dropdown">
<select name="entityName" [(ngModel)]="rowSelected.entityName" class="clr-dropdown">
<option *ngFor="let data of tableList" [value]="data.entity_name">{{data.entity_name}}</option>
</select>
</div>
@ -108,8 +111,8 @@
<br>
<div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="modalEdit = false">Cancel</button>
<button type="submit" class="btn btn-primary" >UPDATE</button>
</div>
<button type="submit" class="btn btn-primary">UPDATE</button>
</div>
</form>
</div>
</clr-modal>
@ -122,7 +125,7 @@
<h2 class="heading">{{rowSelected.id}}</h2>
<div class="modal-footer">
<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>
</clr-modal>
@ -157,17 +160,17 @@
</div>
<div class="clr-col-md-4 clr-col-sm-12">
<label for="email">File</label>
<input type="file" (change)="onFileChanged($event)" formControlName="file_name">
</div>
<input type="file" (change)="onFileChanged($event)" formControlName="file_name">
</div>
</div>
<br>
<div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="modalAdd = false">Cancel</button>
<button type="submit" class="btn btn-primary" >ADD</button>
</div>
<button type="submit" class="btn btn-primary">ADD</button>
</div>
</form>
</form>
</div>
</clr-modal>
</clr-modal>

View File

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

View File

@ -1,4 +1,3 @@
<ol class="breadcrumb breadcrumb-arrow font-trirong">
<li><a href="javascript://" [routerLink]="['/']">Admin</a></li>
<li><a href="javascript://">Data Import </a></li>
@ -13,63 +12,65 @@
<span class="spacer"></span>
<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)="changeToVertical()" *ngIf="layout.direction === 'horizontal'">Vertical Layout</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)="changeToVertical()" *ngIf="layout.direction === 'horizontal'">Vertical
Layout</button>
</div>
<div class="clr-row" >
<div [class]="layout.block1" >
<div class="clr-row">
<div [class]="layout.block1">
<div class="card">
<div class="card-header">
<div class="clr-row">
<div class="clr-col-6">
<div class="clr-row">
<div class="clr-col-6">
<h3 style="text-align: right;"> Data Import</h3>
</div>
<div class="clr-col-6" style="text-align: right;" *ngIf="timelineStyle.step4.open">
<button type="button" class="btn text-dark" (click)="getSheet(id)">Download File</button>
</div>
</div>
<div class="clr-col-6" style="text-align: right;" *ngIf="timelineStyle.step4.open">
<button type="button" class="btn text-dark" (click)="getSheet(id)">Download File</button>
</div>
</div>
<div class=" card-block container">
<div class=" card-block container">
<clr-timeline [clrLayout]="layout.direction" >
<clr-timeline-step [clrState]="timelineStyle.step0.state">
<clr-timeline-step-header>Step 0</clr-timeline-step-header>
<clr-timeline-step-title> <span >Review</span> </clr-timeline-step-title>
</clr-timeline-step>
<clr-timeline [clrLayout]="layout.direction">
<clr-timeline-step [clrState]="timelineStyle.step0.state">
<clr-timeline-step-header>Step 0</clr-timeline-step-header>
<clr-timeline-step-title> <span>Review</span> </clr-timeline-step-title>
</clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step1.state">
<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>
<clr-timeline-step [clrState]="timelineStyle.step1.state">
<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>
<clr-timeline-step class="gemini-ignore" [clrState]="timelineStyle.step2.state">
<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>
<clr-timeline-step class="gemini-ignore" [clrState]="timelineStyle.step2.state">
<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>
<clr-timeline-step [clrState]="timelineStyle.step3.state" >
<clr-timeline-step-header>Step 3</clr-timeline-step-header>
<clr-timeline-step-title><span>Import</span></clr-timeline-step-title>
<clr-timeline-step [clrState]="timelineStyle.step3.state">
<clr-timeline-step-header>Step 3</clr-timeline-step-header>
<clr-timeline-step-title><span>Import</span></clr-timeline-step-title>
</clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step4.state" >
<clr-timeline-step-header>Step 4</clr-timeline-step-header>
<clr-timeline-step-title>Download Excel</clr-timeline-step-title>
</clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step4.state">
<clr-timeline-step-header>Step 4</clr-timeline-step-header>
<clr-timeline-step-title>Download Excel</clr-timeline-step-title>
</clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step5.state">
<clr-timeline-step-header>Step 5</clr-timeline-step-header>
<clr-timeline-step-title>Finish</clr-timeline-step-title>
</clr-timeline-step>
<clr-timeline-step [clrState]="timelineStyle.step5.state">
<clr-timeline-step-header>Step 5</clr-timeline-step-header>
<clr-timeline-step-title>Finish</clr-timeline-step-title>
</clr-timeline-step>
</clr-timeline>
</clr-timeline-step>
</clr-timeline>
</div>
</div>
</div>
</div>
</div>
<div [class]="layout.block2" >
<div [class]="layout.block2">
<!--STEP 0-->
<div class="card" *ngIf="timelineStyle.step0.open">
@ -78,12 +79,12 @@
<h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3>
<div class="container">
<br/>
<br />
<!-- entry form-->
<form #contactForm="ngForm" (ngSubmit)="onSave()">
<div class="container">
<!-- <div class="clr-row">
<!-- <div class="clr-row">
<div class="horizontal1">
<label for="tags"> Student Name<span class="required-field">*</span></label>
<input id="name" type="text" placeholder="Enter name" name="name" required>
@ -104,152 +105,175 @@
</div>
</div> -->
<!-- end row -->
<div *ngFor="let sheetName of sheetNames" >
<h3>{{ sheetName }}</h3>
<div style="max-width:fit-content; overflow-x:auto">
<table class="table">
<thead>
<tr>
<th *ngFor="let co of getHeaders(sheetName)">{{ co }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of getData(sheetName)">
<td *ngFor="let key of getHeaders(sheetName)">{{ item[key] }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<div class="button">
<!-- <button type="submit" class="btn btn-primary" [disabled]="!contactForm.valid">Submit</button> -->
<!-- end row -->
<div *ngFor="let sheetName of sheetNames">
<h3>{{ sheetName }}</h3>
<div style="max-width:fit-content; overflow-x:auto">
<table class="table">
<thead>
<tr>
<th *ngFor="let co of getHeaders(sheetName)">{{ co }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of getData(sheetName)">
<td *ngFor="let key of getHeaders(sheetName)">{{ item[key] }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<div class="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" (click)=" this.timelineStyle.step0 ={state:'current',open:false};this.timelineStyle.step1 ={state:'not-started',open:true}">Next</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"
(click)=" this.timelineStyle.step0 ={state:'current',open:false};this.timelineStyle.step1 ={state:'not-started',open:true}">Next</button>
</div>
</div>
</div>
</form>
</div>
<div class="container">
</div>
</div></div>
<!--STEP 1-->
<div class="card" *ngIf="timelineStyle.step1.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Table Mapping</h3>
</div>
</div>
<!--STEP 1-->
<div class="card" *ngIf="timelineStyle.step1.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Table Mapping</h3>
<form #contactForm="ngForm" >
<form #contactForm="ngForm">
<div class="container">
<div class="clr-row fieldWrapper">
<div class="clr-col-md-12 clr-col-sm-12">
<table class="table" style="width:100%;">
<thead>
<div class="container">
<div class="clr-row fieldWrapper">
<div class="clr-col-md-12 clr-col-sm-12">
<table class="table" style="width:100%;">
<thead>
<tr>
<th>Sheet Name</th>
<th>Table Name</th>
<th>Sheet Name</th>
<th>Table Name</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<tr *ngFor="let data of columnJson; let i = index">
<td class="left">
<input type="text" [(ngModel)]="data.sheetName" [ngModelOptions]="{standalone: true}" name="sheetName" class="clr-input" readonly/>
</td>
<td>
<input type="text" [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}" name="TableName" class="clr-input"/>
<!-- <select [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}" name="TableName">
<td class="left">
<input type="text" [(ngModel)]="data.sheetName" [ngModelOptions]="{standalone: true}"
name="sheetName" class="clr-input" readonly />
</td>
<td>
<input type="text" [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}"
name="TableName" class="clr-input" />
<!-- <select [(ngModel)]="data.TableName" [ngModelOptions]="{standalone: true}" name="TableName">
<option *ngFor="let data of headerData" [value]="data">{{data}}</option>
</select> -->
</td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- <button type="submit" class="btn btn-primary" >Submit</button> -->
</tbody>
</table>
</div>
</div>
<!-- <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 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: '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 class="container">
<div class="clr-col-6">
</div>
</div>
<div class="container" >
</div>
</div></div>
<div class="card" *ngIf="timelineStyle.step2.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Data Mapping</h3>
<form #contactForm="ngForm" >
<div class="container">
<div class="clr-row">
<div class="horizontal1 clr-col-6">
<div *ngIf="checkTransform">
<span class="label label-light-green p7 lbutton" (click)="checkTrans()">Enable TransFormation</span>
<!-- <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>
</div>
<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>
<textarea type="text" name="mapperText" style="height:150px;" [(ngModel)]="mapperText" readonly></textarea>
</form>
<div class="container">
<div class="clr-col-6">
</div>
</div>
<div class="horizontal1 clr-col-6">
<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>
<!-- <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>
</div>
<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>
<textarea type="text" name="RuleData" style="height:150px;" [(ngModel)]="RuleData" readonly></textarea>
</div>
<div class="container">
</div>
</div>
<!-- <button type="submit" class="btn btn-primary" >Submit</button> -->
</div>
<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 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>
<div class="card" *ngIf="timelineStyle.step2.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Data Mapping</h3>
</div></form>
<div class="container">
<div class="clr-col-6">
<form #contactForm="ngForm">
<div class="container">
<div class="clr-row">
<div class="horizontal1 clr-col-6">
<div *ngIf="checkTransform">
<span class="label label-light-green p7 lbutton" (click)="checkTrans()">Enable TransFormation</span>
<!-- <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>
</div>
<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>
<textarea type="text" name="mapperText" style="height:150px;" [(ngModel)]="mapperText"
readonly></textarea>
</div>
</div>
<div class="horizontal1 clr-col-6">
<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>
<!-- <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>
</div>
<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>
<textarea type="text" name="RuleData" style="height:150px;" [(ngModel)]="RuleData"
readonly></textarea>
</div>
</div>
</div>
<!-- <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 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>
</div>
</form>
<div class="container">
<div class="clr-col-6">
</div>
</div>
<div class="container">
</div>
</div>
</div>
<div class="container" >
</div>
</div></div>
<!--STEP 2-->
<div class="card" *ngIf="timelineStyle.step3.open">
<div class="card-header">
<h3 style="text-align: center;">Importing Data</h3>
<!-- <h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3> -->
<div class="container">
<div class="clr-row">
<div class="container" >
<div class="container" *ngIf="keychangeTable">
<!-- <table class="table">
<!--STEP 2-->
<div class="card" *ngIf="timelineStyle.step3.open">
<div class="card-header">
<h3 style="text-align: center;">Importing Data</h3>
<!-- <h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3> -->
<div class="container">
<div class="clr-row">
<div class="container">
<div class="container" *ngIf="keychangeTable">
<!-- <table class="table">
<thead>
<tr>
<th *ngFor="let co of getHeaderskeychange();let i=index">{{co}}</th>
@ -262,25 +286,25 @@
</tbody>
</table> -->
<div *ngFor="let sheetName of sheetNames">
<h3>{{ sheetName }}</h3>
<div style="max-width:1200px; overflow-x:auto ">
<table class="table">
<thead>
<tr>
<th *ngFor="let co of getHeaderskeychange(sheetName)">{{ co }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of getkeychangeData(sheetName)">
<td *ngFor="let key of getHeaderskeychange(sheetName)">{{ item[key] }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- <div class="clr-row">
<div *ngFor="let sheetName of sheetNames">
<h3>{{ sheetName }}</h3>
<div style="max-width:1200px; overflow-x:auto ">
<table class="table">
<thead>
<tr>
<th *ngFor="let co of getHeaderskeychange(sheetName)">{{ co }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of getkeychangeData(sheetName)">
<td *ngFor="let key of getHeaderskeychange(sheetName)">{{ item[key] }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- <div class="clr-row">
<div class="horizontal1">
<label for="tags"> Select Table:<span class="required-field">*</span></label><br>
@ -295,155 +319,179 @@
</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 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: '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>
</div></div></div></div></div>
<!--STEP 3-->
<div class="card" *ngIf="timelineStyle.step4.open;">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Download Excel</h3>
<div class="clr-row">
</div>
<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 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>
</div></div></div>
<!--STEP 4-->
<div class="card" *ngIf="timelineStyle.step5.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">File is Downloaded</h3>
<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" (click)="this.timelineStyle.step5 ={ state: 'success', open: false }; this.back()"> Finish</button>
</div></div></div>
</div>
<clr-modal [(clrModalOpen)]="mappperModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true">
<h3 class="modal-title"> MAPPER FORM</h3>
<div class="modal-body">
<form >
<div class="clr-row" style="padding-left: 10px;">
<div *ngFor="let sheetName of sheetNames" >
<button class="btn btn-primary" (click)="getHeaderbybutton(id,sheetName)">{{sheetName}}</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>
</div>
</div>
</div>
</div>
<!-- <button class="btn btn-primary" (click)="checkData()">Check data</button> -->
</div>
<div class="clr-row fieldWrapper">
<!--STEP 3-->
<div class="card" *ngIf="timelineStyle.step4.open;">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">Download Excel</h3>
<div class="clr-row">
</div>
<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 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>
</div>
</div>
</div>
<!--STEP 4-->
<div class="card" *ngIf="timelineStyle.step5.open">
<div class="card-header">
<h3 style="text-align: center;" *ngIf="!appToUpdate">File is Downloaded</h3>
<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"
(click)="this.timelineStyle.step5 ={ state: 'success', open: false }; this.back()"> Finish</button>
</div>
</div>
</div>
</div>
<clr-modal [(clrModalOpen)]="mappperModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true">
<h3 class="modal-title"> MAPPER FORM</h3>
<div class="modal-body">
<form>
<div class="clr-row" style="padding-left: 10px;">
<div *ngFor="let sheetName of sheetNames">
<button class="btn btn-primary" (click)="getHeaderbybutton(id,sheetName)">{{sheetName}}</button>
</div>
<!-- <button class="btn btn-primary" (click)="checkData()">Check data</button> -->
</div>
<div class="clr-row fieldWrapper">
<div class="clr-col-md-12 clr-col-sm-12">
<table class="table" style="width:100%;" *ngIf="selectedSheetName">
<thead>
<tr>
<th>Header Fields</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of JsonHeader[selectedSheetName]; let i = index">
<td class="left">
<input type="text" [(ngModel)]="data.headerName" [ngModelOptions]="{standalone: true}" name="headerName" class="clr-input" readonly/>
</td>
<td>
<!-- <input type="text" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-input"/> -->
<select [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value">
<option value="null">choose {{selectedSheetName}}</option>
<option *ngFor="let data of headerData" [value]="data">{{data}}</option>
</select>
</td>
</tr>
</tbody>
</table>
<table class="table" style="width:100%;" *ngIf="selectedSheetName">
<thead>
<tr>
<th>Header Fields</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of JsonHeader[selectedSheetName]; let i = index">
<td class="left">
<input type="text" [(ngModel)]="data.headerName" [ngModelOptions]="{standalone: true}"
name="headerName" class="clr-input" readonly />
</td>
<td>
<!-- <input type="text" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-input"/> -->
<select [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value">
<option value="null">choose {{selectedSheetName}}</option>
<option *ngFor="let data of headerData" [value]="data">{{data}}</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<div class="modal-footer">
<button type="button" form-control class="btn btn-outline" (click)="mappperModal = false">Back</button>
<button type="submit" form-control class="btn btn-primary" (click)="onUpdate()">SUBMIT</button>
</div>
</form>
</div>
</clr-modal>
<clr-modal [(clrModalOpen)]="ruleModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true">
<h3 class="modal-title">Add Rule Lines</h3>
<div class="modal-body">
<form>
<div class="clr-row fieldWrapper" >
<div class="clr-col-12">
<table class="table table-striped table-bordered" style="margin-top: 0px;">
<thead>
<tr>
<th>Rule Name</th>
<th>From Sheet</th>
<th>From Column</th>
<th>validation Table</th>
<th>Check Column</th>
<th>Use Column (Id)</th>
<th>Replacement Table (Id)</th>
<th>Replacement Column (Id)</th>
<th>Error Message</th>
<th class="right" style="width:90px;">Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of RuleHeader; let i = index">
<td >
<input type="text" [(ngModel)]="data.rulename" [ngModelOptions]="{standalone: true}" name="rulename" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.fromsheet" [ngModelOptions]="{standalone: true}" name="fromsheet" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.fromColumn" [ngModelOptions]="{standalone: true}" name="fromcolomn" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.validationTable" [ngModelOptions]="{standalone: true}" name="validationtable" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.checkColumn" [ngModelOptions]="{standalone: true}" name="checkcolumn" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.useColumn" [ngModelOptions]="{standalone: true}" name="useColumn" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.replacementTable" [ngModelOptions]="{standalone: true}" name="replacementTable" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.replacementcolumn" [ngModelOptions]="{standalone: true}" name="replacementcolumn" class="clr-input">
</td>
<td >
<input type="text" [(ngModel)]="data.errormsg" [ngModelOptions]="{standalone: true}" name="errormsg" class="clr-input">
</td>
<td style="width:40px;">
<a (click)="deleteRow(i)">
<clr-icon shape="trash" class="is-error"></clr-icon>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 10px;" (click)="onAddLines()">
<clr-icon shape="plus"></clr-icon>
</button>
</table>
</div>
</div>
<br>
<div class="modal-footer">
<button type="button" form-control class="btn btn-outline" (click)="ruleModal = false">Back</button>
<br>
<div class="modal-footer">
<button type="button" form-control class="btn btn-outline" (click)="mappperModal = false">Back</button>
<button type="submit" form-control class="btn btn-primary" (click)="onUpdate()">SUBMIT</button>
</div>
</form>
</div>
</clr-modal>
<clr-modal [(clrModalOpen)]="ruleModal" [clrModalSize]="'xl'" [clrModalStaticBackdrop]="true">
<h3 class="modal-title">Add Rule Lines</h3>
<div class="modal-body">
<form>
<div class="clr-row fieldWrapper">
<div class="clr-col-12">
<table class="table table-striped table-bordered" style="margin-top: 0px;">
<thead>
<tr>
<th>Rule Name</th>
<th>From Sheet</th>
<th>From Column</th>
<th>validation Table</th>
<th>Check Column</th>
<th>Use Column (Id)</th>
<th>Replacement Table (Id)</th>
<th>Replacement Column (Id)</th>
<th>Error Message</th>
<th class="right" style="width:90px;">Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of RuleHeader; let i = index">
<td>
<input type="text" [(ngModel)]="data.rulename" [ngModelOptions]="{standalone: true}" name="rulename"
class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.fromsheet" [ngModelOptions]="{standalone: true}"
name="fromsheet" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.fromColumn" [ngModelOptions]="{standalone: true}"
name="fromcolomn" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.validationTable" [ngModelOptions]="{standalone: true}"
name="validationtable" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.checkColumn" [ngModelOptions]="{standalone: true}"
name="checkcolumn" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.useColumn" [ngModelOptions]="{standalone: true}"
name="useColumn" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.replacementTable" [ngModelOptions]="{standalone: true}"
name="replacementTable" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.replacementcolumn" [ngModelOptions]="{standalone: true}"
name="replacementcolumn" class="clr-input">
</td>
<td>
<input type="text" [(ngModel)]="data.errormsg" [ngModelOptions]="{standalone: true}" name="errormsg"
class="clr-input">
</td>
<td style="width:40px;">
<a (click)="deleteRow(i)">
<clr-icon shape="trash" class="is-error"></clr-icon>
</a>
</td>
</tr>
</tbody>
<button type="button" class="btn btn-primary button1" style="margin-left: 10px;" (click)="onAddLines()">
<clr-icon shape="plus"></clr-icon>
</button>
</table>
</div>
</div>
<br>
<div class="modal-footer">
<button type="button" form-control class="btn btn-outline" (click)="ruleModal = false">Back</button>
<button type="submit" form-control class="btn btn-primary" (click)="onRuleUpdate()">SUBMIT</button>
</div>
</form>
</div>
</clr-modal>
</div>
</form>
</div>
</clr-modal>

View File

@ -16,48 +16,48 @@ export class DatamananementworkflowComponent implements OnInit {
getbyiddata;
id;
columns: any[];
rows:any[];
bodyrow:any[]=[];
rows: any[];
bodyrow: any[] = [];
getHeaderData;
JsonHeader = [];
rowdata;
transform:boolean = false;
checkTransform:boolean = true;
mapperText:string = '';
changeKeyJson:any[];
transform: boolean = false;
checkTransform: boolean = true;
mapperText: string = '';
changeKeyJson: any[];
tableName;
// Layout direction changing
layout = {
direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container",
}
timelineStyle = {
step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false },
step2: { state: "not-started", open: false, failed: false },
step3: { state: "not-started", open: false, failed: false },
step4: { state: "not-started", open: false, failed: false },
step5: { state: "not-started", open: false, failed: false },
};
// Layout direction changing
json: string = "";
layout = {
direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container",
}
timelineStyle = {
step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false },
step2: { state: "not-started", open: false, failed: false },
step3: { state: "not-started", open: false, failed: false },
step4: { state: "not-started", open: false, failed: false },
step5: { state: "not-started", open: false, failed: false },
};
json: string = "";
luisApp =
{
name: '',
created: 1,
trained: 1,
tested: 1,
updated:1,
published: 1,
{
name: '',
created: 1,
trained: 1,
tested: 1,
updated: 1,
published: 1,
};
constructor( private excel: ExcelService, private datamservice:DatamanagementService, private toastr: ToastrService,private router: Router,
private route: ActivatedRoute,public bulkUpload:BulkimportService) { }
};
constructor(private excel: ExcelService, private datamservice: DatamanagementService, private toastr: ToastrService, private router: Router,
private route: ActivatedRoute, public bulkUpload: BulkimportService) { }
ngOnInit(): void {
this.id = this.route.snapshot.params["id"];
@ -65,21 +65,21 @@ json: string = "";
this.getall();
this.getSheetName(this.id);
this.getById(this.id);
this.getTableData(this.id);
// this.getColumns(this.tableName);
// this.getHeadersById(this.id);
}
getall(){
this.datamservice.getall().subscribe((data)=>{
getall() {
this.datamservice.getall().subscribe((data) => {
console.log(data);
this.data=data;
this.data = data;
})
}
getById(id) {
this.datamservice.getTemplateById(id).subscribe((data) => {
console.log(data);
@ -88,20 +88,20 @@ json: string = "";
});
}
headerData;
getColumns(table){
getColumns(table) {
console.log(table);
// console.log(this.getbyiddata.entityName);
this.bulkUpload.getColumnNames(table).subscribe((data) => {
console.log(data);
this.headerData = data;
});
}
getHeadersById(id){
console.log(this.columnJson);
this.bulkUpload.getHeader(id).subscribe((data) => {
console.log(data);
this.getHeaderData = JSON.stringify(data);
});
}
getHeadersById(id) {
console.log(this.columnJson);
this.bulkUpload.getHeader(id).subscribe((data) => {
console.log(data);
this.getHeaderData = JSON.stringify(data);
// const objectArray = data.map(key => ({
// headerName: key,
// value: "",
@ -113,19 +113,19 @@ getHeadersById(id){
// const json = `{"Customer":[{"headerName":"balance","value":""},{"headerName":"c_status","value":""},{"headerName":"city","value":""},{"headerName":"country","value":""},{"headerName":"currency_code","value":""},{"headerName":"customer_id","value":""},{"headerName":"date_of_birth","value":""},{"headerName":"defaultsite_id","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;
},(error) => {
}, (error) => {
console.log(error);
});
}
selectedSheetName: string | null = null;
getHeaderbybutton(id,sheetName){
getHeaderbybutton(id, sheetName) {
// this.bulkUpload.getHeader(id,sheetName).subscribe((data) => {
// console.log(data);
// this.getHeaderData = data;
// const objectArray = data.map(key => ({
// headerName: key,
// value: "",
@ -133,426 +133,423 @@ getHeadersById(id){
// // console.log(objectArray);
// this.getHeaderData = JSON.stringify(objectArray);
// console.log(this.getHeaderData);
// },(error) => {
// console.log(error);
// });
this.selectedSheetName = sheetName;
const columnEntry = this.columnJson.find(entry => entry.sheetName === sheetName);
if (columnEntry) {
const tablename = columnEntry.TableName;
this.getColumns(tablename);
}
if (columnEntry) {
const tablename = columnEntry.TableName;
this.getColumns(tablename);
}
}
checkData(){
checkData() {
console.log(this.JsonHeader);
console.log(this.mapperText);
}
getkeychangesJson(){
getkeychangesJson() {
const jsonString = JSON.stringify(this.rows);
console.log("body",jsonString);
console.log("body", jsonString);
// const datajson = JSON.parse(this.datajson);
// this.datajson = [datajson];
// console.log(this.datajson);
this.bulkUpload.changeKeysOfJson(this.datajson,jsonString).subscribe((data) => {
this.bulkUpload.changeKeysOfJson(this.datajson, jsonString).subscribe((data) => {
console.log(data);
this.changeKeyJson = data.body;
},(error:HttpErrorResponse) => {
this.changeKeyJson = data.body;
}, (error: HttpErrorResponse) => {
console.log(error.error);
});
}
// getHeaderskeychange() {
// let headers: string[] = [];
// if(this.changeKeyJson) {
// this.changeKeyJson.forEach((value) => {
// Object.keys(value).forEach((key) => {
// if(!headers.find((header) => header == key)){
// headers.push(key)
// }
// })
// })
// }
// return headers;
// }
getHeaderskeychange(sheetName: string) {
if (this.changeKeyJson && this.changeKeyJson.length > 0 && this.changeKeyJson[0][sheetName]) {
// Assuming the first item in the array contains the keys.
return Object.keys(this.changeKeyJson[0][sheetName][0]);
}
// getHeaderskeychange() {
// let headers: string[] = [];
// if(this.changeKeyJson) {
// this.changeKeyJson.forEach((value) => {
// Object.keys(value).forEach((key) => {
// if(!headers.find((header) => header == key)){
// headers.push(key)
// }
// })
// })
// }
// return headers;
// }
getHeaderskeychange(sheetName: string) {
if (this.changeKeyJson && this.changeKeyJson.length > 0 && this.changeKeyJson[0][sheetName]) {
// Assuming the first item in the array contains the keys.
return Object.keys(this.changeKeyJson[0][sheetName][0]);
}
return [];
}
getkeychangeData(sheetName: string) {
if (this.changeKeyJson && this.changeKeyJson.length > 0 && this.changeKeyJson[0][sheetName]) {
// Returning the array of data.
return this.changeKeyJson[0][sheetName];
}
return [];
}
// Change to Horizontal Layout
changeToHorizonTal() {
this.layout = {
direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container",
return [];
}
}
// Change to Vertical Layout
changeToVertical() {
this.layout = {
direction: "vertical",
block1: "clr-col-lg-3 clr-col-12 ",
block2: "clr-col-lg-9 clr-col-12 ",
}
}
reset() {
this.json = "";
this.luisApp =
{
name: '',
trained: 1,
tested: 1,
updated:1,
published: 1,
created: 1,
};
this.timelineStyle = {
step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false },
step2: { state: "not-started", open: false, failed: false },
step3: { state: "not-started", open: false, failed: false },
step4: { state: "not-started", open: false, failed: false },
step5: { state: "not-started", open: false, failed: false },
};
}
//dynamic table
sheetNames:any;
getSheetName(id){
this.bulkUpload.getSheetName(id).subscribe(data => {
console.log(data);
this.sheetNames = data;
});
}
getTableData(id){
// console.log(this.getbyiddata.file_name);
this.bulkUpload.convertFileToJson(id).subscribe((data) => {
this.rows = data;
// this.bodyrow = data;
console.log(this.rows);
this.rowdata= [this.rows];
this.rows = [this.rows]
console.log(typeof this.rows);
if(data){
// this.toastr.success("Run Successfully")
getkeychangeData(sheetName: string) {
if (this.changeKeyJson && this.changeKeyJson.length > 0 && this.changeKeyJson[0][sheetName]) {
// Returning the array of data.
return this.changeKeyJson[0][sheetName];
}
var j;
var cart = [];
return [];
}
// Change to Horizontal Layout
changeToHorizonTal() {
this.layout = {
direction: "horizontal",
block1: "clr-col-lg-12 clr-col-12 height container",
block2: "clr-col-lg-12 clr-col-12 container",
}
}
// Change to Vertical Layout
changeToVertical() {
this.layout = {
direction: "vertical",
block1: "clr-col-lg-3 clr-col-12 ",
block2: "clr-col-lg-9 clr-col-12 ",
}
}
reset() {
this.json = "";
this.luisApp =
{
name: '',
trained: 1,
tested: 1,
updated: 1,
published: 1,
for(var i = 0; i < data.length; i++)
{
var columnsIn = data[i];
if(i==1)
{
for(var key in columnsIn)
{
j={prop:key , name: key};
cart.push(j)
created: 1,
};
this.timelineStyle = {
step0: { state: "current", open: true, failed: false },
step1: { state: "not-started", open: false, failed: false },
step2: { state: "not-started", open: false, failed: false },
step3: { state: "not-started", open: false, failed: false },
step4: { state: "not-started", open: false, failed: false },
step5: { state: "not-started", open: false, failed: false },
};
}
//dynamic table
sheetNames: any;
getSheetName(id) {
this.bulkUpload.getSheetName(id).subscribe(data => {
console.log(data);
this.sheetNames = data;
});
}
getTableData(id) {
// console.log(this.getbyiddata.file_name);
this.bulkUpload.convertFileToJson(id).subscribe((data) => {
this.rows = data;
// this.bodyrow = data;
console.log(this.rows);
this.rowdata = [this.rows];
this.rows = [this.rows]
console.log(typeof this.rows);
if (data) {
// this.toastr.success("Run Successfully")
}
var j;
var cart = [];
for (var i = 0; i < data.length; i++) {
var columnsIn = data[i];
if (i == 1) {
for (var key in columnsIn) {
j = { prop: key, name: key };
cart.push(j)
}
}
}
}
this.columns = cart;
}
this.columns = cart;
});
}
// sheetNames = ['Customer', 'Site'];
getHeaders(sheetName: string) {
if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) {
// Assuming the first item in the array contains the keys.
return Object.keys(this.rows[0][sheetName][0]);
});
}
return [];
}
getData(sheetName: string) {
if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) {
// Returning the array of data.
return this.rows[0][sheetName];
// sheetNames = ['Customer', 'Site'];
getHeaders(sheetName: string) {
if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) {
// Assuming the first item in the array contains the keys.
return Object.keys(this.rows[0][sheetName][0]);
}
return [];
}
return [];
}
// getHeaders() {
// let headers: string[] = [];
// this.rows= []
// if(this.rows) {
// this.rows.forEach((value) => {
// Object.keys(value).forEach((key) => {
// if(!headers.find((header) => header == key)){
// headers.push(key)
// }
// })
// })
// }
// return headers;
// }
//data mapping
checkTrans(){
console.log("transform open")
// console.log(this.storeData);
if(this.getHeaderData){
this.checkTransform = false;
this.transform = true;
console.log(this.getHeaderData);
if(this.mapperText === "undefined"){ this.mapperText= '';}
const currentText = this.mapperText;
let trnsfData = currentText + '' +this.getHeaderData;
this.mapperText = trnsfData;
}else {
this.checkTransform = true;
this.transform = false;
getData(sheetName: string) {
if (this.rows && this.rows.length > 0 && this.rows[0][sheetName]) {
// Returning the array of data.
return this.rows[0][sheetName];
}
return [];
}
}
mappperModal = false;
goFromMapper(){
this.mappperModal = true;
this.selectedSheetName = this.sheetNames[0];
const tablename = this.columnJson[0].TableName;
this.getColumns(tablename)
if(this.mapperText){
try {
this.JsonHeader = JSON.parse(this.mapperText);
console.log('Received data:', this.JsonHeader );
} catch (e) { console.error('Invalid JSON:', this.mapperText);}
}else
if (this.getHeaderData) {
// getHeaders() {
// let headers: string[] = [];
// this.rows= []
// if(this.rows) {
// this.rows.forEach((value) => {
// Object.keys(value).forEach((key) => {
// if(!headers.find((header) => header == key)){
// headers.push(key)
// }
// })
// })
// }
// return headers;
// }
//data mapping
checkTrans() {
console.log("transform open")
// console.log(this.storeData);
if (this.getHeaderData) {
this.checkTransform = false;
this.transform = true;
console.log(this.getHeaderData);
if (this.mapperText === "undefined") { this.mapperText = ''; }
const currentText = this.mapperText;
let trnsfData = currentText + '' + this.getHeaderData;
this.mapperText = trnsfData;
} else {
this.checkTransform = true;
this.transform = false;
}
}
mappperModal = false;
goFromMapper() {
this.mappperModal = true;
this.selectedSheetName = this.sheetNames[0];
const tablename = this.columnJson[0].TableName;
this.getColumns(tablename)
if (this.mapperText) {
try {
this.JsonHeader = JSON.parse(this.mapperText);
console.log('Received data:', this.JsonHeader);
} catch (e) { console.error('Invalid JSON:', this.mapperText); }
} else
if (this.getHeaderData) {
// try {
// this.serverData = data.replace(/\[|\]|"/g, '').split(','); //(/\[|\]|'/g, '') //(/[\[\]"]/g, '')
// console.log('Received data:', this.serverData );
// } catch (e) { console.error('Invalid JSON:', data);}
try {
this.JsonHeader = JSON.parse(this.getHeaderData);
console.log('Received data:', this.JsonHeader );
} catch (e) { console.error('Invalid JSON:', this.getHeaderData);}
this.JsonHeader = JSON.parse(this.getHeaderData);
console.log('Received data:', this.JsonHeader);
} catch (e) { console.error('Invalid JSON:', this.getHeaderData); }
}
//this.mappperclick = true;
// this.router.navigate(["../../mapperTable/"], { relativeTo: this.route, queryParams: { id: this.updateId, data: this.nodeEditProperties.mappers, title:this.nodeEditProperties.title }, skipLocationChange: true});
// console.log("gofrommapper",this.updateId,this.nodeEditProperties.mappers)
// if(this.mappperclick = true && this.datajson!= null){
// this.nodeEditProperties.mappers = this.datajson;
// }
}
//this.mappperclick = true;
// this.router.navigate(["../../mapperTable/"], { relativeTo: this.route, queryParams: { id: this.updateId, data: this.nodeEditProperties.mappers, title:this.nodeEditProperties.title }, skipLocationChange: true});
// console.log("gofrommapper",this.updateId,this.nodeEditProperties.mappers)
// if(this.mappperclick = true && this.datajson!= null){
// this.nodeEditProperties.mappers = this.datajson;
// }
}
transReset(){
this.mapperText = '';
this.transform = false;
this.checkTransform = true;
}
transReset() {
this.mapperText = '';
this.transform = false;
this.checkTransform = true;
}
Rule:boolean = false;
checkRule:boolean = true;
RuleData:string = '';
ruleModal = false;
RuleHeader = [];
Rule: boolean = false;
checkRule: boolean = true;
RuleData: string = '';
ruleModal = false;
RuleHeader = [];
checkRules(){
console.log("rule line open")
this.ruleModal = true;
checkRules() {
console.log("rule line open")
this.ruleModal = true;
}
rulechecking(){
if(this.RuleData){
console.log(this.RuleData);
this.checkRule = false;
this.Rule = true;
}else{
}
rulechecking() {
if (this.RuleData) {
console.log(this.RuleData);
this.checkRule = false;
this.Rule = true;
} else {
this.Rule = false;
this.checkRule = true;
}
}
mappperclick = false;
goFromRule() {
this.ruleModal = true;
if (this.RuleData) {
try {
this.RuleHeader = JSON.parse(this.RuleData);
console.log('Received data:', this.RuleHeader);
} catch (e) { console.error('Invalid JSON:', this.RuleData); }
}
console.log(this.RuleHeader);
}
resetRule() {
this.RuleData = undefined;
this.RuleHeader = [];
this.Rule = false;
this.checkRule = true;
}
}
mappperclick = false;
goFromRule(){
this.ruleModal = true;
if(this.RuleData){
try {
this.RuleHeader = JSON.parse(this.RuleData);
console.log('Received data:', this.RuleHeader );
} catch (e) { console.error('Invalid JSON:', this.RuleData);}
}
console.log(this.RuleHeader);
}
resetRule(){
this.RuleData = undefined;
this.RuleHeader = [];
this.Rule = false;
this.checkRule = true;
}
onAddLines(){
this.RuleHeader.push({
rulename: "",
fromsheet:"",
fromColumn: "",
validationTable: "",
checkColumn: "",
useColumn:"",
replacementTable:"",
replacementcolumn:"",
errormsg:""
});
}
deleteRow(index) {
this.RuleHeader.splice(index, 1);
}
onRuleUpdate(){
this.ruleModal = false;
console.log("rule",this.RuleHeader);
let serverData = JSON.stringify(this.RuleHeader);
// console.log(serverData);
let product = JSON.stringify(serverData);
// console.log(product);
try {
this.RuleData = JSON.parse(product);
console.log('Received rulejson data:', this.RuleData);
} catch (e) { console.error('Invalid JSON:', product);}
this.rulechecking()
}
datajson;
keychangeTable = false;
onUpdate(){
this.mappperModal = false;
console.log(this.JsonHeader);
let serverData = JSON.stringify(this.JsonHeader);
// console.log(serverData);
let product = JSON.stringify(serverData);
// console.log(product);
try {
this.datajson = JSON.parse(product);
console.log('Received Newjson data:', this.datajson);
} catch (e) { console.error('Invalid JSON:', product);}
this.mapperText = this.datajson;
// const output = this.datajson.reduce((result, item) => {
// result[item.headerName] = item.value;
// return result;
// }, {});
// console.log(output);
this.getkeychangesJson();
this.keychangeTable=true;
}
//download excel file
selectedTable;
selectTable(val){
this.selectedTable = val;
// this.downloadExcel(val);
}
downloadExcel(id){
console.log(this.changeKeyJson);
const jsonDataWithoutBrackets = this.changeKeyJson[0];
console.log(jsonDataWithoutBrackets);
console.log(this.RuleHeader);
this.bulkUpload.downloadExcel(id,jsonDataWithoutBrackets,this.RuleHeader).subscribe(
(response: Blob) => {
// Process the downloaded Excel file
console.log(response);
// const file = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
// const fileUrl = URL.createObjectURL(file);
// const link = document.createElement('a');
// link.href = fileUrl;
// link.download = 'data.xlsx'; // Set the desired file name
// link.click();
// this.timelineStyle = {
// step0: { state: "success", open: false, failed: false },
// step1: { state: "success", open: false, failed: false },
// step2: { state: "success", open: false, failed: false },
// step3: { state: "success", open: false, failed: false },
// step4: { state: "current", open: true, failed: false },
// };
},
(error) => {
// Handle error
console.log(error);
// this.timelineStyle = {
// step0: { state: "success", open: false, failed: false },
// step1: { state: "success", open: false, failed: false },
// step2: { state: "success", open: false, failed: false },
// step3: { state: "current", open: true, failed: false },
// step4: { state: "not-started", open: false, failed: false },
// step5: { state: "not-started", open: false, failed: false },
// };
}
);
}
getSheet(id){
this.bulkUpload.getSheet(id).subscribe(
(response: Blob) => {
// Process the downloaded Excel file
console.log(response);
const file = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const fileUrl = URL.createObjectURL(file);
const link = document.createElement('a');
link.href = fileUrl;
link.download = 'data.xlsx'; // Set the desired file name
link.click();
onAddLines() {
this.RuleHeader.push({
rulename: "",
fromsheet: "",
fromColumn: "",
validationTable: "",
checkColumn: "",
useColumn: "",
replacementTable: "",
replacementcolumn: "",
errormsg: ""
});
}
}
deleteRow(index) {
this.RuleHeader.splice(index, 1);
}
back(){
this.router.navigate(["../../datamanagement"], { relativeTo: this.route });
}
onRuleUpdate() {
this.ruleModal = false;
console.log("rule", this.RuleHeader);
let serverData = JSON.stringify(this.RuleHeader);
// console.log(serverData);
let product = JSON.stringify(serverData);
// console.log(product);
////step 1 - mapping name
columnJson =[]
getColumnforstep1(){
const objectArray = this.sheetNames.map(key => ({
sheetName: key,
TableName: "",
}));
// console.log(objectArray);
this.columnJson = objectArray;
try {
this.RuleData = JSON.parse(product);
console.log('Received rulejson data:', this.RuleData);
} catch (e) { console.error('Invalid JSON:', product); }
this.rulechecking()
}
}
datajson;
keychangeTable = false;
onUpdate() {
this.mappperModal = false;
console.log(this.JsonHeader);
let serverData = JSON.stringify(this.JsonHeader);
// console.log(serverData);
let product = JSON.stringify(serverData);
// console.log(product);
try {
this.datajson = JSON.parse(product);
console.log('Received Newjson data:', this.datajson);
} catch (e) { console.error('Invalid JSON:', product); }
this.mapperText = this.datajson;
// const output = this.datajson.reduce((result, item) => {
// result[item.headerName] = item.value;
// return result;
// }, {});
// console.log(output);
this.getkeychangesJson();
this.keychangeTable = true;
}
//download excel file
selectedTable;
selectTable(val) {
this.selectedTable = val;
// this.downloadExcel(val);
}
downloadExcel(id) {
console.log(this.changeKeyJson);
const jsonDataWithoutBrackets = this.changeKeyJson[0];
console.log(jsonDataWithoutBrackets);
console.log(this.RuleHeader);
this.bulkUpload.downloadExcel(id, jsonDataWithoutBrackets, this.RuleHeader).subscribe(
(response: Blob) => {
// Process the downloaded Excel file
console.log(response);
// const file = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
// const fileUrl = URL.createObjectURL(file);
// const link = document.createElement('a');
// link.href = fileUrl;
// link.download = 'data.xlsx'; // Set the desired file name
// link.click();
// this.timelineStyle = {
// step0: { state: "success", open: false, failed: false },
// step1: { state: "success", open: false, failed: false },
// step2: { state: "success", open: false, failed: false },
// step3: { state: "success", open: false, failed: false },
// step4: { state: "current", open: true, failed: false },
// };
},
(error) => {
// Handle error
console.log(error);
// this.timelineStyle = {
// step0: { state: "success", open: false, failed: false },
// step1: { state: "success", open: false, failed: false },
// step2: { state: "success", open: false, failed: false },
// step3: { state: "current", open: true, failed: false },
// step4: { state: "not-started", open: false, failed: false },
// step5: { state: "not-started", open: false, failed: false },
// };
}
);
}
getSheet(id) {
this.bulkUpload.getSheet(id).subscribe(
(response: Blob) => {
// Process the downloaded Excel file
console.log(response);
const file = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const fileUrl = URL.createObjectURL(file);
const link = document.createElement('a');
link.href = fileUrl;
link.download = 'data.xlsx'; // Set the desired file name
link.click();
});
}
back() {
this.router.navigate(["../../datamanagement"], { relativeTo: this.route });
}
////step 1 - mapping name
columnJson = []
getColumnforstep1() {
const objectArray = this.sheetNames.map(key => ({
sheetName: key,
TableName: "",
}));
// console.log(objectArray);
this.columnJson = objectArray;
}
}