add base project
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BulkimportComponent } from './bulkimport.component';
|
||||
|
||||
describe('BulkimportComponent', () => {
|
||||
let component: BulkimportComponent;
|
||||
let fixture: ComponentFixture<BulkimportComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BulkimportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BulkimportComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bulkimport',
|
||||
templateUrl: './bulkimport.component.html',
|
||||
styleUrls: ['./bulkimport.component.scss']
|
||||
})
|
||||
export class BulkimportComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
<h4 style="font-weight: 300;display: inline;"><b>Validation Rule</b></h4>
|
||||
<span class="label label-light-blue" style="display: inline;margin-left: 10px;">Add Mode</span><br>
|
||||
Validation Rules are proccessed while importing bulk records for respective entity
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- entry form-->
|
||||
<form [formGroup]="entryForm"><!-- (ngSubmit)="onSubmit()"-->
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">Entity Name</label>
|
||||
<input id="projectName" type="text" formControlName="entity_name" placeholder="Enter Entity Name"
|
||||
class="clr-input" required>
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="description">Description</label>
|
||||
<textarea id="" cols="10" rows="2" name=" remarks" formControlName="description" placeholder="Enter Description">
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="workflow_name">Active</label>
|
||||
<input type="checkbox" formControlName="active" clrToggle />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 40px;">
|
||||
<h5>Add Rule</h5>
|
||||
<!-- <div>Select open to add rules, select reset to delete existing rules</div> -->
|
||||
</div>
|
||||
<hr>
|
||||
<div class="clr-row fieldWrapper" style="margin-top: 40px;">
|
||||
<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>Replacement Column (Id)</th>
|
||||
<th>Use Column (Id)</th>
|
||||
<th>Error Message</th>
|
||||
<th class="right" style="width:125px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of serverData; 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.replacementcolumn" [ngModelOptions]="{standalone: true}" name="replacementcolumn" 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.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" (click)="onAddLines()">
|
||||
<clr-icon shape="plus"></clr-icon>
|
||||
</button>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="clr-row">
|
||||
|
||||
<div class="clr-col-6">
|
||||
<div *ngIf="checkTransformMapper">
|
||||
<span class="label label-light-green p7 lbutton" (click)="checkTransMapper()">Enable TransFormation</span>
|
||||
<textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea>
|
||||
</div>
|
||||
<div *ngIf="transformMapper">
|
||||
<label for="sequence" style="font-weight: bold;">Mapper Fields <span class="label label-light-green p7 lbutton" (click)="goFromMapperField()">OPEN</span><span class="label label-light-green p7 lbutton" (click)="transMapperReset()">RESET</span></label>
|
||||
<textarea type="text" name="mapperText" style="height:150px;" [(ngModel)]="mapperText" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clr-col-6">
|
||||
<div *ngIf="checkTransform">
|
||||
<div style="text-align: right; width: 100px;"> <span style="cursor: pointer;" class="label label-light-green p7 lbutton" (click)="checkTrans()">Add Rule line</span></div>
|
||||
<textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea>
|
||||
</div>
|
||||
<div *ngIf="transform">
|
||||
<label for="sequence" style="font-weight: bold;"><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" formControlName="rule_line" style="height:150px;" [(ngModel)]="mapperdata" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="center">
|
||||
<div class="btn-group">
|
||||
<div class="checkbox btn">
|
||||
<input type="checkbox" id="btn-demo-check-1" (click)="goback()"/>
|
||||
<label for="btn-demo-check-1">Cancel</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="!entryForm.valid" (click)="onSubmit()">SUBMIT</button>
|
||||
</div>
|
||||
</form>
|
||||
</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>
|
||||
</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>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//@import "../../../../assets/scss/var";
|
||||
.s-info-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-pg {
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
.button1::after {
|
||||
content: none;
|
||||
}
|
||||
.button1:hover::after {
|
||||
content: "ADD ROWS";
|
||||
}
|
||||
|
||||
$bg-color: #dddddd;
|
||||
|
||||
.section {
|
||||
background-color: $bg-color;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.section p {
|
||||
//color: white;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.clr-file {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
//padding: 0.6rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
input[type=text],[type=date],[type=number],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
margin-top: 3px;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
select{
|
||||
width: 100%;
|
||||
margin-top: 3px;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BulkimportaddComponent } from './bulkimportadd.component';
|
||||
|
||||
describe('BulkimportaddComponent', () => {
|
||||
let component: BulkimportaddComponent;
|
||||
let fixture: ComponentFixture<BulkimportaddComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BulkimportaddComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BulkimportaddComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+236
@@ -0,0 +1,236 @@
|
||||
import { HttpErrorResponse, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
@Component({
|
||||
selector: 'app-bulkimportadd',
|
||||
templateUrl: './bulkimportadd.component.html',
|
||||
styleUrls: ['./bulkimportadd.component.scss']
|
||||
})
|
||||
export class BulkimportaddComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
selectedFile: File[]=[];
|
||||
|
||||
datajson;
|
||||
transform:boolean = false;
|
||||
checkTransform:boolean = true;
|
||||
mapperdata;
|
||||
|
||||
entityname;
|
||||
description;
|
||||
constructor(private _fb: FormBuilder, private router: Router,private toastr: ToastrService,
|
||||
private route: ActivatedRoute,private dataservice:BulkimportService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.entryForm = this._fb.group({
|
||||
entity_name:[null],
|
||||
rule_line:[null],
|
||||
description: [null],
|
||||
active: [true],
|
||||
});
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
const data = params['data'];
|
||||
this.entityname = params['name'];
|
||||
this.description = params['description'];
|
||||
|
||||
|
||||
if (data) {
|
||||
try {
|
||||
this.datajson = JSON.parse(data);
|
||||
console.log('Received data:', this.datajson);
|
||||
} catch (e) { console.error('Invalid JSON:', data);}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
const condition = this.dataservice.getCondition();
|
||||
if(condition === 'mapper'){
|
||||
this.transform = true;
|
||||
this.checkTransform = false;
|
||||
if(this.datajson!== undefined){
|
||||
// if(this.entryForm.value.rule_line == 'undefined'){ this.entryForm.value.rule_line= '';}
|
||||
const currentText = this.entryForm.value.rule_line = '';
|
||||
this.mapperdata = currentText + this.datajson;
|
||||
// this.entryForm.value.rule_line = this.mapperdata;
|
||||
// this.Updating();
|
||||
this.dataservice.setCondition('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(this.entryForm.value);
|
||||
|
||||
this.entryForm.patchValue({
|
||||
entity_name: this.entityname,
|
||||
description: this.description,
|
||||
});
|
||||
|
||||
console.log(this.entryForm.value);
|
||||
}
|
||||
|
||||
serverData = [
|
||||
{
|
||||
"rulename": "",
|
||||
"fromsheet": "",
|
||||
"fromColumn": "",
|
||||
"validationTable": "",
|
||||
"checkColumn": "",
|
||||
"replacementcolumn": "",
|
||||
"useColumn": "",
|
||||
"errormsg": ""
|
||||
}];
|
||||
onAddLines(){
|
||||
this.serverData.push({
|
||||
rulename: "",
|
||||
fromsheet:"",
|
||||
fromColumn: "",
|
||||
validationTable: "",
|
||||
checkColumn: "",
|
||||
replacementcolumn:"",
|
||||
useColumn:"",
|
||||
errormsg:""
|
||||
});
|
||||
console.log(this.serverData);
|
||||
}
|
||||
deleteRow(index) {
|
||||
this.serverData.splice(index, 1);
|
||||
}
|
||||
|
||||
toastrShown: boolean = false;
|
||||
onSubmit(){
|
||||
this.entryForm.value.rule_line = JSON.stringify(this.serverData);
|
||||
console.log(this.entryForm.value);
|
||||
this.dataservice.saveData(this.entryForm.value).subscribe((data)=>{
|
||||
console.log(data);
|
||||
if (data) {
|
||||
if (!this.toastrShown) {
|
||||
this.toastrShown = true; // Set the flag to indicate that the toastr message has been shown
|
||||
this.toastr.success("Added Successfully");
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../all"], { relativeTo: this.route });
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}, (error: HttpHeaderResponse)=>{
|
||||
console.log(error);
|
||||
if(error.status===202){
|
||||
this.toastr.success("Added Succesfully");
|
||||
}
|
||||
if(error.status===404){
|
||||
this.toastr.error("Not Added");
|
||||
}
|
||||
if(error.status===400){
|
||||
this.toastr.error("Not Added");
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../all"], { relativeTo: this.route });
|
||||
},500);
|
||||
}
|
||||
goback(){
|
||||
this.router.navigate(["../all"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
///rules
|
||||
checkTrans(){
|
||||
|
||||
console.log("rule line open")
|
||||
this.dataservice.setCondition('mapper');
|
||||
|
||||
this.router.navigate(["../ruleline/"], { relativeTo: this.route, queryParams: {data:this.entryForm.value.rule_line, entityname:this.entryForm.value.entity_name, description:this.entryForm.value.description}, skipLocationChange: true});
|
||||
console.log(this.entryForm.value.entity_name);
|
||||
|
||||
}
|
||||
|
||||
mappperclick = false;
|
||||
goFromMapper(){
|
||||
//this.mappperclick = true;
|
||||
this.dataservice.setCondition('mapper');
|
||||
this.router.navigate(["../ruleline/"], { relativeTo: this.route, queryParams: {data:this.entryForm.value.rule_line, entityname:this.entryForm.value.entity_name, description:this.entryForm.value.description}, skipLocationChange: true});
|
||||
console.log(this.entryForm.value.entity_name);
|
||||
}
|
||||
|
||||
transReset(){
|
||||
this.entryForm.value.rule_line = undefined;
|
||||
this.transform = false;
|
||||
this.checkTransform = true;
|
||||
}
|
||||
|
||||
|
||||
headerData;
|
||||
getColumns(table){
|
||||
console.log(table);
|
||||
// console.log(this.getbyiddata.entityName);
|
||||
this.dataservice.getColumnNames(table).subscribe((data) => {
|
||||
console.log(data);
|
||||
this.headerData = data;
|
||||
});
|
||||
}
|
||||
|
||||
checkTransformMapper = true;
|
||||
transformMapper = false;
|
||||
mapperText;
|
||||
getHeaderData;
|
||||
JsonHeader = [];
|
||||
selectedSheetName: string | null = null;
|
||||
columnJson =[];
|
||||
sheetNames:any;
|
||||
checkTransMapper(){
|
||||
|
||||
console.log("Mapper open")
|
||||
// console.log(this.storeData);
|
||||
if(this.getHeaderData){
|
||||
this.checkTransformMapper = false;
|
||||
this.transformMapper = 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.checkTransformMapper = true;
|
||||
this.transformMapper = false;
|
||||
}
|
||||
|
||||
}
|
||||
mappperModal = false;
|
||||
goFromMapperField(){
|
||||
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);}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
transResetMapper(){
|
||||
this.mapperText = '';
|
||||
this.transformMapper = false;
|
||||
this.checkTransformMapper = true;
|
||||
}
|
||||
|
||||
onUpdate(){
|
||||
this.mappperModal = false;
|
||||
}
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
|
||||
<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="jvascript://">Data Management</a></li>
|
||||
<li><a href="javascript://">Validation Rule</a></li>
|
||||
</ol>
|
||||
<br>
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-8">
|
||||
<h3>Validation Rule</h3>
|
||||
</div>
|
||||
<div class="clr-col-4" style="text-align: right;">
|
||||
<button class="btn btn-outline" (click)="onExport()">
|
||||
<clr-icon shape="export"></clr-icon> xlsx
|
||||
</button>
|
||||
<button id="add" class="btn btn-primary" (click)="goToAdd()">
|
||||
<clr-icon shape="plus"></clr-icon>ADD
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<clr-dg-column [clrDgField]="'entity_name'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Entity Name
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'description'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Description
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'active'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Active
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'action'" style="width: 100px;"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Action
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-row *clrDgItems="let user of data?.slice()?.reverse()" [clrDgItem]="user">
|
||||
<clr-dg-cell>{{user.entity_name}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{user.description}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{user.active}}</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>
|
||||
</a>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-action-overflow>
|
||||
<button class="action-item" (click)="goToEdit(user.id)">Edit <clr-icon shape="edit" class="is-error"></clr-icon></button>
|
||||
<!-- <button class="action-item" (click)="onDelete(user)">Delete<clr-icon shape="trash" class="is-error"></clr-icon></button> -->
|
||||
</clr-dg-action-overflow>
|
||||
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">Users per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}} users
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
|
||||
<clr-modal [(clrModalOpen)]="modaldelete" [clrModalSize]="'lg'" [clrModalStaticBackdrop]="true">
|
||||
|
||||
<div class="modal-body" *ngIf="rowSelected.id">
|
||||
<h1 class="delete">Are You Sure Want to delete?</h1>
|
||||
<h2 class="heading">{{rowSelected.id}}</h2>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="modaldelete = false">Cancel</button>
|
||||
<button type="submit" (click)="delete(rowSelected.id)" class="btn btn-primary" >Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</clr-modal>
|
||||
|
||||
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BulkimportallComponent } from './bulkimportall.component';
|
||||
|
||||
describe('BulkimportallComponent', () => {
|
||||
let component: BulkimportallComponent;
|
||||
let fixture: ComponentFixture<BulkimportallComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BulkimportallComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BulkimportallComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { ExcelService } from 'src/app/services/excel.service';
|
||||
import * as moment from 'moment';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bulkimportall',
|
||||
templateUrl: './bulkimportall.component.html',
|
||||
styleUrls: ['./bulkimportall.component.scss']
|
||||
})
|
||||
export class BulkimportallComponent implements OnInit {
|
||||
|
||||
loading = false;
|
||||
error;
|
||||
selected: any[] = [];
|
||||
rowSelected :any= {};
|
||||
modaldelete=false;
|
||||
data;
|
||||
constructor(private router: Router, private toastr: ToastrService,
|
||||
private route: ActivatedRoute,private excel: ExcelService,private bulkimportService:BulkimportService,) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getall();
|
||||
}
|
||||
getall(){
|
||||
this.bulkimportService.getDetails().subscribe((data)=>{
|
||||
console.log(data);
|
||||
this.data=data;
|
||||
if(this.data.length == 0){
|
||||
this.error="No data Available";
|
||||
console.log(this.error);
|
||||
}
|
||||
|
||||
},(error) => {
|
||||
console.log(error);
|
||||
if(error){
|
||||
this.error="No data Available OR server Error";
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
goToAdd(){
|
||||
this.router.navigate(["../add"], { relativeTo: this.route });
|
||||
|
||||
}
|
||||
onExport() {
|
||||
this.excel.exportAsExcelFile(this.data, 'user_',
|
||||
moment().format('YYYYMMDD_HHmmss'))
|
||||
}
|
||||
goToEdit(id) {
|
||||
this.router.navigate(["../edit/" + id], { relativeTo: this.route });
|
||||
}
|
||||
onDelete(row) {
|
||||
this.rowSelected = row;
|
||||
this.modaldelete=true;
|
||||
}
|
||||
|
||||
delete(id){
|
||||
this.modaldelete = false;
|
||||
console.log("in delete "+id);
|
||||
this.bulkimportService.deleteById(id).subscribe(
|
||||
(data) => {
|
||||
console.log(data);
|
||||
this.ngOnInit();
|
||||
if (data == null || data) {
|
||||
this.toastr.success('Deleted successfully');
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
console.log('Error in adding data...',+error);
|
||||
if(isNaN(error)){
|
||||
this.toastr.success('Deleted successfully');
|
||||
}else{
|
||||
this.toastr.error('Not Deleted Data Getting Some Error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
activeTab: number = 1;
|
||||
|
||||
showTab(tabNumber: number) {
|
||||
this.activeTab = tabNumber;
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
<h4 style="font-weight: 300;display: inline;"><b>Validation Rule</b></h4>
|
||||
<span class="label label-light-blue" style="display: inline;margin-left: 10px;">Edit Mode</span><br>
|
||||
Validation Rules are proccessed while importing bulk records for respective entity
|
||||
<hr>
|
||||
<div class="container">
|
||||
<form><!-- (ngSubmit)="onSubmit()"-->
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">Entity Name</label>
|
||||
<input id="projectName" type="text" [(ngModel)]="tdata.entity_name" name="entity_name" placeholder="Enter Entity Name"
|
||||
class="clr-input" required>
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="description">Description</label>
|
||||
<textarea id="" cols="10" rows="2" [(ngModel)]="tdata.description" name="description" placeholder="Enter Description">
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="workflow_name">Active</label>
|
||||
<input type="checkbox" [(ngModel)]="tdata.active" name="active" clrToggle />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 40px;">
|
||||
<div>Select open to add rules, select reset to delete existing rules</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div style="margin-top: 40px;">
|
||||
<h5>Add Rule</h5>
|
||||
<!-- <div>Select open to add rules, select reset to delete existing rules</div> -->
|
||||
</div>
|
||||
<hr>
|
||||
<div class="clr-row fieldWrapper" style="margin-top: 40px;">
|
||||
<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>Replacement Column (Id)</th>
|
||||
<th>Use Column (Id)</th>
|
||||
<th>Error Message</th>
|
||||
<th class="right" style="width:125px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of serverData; 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.replacementcolumn" [ngModelOptions]="{standalone: true}" name="replacementcolumn" 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.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" (click)="onAddLines()">
|
||||
<clr-icon shape="plus"></clr-icon>
|
||||
</button>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="clr-row">
|
||||
|
||||
<div class="clr-col-6">
|
||||
<div *ngIf="checkTransform">
|
||||
<div style="text-align: right; width: 100px;"> <span style="cursor: pointer;" class="label label-light-green p7 lbutton" (click)="checkTrans()">Add Rule line</span></div>
|
||||
<textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea>
|
||||
</div>
|
||||
<div *ngIf="transform">
|
||||
<label for="sequence" style="font-weight: bold;"><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" style="height:150px;" [(ngModel)]="tdata.rule_line" name="rule_line" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="center">
|
||||
<div class="btn-group">
|
||||
<div class="checkbox btn">
|
||||
<input type="checkbox" id="btn-demo-check-1" (click)="goback()"/>
|
||||
<label for="btn-demo-check-1">Cancel</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" (click)="onSubmit()">UPDATE</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//@import "../../../../assets/scss/var";
|
||||
.s-info-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-pg {
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
.button1::after {
|
||||
content: none;
|
||||
}
|
||||
.button1:hover::after {
|
||||
content: "ADD ROWS";
|
||||
}
|
||||
|
||||
$bg-color: #dddddd;
|
||||
|
||||
.section {
|
||||
background-color: $bg-color;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.section p {
|
||||
//color: white;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.clr-file {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
//padding: 0.6rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
input[type=text],[type=date],[type=number],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
margin-top: 3px;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
select{
|
||||
width: 100%;
|
||||
margin-top: 3px;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BulkimporteditComponent } from './bulkimportedit.component';
|
||||
|
||||
describe('BulkimporteditComponent', () => {
|
||||
let component: BulkimporteditComponent;
|
||||
let fixture: ComponentFixture<BulkimporteditComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BulkimporteditComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BulkimporteditComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
import { HttpErrorResponse, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bulkimportedit',
|
||||
templateUrl: './bulkimportedit.component.html',
|
||||
styleUrls: ['./bulkimportedit.component.scss']
|
||||
})
|
||||
export class BulkimporteditComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
selectedFile: File[]=[];
|
||||
id;
|
||||
datajson;
|
||||
transform:boolean = false;
|
||||
checkTransform:boolean = true;
|
||||
mapperdata;
|
||||
tdata: any = {};
|
||||
entityname;
|
||||
description;
|
||||
constructor(private _fb: FormBuilder, private router: Router,private toastr: ToastrService,
|
||||
private route: ActivatedRoute,private dataservice:BulkimportService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.id = this.route.snapshot.params["id"];
|
||||
console.log("update with id = ", this.id);
|
||||
|
||||
// this.entryForm = this._fb.group({
|
||||
// entity_name:[null],
|
||||
// rule_line:[null],
|
||||
// description: [null],
|
||||
// active: [true],
|
||||
// });
|
||||
|
||||
|
||||
this.dataservice.getDetailsById(this.id).subscribe(data => {
|
||||
this.tdata = data;
|
||||
this.serverData = JSON.parse(data.rule_line);
|
||||
console.log(this.tdata);
|
||||
},
|
||||
(err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
const data = params['data'];
|
||||
this.entityname = params['name'];
|
||||
this.description = params['description'];
|
||||
|
||||
|
||||
if (data) {
|
||||
try {
|
||||
this.datajson = JSON.parse(data);
|
||||
console.log('Received data:', this.datajson);
|
||||
} catch (e) { console.error('Invalid JSON:', data);}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(this.tdata.rule_line !== '' && this.tdata.rule_line !== null && this.tdata.rule_line !== undefined) {
|
||||
console.log(this.tdata.rule_line)
|
||||
this.checkTransform = false;
|
||||
this.transform = true;
|
||||
}else{
|
||||
console.log(this.tdata.rule_line)
|
||||
this.checkTransform = true;
|
||||
this.transform = false;
|
||||
this.checkTransform = true;
|
||||
}
|
||||
|
||||
const condition = this.dataservice.getCondition();
|
||||
if(condition === 'mapper'){
|
||||
console.log("datagetting");
|
||||
this.transform = true;
|
||||
this.checkTransform = false;
|
||||
if(this.datajson!== undefined){
|
||||
// if(this.entryForm.value.rule_line == 'undefined'){ this.entryForm.value.rule_line= '';}
|
||||
const currentText = this.tdata.rule_line = '';
|
||||
this.mapperdata = currentText + this.datajson;
|
||||
this.tdata.rule_line = this.mapperdata;
|
||||
// this.Updating();
|
||||
this.dataservice.setCondition('');
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
console.log(this.tdata);
|
||||
// this.entryForm.patchValue({
|
||||
// entity_name: this.entityname,
|
||||
// description: this.description,
|
||||
// });
|
||||
// console.log(this.entryForm.value);
|
||||
}
|
||||
|
||||
getById(id: number) {
|
||||
|
||||
}
|
||||
|
||||
serverData = [];
|
||||
onAddLines(){
|
||||
this.serverData.push({
|
||||
rulename: "",
|
||||
fromsheet:"",
|
||||
fromColumn: "",
|
||||
validationTable: "",
|
||||
checkColumn: "",
|
||||
replacementcolumn:"",
|
||||
useColumn:"",
|
||||
errormsg:""
|
||||
});
|
||||
console.log(this.serverData);
|
||||
}
|
||||
deleteRow(index) {
|
||||
this.serverData.splice(index, 1);
|
||||
}
|
||||
|
||||
toastrShown: boolean = false;
|
||||
onSubmit(){
|
||||
this.tdata.rule_line = JSON.stringify(this.serverData);
|
||||
console.log(this.tdata);
|
||||
this.dataservice.updateData(this.tdata, this.id).subscribe((data)=>{
|
||||
console.log(data);
|
||||
if (data.operationStatus) {
|
||||
this.toastr.warning(data.operationMessage);
|
||||
}else{
|
||||
if (!this.toastrShown) {
|
||||
this.toastrShown = true; // Set the flag to indicate that the toastr message has been shown
|
||||
this.toastr.success("Update Successfully");
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../../all"], { relativeTo: this.route });
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}, (error: HttpHeaderResponse)=>{
|
||||
console.log(error);
|
||||
if(error.status===202){
|
||||
this.toastr.success("Update Succesfully");
|
||||
}
|
||||
if(error.status===404){
|
||||
this.toastr.error("Not Update");
|
||||
}
|
||||
if(error.status===400){
|
||||
this.toastr.error("Not Update");
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../../all"], { relativeTo: this.route });
|
||||
},500);
|
||||
}
|
||||
|
||||
Updating(){
|
||||
console.log(this.tdata);
|
||||
this.dataservice.updateData(this.tdata, this.id).subscribe(data=>{
|
||||
console.log(data);
|
||||
// this.ngOnInit();
|
||||
}, (error: HttpHeaderResponse)=>{
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
goback(){
|
||||
this.router.navigate(["../../all"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
|
||||
///rules
|
||||
checkTrans(){
|
||||
|
||||
console.log("rule line open")
|
||||
this.dataservice.setCondition('mapper');
|
||||
|
||||
this.router.navigate(["../../rulelineedit/"], { relativeTo: this.route, queryParams: {id:this.id, data:this.tdata.rule_line, entityname:this.tdata.entity_name, description:this.tdata.description}, skipLocationChange: true});
|
||||
console.log(this.tdata.rule_line);
|
||||
|
||||
}
|
||||
|
||||
mappperclick = false;
|
||||
goFromMapper(){
|
||||
//this.mappperclick = true;
|
||||
this.dataservice.setCondition('mapper');
|
||||
this.router.navigate(["../../rulelineedit/"], { relativeTo: this.route, queryParams: {id:this.id, data:this.tdata.rule_line, entityname:this.tdata.entity_name, description:this.tdata.description}, skipLocationChange: true});
|
||||
console.log(this.tdata.rule_line);
|
||||
}
|
||||
|
||||
transReset(){
|
||||
this.tdata.rule_line = undefined;
|
||||
this.transform = false;
|
||||
this.checkTransform = true;
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<h4 style="font-weight: 300;display: inline;"><b>Add Rule Lines</b></h4>
|
||||
<hr>
|
||||
<div class="container">
|
||||
<div class="clr-row" style="padding-left: 10px;">
|
||||
<button type="button" form-control class="btn btn-primary" (click)="columnList()">Get Header</button>
|
||||
</div>
|
||||
|
||||
<form (ngSubmit)="onUpdate()">
|
||||
|
||||
|
||||
<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>Replacement Column (Id)</th>
|
||||
<th>Use Column (Id)</th>
|
||||
<th>Error Message</th>
|
||||
<th class="right" style="width:125px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of serverData; 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.replacementcolumn" [ngModelOptions]="{standalone: true}" name="replacementcolumn" 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.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" (click)="onAddLines()">
|
||||
<clr-icon shape="plus"></clr-icon>
|
||||
</button>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="center">
|
||||
<button type="button" form-control class="btn btn-outline" (click)="back()">Back</button>
|
||||
<button type="submit" form-control class="btn btn-primary" (click)="onUpdate()">SUBMIT</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.35rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
input[type=text],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
// margin: 8px 0;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
.postColumn{
|
||||
border: 1px solid #ccc;
|
||||
width: 78%;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.colName{
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
}
|
||||
.colfields{
|
||||
border: 1px solid black;
|
||||
margin: 17px;
|
||||
text-align: center;
|
||||
padding: 3px;
|
||||
}
|
||||
.fieldWrapper{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
select{
|
||||
width: 100%;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BulkimporteditlineComponent } from './bulkimporteditline.component';
|
||||
|
||||
describe('BulkimporteditlineComponent', () => {
|
||||
let component: BulkimporteditlineComponent;
|
||||
let fixture: ComponentFixture<BulkimporteditlineComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BulkimporteditlineComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BulkimporteditlineComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DataflowService } from 'src/app/services/fnd/dataflow.service';
|
||||
// import { NewwebhookService } from 'src/app/services/fnd/newwebhook.service';
|
||||
// import { SftplocationService } from 'src/app/services/fnd/sftplocation.service';
|
||||
// import { Webhookservicesui1Service } from 'src/app/services/fnd/webhookservicesui1.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bulkimporteditline',
|
||||
templateUrl: './bulkimporteditline.component.html',
|
||||
styleUrls: ['./bulkimporteditline.component.scss']
|
||||
})
|
||||
export class BulkimporteditlineComponent implements OnInit {
|
||||
serverData = [];
|
||||
id;
|
||||
title
|
||||
sourceTable;
|
||||
sourceFData;
|
||||
Mid:any;
|
||||
flowType;
|
||||
remoteD;
|
||||
sftpDId;
|
||||
emailDId;
|
||||
key;
|
||||
webhookDId;
|
||||
|
||||
name;
|
||||
description;
|
||||
// data = ['email', 'password']
|
||||
constructor( private router : Router,
|
||||
private route: ActivatedRoute,
|
||||
private dataservice:DataflowService,
|
||||
// private sftpService:SftplocationService,
|
||||
// private emaildbService:Webhookservicesui1Service,
|
||||
// private webhookService:NewwebhookService,
|
||||
private _fb:FormBuilder) { }
|
||||
|
||||
public entryForm: FormGroup;
|
||||
|
||||
ngOnInit(): void {
|
||||
// this.entryForm = this._fb.group({
|
||||
// connector_json: this._fb.array([])
|
||||
// });
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.id = params['id'];
|
||||
// this.Mid = params['mid'];
|
||||
const data = params['data'];
|
||||
this.name = params['entityname'];
|
||||
this.description = params['description'];
|
||||
if (data) {
|
||||
// try {
|
||||
// this.serverData = data.replace(/\[|\]|"/g, '').split(','); //(/\[|\]|'/g, '') //(/[\[\]"]/g, '')
|
||||
// console.log('Received data:', this.serverData );
|
||||
// } catch (e) { console.error('Invalid JSON:', data);}
|
||||
try {
|
||||
this.serverData = JSON.parse(data);
|
||||
console.log('Received data:', this.serverData );
|
||||
} catch (e) { console.error('Invalid JSON:', data);}
|
||||
}
|
||||
// this.serverData.map(d =>
|
||||
// this.person.push(this._fb.group({ andor: '', fields_name:'',condition:'',value: d ,}))
|
||||
// );
|
||||
|
||||
});
|
||||
|
||||
const condition = this.dataservice.getCondition();
|
||||
if(condition === 'mapper'){
|
||||
console.log("mapper")
|
||||
}else if(condition === 'filter'){
|
||||
console.log("filter");
|
||||
}
|
||||
console.log(this.name,this.description);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
columnList(){
|
||||
|
||||
this.dataservice.getColumnListFromSourceTable(this.id,this.title).subscribe((data)=>{
|
||||
console.log(data);
|
||||
this.sourceTable = data;
|
||||
});
|
||||
}
|
||||
|
||||
// sftpHeader(){
|
||||
// this.sftpService.getExcelHeaders(this.title,this.remoteD).subscribe((headers) => {
|
||||
// console.log("sftp Data",headers);
|
||||
// this.sourceTable = headers;
|
||||
// });
|
||||
// }
|
||||
|
||||
// emailHeader(){
|
||||
// this.emaildbService.getHeadersFromExcelMail(this.emailDId,this.title,this.key).subscribe((headers)=>{
|
||||
// console.log("email Data",headers);
|
||||
// this.sourceTable = headers;
|
||||
// });
|
||||
// }
|
||||
|
||||
// webhookHeader(){
|
||||
// this.webhookService.getHeadersFromWBExcelMail(this.webhookDId,this.title,this.key).subscribe((headers)=>{
|
||||
// console.log("webhook Data",headers);
|
||||
// this.sourceTable = headers;
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
FilDemo(){
|
||||
let data = [""];
|
||||
const defaultObject = {
|
||||
andor: "AND",
|
||||
fields_name: "",
|
||||
condition: "=",
|
||||
}
|
||||
const objectArray = data.map(value => ({
|
||||
...defaultObject,
|
||||
value: value,
|
||||
}));
|
||||
console.log(objectArray);
|
||||
this.sourceFData = JSON.stringify(objectArray);
|
||||
|
||||
try {
|
||||
this.serverData = JSON.parse(this.sourceFData);
|
||||
console.log('Received data:', this.serverData );
|
||||
} catch (e) { console.error('Invalid JSON:', this.sourceFData);}
|
||||
|
||||
|
||||
|
||||
}
|
||||
// get person() {
|
||||
// return this.entryForm.get("connector_json") as FormArray;
|
||||
// }
|
||||
|
||||
onUpdate(){
|
||||
console.log(this.serverData);
|
||||
let serverData = JSON.stringify(this.serverData);
|
||||
console.log(serverData);
|
||||
let product = JSON.stringify(serverData);
|
||||
console.log(product);
|
||||
console.log(this.Mid);
|
||||
this.router.navigate(['../edit/'+ this.id],{relativeTo:this.route, queryParams: { data: product, name:this.name, description:this.description }, skipLocationChange: true});
|
||||
}
|
||||
back(){
|
||||
this.router.navigate(['../edit/'+ this.id], { relativeTo: this.route });
|
||||
this.dataservice.setCondition('');
|
||||
}
|
||||
|
||||
onAddLines(){
|
||||
this.serverData.push({
|
||||
rulename: "",
|
||||
fromsheet:"",
|
||||
fromColumn: "",
|
||||
validationTable: "",
|
||||
checkColumn: "",
|
||||
replacementcolumn:"",
|
||||
useColumn:"",
|
||||
errormsg:""
|
||||
});
|
||||
}
|
||||
deleteRow(index) {
|
||||
this.serverData.splice(index, 1);
|
||||
}
|
||||
|
||||
// postApi(){
|
||||
// this.data.map(d =>
|
||||
// this.person.push(this._fb.group({ fieldname: d , checkboxval:'',sample_format:'',mapped_fields:'',dest_format:''}))
|
||||
// );
|
||||
// }
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<h4 style="font-weight: 300;display: inline;"><b>Add Rule Lines</b></h4>
|
||||
<hr>
|
||||
<div class="container">
|
||||
<div class="clr-row" style="padding-left: 10px;">
|
||||
<button type="button" form-control class="btn btn-primary" (click)="columnList()">Get Header</button>
|
||||
</div>
|
||||
|
||||
<form (ngSubmit)="onUpdate()">
|
||||
|
||||
|
||||
<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>Replacement Column (Id)</th>
|
||||
<th>Use Column (Id)</th>
|
||||
<th>Error Message</th>
|
||||
<th class="right" style="width:125px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of serverData; 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.replacementcolumn" [ngModelOptions]="{standalone: true}" name="replacementcolumn" 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.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" (click)="onAddLines()">
|
||||
<clr-icon shape="plus"></clr-icon>
|
||||
</button>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="center">
|
||||
<button type="button" form-control class="btn btn-outline" (click)="back()">Back</button>
|
||||
<button type="submit" form-control class="btn btn-primary" (click)="onUpdate()">SUBMIT</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.35rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
input[type=text],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
// margin: 8px 0;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
.postColumn{
|
||||
border: 1px solid #ccc;
|
||||
width: 78%;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.colName{
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
}
|
||||
.colfields{
|
||||
border: 1px solid black;
|
||||
margin: 17px;
|
||||
text-align: center;
|
||||
padding: 3px;
|
||||
}
|
||||
.fieldWrapper{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
select{
|
||||
width: 100%;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BulkimportlineComponent } from './bulkimportline.component';
|
||||
|
||||
describe('BulkimportlineComponent', () => {
|
||||
let component: BulkimportlineComponent;
|
||||
let fixture: ComponentFixture<BulkimportlineComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BulkimportlineComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BulkimportlineComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DataflowService } from 'src/app/services/fnd/dataflow.service';
|
||||
// import { NewwebhookService } from 'src/app/services/fnd/newwebhook.service';
|
||||
// import { SftplocationService } from 'src/app/services/fnd/sftplocation.service';
|
||||
// import { Webhookservicesui1Service } from 'src/app/services/fnd/webhookservicesui1.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bulkimportline',
|
||||
templateUrl: './bulkimportline.component.html',
|
||||
styleUrls: ['./bulkimportline.component.scss']
|
||||
})
|
||||
export class BulkimportlineComponent implements OnInit {
|
||||
serverData = [];
|
||||
andor = ['AND', 'OR','NOT'];
|
||||
fieldname = ['name1', 'name2'];
|
||||
condition = ['=','!=','<','>','<=','>=','LIKE','BETWEEN','IN'];
|
||||
id;
|
||||
title
|
||||
sourceTable;
|
||||
sourceFData;
|
||||
Mid:any;
|
||||
flowType;
|
||||
remoteD;
|
||||
sftpDId;
|
||||
emailDId;
|
||||
key;
|
||||
webhookDId;
|
||||
|
||||
name;
|
||||
description;
|
||||
// data = ['email', 'password']
|
||||
constructor( private router : Router,
|
||||
private route: ActivatedRoute,
|
||||
private dataservice:DataflowService,
|
||||
// private sftpService:SftplocationService,
|
||||
// private emaildbService:Webhookservicesui1Service,
|
||||
// private webhookService:NewwebhookService,
|
||||
private _fb:FormBuilder) { }
|
||||
|
||||
public entryForm: FormGroup;
|
||||
|
||||
ngOnInit(): void {
|
||||
// this.entryForm = this._fb.group({
|
||||
// connector_json: this._fb.array([])
|
||||
// });
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
// this.id = params['id'];
|
||||
// this.Mid = params['mid'];
|
||||
const data = params['data'];
|
||||
this.name = params['entityname'];
|
||||
this.description = params['description'];
|
||||
if (data) {
|
||||
// try {
|
||||
// this.serverData = data.replace(/\[|\]|"/g, '').split(','); //(/\[|\]|'/g, '') //(/[\[\]"]/g, '')
|
||||
// console.log('Received data:', this.serverData );
|
||||
// } catch (e) { console.error('Invalid JSON:', data);}
|
||||
try {
|
||||
this.serverData = JSON.parse(data);
|
||||
console.log('Received data:', this.serverData );
|
||||
} catch (e) { console.error('Invalid JSON:', data);}
|
||||
}
|
||||
// this.serverData.map(d =>
|
||||
// this.person.push(this._fb.group({ andor: '', fields_name:'',condition:'',value: d ,}))
|
||||
// );
|
||||
|
||||
});
|
||||
|
||||
const condition = this.dataservice.getCondition();
|
||||
if(condition === 'mapper'){
|
||||
console.log("mapper")
|
||||
}else if(condition === 'filter'){
|
||||
console.log("filter");
|
||||
}
|
||||
console.log(this.name,this.description);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
columnList(){
|
||||
|
||||
this.dataservice.getColumnListFromSourceTable(this.id,this.title).subscribe((data)=>{
|
||||
console.log(data);
|
||||
this.sourceTable = data;
|
||||
});
|
||||
}
|
||||
|
||||
// sftpHeader(){
|
||||
// this.sftpService.getExcelHeaders(this.title,this.remoteD).subscribe((headers) => {
|
||||
// console.log("sftp Data",headers);
|
||||
// this.sourceTable = headers;
|
||||
// });
|
||||
// }
|
||||
|
||||
// emailHeader(){
|
||||
// this.emaildbService.getHeadersFromExcelMail(this.emailDId,this.title,this.key).subscribe((headers)=>{
|
||||
// console.log("email Data",headers);
|
||||
// this.sourceTable = headers;
|
||||
// });
|
||||
// }
|
||||
|
||||
// webhookHeader(){
|
||||
// this.webhookService.getHeadersFromWBExcelMail(this.webhookDId,this.title,this.key).subscribe((headers)=>{
|
||||
// console.log("webhook Data",headers);
|
||||
// this.sourceTable = headers;
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
FilDemo(){
|
||||
let data = [""];
|
||||
const defaultObject = {
|
||||
andor: "AND",
|
||||
fields_name: "",
|
||||
condition: "=",
|
||||
}
|
||||
const objectArray = data.map(value => ({
|
||||
...defaultObject,
|
||||
value: value,
|
||||
}));
|
||||
console.log(objectArray);
|
||||
this.sourceFData = JSON.stringify(objectArray);
|
||||
|
||||
try {
|
||||
this.serverData = JSON.parse(this.sourceFData);
|
||||
console.log('Received data:', this.serverData );
|
||||
} catch (e) { console.error('Invalid JSON:', this.sourceFData);}
|
||||
|
||||
|
||||
|
||||
}
|
||||
// get person() {
|
||||
// return this.entryForm.get("connector_json") as FormArray;
|
||||
// }
|
||||
|
||||
onUpdate(){
|
||||
console.log(this.serverData);
|
||||
let serverData = JSON.stringify(this.serverData);
|
||||
console.log(serverData);
|
||||
let product = JSON.stringify(serverData);
|
||||
console.log(product);
|
||||
console.log(this.Mid);
|
||||
this.router.navigate(['../add'],{relativeTo:this.route, queryParams: { data: product, name:this.name, description:this.description }, skipLocationChange: true});
|
||||
}
|
||||
back(){
|
||||
this.router.navigate(["../add"], { relativeTo: this.route });
|
||||
this.dataservice.setCondition('');
|
||||
}
|
||||
|
||||
onAddLines(){
|
||||
this.serverData.push({
|
||||
rulename: "",
|
||||
fromsheet:"",
|
||||
fromColumn: "",
|
||||
validationTable: "",
|
||||
checkColumn: "",
|
||||
replacementcolumn:"",
|
||||
useColumn:"",
|
||||
errormsg:""
|
||||
});
|
||||
}
|
||||
deleteRow(index) {
|
||||
this.serverData.splice(index, 1);
|
||||
}
|
||||
|
||||
// postApi(){
|
||||
// this.data.map(d =>
|
||||
// this.person.push(this._fb.group({ fieldname: d , checkboxval:'',sample_format:'',mapped_fields:'',dest_format:''}))
|
||||
// );
|
||||
// }
|
||||
}
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
<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>
|
||||
</ol>
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-4">
|
||||
<h3>Data Management </h3>
|
||||
</div>
|
||||
<div class="clr-col-8" style="text-align: right;">
|
||||
|
||||
<button class="btn btn-outline" (click)="getall()">
|
||||
<clr-icon shape="refresh"></clr-icon> Reload
|
||||
</button>
|
||||
<button class="btn btn-outline" (click)="onExport()">
|
||||
<clr-icon shape="export"></clr-icon> xlsx
|
||||
</button>
|
||||
<button id="add" class="btn btn-primary" (click)="goToAdd()">
|
||||
<clr-icon shape="plus"></clr-icon>ADD
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<clr-dg-column [clrDgField]="''"><ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Go To
|
||||
</ng-container></clr-dg-column>
|
||||
<!-- <clr-dg-column [clrDgField]="'name'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
User Name
|
||||
</ng-container></clr-dg-column> -->
|
||||
<clr-dg-column [clrDgField]="'entityName'">
|
||||
<ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Entity Name
|
||||
</ng-container>
|
||||
</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
|
||||
</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>
|
||||
<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>
|
||||
</a>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-action-overflow>
|
||||
<button class="action-item" (click)="onEdit(user)">Edit</button>
|
||||
</clr-dg-action-overflow>
|
||||
|
||||
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">Users per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}} users
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
|
||||
<clr-modal [(clrModalOpen)]="modalEdit" [clrModalSize]="'lg'" [clrModalStaticBackdrop]="true">
|
||||
<h3 class="modal-title"> Edit data</h3>
|
||||
<div class="modal-body" *ngIf="rowSelected.id">
|
||||
<h2 class="heading">{{rowSelected.id}}</h2>
|
||||
|
||||
<form (ngSubmit)="onUpdate(rowSelected.id)">
|
||||
<div class="clr-row">
|
||||
<!-- <div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="name"> User Name</label>
|
||||
<select name="user_id" [(ngModel)]="rowSelected.user_id">
|
||||
<option *ngFor="let data of udata" [value]="data.userId">{{data.username}}</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<!-- <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="entity_name" [(ngModel)]="rowSelected.entity_name">
|
||||
<datalist id="config">
|
||||
<option *ngFor="let item of entitydata" [ngValue]="item">{{item}}</option>
|
||||
</datalist>
|
||||
|
||||
</div> -->
|
||||
<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">
|
||||
<option *ngFor="let data of tableList" [value]="data.entity_name">{{data.entity_name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="email">File Name</label>
|
||||
<input type="file" (change)="onFileChanged($event)" name="file_name">{{rowSelected.file_name}}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
</clr-modal>
|
||||
|
||||
|
||||
<clr-modal [(clrModalOpen)]="modaldelete" [clrModalSize]="'lg'" [clrModalStaticBackdrop]="true">
|
||||
|
||||
<div class="modal-body" *ngIf="rowSelected.id">
|
||||
<h1 class="delete">Are You Sure Want to delete?</h1>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</clr-modal>
|
||||
|
||||
|
||||
<clr-modal [(clrModalOpen)]="modalAdd" [clrModalSize]="'lg'" [clrModalStaticBackdrop]="true">
|
||||
<h3 class="modal-title"> ENTRY FORM</h3>
|
||||
<div class="modal-body">
|
||||
|
||||
<form [formGroup]="entryForm" (ngSubmit)="onSubmit()">
|
||||
<div class="clr-row" style="height: fit-content;">
|
||||
<!-- <div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="name"> User Name</label>
|
||||
<select formControlName="user_id">
|
||||
<option *ngFor="let data of udata" [value]="data.userId">{{data.username}}</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<!-- <div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="email">Entity Name</label>
|
||||
<input type="text" list="config" class="clr-dropdown" formControlName="entity_name">
|
||||
<datalist id="config">
|
||||
<option *ngFor="let item of entitydata" [ngValue]="item">{{item}}</option>
|
||||
</datalist>
|
||||
|
||||
</div> -->
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="email">Entity Name</label>
|
||||
<!-- <input type="text" list="config" class="clr-dropdown" formControlName="file_type"> -->
|
||||
<select formControlName="entityName" class="clr-dropdown">
|
||||
<option *ngFor="let data of tableList" [value]="data.entity_name">{{data.entity_name}}</option>
|
||||
</select>
|
||||
</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>
|
||||
</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>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</clr-modal>
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
//@import "../../../../assets/scss/var";
|
||||
.s-info-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-pg {
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
.button1::after {
|
||||
content: none;
|
||||
}
|
||||
.button1:hover::after {
|
||||
content: "ADD ROWS";
|
||||
}
|
||||
|
||||
$bg-color: #dddddd;
|
||||
|
||||
.section {
|
||||
background-color: $bg-color;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.section p {
|
||||
//color: white;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.clr-file {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
//padding: 0.6rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
input[type=text],[type=date],[type=number],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
margin-top: 3px;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
select{
|
||||
width: 100%;
|
||||
margin-top: 3px;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DatamanagementComponent } from './datamanagement.component';
|
||||
|
||||
describe('DatamanagementComponent', () => {
|
||||
let component: DatamanagementComponent;
|
||||
let fixture: ComponentFixture<DatamanagementComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DatamanagementComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DatamanagementComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
import { HttpErrorResponse, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { DatamanagementService } from 'src/app/services/fnd/datamanagement.service';
|
||||
import { UsermaintanceService } from 'src/app/services/admin/usermaintance.service';
|
||||
import { ExcelService } from 'src/app/services/excel.service';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
@Component({
|
||||
selector: 'app-datamanagement',
|
||||
templateUrl: './datamanagement.component.html',
|
||||
styleUrls: ['./datamanagement.component.scss']
|
||||
})
|
||||
export class DatamanagementComponent implements OnInit {
|
||||
rowSelected: any = {};
|
||||
modaldelete = false;
|
||||
modalEdit = false;
|
||||
modalAdd = false;
|
||||
public entryForm: FormGroup;
|
||||
selected: any[] = [];
|
||||
error;
|
||||
loading = false;
|
||||
data;
|
||||
udata;
|
||||
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,
|
||||
private route: ActivatedRoute,) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getall();
|
||||
// this.getuserall();
|
||||
this.allentity();
|
||||
this.entitygetall();
|
||||
this.entryForm = this._fb.group({
|
||||
user_id: [null],
|
||||
file_name: [null],
|
||||
entityName: [null],
|
||||
// entity_name:[null],
|
||||
file_type: [null],
|
||||
|
||||
});
|
||||
// this.datamservice.getjson().subscribe((data)=>{
|
||||
// console.log(data);
|
||||
// })
|
||||
}
|
||||
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) => {
|
||||
console.log(error);
|
||||
if (error) {
|
||||
this.error = "No data Available OR server Error";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
entitygetall() {
|
||||
this.bulkimportService.getDetails().subscribe((data) => {
|
||||
console.log(data);
|
||||
this.tableList = data;
|
||||
}, (error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getuserall() {
|
||||
this.userservice.getAll().subscribe((data) => {
|
||||
console.log(data);
|
||||
this.udata = data;
|
||||
})
|
||||
}
|
||||
allentity() {
|
||||
// this.datamservice.getallentity().subscribe((data)=>{
|
||||
// console.log(data);
|
||||
// this.entitydata=data;
|
||||
// }, (error: HttpHeaderResponse)=>{
|
||||
// console.log(error);
|
||||
// })
|
||||
}
|
||||
onExport() {
|
||||
this.excel.exportAsExcelFile(this.data, 'user_',
|
||||
moment().format('YYYYMMDD_HHmmss'))
|
||||
}
|
||||
public onFileChanged(event) {
|
||||
//Select File
|
||||
console.log(event);
|
||||
this.selectedFile = event.target.files[0];
|
||||
|
||||
}
|
||||
goToAdd() {
|
||||
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(() => {
|
||||
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) {
|
||||
this.rowSelected = row;
|
||||
this.modaldelete = true;
|
||||
}
|
||||
|
||||
delete(id) {
|
||||
this.modaldelete = false;
|
||||
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) {
|
||||
this.toastr.success("Delete Succesfully");
|
||||
}
|
||||
}, (error: HttpHeaderResponse) => {
|
||||
console.log(error);
|
||||
if (error.status >= 200 && error.status <= 299) {
|
||||
this.toastr.success("Delete Succesfully");
|
||||
}
|
||||
if (error.status >= 400 && error.status <= 499) {
|
||||
this.toastr.error("Not Delete");
|
||||
}
|
||||
if (error.status >= 500 && error.status <= 599) {
|
||||
this.toastr.error("Server Error");
|
||||
}
|
||||
});
|
||||
this.ngOnInit();
|
||||
}
|
||||
onUpdate(id) {
|
||||
this.modalEdit = false;
|
||||
this.datamservice.update(id, this.rowSelected, this.selectedFile).subscribe(
|
||||
(data) => {
|
||||
console.log(data);
|
||||
if (data.status === 202) {
|
||||
this.toastr.success("Updated Succesfully");
|
||||
}
|
||||
|
||||
},
|
||||
(error: HttpErrorResponse) => {
|
||||
console.log(error.message);
|
||||
}
|
||||
);
|
||||
this.ngOnInit();
|
||||
}
|
||||
work(id: any) {
|
||||
console.log(id);
|
||||
this.router.navigate(["../dataworkflow/" + id], { relativeTo: this.route });
|
||||
}
|
||||
}
|
||||
+497
@@ -0,0 +1,497 @@
|
||||
<ol class="breadcrumb breadcrumb-arrow font-trirong">
|
||||
<li><a href="javascript://" [routerLink]="['/']">Admin</a></li>
|
||||
<li><a href="javascript://">Data Import </a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="button-bar">
|
||||
|
||||
<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>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clr-row">
|
||||
<div [class]="layout.block1">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<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=" 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-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 [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.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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div [class]="layout.block2">
|
||||
|
||||
<!--STEP 0-->
|
||||
<div class="card" *ngIf="timelineStyle.step0.open">
|
||||
<div class="card-header">
|
||||
<h3 style="text-align: center;" *ngIf="!appToUpdate">{{tableName}} Table</h3>
|
||||
<h3 style="text-align: center;" *ngIf="appToUpdate"> Update {{college.studentname}}</h3>
|
||||
<div class="container">
|
||||
|
||||
<br />
|
||||
|
||||
<!-- entry form-->
|
||||
<form #contactForm="ngForm" (ngSubmit)="onSave()">
|
||||
<div class="container">
|
||||
<!-- <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>
|
||||
</div>
|
||||
|
||||
<div class="horizontal1">
|
||||
<label for="tags">Department<span class="required-field">*</span></label>
|
||||
<input id="department" type="text" placeholder="Enter department" name="department" required>
|
||||
</div>
|
||||
<div class="horizontal1">
|
||||
<label for="tags">Phone<span class="required-field">*</span></label>
|
||||
<input id="phone" type="text" placeholder="Enter phone" name="phone" required>
|
||||
</div>
|
||||
<div class="horizontal1">
|
||||
<label for="tags">EmailId<span class="required-field">*</span></label>
|
||||
<input id="emailId" type="text" placeholder="Enter emailid" name="emailId" required>
|
||||
|
||||
</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> -->
|
||||
|
||||
<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>
|
||||
</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>
|
||||
|
||||
<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>
|
||||
<tr>
|
||||
<th>Sheet Name</th>
|
||||
<th>Table Name</th>
|
||||
</tr>
|
||||
</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">
|
||||
<option *ngFor="let data of headerData" [value]="data">{{data}}</option>
|
||||
</select> -->
|
||||
</td>
|
||||
</tr>
|
||||
</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:'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) <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) <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>
|
||||
|
||||
<!--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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of changeKeyJson">
|
||||
<td *ngFor="let key of getHeaderskeychange()">{{item[key]}}</td>
|
||||
</tr>
|
||||
</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 class="horizontal1">
|
||||
<label for="tags"> Select Table:<span class="required-field">*</span></label><br>
|
||||
|
||||
<select name="singleSelect" ng-model="data.singleSelect" (change)="selectTable($event.target.value)">
|
||||
<option value="null">Select Table</option>
|
||||
<option value="table1">table1</option>
|
||||
<option value="table2">table2</option>
|
||||
<option value="table3">table3</option>
|
||||
<option value="table4">table4</option>
|
||||
<option value="table5">table5</option>
|
||||
</select><br>
|
||||
</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:'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>
|
||||
</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>
|
||||
</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>
|
||||
<button type="submit" form-control class="btn btn-primary" (click)="onRuleUpdate()">SUBMIT</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</clr-modal>
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
.horizontal{
|
||||
width: 25%;
|
||||
padding: 5px;
|
||||
}
|
||||
.horizontal1{
|
||||
width: 50%;
|
||||
padding: 10px;
|
||||
}
|
||||
.middle{
|
||||
width: 33%;
|
||||
padding: 10px;
|
||||
}
|
||||
.middle1{
|
||||
width: 75%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.full{
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
// input[type=text],[type=date] {
|
||||
// width: 100%;
|
||||
// padding: 12px 20px;
|
||||
// margin: 8px 0;
|
||||
// display: inline-block;
|
||||
// border: 1px solid #ccc;
|
||||
// border-radius: 4px;
|
||||
// box-sizing: border-box;
|
||||
// }
|
||||
// textarea
|
||||
// {
|
||||
// width: 100%;
|
||||
// padding: 15px 15px;
|
||||
// display: inline-block;
|
||||
// border: 1px solid #ccc;
|
||||
// border-radius: 4px;
|
||||
// box-sizing: border-box;
|
||||
// }
|
||||
|
||||
.center{
|
||||
color: blue;
|
||||
}
|
||||
@media (max-width: 600px){
|
||||
.horizontal,.middle,.horizontal1,.middle1 {
|
||||
width: 100%;
|
||||
}}
|
||||
|
||||
|
||||
.postColumn{
|
||||
border: 1px solid #ccc;
|
||||
width: 78%;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.colName{
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
}
|
||||
.fieldWrapper{
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.35rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
input[type=text],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
// margin: 8px 0;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
.postColumn{
|
||||
border: 1px solid #ccc;
|
||||
width: 78%;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.colName{
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
}
|
||||
.colfields{
|
||||
border: 1px solid black;
|
||||
margin: 17px;
|
||||
text-align: center;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
select{
|
||||
width: 100%;
|
||||
margin-top: 3px;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DatamananementworkflowComponent } from './datamananementworkflow.component';
|
||||
|
||||
describe('DatamananementworkflowComponent', () => {
|
||||
let component: DatamananementworkflowComponent;
|
||||
let fixture: ComponentFixture<DatamananementworkflowComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DatamananementworkflowComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DatamananementworkflowComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+555
@@ -0,0 +1,555 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { DatamanagementService } from 'src/app/services/fnd/datamanagement.service';
|
||||
import { ExcelService } from 'src/app/services/excel.service';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-datamananementworkflow',
|
||||
templateUrl: './datamananementworkflow.component.html',
|
||||
styleUrls: ['./datamananementworkflow.component.scss']
|
||||
})
|
||||
export class DatamananementworkflowComponent implements OnInit {
|
||||
data;
|
||||
getbyiddata;
|
||||
id;
|
||||
columns: any[];
|
||||
rows: any[];
|
||||
bodyrow: any[] = [];
|
||||
getHeaderData;
|
||||
JsonHeader = [];
|
||||
rowdata;
|
||||
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 },
|
||||
};
|
||||
|
||||
json: string = "";
|
||||
luisApp =
|
||||
{
|
||||
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) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.id = this.route.snapshot.params["id"];
|
||||
console.log("update with id = ", this.id);
|
||||
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) => {
|
||||
console.log(data);
|
||||
this.data = data;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
getById(id) {
|
||||
this.datamservice.getTemplateById(id).subscribe((data) => {
|
||||
console.log(data);
|
||||
this.getbyiddata = data;
|
||||
this.tableName = data.entityName;
|
||||
});
|
||||
}
|
||||
headerData;
|
||||
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);
|
||||
|
||||
// const objectArray = data.map(key => ({
|
||||
// headerName: key,
|
||||
// value: "",
|
||||
// }));
|
||||
// // console.log(objectArray);
|
||||
// this.getHeaderData = JSON.stringify(objectArray);
|
||||
// console.log(this.getHeaderData);
|
||||
|
||||
// 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) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
selectedSheetName: string | null = null;
|
||||
getHeaderbybutton(id, sheetName) {
|
||||
// this.bulkUpload.getHeader(id,sheetName).subscribe((data) => {
|
||||
// console.log(data);
|
||||
// this.getHeaderData = data;
|
||||
|
||||
// const objectArray = data.map(key => ({
|
||||
// headerName: key,
|
||||
// value: "",
|
||||
// }));
|
||||
// // 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkData() {
|
||||
console.log(this.JsonHeader);
|
||||
console.log(this.mapperText);
|
||||
}
|
||||
|
||||
getkeychangesJson() {
|
||||
|
||||
const jsonString = JSON.stringify(this.rows);
|
||||
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) => {
|
||||
console.log(data);
|
||||
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]);
|
||||
}
|
||||
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",
|
||||
}
|
||||
}
|
||||
// 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")
|
||||
}
|
||||
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;
|
||||
|
||||
});
|
||||
}
|
||||
// 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];
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
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.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;
|
||||
}
|
||||
|
||||
Rule: boolean = false;
|
||||
checkRule: boolean = true;
|
||||
RuleData: string = '';
|
||||
ruleModal = false;
|
||||
RuleHeader = [];
|
||||
|
||||
checkRules() {
|
||||
console.log("rule line open")
|
||||
this.ruleModal = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MappingruleComponent } from './mappingrule.component';
|
||||
|
||||
describe('MappingruleComponent', () => {
|
||||
let component: MappingruleComponent;
|
||||
let fixture: ComponentFixture<MappingruleComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MappingruleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MappingruleComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-mappingrule',
|
||||
templateUrl: './mappingrule.component.html',
|
||||
styleUrls: ['./mappingrule.component.scss']
|
||||
})
|
||||
export class MappingruleComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
<h4 style="font-weight: 300;display: inline;"><b>Mapping Rule</b></h4>
|
||||
<span class="label label-light-blue" style="display: inline;margin-left: 10px;">Add Mode</span><br>
|
||||
Mapping Rules are proccessed while importing bulk records for respective entity
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- entry form-->
|
||||
<form [formGroup]="entryForm"><!-- (ngSubmit)="onSubmit()"-->
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">Entity Name</label>
|
||||
<select formControlName="entity_name" required>
|
||||
<option value="null">Choose Entity Name</option>
|
||||
<option>customer</option>
|
||||
<option>site</option>
|
||||
<option>Service order</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">Sheet Name</label>
|
||||
<input type="text" formControlName="fileType" placeholder="Enter File Name"
|
||||
class="clr-input" required>
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">File</label><br>
|
||||
<input type="file" (change)="chooseFile($event)">
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="description">Description</label>
|
||||
<textarea id="" cols="10" rows="2" name=" remarks" formControlName="description" placeholder="Enter Description">
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="workflow_name">Active</label>
|
||||
<input type="checkbox" formControlName="active" clrToggle />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 40px;">
|
||||
<h5>Mapping Fields</h5>
|
||||
<!-- <div>Select open to add rules, select reset to delete existing rules</div> -->
|
||||
</div>
|
||||
<hr>
|
||||
<div class="clr-row" style="padding-left: 10px;">
|
||||
<button class="btn btn-primary" (click)="getHeaderFieldData()">Get Header</button>
|
||||
<button class="btn btn-primary" (click)="getDDFieldData()">Get Value</button>
|
||||
</div>
|
||||
<div class="clr-row fieldWrapper">
|
||||
<div class="clr-col-md-12 clr-col-sm-12">
|
||||
<table class="table" style="width:75%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header Fields</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of serverData; let i = index">
|
||||
<td class="left">
|
||||
<input type="text" [(ngModel)]="data.headerName" [ngModelOptions]="{standalone: true}" name="headerName" class="clr-input" readonly>
|
||||
</td>
|
||||
<td>
|
||||
<select colspan="2" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-dropdown" >
|
||||
<option value="null">Select Values</option>
|
||||
<option *ngFor="let sub of valueofField" [value]="sub">{{sub}}</option>
|
||||
<!-- <option [ngValue]="null" [selected]="data.checkboxval">null</option> -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="center">
|
||||
<div class="btn-group">
|
||||
<div class="checkbox btn">
|
||||
<input type="checkbox" id="btn-demo-check-1" (click)="goback()"/>
|
||||
<label for="btn-demo-check-1">Cancel</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="!entryForm.valid" (click)="onSubmit()">SUBMIT</button>
|
||||
</div>
|
||||
</form>
|
||||
</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>
|
||||
</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>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//@import "../../../../assets/scss/var";
|
||||
.s-info-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-pg {
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
.button1::after {
|
||||
content: none;
|
||||
}
|
||||
.button1:hover::after {
|
||||
content: "ADD ROWS";
|
||||
}
|
||||
|
||||
$bg-color: #dddddd;
|
||||
|
||||
.section {
|
||||
background-color: $bg-color;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.section p {
|
||||
//color: white;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.clr-file {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
//padding: 0.6rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
input[type=text],[type=date],[type=number],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
margin-top: 3px;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
select{
|
||||
width: 100%;
|
||||
margin-top: 3px;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MappingruleaddComponent } from './mappingruleadd.component';
|
||||
|
||||
describe('MappingruleaddComponent', () => {
|
||||
let component: MappingruleaddComponent;
|
||||
let fixture: ComponentFixture<MappingruleaddComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MappingruleaddComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MappingruleaddComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
import { HttpErrorResponse, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-mappingruleadd',
|
||||
templateUrl: './mappingruleadd.component.html',
|
||||
styleUrls: ['./mappingruleadd.component.scss']
|
||||
})
|
||||
export class MappingruleaddComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
selectedFile: File[]=[];
|
||||
|
||||
datajson;
|
||||
transform:boolean = false;
|
||||
checkTransform:boolean = true;
|
||||
mapperdata;
|
||||
|
||||
entityname;
|
||||
description;
|
||||
constructor(private _fb: FormBuilder, private router: Router,private toastr: ToastrService,
|
||||
private route: ActivatedRoute,private dataservice:BulkimportService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.entryForm = this._fb.group({
|
||||
entity_name:[null],
|
||||
mapping_rule:[null],
|
||||
description: [null],
|
||||
active: [true],
|
||||
fileType: [null],
|
||||
});
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
const data = params['data'];
|
||||
this.entityname = params['name'];
|
||||
this.description = params['description'];
|
||||
|
||||
|
||||
if (data) {
|
||||
try {
|
||||
this.datajson = JSON.parse(data);
|
||||
console.log('Received data:', this.datajson);
|
||||
} catch (e) { console.error('Invalid JSON:', data);}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
const condition = this.dataservice.getCondition();
|
||||
if(condition === 'mapper'){
|
||||
this.transform = true;
|
||||
this.checkTransform = false;
|
||||
if(this.datajson!== undefined){
|
||||
// if(this.entryForm.value.rule_line == 'undefined'){ this.entryForm.value.rule_line= '';}
|
||||
const currentText = this.entryForm.value.rule_line = '';
|
||||
this.mapperdata = currentText + this.datajson;
|
||||
// this.entryForm.value.rule_line = this.mapperdata;
|
||||
// this.Updating();
|
||||
this.dataservice.setCondition('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(this.entryForm.value);
|
||||
|
||||
this.entryForm.patchValue({
|
||||
entity_name: this.entityname,
|
||||
description: this.description,
|
||||
});
|
||||
|
||||
console.log(this.entryForm.value);
|
||||
}
|
||||
|
||||
serverData = [
|
||||
{
|
||||
}];
|
||||
onAddLines(){
|
||||
this.serverData.push({
|
||||
rulename: "",
|
||||
fromsheet:"",
|
||||
fromColumn: "",
|
||||
validationTable: "",
|
||||
checkColumn: "",
|
||||
replacementcolumn:"",
|
||||
useColumn:"",
|
||||
errormsg:""
|
||||
});
|
||||
console.log(this.serverData);
|
||||
}
|
||||
deleteRow(index) {
|
||||
this.serverData.splice(index, 1);
|
||||
}
|
||||
|
||||
toastrShown: boolean = false;
|
||||
onSubmit(){
|
||||
this.entryForm.value.mapping_rule = JSON.stringify(this.serverData);
|
||||
console.log(this.entryForm.value);
|
||||
this.dataservice.saveMappingData(this.entryForm.value).subscribe((data)=>{
|
||||
console.log(data);
|
||||
if (data) {
|
||||
if (!this.toastrShown) {
|
||||
this.toastrShown = true; // Set the flag to indicate that the toastr message has been shown
|
||||
this.toastr.success("Added Successfully");
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../all"], { relativeTo: this.route });
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}, (error: HttpHeaderResponse)=>{
|
||||
console.log(error);
|
||||
if(error.status===202){
|
||||
this.toastr.success("Added Succesfully");
|
||||
}
|
||||
if(error.status===404){
|
||||
this.toastr.error("Not Added");
|
||||
}
|
||||
if(error.status===400){
|
||||
this.toastr.error("Not Added");
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../all"], { relativeTo: this.route });
|
||||
},500);
|
||||
}
|
||||
goback(){
|
||||
this.router.navigate(["../all"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
|
||||
headerData;
|
||||
getColumns(table){
|
||||
console.log(table);
|
||||
// console.log(this.getbyiddata.entityName);
|
||||
this.dataservice.getColumnNames(table).subscribe((data) => {
|
||||
console.log(data);
|
||||
this.headerData = data;
|
||||
});
|
||||
}
|
||||
|
||||
checkTransformMapper = true;
|
||||
transformMapper = false;
|
||||
mapperText;
|
||||
getHeaderData;
|
||||
JsonHeader = [];
|
||||
selectedSheetName: string | null = null;
|
||||
columnJson =[];
|
||||
sheetNames:any;
|
||||
checkTransMapper(){
|
||||
|
||||
console.log("Mapper open")
|
||||
// console.log(this.storeData);
|
||||
if(this.getHeaderData){
|
||||
this.checkTransformMapper = false;
|
||||
this.transformMapper = 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.checkTransformMapper = true;
|
||||
this.transformMapper = false;
|
||||
}
|
||||
|
||||
}
|
||||
mappperModal = false;
|
||||
goFromMapperField(){
|
||||
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);}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
transResetMapper(){
|
||||
this.mapperText = '';
|
||||
this.transformMapper = false;
|
||||
this.checkTransformMapper = true;
|
||||
}
|
||||
|
||||
onUpdate(){
|
||||
this.mappperModal = false;
|
||||
}
|
||||
|
||||
|
||||
getHeaderFieldData(){
|
||||
if(this.entryForm.value.entity_name){
|
||||
this.dataservice.getColumnNames(this.entryForm.value.entity_name).subscribe(data =>{
|
||||
console.log(data);
|
||||
const objectArray = data.map(fieldname => ({
|
||||
headerName: fieldname,
|
||||
value: "",
|
||||
}));
|
||||
// console.log(objectArray);
|
||||
const headerdata= JSON.stringify(objectArray);
|
||||
this.serverData = JSON.parse(headerdata);
|
||||
})
|
||||
}else{
|
||||
this.toastr.warning("Entity Name is Required")
|
||||
}
|
||||
}
|
||||
|
||||
chooseFile(event){
|
||||
console.log(event);
|
||||
this.selectedFile = event.target.files[0];
|
||||
}
|
||||
|
||||
valueofField;
|
||||
getDDFieldData(){
|
||||
if(this.entryForm.value.fileType && this.selectedFile){
|
||||
this.dataservice.getDDforMappingRule(this.selectedFile,this.entryForm.value.fileType).subscribe(data =>{
|
||||
console.log(data);
|
||||
this.valueofField = data.body;
|
||||
},(error)=>{
|
||||
if(error.status === 404){
|
||||
this.toastr.error("Sheet not found")
|
||||
}
|
||||
if(error.status >= 500 && error.status <= 599){
|
||||
this.toastr.error("Server Error")
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.toastr.warning("Sheet name and file is required")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
|
||||
<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="jvascript://">Data Management</a></li>
|
||||
<li><a href="javascript://">Mapping Rule</a></li>
|
||||
</ol>
|
||||
<br>
|
||||
|
||||
<div class="dg-wrapper">
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-8">
|
||||
<h3>Mapping Rule</h3>
|
||||
</div>
|
||||
<div class="clr-col-4" style="text-align: right;">
|
||||
<button class="btn btn-outline" (click)="onExport()">
|
||||
<clr-icon shape="export"></clr-icon> xlsx
|
||||
</button>
|
||||
<button id="add" class="btn btn-primary" (click)="goToAdd()">
|
||||
<clr-icon shape="plus"></clr-icon>ADD
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<clr-dg-column [clrDgField]="'entity_name'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Entity Name
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'description'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Description
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'active'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Active
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'fileType'"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
File Type
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'action'" style="width: 100px;"> <ng-container *clrDgHideableColumn="{hidden: false}">
|
||||
Action
|
||||
</ng-container></clr-dg-column>
|
||||
<clr-dg-row *clrDgItems="let user of data?.slice()?.reverse()" [clrDgItem]="user">
|
||||
<clr-dg-cell>{{user.entity_name}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{user.description}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{user.active}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{user.fileType}}</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>
|
||||
</a>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-action-overflow>
|
||||
<button class="action-item" (click)="goToEdit(user.id)">Edit <clr-icon shape="edit" class="is-error"></clr-icon></button>
|
||||
<!-- <button class="action-item" (click)="onDelete(user)">Delete<clr-icon shape="trash" class="is-error"></clr-icon></button> -->
|
||||
</clr-dg-action-overflow>
|
||||
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">Users per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}} users
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
|
||||
<clr-modal [(clrModalOpen)]="modaldelete" [clrModalSize]="'lg'" [clrModalStaticBackdrop]="true">
|
||||
|
||||
<div class="modal-body" *ngIf="rowSelected.id">
|
||||
<h1 class="delete">Are You Sure Want to delete?</h1>
|
||||
<h2 class="heading">{{rowSelected.id}}</h2>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="modaldelete = false">Cancel</button>
|
||||
<button type="submit" (click)="delete(rowSelected.id)" class="btn btn-primary" >Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</clr-modal>
|
||||
|
||||
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
.delete,.heading{
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MappingruleallComponent } from './mappingruleall.component';
|
||||
|
||||
describe('MappingruleallComponent', () => {
|
||||
let component: MappingruleallComponent;
|
||||
let fixture: ComponentFixture<MappingruleallComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MappingruleallComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MappingruleallComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { ExcelService } from 'src/app/services/excel.service';
|
||||
import * as moment from 'moment';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
@Component({
|
||||
selector: 'app-mappingruleall',
|
||||
templateUrl: './mappingruleall.component.html',
|
||||
styleUrls: ['./mappingruleall.component.scss']
|
||||
})
|
||||
export class MappingruleallComponent implements OnInit {
|
||||
loading = false;
|
||||
error;
|
||||
selected: any[] = [];
|
||||
rowSelected :any= {};
|
||||
modaldelete=false;
|
||||
data;
|
||||
constructor(private router: Router, private toastr: ToastrService,
|
||||
private route: ActivatedRoute,private excel: ExcelService,private bulkimportService:BulkimportService,) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getall();
|
||||
}
|
||||
getall(){
|
||||
this.bulkimportService.getMappingDetails().subscribe((data)=>{
|
||||
console.log(data);
|
||||
this.data=data;
|
||||
if(this.data.length == 0){
|
||||
this.error="No data Available";
|
||||
console.log(this.error);
|
||||
}
|
||||
|
||||
},(error) => {
|
||||
console.log(error);
|
||||
if(error){
|
||||
this.error="No data Available OR server Error";
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
goToAdd(){
|
||||
this.router.navigate(["../add"], { relativeTo: this.route });
|
||||
|
||||
}
|
||||
onExport() {
|
||||
this.excel.exportAsExcelFile(this.data, 'user_',
|
||||
moment().format('YYYYMMDD_HHmmss'))
|
||||
}
|
||||
goToEdit(id) {
|
||||
this.router.navigate(["../edit/" + id], { relativeTo: this.route });
|
||||
}
|
||||
onDelete(row) {
|
||||
this.rowSelected = row;
|
||||
this.modaldelete=true;
|
||||
}
|
||||
|
||||
delete(id){
|
||||
this.modaldelete = false;
|
||||
console.log("in delete "+id);
|
||||
this.bulkimportService.deleteMappingById(id).subscribe(
|
||||
(data) => {
|
||||
console.log(data);
|
||||
this.ngOnInit();
|
||||
if (data == null || data) {
|
||||
this.toastr.success('Deleted successfully');
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
console.log('Error in adding data...',+error);
|
||||
if(isNaN(error)){
|
||||
this.toastr.success('Deleted successfully');
|
||||
}else{
|
||||
this.toastr.error('Not Deleted Data Getting Some Error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
activeTab: number = 1;
|
||||
|
||||
showTab(tabNumber: number) {
|
||||
this.activeTab = tabNumber;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<h4 style="font-weight: 300;display: inline;"><b>Mapping Rule</b></h4>
|
||||
<span class="label label-light-blue" style="display: inline;margin-left: 10px;">Edit Mode</span><br>
|
||||
Mapping Rules are proccessed while importing bulk records for respective entity
|
||||
<hr>
|
||||
<div class="container">
|
||||
<form><!-- (ngSubmit)="onSubmit()"-->
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">Entity Name</label>
|
||||
<select [(ngModel)]="tdata.entity_name" name="entity_name" >
|
||||
<option value="null">Choose Entity Name</option>
|
||||
<option>customer</option>
|
||||
<option>site</option>
|
||||
<option>Service order</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">Sheet Name</label>
|
||||
<input id="projectName" type="text" [(ngModel)]="tdata.fileType" name="fileType" placeholder="Enter File Name"
|
||||
class="clr-input" required>
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="projectName">File</label><br>
|
||||
<input type="file" (change)="chooseFile($event)">
|
||||
</div>
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="description">Description</label>
|
||||
<textarea id="" cols="10" rows="2" name=" remarks" [(ngModel)]="tdata.description" name="description" placeholder="Enter Description">
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<div class="clr-col-md-4 clr-col-sm-12">
|
||||
<label for="workflow_name">Active</label>
|
||||
<input type="checkbox" [(ngModel)]="tdata.active" name="active" clrToggle />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 40px;">
|
||||
<h5>Mapping Fields</h5>
|
||||
<!-- <div>Select open to add rules, select reset to delete existing rules</div> -->
|
||||
</div>
|
||||
<hr>
|
||||
<div class="clr-row" style="padding-left: 10px;">
|
||||
<button class="btn btn-primary" (click)="getHeaderFieldData()">Get Header</button>
|
||||
<button class="btn btn-primary" (click)="getDDFieldData()">Get Value</button>
|
||||
</div>
|
||||
<div class="clr-row fieldWrapper">
|
||||
<div class="clr-col-md-12 clr-col-sm-12">
|
||||
<table class="table" style="width:75%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header Fields</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of serverData; let i = index">
|
||||
<td class="left">
|
||||
<input type="text" [(ngModel)]="data.headerName" [ngModelOptions]="{standalone: true}" name="headerName" class="clr-input" readonly>
|
||||
</td>
|
||||
<td>
|
||||
<input *ngIf="!showdropdown" type="text" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-input">
|
||||
|
||||
<span *ngIf="showdropdown"><select colspan="2" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}" name="value" class="clr-dropdown" >
|
||||
<option value="null">Select Values</option>
|
||||
<option *ngFor="let sub of valueofField" [value]="sub">{{sub}}</option>
|
||||
</select></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="clr-row">
|
||||
|
||||
<div class="clr-col-6">
|
||||
<div *ngIf="checkTransform">
|
||||
<div style="text-align: right; width: 100px;"> <span style="cursor: pointer;" class="label label-light-green p7 lbutton" (click)="checkTrans()">Add Rule line</span></div>
|
||||
<textarea type="text" style="height:150px; background-color:#d6d6d6;" readonly></textarea>
|
||||
</div>
|
||||
<div *ngIf="transform">
|
||||
<label for="sequence" style="font-weight: bold;"><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" style="height:150px;" [(ngModel)]="tdata.rule_line" name="rule_line" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="center">
|
||||
<div class="btn-group">
|
||||
<div class="checkbox btn">
|
||||
<input type="checkbox" id="btn-demo-check-1" (click)="goback()"/>
|
||||
<label for="btn-demo-check-1">Cancel</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" (click)="onSubmit()">UPDATE</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//@import "../../../../assets/scss/var";
|
||||
.s-info-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-pg {
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
.button1::after {
|
||||
content: none;
|
||||
}
|
||||
.button1:hover::after {
|
||||
content: "ADD ROWS";
|
||||
}
|
||||
|
||||
$bg-color: #dddddd;
|
||||
|
||||
.section {
|
||||
background-color: $bg-color;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.section p {
|
||||
//color: white;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.clr-input {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.75rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.clr-file {
|
||||
color: #212529;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
//padding: 0.6rem 0.75rem;
|
||||
margin-top: 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
input[type=text],[type=date],[type=number],textarea {
|
||||
width: 100%;
|
||||
padding: 15px 15px;
|
||||
margin-top: 3px;
|
||||
background-color:rgb(255, 255, 255);
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.required-field{
|
||||
color: red;
|
||||
|
||||
}
|
||||
select{
|
||||
width: 100%;
|
||||
margin-top: 3px;
|
||||
padding: 5px 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MappingruleeditComponent } from './mappingruleedit.component';
|
||||
|
||||
describe('MappingruleeditComponent', () => {
|
||||
let component: MappingruleeditComponent;
|
||||
let fixture: ComponentFixture<MappingruleeditComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MappingruleeditComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MappingruleeditComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
import { HttpErrorResponse, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { BulkimportService } from 'src/app/services/fnd/bulkimport.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-mappingruleedit',
|
||||
templateUrl: './mappingruleedit.component.html',
|
||||
styleUrls: ['./mappingruleedit.component.scss']
|
||||
})
|
||||
export class MappingruleeditComponent implements OnInit {
|
||||
public entryForm: FormGroup;
|
||||
selectedFile: File[]=[];
|
||||
id;
|
||||
datajson;
|
||||
transform:boolean = false;
|
||||
checkTransform:boolean = true;
|
||||
mapperdata;
|
||||
tdata: any = {};
|
||||
entityname;
|
||||
description;
|
||||
constructor(private _fb: FormBuilder, private router: Router,private toastr: ToastrService,
|
||||
private route: ActivatedRoute,private dataservice:BulkimportService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.id = this.route.snapshot.params["id"];
|
||||
console.log("update with id = ", this.id);
|
||||
|
||||
|
||||
this.dataservice.getMappingDetailsById(this.id).subscribe(data => {
|
||||
this.tdata = data;
|
||||
this.serverData = JSON.parse(data.mapping_rule);
|
||||
console.log(this.tdata);
|
||||
},
|
||||
(err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
console.log(this.tdata);
|
||||
// this.entryForm.patchValue({
|
||||
// entity_name: this.entityname,
|
||||
// description: this.description,
|
||||
// });
|
||||
// console.log(this.entryForm.value);
|
||||
}
|
||||
|
||||
getById(id: number) {
|
||||
|
||||
}
|
||||
|
||||
serverData = [];
|
||||
|
||||
toastrShown: boolean = false;
|
||||
onSubmit(){
|
||||
this.tdata.mapping_rule = JSON.stringify(this.serverData);
|
||||
console.log(this.tdata);
|
||||
this.dataservice.updateMappingData(this.tdata, this.id).subscribe((data)=>{
|
||||
console.log(data);
|
||||
if (data.operationStatus) {
|
||||
this.toastr.warning(data.operationMessage);
|
||||
}else{
|
||||
if (!this.toastrShown) {
|
||||
this.toastrShown = true; // Set the flag to indicate that the toastr message has been shown
|
||||
this.toastr.success("Update Successfully");
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../../all"], { relativeTo: this.route });
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}, (error: HttpHeaderResponse)=>{
|
||||
console.log(error);
|
||||
if(error.status===202){
|
||||
this.toastr.success("Update Succesfully");
|
||||
}
|
||||
if(error.status===404){
|
||||
this.toastr.error("Not Update");
|
||||
}
|
||||
if(error.status===400){
|
||||
this.toastr.error("Not Update");
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["../../all"], { relativeTo: this.route });
|
||||
},500);
|
||||
}
|
||||
|
||||
Updating(){
|
||||
console.log(this.tdata);
|
||||
this.dataservice.updateData(this.tdata, this.id).subscribe(data=>{
|
||||
console.log(data);
|
||||
// this.ngOnInit();
|
||||
}, (error: HttpHeaderResponse)=>{
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
goback(){
|
||||
this.router.navigate(["../../all"], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
|
||||
headerData;
|
||||
getColumns(table){
|
||||
console.log(table);
|
||||
// console.log(this.getbyiddata.entityName);
|
||||
this.dataservice.getColumnNames(table).subscribe((data) => {
|
||||
console.log(data);
|
||||
this.headerData = data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
getHeaderFieldData(){
|
||||
if(this.tdata.entity_name){
|
||||
this.dataservice.getColumnNames(this.tdata.entity_name).subscribe(data =>{
|
||||
console.log(data);
|
||||
const objectArray = data.map(fieldname => ({
|
||||
headerName: fieldname,
|
||||
value: "",
|
||||
}));
|
||||
// console.log(objectArray);
|
||||
const headerdata= JSON.stringify(objectArray);
|
||||
this.serverData = JSON.parse(headerdata);
|
||||
})
|
||||
}else{
|
||||
this.toastr.warning("Entity Name is Required")
|
||||
}
|
||||
}
|
||||
|
||||
showdropdown = false;
|
||||
chooseFile(event){
|
||||
console.log(event);
|
||||
this.selectedFile = event.target.files[0];
|
||||
if(event){ this.showdropdown = true;}
|
||||
|
||||
}
|
||||
|
||||
valueofField;
|
||||
getDDFieldData(){
|
||||
if(this.tdata.fileType && this.selectedFile){
|
||||
this.dataservice.getDDforMappingRule(this.selectedFile,this.tdata.fileType).subscribe(data =>{
|
||||
console.log(data);
|
||||
this.valueofField = data.body;
|
||||
},(error)=>{
|
||||
if(error.status === 404){
|
||||
this.toastr.error("Sheet not found")
|
||||
}
|
||||
if(error.status >= 500 && error.status <= 599){
|
||||
this.toastr.error("Server Error")
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.toastr.warning("Sheet name and file is required")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user