accesstye

This commit is contained in:
string 2025-03-20 11:46:06 +05:30
parent 6f3c5d857e
commit f7c801e835
6 changed files with 502 additions and 469 deletions

View File

@ -12,171 +12,178 @@ import { AccesstypeService } from 'src/app/services/admin/accesstype.service';
export class AccesstypeComponent implements OnInit { export class AccesstypeComponent implements OnInit {
loading = false; loading = false;
selected: any[] = []; selected: any[] = [];
rowSelected :any= {}; rowSelected: any = {};
modaldelete=false; modaldelete = false;
modalAdd= false; modalAdd = false;
modaledit=false; modaledit = false;
moduleAdd=false; moduleAdd = false;
error; error;
data; data;
module; module;
moduledata; moduledata;
submitted=false; submitted = false;
selected1 = "true"; selected1 = "true";
public entryForm: FormGroup; public entryForm: FormGroup;
public mentryForm:FormGroup; public mentryForm: FormGroup;
constructor( private _fb: FormBuilder,private toastr:ToastrService, constructor(private _fb: FormBuilder, private toastr: ToastrService,
private router: Router,private accesstype:AccesstypeService, private router: Router, private accesstype: AccesstypeService,
private route: ActivatedRoute, private route: ActivatedRoute,
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.entryForm = this._fb.group({ this.entryForm = this._fb.group({
name:['',[Validators.required]], name: ['', [Validators.required]],
defaultvalue:['',[Validators.required]] , defaultvalue: ['', [Validators.required]],
description:['',[Validators.required]] , description: ['', [Validators.required]],
}); });
this.mentryForm=this._fb.group({ this.mentryForm = this._fb.group({
modulename:[null], modulename: [null],
}) })
this.getdata(); this.getdata();
this.getdata1(); this.getdata1();
} }
getdata(){ getdata() {
this.accesstype.getAll().subscribe(resp => { this.accesstype.getAll().subscribe(resp => {
this.data = resp; this.data = resp;
console.log('menus: ', this.data); console.log('menus: ', this.data);
if(this.data.length==0){ if (this.data.length == 0) {
this.error="No data Available"; this.error = "No data Available";
console.log(this.error) console.log(this.error)
} }
},(error) => { }, (error) => {
console.log(error); console.log(error);
if(error){ if (error) {
this.error="Server Error"; this.error = "Server Error";
} }
}) })
} }
getdata1(){ getdata1() {
this.accesstype.getAll1().subscribe(resp => { this.accesstype.getAll1().subscribe(resp => {
this.moduledata = resp; this.moduledata = resp;
console.log('menus: ', this.moduledata); console.log('menus: ', this.moduledata);
if(this.moduledata.length==0){ if (this.moduledata.length == 0) {
this.error="No data Available"; this.error = "No data Available";
console.log(this.error) console.log(this.error)
} }
},(error) => { }, (error) => {
console.log(error); console.log(error);
if(error){ if (error) {
this.error="Server Error"; this.error = "Server Error";
} }
}) })
} }
goToAdd(){ goToAdd() {
this.modalAdd=true; this.modalAdd = true;
} }
onSubmit(){ onSubmit() {
console.log(this.entryForm.value); console.log(this.entryForm.value);
this.submitted=true; this.submitted = true;
if (this.entryForm.invalid) { if (this.entryForm.invalid) {
return; return;
} }
console.log(this.entryForm.value); console.log(this.entryForm.value);
this.accesstype.create(this.entryForm.value).subscribe((data)=>{ this.accesstype.create(this.entryForm.value).subscribe((data) => {
console.log(data); console.log(data);
if (data) { if (data) {
this.toastr.success('Added successfully'); this.toastr.success('Added successfully');
} }
this.ngOnInit();
}, },
(error) => { (error) => {
console.log('Error in adding data...',+error); console.log('Error in adding data...', error);
if(error){ if (error) {
this.toastr.error('Not added Data Getting Some Error'); this.toastr.error('Not added Data Getting Some Error');
} }
this.ngOnInit();
}); });
this.modalAdd=false; this.modalAdd = false;
} }
goToEdit(row) { goToEdit(row) {
this.rowSelected = row; this.rowSelected = row;
console.log(row) console.log(row)
this.modaledit=true; this.modaledit = true;
//this.router.navigate(["../edit/" + id], { relativeTo: this.route }); //this.router.navigate(["../edit/" + id], { relativeTo: this.route });
} }
onDelete(row) { onDelete(row) {
this.rowSelected = row; this.rowSelected = row;
this.modaldelete=true; this.modaldelete = true;
} }
delete(id) delete(id) {
{
this.modaldelete = false; this.modaldelete = false;
console.log("in delete "+id); console.log("in delete " + id);
this.accesstype.delete(id).subscribe((data)=>{ this.accesstype.delete(id).subscribe((data) => {
console.log(data); console.log(data);
if (data) { if (data) {
this.toastr.success('Deleted successfully'); this.toastr.success('Deleted successfully');
}
},
(error) => {
console.log('Error in adding data...',+error);
if(error){
this.toastr.error('Not Deleted Data Getting Some Error');
} }
}); this.ngOnInit();
},
(error) => {
console.log('Error in adding data...', error);
if (error) {
this.toastr.error('Not Deleted Data Getting Some Error');
}
this.ngOnInit();
});
} }
onUpdate(id){ onUpdate(id) {
this.modaledit=false; this.modaledit = false;
this.accesstype.update(id,this.rowSelected).subscribe((data)=>{ this.accesstype.update(id, this.rowSelected).subscribe((data) => {
console.log(data); console.log(data);
if (data) { if (data) {
this.toastr.success('Updated successfully'); this.toastr.success('Updated successfully');
} }
}, this.ngOnInit();
(error) => { },
console.log('Error in adding data...',+error); (error) => {
if(error){ console.log('Error in adding data...', error);
this.toastr.error('Not updated Data Getting Some Error'); if (error) {
} this.toastr.error('Not updated Data Getting Some Error');
}); }
this.ngOnInit();
});
} }
goTomodules(){ goTomodules() {
this.router.navigate(["../acmodules"], { relativeTo: this.route }); this.router.navigate(["../acmodules"], { relativeTo: this.route });
} }
accessid; accessid;
gomodules(row){ gomodules(row) {
this.rowSelected = row; this.rowSelected = row;
this.moduleAdd=true; this.moduleAdd = true;
this.accessid=row.id this.accessid = row.id
this.getallidmodules(this.accessid) this.getallidmodules(this.accessid)
} }
moduledata1; moduledata1;
getallidmodules(id){ getallidmodules(id) {
this.accesstype.getById(id).subscribe((data)=>{ this.accesstype.getById(id).subscribe((data) => {
console.log(data); console.log(data);
this.moduledata1=data; this.moduledata1 = data;
if(this.moduledata1.length==0){ if (this.moduledata1.length == 0) {
this.error="No data Available"; this.error = "No data Available";
console.log(this.error) console.log(this.error)
} }
}) })
} }
addmodules(id){ addmodules(id) {
console.log(this.mentryForm.value); console.log(this.mentryForm.value);
this.accesstype.addById(id,this.mentryForm.value).subscribe((data)=>{ this.accesstype.addById(id, this.mentryForm.value).subscribe((data) => {
console.log(data); console.log(data);
if(data){ if (data) {
this.toastr.success("Added Successfully"); this.toastr.success("Added Successfully");
} }
},(error) => { this.ngOnInit();
console.log('Error in adding data...',+error); }, (error) => {
if(error){ console.log('Error in adding data...', error);
this.toastr.error('Not Added Data Getting Some Error'); if (error) {
} this.toastr.error('Not Added Data Getting Some Error');
}) }
this.moduleAdd=false; this.ngOnInit();
})
this.moduleAdd = false;
} }
} }

View File

@ -4,9 +4,6 @@
<li><a href="javascript://">{{ 'MENU_ACCESS_CONTROL' | translate }}</a></li> <li><a href="javascript://">{{ 'MENU_ACCESS_CONTROL' | translate }}</a></li>
</ol> </ol>
<div class="clr-row"> <div class="clr-row">
<div class="clr-col-6" style="display:flex ;"> <div class="clr-col-6" style="display:flex ;">
<div style="margin-right: 25px;"> <div style="margin-right: 25px;">
@ -20,8 +17,10 @@
{{ 'FOR' | translate }} <select id="" style="height: 30px;" (change)="idofselected($event.target.value)"> {{ 'FOR' | translate }} <select id="" style="height: 30px;" (change)="idofselected($event.target.value)">
<option *ngFor="let sub of givendata" [value]="sub.usrGrp" [selected]="sub.usrGrp== 40">{{sub.groupName}}</option> <option *ngFor="let sub of givendata" [value]="sub.usrGrp" [selected]="sub.usrGrp== 40">{{sub.groupName}}</option>
</select> </select>
<button id="add" class="btn btn-primary" style="margin-left: 20px;" (click)="getbyuseriddata()"> {{ 'RELOAD' | translate }} </button> <button id="add" class="btn btn-primary" style="margin-left: 20px;" (click)="getbyuseriddata()"> {{ 'RELOAD' |
<span *ngIf="!toggle">{{ 'SHOW_ALL' | translate }} </span><span *ngIf="toggle">{{ 'ONLY_MAIN_MENU' | translate }}</span> translate }} </button>
<span *ngIf="!toggle">{{ 'SHOW_ALL' | translate }} </span><span *ngIf="toggle">{{ 'ONLY_MAIN_MENU' | translate
}}</span>
<label class="switch"> <label class="switch">
<input type="checkbox" ([ngModel])="toggle" checked (click)="toggleCheckbox()"> <input type="checkbox" ([ngModel])="toggle" checked (click)="toggleCheckbox()">
<span class="slider round"></span> <span class="slider round"></span>
@ -34,15 +33,16 @@
<div class="clr-row"> <div class="clr-row">
<div class="clr-col-12" style="text-align: right;"> <div class="clr-col-12" style="text-align: right;">
<button id="add" class="btn btn-primary" style="margin-left: 20px;" (click)="modaladd()">
<button id="add" class="btn btn-primary" style="margin-left: 20px;" (click)="modaladd()" [disabled]="!toggle">
<clr-icon shape="plus"></clr-icon>{{ 'ADD' | translate }} </button> <clr-icon shape="plus"></clr-icon>{{ 'ADD' | translate }} </button>
<div *ngIf="!toggle" class="error-message" style="color: red; font-size: 14px; margin-top: 5px;">
{{ ' Close toggle to activate Add button. ' | translate }}
</div>
</div> </div>
</div> </div>
<clr-datagrid [clrDgLoading]="loading" *ngIf="!toggle"> <clr-datagrid [clrDgLoading]="loading" *ngIf="!toggle">
<clr-dg-placeholder> <clr-dg-placeholder>
<ng-template #loadingSpinner><clr-spinner>Loading ... </clr-spinner></ng-template> <ng-template #loadingSpinner><clr-spinner>Loading ... </clr-spinner></ng-template>
@ -50,29 +50,29 @@
</clr-dg-placeholder> </clr-dg-placeholder>
<clr-dg-column [clrDgField]="'no'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'no'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'NO' | translate }} {{ 'NO' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'menuname'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'menuname'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'MENU_ITEM_NAME' | translate }} {{ 'MENU_ITEM_NAME' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'mvisible'"><ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'mvisible'"><ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'VIEW' | translate }} {{ 'VIEW' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'mcreate'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'mcreate'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'CREATE' | translate }} {{ 'CREATE' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'medit'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'medit'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'EDIT' | translate }} {{ 'EDIT' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'mdelete'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'mdelete'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'DELETE' | translate }} {{ 'DELETE' | translate }}
<!-- <input type="checkbox" clrCheckbox name="mdelete" [checked]="colvalue" (change)="changedelete($event.target.checked)"> --> <!-- <input type="checkbox" clrCheckbox name="mdelete" [checked]="colvalue" (change)="changedelete($event.target.checked)"> -->
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'mquery'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'mquery'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'QUERY' | translate }} {{ 'QUERY' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-column [clrDgField]="'mexport'"> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-dg-column [clrDgField]="'mexport'"> <ng-container *clrDgHideableColumn="{hidden: false}">
{{ 'EXPORT' | translate }} {{ 'EXPORT' | translate }}
</ng-container></clr-dg-column> </ng-container></clr-dg-column>
<clr-dg-row *ngFor="let all of alldata;let i=index"> <clr-dg-row *ngFor="let all of alldata;let i=index">
@ -89,9 +89,10 @@
<clr-dg-action-overflow> <clr-dg-action-overflow>
<button class="action-item" (click)="modalEdit(all)">{{ 'EDIT' | translate }} <clr-icon shape="edit" <button class="action-item" (click)="modalEdit(all)">{{ 'EDIT' | translate }} <clr-icon shape="edit"
class="is-error"></clr-icon></button> class="is-error"></clr-icon></button>
<button class="action-item" *ngIf="all.menuId!==0" (click)="modalDelete(all)">{{ 'DELETE' | translate }} <clr-icon shape="trash" <button class="action-item" *ngIf="all.menuId!==0" (click)="modalDelete(all)">{{ 'DELETE' | translate }}
class="is-error"></clr-icon></button> <clr-icon shape="trash" class="is-error"></clr-icon></button>
<button class="action-item" *ngIf="all.menuId==0" (click)="modaldeletemainmenu(all)">{{ 'DELETE_MENU_SUBMENU' | translate }} <button class="action-item" *ngIf="all.menuId==0" (click)="modaldeletemainmenu(all)">{{ 'DELETE_MENU_SUBMENU' |
translate }}
<clr-icon shape="edit" class="is-error"></clr-icon></button> <clr-icon shape="edit" class="is-error"></clr-icon></button>
</clr-dg-action-overflow> </clr-dg-action-overflow>

View File

@ -15,19 +15,19 @@ export class MenuaccesscontrolComponent implements OnInit {
loading = false; loading = false;
givendata; givendata;
alldata; alldata;
colvalue="true"; colvalue = "true";
usergrpid=1; usergrpid = 1;
secmenuaccessdata; secmenuaccessdata;
modalAdd= false; modalAdd = false;
modaledit=false; modaledit = false;
modaldelete=false; modaldelete = false;
modaldelete1=false; modaldelete1 = false;
rowSelected :any= {}; rowSelected: any = {};
public entryForm: FormGroup; public entryForm: FormGroup;
selected = "true"; selected = "true";
menudata; menudata;
menus; menus;
menuselectid=1; menuselectid = 1;
msg; msg;
error; error;
mcreate; mcreate;
@ -36,197 +36,211 @@ export class MenuaccesscontrolComponent implements OnInit {
toggle: boolean = false; toggle: boolean = false;
maindata; maindata;
showdata; showdata;
constructor(private mainservice:UsermaintanceService, constructor(private mainservice: UsermaintanceService,
private _fb: FormBuilder, private _fb: FormBuilder,
private toastr:ToastrService, private toastr: ToastrService,
private route:ActivatedRoute, private route: ActivatedRoute,
private usergrpservice:UsergrpmaintainceService, private usergrpservice: UsergrpmaintainceService,
private menuGroupService: MenuGroupService, private menuGroupService: MenuGroupService,
private menuservice:MenumaintanceService,) { } private menuservice: MenumaintanceService,) { }
ngOnInit(): void { ngOnInit(): void {
this.showdata = this.menuGroupService.getdata(); this.showdata = this.menuGroupService.getdata();
console.log(this.showdata); console.log(this.showdata);
this.mcreate=this.showdata.mcreate; this.mcreate = this.showdata.mcreate;
console.log(this.mcreate); console.log(this.mcreate);
this.mdelete=this.showdata.mdelete this.mdelete = this.showdata.mdelete
console.log(this.mdelete); console.log(this.mdelete);
this.medit=this.showdata.medit this.medit = this.showdata.medit
console.log(this.medit); console.log(this.medit);
this.dropddowngetdata(); this.dropddowngetdata();
// this.getall(); // this.getall();
this.getbyuseriddata(); this.getbyuseriddata();
this.entryForm=this._fb.group({ this.entryForm = this._fb.group({
grpid:this.usergrpid , grpid: this.usergrpid,
gmenuid:this.menuselectid , gmenuid: this.menuselectid,
});
}
dropddowngetdata(){
this.usergrpservice.getAll().subscribe((data) => {
console.log(data);
this.givendata = data;
});
}
getdata(){
this.menuservice.getByCurrentUserMenuGroupId1().subscribe(resp => {
this.menus = resp;
console.log('menus: ', this.menus);
})
}
getall(){
this.usergrpservice.getall().subscribe((data)=>{
this.secmenuaccessdata=data
console.log(data);
})
}
idofselected(val){
console.log(val);
this.usergrpid=val;
}
idselected(val){
console.log(val)
this.menuselectid=val;
}
getbyuseriddata(){
this.usergrpservice.getbyusergrpid(this.usergrpid).subscribe((data)=>{
this.alldata=data;
console.log(this.alldata);
if(this.alldata.array?.length === 0){
this.msg='No Data Availabel'
}
for(this.alldata; this.alldata>=100;this.alldata++){
this.maindata=this.alldata.menuId === 0
console.log(this.maindata)
}
// console.log(this.menudata)
},
(error) => {
console.log('Error in adding data...',+error);
if(error){
this.error="No data Available"
}
});
}
modaladd(){
this.modalAdd=true;
this.getdata();
}
onSubmit(){
this.modalAdd=false;
this.entryForm.value.grpid=this.usergrpid;
this.entryForm.value.gmenuid=this.menuselectid;
console.log(this.entryForm.value);
this.menuservice.create2(this.entryForm.value).subscribe((data)=>{
console.log(data);
if (data) {
this.toastr.success('Added successfully');
}
},
(error) => {
console.log('Error in adding data...',+error);
if(error){
this.toastr.error('Not added Data Getting Some Error');
}
}); });
} }
modalEdit(row){ dropddowngetdata() {
this.rowSelected=row; this.usergrpservice.getAll().subscribe((data) => {
console.log(this.rowSelected); console.log(data);
this.modaledit=true; this.givendata = data;
} });
modalDelete(row){ }
this.rowSelected=row; getdata() {
console.log(this.rowSelected) this.menuservice.getByCurrentUserMenuGroupId1().subscribe(resp => {
this.modaldelete=true; this.menus = resp;
} console.log('menus: ', this.menus);
delete(id,usrgrp){ })
this.modaldelete=false; }
this.usergrpservice.delete(id,usrgrp).subscribe((data)=>{ getall() {
console.log(data); this.usergrpservice.getall().subscribe((data) => {
if (data) { this.secmenuaccessdata = data
this.toastr.success('Deleted successfully'); console.log(data);
})
}
idofselected(val) {
console.log(val);
this.usergrpid = val;
}
idselected(val) {
console.log(val)
this.menuselectid = val;
}
getbyuseriddata() {
this.usergrpservice.getbyusergrpid(this.usergrpid).subscribe((data) => {
this.alldata = data;
console.log(this.alldata);
if (this.alldata.array?.length === 0) {
this.msg = 'No Data Availabel'
}
for (this.alldata; this.alldata >= 100; this.alldata++) {
this.maindata = this.alldata.menuId === 0
console.log(this.maindata)
}
// console.log(this.menudata)
},
(error) => {
console.log('Error in adding data...', error);
if (error) {
this.error = "No data Available"
} }
},(error) => { });
console.log('Error in adding data...',+error); }
if(error){ modaladd() {
this.toastr.error('Not Deleted Data Getting Some Error'); this.modalAdd = true;
} this.getdata();
}); }
} onSubmit() {
modaldeletemainmenu(row){ this.modalAdd = false;
this.rowSelected=row; this.entryForm.value.grpid = this.usergrpid;
console.log(this.rowSelected) this.entryForm.value.gmenuid = this.menuselectid;
this.modaldelete1=true; console.log(this.entryForm.value);
} this.menuservice.create2(this.entryForm.value).subscribe((data) => {
delete1(id,usrgrp){ console.log(data);
this.modaldelete1=false; if (data) {
this.usergrpservice.deletemain(id,usrgrp).subscribe((data)=>{ this.toastr.success('Added successfully');
console.log(data); }
if (data) { this.ngOnInit();
this.toastr.success('Deleted successfully');
},
(error) => {
console.log('Error in adding data...', error);
if (error.status == 400) {
this.toastr.error(error.error);
} else if (error) {
this.toastr.error('Not added Data Getting Some Error');
} }
},(error) => { this.ngOnInit();
console.log('Error in adding data...',+error); });
if(error){
this.toastr.error('Not Deleted Data Getting Some Error'); }
} modalEdit(row) {
}); this.rowSelected = row;
} console.log(this.rowSelected);
onUpdate(id:any,usrgrp:any){ this.modaledit = true;
this.modaledit=false; }
console.log(id,usrgrp); modalDelete(row) {
this.menuservice.update2(id,usrgrp,this.rowSelected).subscribe((data)=>{ this.rowSelected = row;
console.log(data); console.log(this.rowSelected)
if (data) { this.modaldelete = true;
this.toastr.success('Updated successfully'); }
} delete(id, usrgrp) {
}, (error) => { this.modaldelete = false;
console.log('Error in adding data...',+error); this.usergrpservice.delete(id, usrgrp).subscribe((data) => {
if(error){ console.log(data);
if (data) {
this.toastr.success('Deleted successfully');
}
this.ngOnInit();
}, (error) => {
console.log('Error in adding data...', error);
if (error) {
this.toastr.error('Not Deleted Data Getting Some Error');
}
this.ngOnInit();
});
}
modaldeletemainmenu(row) {
this.rowSelected = row;
console.log(this.rowSelected)
this.modaldelete1 = true;
}
delete1(id, usrgrp) {
this.modaldelete1 = false;
this.usergrpservice.deletemain(id, usrgrp).subscribe((data) => {
console.log(data);
if (data) {
this.toastr.success('Deleted successfully');
}
this.ngOnInit();
}, (error) => {
console.log('Error in adding data...', error);
if (error) {
this.toastr.error('Not Deleted Data Getting Some Error');
}
this.ngOnInit();
});
}
onUpdate(id: any, usrgrp: any) {
this.modaledit = false;
console.log(id, usrgrp);
this.menuservice.update2(id, usrgrp, this.rowSelected).subscribe((data) => {
console.log(data);
if (data) {
this.toastr.success('Updated successfully');
}
this.ngOnInit();
}, (error) => {
console.log('Error in adding data...', error);
if (error) {
this.toastr.error('Not Updated Data Getting Some Error'); this.toastr.error('Not Updated Data Getting Some Error');
} }
}); this.ngOnInit();
} });
onChecked(value){
if(value=="y")
{
this.selected="y"
console.log(this.selected); // make a call for checked
} }
else onChecked(value) {
{ if (value == "y") {
this.selected="n"// make a call for unchecked this.selected = "y"
console.log(this.selected); // make a call for checked
}
else {
this.selected = "n"// make a call for unchecked
}
}
changedelete(val) {
console.log(val);
val = this.colvalue = val;
console.log(val);
}
data: {};
Sync(id: any, row) {
this.rowSelected = row;
console.log(id);
if (this.rowSelected.subMenus != 0) {
this.rowSelected.subMenus = []
} console.log(this.rowSelected);
this.menuservice.sink(id, this.rowSelected).subscribe((data) => {
console.log(data);
if (data) {
this.toastr.success('SYNC successfully');
}
this.ngOnInit();
}, (error) => {
console.log(error);
if (error) {
this.toastr.error('Not SYNC Data Getting Some Error');
}
this.ngOnInit();
})
}
toggleCheckbox() {
this.toggle = !this.toggle;
//this.dataService.setDivToggler(this.toggler);
} }
} }
changedelete(val){
console.log(val);
val=this.colvalue=val;
console.log(val);
}
data:{};
Sync(id:any,row){
this.rowSelected = row;
console.log(id);
if(this.rowSelected.subMenus!=0){
this.rowSelected.subMenus=[]
}console.log(this.rowSelected);
this.menuservice.sink(id,this.rowSelected).subscribe((data)=>{
console.log(data);
if (data) {
this.toastr.success('SYNC successfully');
}
},(error) => { console.log(error);
if(error){
this.toastr.error('Not SYNC Data Getting Some Error');
} })
}
toggleCheckbox() {
this.toggle = !this.toggle;
//this.dataService.setDivToggler(this.toggler);
}
}

View File

@ -11,106 +11,111 @@ import { AccesstypeService } from 'src/app/services/admin/accesstype.service';
export class ModulesComponent implements OnInit { export class ModulesComponent implements OnInit {
loading = false; loading = false;
selected: any[] = []; selected: any[] = [];
rowSelected :any= {}; rowSelected: any = {};
modaldelete=false; modaldelete = false;
modalAdd= false; modalAdd = false;
modaledit=false; modaledit = false;
error; error;
data; data;
submitted=false; submitted = false;
public entryForm: FormGroup; public entryForm: FormGroup;
constructor(private _fb: FormBuilder,private accesstype:AccesstypeService, constructor(private _fb: FormBuilder, private accesstype: AccesstypeService,
private toastr:ToastrService,) { } private toastr: ToastrService,) { }
ngOnInit(): void { ngOnInit(): void {
this.entryForm = this._fb.group({ this.entryForm = this._fb.group({
modules:['',[Validators.required]], modules: ['', [Validators.required]],
description:['',[Validators.required]] , description: ['', [Validators.required]],
access_exclusive:['',[Validators.required]], access_exclusive: ['', [Validators.required]],
}); });
this.getdata(); this.getdata();
} }
getdata(){ getdata() {
this.accesstype.getAll1().subscribe(resp => { this.accesstype.getAll1().subscribe(resp => {
this.data = resp; this.data = resp;
console.log('menus: ', this.data); console.log('menus: ', this.data);
if(this.data.length==0){ if (this.data.length == 0) {
this.error="No data Available"; this.error = "No data Available";
console.log(this.error) console.log(this.error)
} }
},(error) => { }, (error) => {
console.log(error); console.log(error);
if(error){ if (error) {
this.error="Server Error"; this.error = "Server Error";
} }
}) })
} }
goToAdd(){ goToAdd() {
this.modalAdd=true; this.modalAdd = true;
} }
onSubmit(){ onSubmit() {
console.log(this.entryForm.value); console.log(this.entryForm.value);
this.submitted=true; this.submitted = true;
if (this.entryForm.invalid) { if (this.entryForm.invalid) {
return; return;
} }
this.accesstype.create1(this.entryForm.value).subscribe((data)=>{ this.accesstype.create1(this.entryForm.value).subscribe((data) => {
console.log(data); console.log(data);
if (data) { if (data) {
this.toastr.success('Added successfully'); this.toastr.success('Added successfully');
} }
this.ngOnInit();
}, },
(error) => { (error) => {
console.log('Error in adding data...',+error); console.log('Error in adding data...', error);
if(error){ if (error) {
this.toastr.error('Not added Data Getting Some Error'); this.toastr.error('Not added Data Getting Some Error');
} }
this.ngOnInit();
}); });
this.modalAdd=false; this.modalAdd = false;
} }
goToEdit(row) { goToEdit(row) {
this.rowSelected = row; this.rowSelected = row;
console.log(row) console.log(row)
this.modaledit=true; this.modaledit = true;
//this.router.navigate(["../edit/" + id], { relativeTo: this.route }); //this.router.navigate(["../edit/" + id], { relativeTo: this.route });
} }
onDelete(row) { onDelete(row) {
this.rowSelected = row; this.rowSelected = row;
this.modaldelete=true; this.modaldelete = true;
} }
delete(id) delete(id) {
{
this.modaldelete = false; this.modaldelete = false;
console.log("in delete "+id); console.log("in delete " + id);
this.accesstype.delete1(id).subscribe((data)=>{ this.accesstype.delete1(id).subscribe((data) => {
console.log(data); console.log(data);
if (data) { if (data) {
this.toastr.success('Deleted successfully'); this.toastr.success('Deleted successfully');
}
},
(error) => {
console.log('Error in adding data...',+error);
if(error){
this.toastr.error('Not Deleted Data Getting Some Error');
} }
}); this.ngOnInit();
},
(error) => {
console.log('Error in adding data...', error);
if (error) {
this.toastr.error('Not Deleted Data Getting Some Error');
}
this.ngOnInit();
});
} }
onUpdate(id){ onUpdate(id) {
this.modaledit=false; this.modaledit = false;
this.accesstype.update1(id,this.rowSelected).subscribe((data)=>{ this.accesstype.update1(id, this.rowSelected).subscribe((data) => {
console.log(data); console.log(data);
if (data) { if (data) {
this.toastr.success('Updated successfully'); this.toastr.success('Updated successfully');
} }
}, this.ngOnInit();
(error) => { },
console.log('Error in adding data...',+error); (error) => {
if(error){ console.log('Error in adding data...', error);
this.toastr.error('Not updated Data Getting Some Error'); if (error) {
} this.toastr.error('Not updated Data Getting Some Error');
}); }
this.ngOnInit();
});
} }
} }

View File

@ -19,11 +19,11 @@
<div class="clr-col-4" style="text-align: right;"> <div class="clr-col-4" style="text-align: right;">
<button class="btn btn-outline" (click)="onExport()"> <button class="btn btn-outline" (click)="onExport()">
<clr-icon shape="export"></clr-icon> {{ 'EXPORT' | translate }} <clr-icon shape="export"></clr-icon> {{ 'EXPORT' | translate }}
</button> </button>
<button id="add" class="btn btn-primary" (click)="goToAdd()"> <button id="add" class="btn btn-primary" (click)="goToAdd()">
<clr-icon shape="plus"></clr-icon>{{ 'ADD' | translate }} <clr-icon shape="plus"></clr-icon>{{ 'ADD' | translate }}
</button> </button>
</div> </div>
</div> </div>
@ -74,8 +74,10 @@
<clr-dg-cell>{{user.sequence_size}}</clr-dg-cell> <clr-dg-cell>{{user.sequence_size}}</clr-dg-cell>
<!-- <clr-dg-cell>{{user.date_format}}</clr-dg-cell> --> <!-- <clr-dg-cell>{{user.date_format}}</clr-dg-cell> -->
<clr-dg-action-overflow> <clr-dg-action-overflow>
<button class="action-item" (click)="goToEdit(user)"> {{ 'EDIT' | translate }} <clr-icon shape="edit" class="is-error"></clr-icon></button> <button class="action-item" (click)="goToEdit(user)"> {{ 'EDIT' | translate }} <clr-icon shape="edit"
<button class="action-item" (click)="onDelete(user)"> {{ 'DELETE' | translate }}<clr-icon shape="trash" class="is-error"></clr-icon></button> class="is-error"></clr-icon></button>
<button class="action-item" (click)="onDelete(user)"> {{ 'DELETE' | translate }}<clr-icon shape="trash"
class="is-error"></clr-icon></button>
</clr-dg-action-overflow> </clr-dg-action-overflow>
@ -83,7 +85,8 @@
<clr-dg-footer> <clr-dg-footer>
<clr-dg-pagination #pagination [clrDgPageSize]="10"> <clr-dg-pagination #pagination [clrDgPageSize]="10">
<clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">{{ 'USERS_PER_PAGE' | translate }}</clr-dg-page-size> <clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">{{ 'USERS_PER_PAGE' | translate
}}</clr-dg-page-size>
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} of {{pagination.totalItems}} users {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} of {{pagination.totalItems}} users
</clr-dg-pagination> </clr-dg-pagination>
</clr-dg-footer> </clr-dg-footer>
@ -110,11 +113,11 @@
<div class="clr-row"> <div class="clr-row">
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="name">Name<span class="required-field">*</span></label> <label for="name">Name<span class="required-field">*</span></label>
<input type="text" class="clr-input" name="sequence_name" formControlName="sequence_name" > <input type="text" class="clr-input" name="sequence_name" formControlName="sequence_name">
</div> </div>
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="name">Sequence Code</label> <label for="name">Sequence Code</label>
<input type="text" class="clr-input" name="sequence_code" formControlName="sequence_code" > <input type="text" class="clr-input" name="sequence_code" formControlName="sequence_code">
</div> </div>
<!-- <div class="clr-col-sm-12"> <!-- <div class="clr-col-sm-12">
<label for="name">Implementation</label> <label for="name">Implementation</label>
@ -131,7 +134,7 @@
<label for="name">Active</label> <label for="name">Active</label>
<input type="checkbox" formControlName="active" name="active" clrCheckbox> <input type="checkbox" formControlName="active" name="active" clrCheckbox>
</div> --> </div> -->
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="name">Prefix<span class="required-field">*</span></label> <label for="name">Prefix<span class="required-field">*</span></label>
<input type="text" class="clr-input" formControlName="prefix" name="prefix"> <input type="text" class="clr-input" formControlName="prefix" name="prefix">
@ -197,7 +200,7 @@
<label for="name">Active</label> <label for="name">Active</label>
<input type="checkbox" name="active" name="menuId" clrCheckbox [(ngModel)]="rowSelected.active"> <input type="checkbox" name="active" name="menuId" clrCheckbox [(ngModel)]="rowSelected.active">
</div> --> </div> -->
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="name">Prefix<span class="required-field">*</span></label> <label for="name">Prefix<span class="required-field">*</span></label>
<input type="text" class="clr-input" name="prefix" [(ngModel)]="rowSelected.prefix"> <input type="text" class="clr-input" name="prefix" [(ngModel)]="rowSelected.prefix">
@ -216,11 +219,13 @@
</div> </div>
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="tags">Current No</label> <label for="tags">Current No</label>
<input type="number" class="clr-input" name="current_no" [(ngModel)]="rowSelected.current_no" readonly> <input type="number" class="clr-input" name="current_no" [(ngModel)]="rowSelected.current_no"
readonly>
</div> </div>
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="tags">Demonstration</label> <label for="tags">Demonstration</label>
<input type="text" class="clr-input" name="demonstration" [(ngModel)]="rowSelected.demonstration" readonly> <input type="text" class="clr-input" name="demonstration" [(ngModel)]="rowSelected.demonstration"
readonly>
</div> </div>
<div class="clr-col-sm-12"> <div class="clr-col-sm-12">
<label for="tags">Sequence Size</label> <label for="tags">Sequence Size</label>

View File

@ -15,65 +15,67 @@ export class SequencegenaratorComponent implements OnInit {
loading = false; loading = false;
selected: any[] = []; selected: any[] = [];
workflow_data; workflow_data;
rowSelected :any= {}; rowSelected: any = {};
modaldelete=false; modaldelete = false;
error; error;
alldata; alldata = [];
modaladd=false; modaladd = false;
modaledit=false; modaledit = false;
submitted = false; submitted = false;
public entryForm: FormGroup; public entryForm: FormGroup;
constructor(private seqservice:SequenceService,private router: Router, private toastr: ToastrService,private _fb: FormBuilder, constructor(private seqservice: SequenceService, private router: Router, private toastr: ToastrService, private _fb: FormBuilder,
private route: ActivatedRoute,private excel: ExcelService) { } private route: ActivatedRoute, private excel: ExcelService) { }
ngOnInit(): void { ngOnInit(): void {
this.getall(); this.getall();
this.entryForm = this._fb.group({ this.entryForm = this._fb.group({
prefix:[null], prefix: [null],
sequence_size:[null], sequence_size: [null],
suffix:[null], suffix: [null],
starting_no:[null], starting_no: [null],
seperator:[null], seperator: [null],
sequence_name:[null], sequence_name: [null],
sequence_code:[null], sequence_code: [null],
demonstration:[null], demonstration: [null],
current_no:[null] current_no: [null]
}); });
} }
getall(){ getall() {
this.seqservice.getAll().subscribe((data)=>{ this.seqservice.getAll().subscribe((data) => {
console.log(data); console.log(data);
this.alldata=data; this.alldata = data;
if(this.alldata.lenght==0){
this.error="No data" if (this.alldata.length == 0) {
console.log('zero data ');
this.error = "No data Available!"
} }
},(error) => { }, (error) => {
console.log(error); console.log(error);
if(error){ if (error) {
this.error="No data Available OR server Error"; this.error = "No data Available OR server Error";
} }
}) })
} }
// onSubmit(){ // onSubmit(){
// console.log(this.entryForm.value); // console.log(this.entryForm.value);
// this.seqservice.create(this.entryForm.value).subscribe((data)=>{ // this.seqservice.create(this.entryForm.value).subscribe((data)=>{
// console.log(data); // console.log(data);
// if (data) { // if (data) {
// this.toastr.success('Added successfully'); // this.toastr.success('Added successfully');
// } // }
// }, // },
// (error) => { // (error) => {
// console.log('Error in adding data...',+error); // console.log('Error in adding data...',+error);
// if(error){ // if(error){
// this.toastr.error('Not added Data'); // this.toastr.error('Not added Data');
// } // }
// }); // });
// this.modaladd=false; // this.modaladd=false;
// } // }
@ -93,20 +95,20 @@ current_no:[null]
this.seqservice.create(this.entryForm.value).subscribe( this.seqservice.create(this.entryForm.value).subscribe(
(data) => { (data) => {
console.log(data); console.log(data);
if (data || data.status >=200 && data.status <=299) { if (data || data.status >= 200 && data.status <= 299) {
this.toastr.success("Added Succesfully"); this.toastr.success("Added Succesfully");
this.ngOnInit(); this.ngOnInit();
} }
},(error) => { }, (error) => {
if(error.status >=200 && error.status <=299){ if (error.status >= 200 && error.status <= 299) {
this.toastr.success("Added Succesfully"); this.toastr.success("Added Succesfully");
this.ngOnInit(); this.ngOnInit();
} }
if(error.status >=400 && error.status <=499){ if (error.status >= 400 && error.status <= 499) {
this.toastr.error("Not Added"); this.toastr.error("Not Added");
this.ngOnInit(); this.ngOnInit();
} }
if(error.status >=500 && error.status <=599){ if (error.status >= 500 && error.status <= 599) {
this.toastr.error("Server Error"); this.toastr.error("Server Error");
this.ngOnInit(); this.ngOnInit();
} }
@ -114,8 +116,8 @@ current_no:[null]
} }
goToAdd(){ goToAdd() {
this.modaladd=true; this.modaladd = true;
} }
@ -127,63 +129,62 @@ current_no:[null]
goToEdit(row) { goToEdit(row) {
this.rowSelected = row; this.rowSelected = row;
console.log(row) console.log(row)
this.modaledit=true; this.modaledit = true;
} }
onDelete(row) { onDelete(row) {
this.rowSelected = row; this.rowSelected = row;
this.modaldelete=true; this.modaldelete = true;
} }
delete(id) delete(id) {
{
this.modaldelete = false; this.modaldelete = false;
console.log("in delete "+id); console.log("in delete " + id);
this.seqservice.delete(id).subscribe((data)=>{ this.seqservice.delete(id).subscribe((data) => {
console.log(data); console.log(data);
if (data == null || data.status >=200 && data.status <=299) { if (data == null || data.status >= 200 && data.status <= 299) {
this.toastr.success('Deleted successfully'); this.toastr.success('Deleted successfully');
this.ngOnInit(); this.ngOnInit();
} }
}, },
(error) => { (error) => {
console.log(error); console.log(error);
if(error.status >=200 && error.status <=299){ if (error.status >= 200 && error.status <= 299) {
this.toastr.success('Deleted successfully'); this.toastr.success('Deleted successfully');
this.ngOnInit(); this.ngOnInit();
} }
if(error.status >=400 && error.status <=499){ if (error.status >= 400 && error.status <= 499) {
this.toastr.error('Not Deleted Data Getting Some Error'); this.toastr.error('Not Deleted Data Getting Some Error');
this.ngOnInit(); this.ngOnInit();
} }
if(error.status >=500 && error.status <=599){ if (error.status >= 500 && error.status <= 599) {
this.toastr.error('Server Error'); this.toastr.error('Server Error');
this.ngOnInit(); this.ngOnInit();
} }
}); });
} }
onUpdate(id){ onUpdate(id) {
this.modaledit=false; this.modaledit = false;
this.seqservice.update(id,this.rowSelected).subscribe((data)=>{ this.seqservice.update(id, this.rowSelected).subscribe((data) => {
console.log(data); console.log(data);
if (data || data.status >=200 && data.status <=299) { if (data || data.status >= 200 && data.status <= 299) {
this.toastr.success("Update Succesfully"); this.toastr.success("Update Succesfully");
this.ngOnInit(); this.ngOnInit();
} }
},(error: HttpErrorResponse) => { }, (error: HttpErrorResponse) => {
console.log(error?.message); console.log(error?.message);
if(error.status >=200 && error.status <=299){ if (error.status >= 200 && error.status <= 299) {
this.toastr.success("Update Succesfully"); this.toastr.success("Update Succesfully");
this.ngOnInit(); this.ngOnInit();
} }
if(error.status >=400 && error.status <=499){ if (error.status >= 400 && error.status <= 499) {
this.toastr.error("Not Update"); this.toastr.error("Not Update");
this.ngOnInit(); this.ngOnInit();
} }
if(error.status >=500 && error.status <=599){ if (error.status >= 500 && error.status <= 599) {
this.toastr.error("Server Error"); this.toastr.error("Server Error");
this.ngOnInit(); this.ngOnInit();
} }
}); });
} }
} }