dynamic form correction

This commit is contained in:
bitbucket 2022-04-28 16:45:06 +05:30
parent ed0ad74599
commit 9d435db7a3
22 changed files with 3129 additions and 874 deletions

View File

@ -65,8 +65,8 @@ import { PushNotifyService } from './shared/push-notify.service';
import { MatVideoModule } from 'mat-video';
import { ReqTokenInterceptor } from './_guard/req-token.interceptor';
import { DynamicNotifyComponent } from './layouts/dynamic-notify/dynamic-notify.component';
import { SelectAllComponent } from './select-all/select-all.component';
import { CustomNotificationComponent } from './layouts/custom-notification/custom-notification.component';
// import { SelectAllComponent } from './select-all/select-all.component';
// import { CustomNotificationComponent } from './layouts/custom-notification/custom-notification.component';
//import { OtpComponent } from './session/otp/otp.component';
@ -90,7 +90,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
AdminLayoutComponent,
AuthLayoutComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, HttpLoaderComponent,
IncomingCallComponent, VideoChatComponent, DynamicNotifyComponent, SelectAllComponent, CustomNotificationComponent
IncomingCallComponent, VideoChatComponent, DynamicNotifyComponent,
],
imports: [
ReactiveFormsModule,

View File

@ -21,7 +21,7 @@ import { MatDialog } from '@angular/material';
// import { VideoChatComponent } from 'app/video-chat/video-chat.component';
import { PushNotifyService } from 'app/shared/push-notify.service';
import { DynamicNotifyComponent } from '../dynamic-notify/dynamic-notify.component';
import { CustomNotificationComponent } from '../custom-notification/custom-notification.component';

View File

@ -757,87 +757,25 @@ export class DynamicQuestionTemplateComponent implements OnInit {
if(check_dup.length == 0){
this.formGroupN.addControl(val.group_key,this._fb.array([]))
// val.question.reverse()
let childControl: any = this.formGroupN.get(val.group_key) as FormArray
console.log(childControl)
let control_names:any={}
console.log(inserted_control_obj)
console.log(inserted_control_obj.questions[index].group_questions)
inserted_control_obj.questions[index].group_questions = []
inserted_control_obj.questions[index].group_questions.push(val.question)
console.log(inserted_control_obj.questions[index].group_questions)
console.log(question_index_after)
this.whole_json.splice(question_index_after+1,0,val);
val.question.forEach(group_val=>{
if(group_val.question_key){
control_names[group_val.question_key] = ''
console.log(ques_control)
}
this.addOrRemoveControl(group_val,ques_control,question_index_after,options,val)
control_names[group_val.question_key] = ''
// console.log("check ffffff",inserted_control_obj.questions.reverse(),inserted_control_obj.questions,group_val)
this.addOrRemoveControl(group_val,ques_control,question_index_after,options,val)
})
const question_temp:any = JSON.parse(JSON.stringify(val.question));
inserted_control_obj.questions[index].question = question_temp
console.log(control_names)
console.log(childControl)
console.log(val.group_questions[0])
childControl.push(this._fb.group(control_names))
val.group_questions[0].forEach((group_indi,arr_index)=>{
console.log(arr_index)
//this.quesService.addAdditionalControl(group_indi, childControl.controls[0], arr_index)
console.log(group_indi)
if(group_indi.is_repeatable =='2'){
// childControl.push(this._fb.group(control_names))
childControl.push(this._fb.group(control_names))
console.log(childControl)
console.log(group_indi)
childControl.controls[0].addControl(group_indi.group_key,this._fb.array([]))
// val.question.reverse()
console.log(childControl)
console.log(group_indi.group_key)
control_names[group_indi.group_key] = ''
// childControl.push(this._fb.group(control_names))
console.log(control_names)
console.log(childControl)
let s:any = localStorage.getItem('use');
console.log(s)
if( !group_indi.questions_level_two[0][0]){
this.quesService.addLevelTwoControls2(group_indi,childControl,val.group_questions[0],val.question,arr_index)
}
}
// console.log(group_indi)
// console.log(childControl)
// console.log(arr_index)
// this.quesService.addAdditionalControl(group_indi, childControl.controls[0], arr_index)
this.quesService.addAdditionalControl(group_indi, childControl.controls[0], arr_index)
})
}
}
else{
@ -854,14 +792,11 @@ export class DynamicQuestionTemplateComponent implements OnInit {
}
})
}
addOrRemoveControl(val,ques_control,question_index_after,options,paren_ques) {
console.log(val);
console.log(ques_control);
console.log(question_index_after);
console.log(paren_ques);
if(options == 1){
let check_dup=ques_control.filter(control_key=>control_key.question_key == val.question_key)
@ -883,21 +818,13 @@ export class DynamicQuestionTemplateComponent implements OnInit {
}
}
else{
console.log(paren_ques)
ques_control.forEach((control_key,index)=>{
if(paren_ques.hasOwnProperty('is_repeatable') && paren_ques.is_repeatable == '1') {
//console.log(control_key)
if(control_key.group_key == paren_ques.group_key){
this.whole_json.splice(index,1)
// this.formGroupN.controls[val.question_key].reset()
console.log(paren_ques)
console.log( this.formGroupN.get(paren_ques.group_key))
this.formGroupN.removeControl(paren_ques.group_key);
console.log( this.formGroupN.get(paren_ques.group_key))
}
}

View File

@ -5,7 +5,7 @@
::ng-deep { .no-padding > mat-dialog-container {
// background: black;
padding: 0;
// overflow-y: scroll !important;
overflow-y: scroll !important;
}
}

View File

@ -80,7 +80,7 @@ export class FormComponent implements OnInit {
}
ngOnInit() {
this.getSectionData()
// this.getSectionData()
if(this.pd_all_details.form_id=='5' && this.pdMasterList.product_abbr=='LFMP')
{
@ -174,6 +174,7 @@ else
// this.pdTriggerService.loadTemplate(Number(this.pd_all_details.form_id)).subscribe(result=>{
let params = this.pd_all_details_data.FormData.mapid;
console.log(params)
console.log( this.pd_all_details_data)
let map_id = this.pd_all_details_data.FormData.map_id
let form_id = this.pd_all_details_data.FormData.form_id
this.pd_all_details_data.Formname
@ -184,7 +185,7 @@ else
if(!environment.production){
console.log( result.dataStatus)
result.dataStatus = false
//result.dataStatus = false
}
console.log( result.dataStatus)
@ -205,7 +206,11 @@ else
console.log(question_template.json)
// this.questions_JSON = question_template;
console.log( this.questions_JSON)
this.getSectionData()
if(this.pd_all_details_data.FormData.isAnswered == true){
this.getSectionData()
}
// this.getSectionData()
this.questionService.notify(this.questions_JSON)
// setTimeout(() => {
// this.covidAnswers = null
@ -238,6 +243,9 @@ else
//this.questions_JSON = JSON.parse(question_template.json);
console.log(this.questions_JSON);
// this.getSectionData()
if(this.pd_all_details_data.FormData.isAnswered == true){
this.getSectionData()
}
this.questionService.notify(this.questions_JSON)
setTimeout(() => {
@ -444,9 +452,10 @@ else
if(this.pd_all_details_data.hasOwnProperty("Form_parent")){
console.log(this.pd_all_details_data)
let form_group = this.pd_all_details_data.Form_parent.is_group_form
let company_id = this.pd_all_details_data.Form_parent.is_business_form
if(form_group == 1){
if(company_id == 1){
params = {"pdid":this.pdMasterList.pd_id,"parent_pdid":this.pdMasterList.pd_id,formid:this.pd_all_details_data.FormData.form_id,"json":this.commonFormGroup.getRawValue(),fk_createdby:'',"company_id":company_id,"template_id": this.template_id}
}

View File

@ -106,6 +106,7 @@ export class GeneralInfoComponent implements OnInit {
/** Constructor Section */
constructor(notifier: NotifierService, private _fb: FormBuilder, private _pd: PdTrigerService, private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialogRef: MatDialogRef<GeneralInfoComponent>, private titleCase: TitleCasePipe, private imageRef: MatDialogRef<ImageCropComponent>) {
console.log(this.pd_all_details)
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.lender_short_name = this.pd_all_details.pdmaster_details.lender_short_name;
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
@ -378,6 +379,7 @@ export class GeneralInfoComponent implements OnInit {
}
else {
console.log( this.pd_applicants_details)
this.pd_applicants_details.forEach((element, key) => {

View File

@ -250,17 +250,22 @@ export class StartPd2Component implements OnInit, OnDestroy {
console.log(this.pdMasterList);
console.log(details);
console.log(this.startPD,2,this.randomString)
let data:any;
data = {pd_FullDetails:this.pdFullDetails,pdMasterList:this.pdMasterList,FormData:details,Formname:details.form_name,pdmaster_details:this.pdMasterList};
let componen_name:any = FormComponent
if(details.is_business_form == 1) {
componen_name = FormGroupComponent
}else if(details.form_id == '26'){
componen_name = ImagesAllComponent
}else if(details.form_id == '18'){
componen_name = GeneralInfoComponent
data = this.pdFullDetails;
}
const dialogRef = this.dialog.open(componen_name, {
data: {pd_FullDetails:this.pdFullDetails,pdMasterList:this.pdMasterList,FormData:details,Formname:details.form_name,pdmaster_details:this.pdMasterList},
data: data,
position: { right: '0'},
maxWidth: '100vw',

View File

@ -225,7 +225,7 @@
<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.schedule && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.COMPLETED && master.pd_status!=pdStatusCheck.ADD_ON_PENDING && currentPDStatus!=pdStatusCheck.QC_COMPLETED" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Schedule" matTooltipPosition="above" (click)="scheduleDetails(master,addresses)"><mat-icon>schedule</mat-icon></button></span>
<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.TRIGGERED && currentPDStatus!=pdStatusCheck.ALLOCATED_TO_FIA && master.pd_status!=pdStatusCheck.CANCELLED && enableStartPD" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above" (click)="getPDStart(addresses,master.pd_status)"><mat-icon>question_answer</mat-icon></button></span>
<!-- <span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.TRIGGERED && currentPDStatus!=pdStatusCheck.ALLOCATED_TO_FIA && master.pd_status!=pdStatusCheck.CANCELLED && enableStartPD" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion v2.0" matTooltipPosition="above" (click)="getPDStart2(addresses,master.pd_status)"><mat-icon>textsms</mat-icon></button></span> -->
<!--<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.TRIGGERED && currentPDStatus!=pdStatusCheck.ALLOCATED_TO_FIA && master.pd_status!=pdStatusCheck.CANCELLED && enableStartPD" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion v2.0" matTooltipPosition="above" (click)="getPDStart2(addresses,master.pd_status)"><mat-icon>question_answer</mat-icon></button></span>-->
<!-- <span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.TRIGGERED && currentPDStatus!=pdStatusCheck.ALLOCATED_TO_FIA && master.pd_status!=pdStatusCheck.CANCELLED && enableStartPD" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion v2.0" matTooltipPosition="above" (click)="getPDStart2(addresses,master.pd_status)"><mat-icon>textsms</mat-icon></button></span> -->
</div>
</div>
</div>

View File

@ -1084,8 +1084,8 @@ export class PdTrigerService {
// console.log(apivalue)
// return apivalue
// })
return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/all/'+form_id+'.json').map(rr=>{
// return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/LFMP/9.json').map(rr=>{
//return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/all/'+form_id+'.json').map(rr=>{
return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/DONE/6.json').map(rr=>{
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
// this.raw_credit_pd_template= returnValue.records.template
console.log("12345")

View File

@ -1,4 +1,4 @@
<div class="form">
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
@ -61,6 +61,7 @@
</mat-tab-group>
<!-- </mat-dialog-content> -->
</div>
<notifier-container></notifier-container>

View File

@ -37,4 +37,149 @@ mat-card .child_mat_card > mat-card {
box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2);
}
}
}
// .child_mat_card mat-card {
// margin: 2 0%;
// }
.body-container {
background-color: white !important;
}
.form{
background-color: white !important;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
}
.p-text {
color:#e00201 !important;
font-weight: bold;
}
::ng-deep .mat-card-header-text{
margin:0px !important;
}
.mat-purple{
background-color: gray !important;
}
.cdk-global-overlay-wrapper{
justify-content: center !important;
}
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;
mat-card .child_mat_card > mat-card {
border-radius: 0px 0px 0px 15px;
box-shadow: $base-card-box-shadow;
transform: scale(0.95);
transition: box-shadow 0.5s, transform 0.5s;
border: 1px solid lavender;
&:hover {
cursor: pointer;
// background-color: #e00201 !important;
transform: scale(1);
box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2);
}
}
::ng-deep .mat-dialog-container{
overflow: hidden !important;
}
::ng-deep .mat-card-header-text{
margin:0px !important;
}
.mat-purple{
background-color: gray !important;
}
.cdk-global-overlay-wrapper{
justify-content: center !important;
}
mat-card.parent_mat_card > {
mat-card-header {
display: flex;
flex-direction: column;
}
mat-card-content {
min-height:auto;
max-height:52vh;
overflow:auto;
}
::ng-deep .mat-menu-content {
padding-top: 0px !important;
padding-bottom: 0px !important;
}
.mat-menu-item{
line-height:35px;
height:35px;
}
.user-thumb {
position: absolute;
bottom: -35%;
// img {
// border: 5px solid $white;
// border-radius: 100%;
// height: 75px;
// width: 75px;
// }
}
// @media only screen and (max-width:319px) {
// mat-card-content {
// max-height: 350px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:320px) and (max-width:767px) {
// mat-card-content {
// max-height: 350px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:768px) and (max-width:1023px) {
// mat-card-content {
// max-height: 350px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:1024px) and (max-width:1899px) {
// mat-card-content {
// max-height: 400px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:1900px) {
// mat-card-content {
// max-height: 500px;
// overflow: auto;
// }
// }
}
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;
mat-card .child_mat_card > mat-card {
border-radius: 0px 0px 0px 15px;
box-shadow: $base-card-box-shadow;
transform: scale(0.95);
transition: box-shadow 0.5s, transform 0.5s;
border: 1px solid lavender;
&:hover {
cursor: pointer;
// background-color: #e00201 !important;
transform: scale(1);
box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2);
}
}
.form{
background-color: white !important;
}
.my-disable{
pointer-events:none;
}

View File

@ -7,6 +7,7 @@ import { MasterService } from '../master.service';
import {ActivatedRoute, Router} from "@angular/router";
import { EditTemplateComponent } from '../edit-template/edit-template.component';
import { ViewComponent } from '../view/view.component';
@Component({
selector: 'app-form-group',
templateUrl: './form-group.component.html',
@ -32,7 +33,7 @@ export class FormGroupComponent implements OnInit {
errorMessage: any;
// vendor_status_arr: any=[];
constructor( private notifier: NotifierService,
constructor( private notifier: NotifierService,private dialog: MatDialog,
private route: ActivatedRoute,
private router: Router,
private masterService: MasterService,
@ -132,11 +133,32 @@ loadPdViewCompoent(){
console.log(details)
localStorage.setItem('form_id',details.form_id);
console.log(company)
localStorage.setItem('form',JSON.stringify(details));
this.masterService.list_3.next(details);
console.log(id)
//this.router.navigate(['Group-form'], { relativeTo: this.route });
this.router.navigate(['edit',id], { relativeTo: this.route });
// localStorage.setItem('form',JSON.stringify(details));
// this.masterService.list_3.next(details);
// console.log(id)
// //this.router.navigate(['Group-form'], { relativeTo: this.route });
// this.router.navigate(['edit',id], { relativeTo: this.route });
if(details.json !== ""){
localStorage.setItem('form',JSON.stringify(details));
this.masterService.list_3.next(details);
console.log(id)
//this.router.navigate(['Group-form'], { relativeTo: this.route });
this.router.navigate(['edit',id], { relativeTo: this.route });
}else{
const dialogRef = this.dialog.open(ViewComponent, {
data: {'form_name': details.form_name, 'data':details,id:"1"},
// position: { right: '0'},
disableClose: true,
minWidth: '30%',
maxWidth: '40%',
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
// this.loadTemplates(this.startPD,2,this.randomString);
});
}
}
}

View File

@ -60,19 +60,19 @@
<div class="example-container" style="padding-left: 10px;">
<h4 style="text-align: center;color: green;">Available Questions
<button class="float-left" mat-icon-button color="primary" aria-label="Add"
(click)="add()" matTooltip="Add Field">
(click)="add(question)" matTooltip="Add Field">
<mat-icon>add_circle</mat-icon>
</button>
</h4>
<div cdkDropList #pendingList="cdkDropList" [cdkDropListData]="todo" [cdkDropListConnectedTo]="[doneList,reviewList,reviewList2]"
class="example-list" (cdkDropListDropped)="drop($event)" >
class="example-list" (cdkDropListDropped)="drop($event,null,todo)" >
<div class="example-box" *ngFor="let item of todo" cdkDrag id="myDIV" [ngStyle]= "{'background-color':(show_1== true && child_name == check2(item) && item.disable !=true) ? '#4caf50' : '','color':'black' }" >
<div style="padding: 8px;">
<i class="material-icons">drag_indicator</i>
</div>
<div class="w-100 drag-content" id="myDIV" [ngStyle]= "{'text-decoration':item.disable == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<div class="w-100 drag-content" id="myDIV" [ngStyle]= "{'text-decoration':check_disable(item.disable) == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<!-- {{item.question}} -->
{{check(item)}}
</div>
@ -111,20 +111,20 @@
<div class="example-container" *ngIf="show_1== true" style="width: 30%;">
<!-- <div class="example-container" *ngIf="show_value == true" style="width: 30%;"> -->
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name}}
<!-- <button class="float-left" mat-icon-button color="primary" aria-label="Add"
(click)="addEmailFormGroup()" matTooltip="Add">
<mat-icon>add</mat-icon>
</button> -->
<button class="float-left" mat-icon-button color="primary" aria-label="Add"
(click)="add(done,child_name)" matTooltip="Add Field">
<mat-icon>add_circle</mat-icon>
</button>
</h4>
<div cdkDropList #doneList="cdkDropList" [cdkDropListData]="done" [cdkDropListConnectedTo]="[pendingList,reviewList,reviewList2]"
class="example-list" (cdkDropListDropped)="drop($event,child_name)">
class="example-list" (cdkDropListDropped)="drop($event,child_name,done)">
<!-- <mat-label>Remarks</mat-label> -->
<div class="example-box" *ngFor="let item of done" cdkDrag [ngStyle]= "{'background-color':(show_2== true && child_name2 == item.question && item.disable !=true) ? '#4caf50' : ''} ">
<div style="padding: 8px;">
<i class="material-icons">drag_indicator</i>
</div>
<div class="w-100 drag-content" id="myDIV2" [ngStyle]= "{'text-decoration':item.disable == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<div class="w-100 drag-content" id="myDIV2" [ngStyle]= "{'text-decoration':check_disable(item.disable) == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
{{check(item)}}
</div>
<div class="w-10 delete-icon" id="hide2" *ngIf="item.group_title || (item.onchange_properties !=null && item.disable != true)">
@ -156,16 +156,21 @@
</div>
<div class="example-container" *ngIf="show_2== true"style="width: 30%;">
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name2}}</h4>
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name2}}
<button class="float-left" mat-icon-button color="primary" aria-label="Add"
(click)="add(basket,child_name2,child_name)" matTooltip="Add Field">
<mat-icon>add_circle</mat-icon>
</button>
</h4>
<div cdkDropList #reviewList2="cdkDropList" [cdkDropListData]="basket" [cdkDropListConnectedTo]="[doneList,pendingList,reviewList]"
class="example-list" (cdkDropListDropped)="drop($event,child_name2)">
class="example-list" (cdkDropListDropped)="drop($event,child_name2,basket)">
<div class="example-box" *ngFor="let item of basket" cdkDrag [ngStyle]= "{'background-color':(show_3== true && child_name3 == item.question && item.disable !=true) ? '#4caf50' : ''} " >
<!-- <mat-icon style="padding-right: 30px;">drag_indicator</mat-icon>{{item.question}} -->
<div style="padding: 8px;">
<i class="material-icons">drag_indicator</i>
</div>
<div class="w-100 drag-content" id="myDIV" [ngStyle]= "{'text-decoration':item.disable == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<div class="w-100 drag-content" id="myDIV" [ngStyle]= "{'text-decoration':check_disable(item.disable) == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<!-- {{item.question}} -->
{{check(item)}}
</div>
@ -198,16 +203,21 @@
</div>
<div class="example-container" *ngIf="show_3== true" style="width: 30%;">
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name3}}</h4>
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name3}}
<button class="float-left" mat-icon-button color="primary" aria-label="Add"
(click)="add(items,child_name3,child_name2)" matTooltip="Add Field">
<mat-icon>add_circle</mat-icon>
</button>
</h4>
<div cdkDropList #reviewList3="cdkDropList" [cdkDropListData]="items" [cdkDropListConnectedTo]="[doneList,pendingList,reviewList2,reviewList]"
class="example-list" (cdkDropListDropped)="drop($event,child_name3)">
class="example-list" (cdkDropListDropped)="drop($event,child_name3,items)">
<div class="example-box" *ngFor="let item of items" cdkDrag [ngStyle]= "{'background-color':(show_4== true && child_name4 == item.question && item.disable !=true) ? '#4caf50' : ''} ">
<!-- <mat-icon style="padding-right: 30px;">drag_indicator</mat-icon>{{item.question}} -->
<div style="padding: 8px;">
<i class="material-icons">drag_indicator</i>
</div>
<div class="w-100 drag-content" [ngStyle]= "{'text-decoration':item.disable == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<div class="w-100 drag-content" [ngStyle]= "{'text-decoration':check_disable(item.disable) == true ? 'line-through' : '','color':item.disable ==true ? 'red':''} " >
<!-- {{item.question}} -->
{{check(item)}}
</div>
@ -238,16 +248,19 @@
</div>
<div class="example-container" *ngIf="show4== true"style="width: 30%;">
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name4}}</h4>
<h4 style="text-align: center;padding-bottom: 13px;">{{child_name4}} <button class="float-left" mat-icon-button color="primary" aria-label="Add"
(click)="add(review,child_name4,child_name3)" matTooltip="Add Field">
<mat-icon>add_circle</mat-icon>
</button></h4>
<div cdkDropList #reviewList="cdkDropList" [cdkDropListData]="review" [cdkDropListConnectedTo]="[doneList,pendingList,reviewList2,reviewList3]"
class="example-list" (cdkDropListDropped)="drop($event,child_name4)">
class="example-list" (cdkDropListDropped)="drop($event,child_name4,review)">
<div class="example-box" *ngFor="let item of review" cdkDrag>
<!-- <mat-icon style="padding-right: 30px;">drag_indicator</mat-icon>{{item.question}} -->
<div style="padding: 8px;">
<i class="material-icons">drag_indicator</i>
</div>
<div class="w-100 drag-content" id="myDIV" [ngStyle]= "{'text-decoration':item.disable == true ? 'line-through' : '','color':'red'} " >
<div class="w-100 drag-content" id="myDIV" [ngStyle]= "{'text-decoration':check_disable(item.disable) == true ? 'line-through' : '','color':'red'} " >
<!-- {{item.question}} -->
{{check(item)}}
</div>

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { MatDialog } from '@angular/material';
import { ActivatedRoute, Router } from '@angular/router';
@ -9,12 +9,14 @@ import { ViewComponent } from '../view/view.component';
import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop';
import { MatSlideToggleChange } from '@angular/material';
import { LenderListComponent } from '../lender-list/lender-list.component';
import { SelectionListViewComponent } from '../selection-list-view/selection-list-view.component';
@Component({
selector: 'app-question-view',
templateUrl: './question-view.component.html',
styleUrls: ['./question-view.component.scss']
})
export class QuestionViewComponent {
@ViewChild(SelectionListViewComponent) child:SelectionListViewComponent;
section_name: any=[];
form_index: any=[];
visible: boolean;
@ -205,7 +207,8 @@ export class QuestionViewComponent {
}
add(param){
add(param,name,p_name){
console.log(param)
// localStorage.setItem('addquestion','')
localStorage.removeItem('addquestion');
const dialogRef = this.dialog.open(ViewComponent, {
@ -221,9 +224,9 @@ export class QuestionViewComponent {
let data = localStorage.getItem('addquestion')
console.log(JSON.parse(data))
console.log(this.forms)
this.question.push(JSON.parse(data))
param.push(JSON.parse(data))
console.log(param);
this.drag_list(param,name,p_name)
});
}
@ -336,7 +339,7 @@ console.log(s);
}
drop(event: CdkDragDrop<string[]>,child_name:any) {
drop(event: CdkDragDrop<string[]>,child_name:any,data:any) {
console.log(event)
console.log(this.done)
console.log(child_name)
@ -351,7 +354,7 @@ console.log(s);
);
}
this.drag_list(this.done,child_name)
this.drag_list(data,child_name,child_name)
}
show(element){
@ -619,22 +622,93 @@ check3(a,b){
return a;
}
}
drag_list(data, name){
drag_list(data, name,p_name){
console.log(this.full_data)
console.log(data)
console.log(name)
this.full_data.questions.forEach(element => {
if(element.question == name){
if(element.question == name || element.question == p_name){
element
if(element.onchange_properties instanceof Array && element.onchange_properties !=null){
if(element.onchange_properties[0] && element.onchange_properties[0].form_controls){
// console.log(element.onchange_properties[0].form_controls[0].questions);
if(element.question == name ){
element.onchange_properties[0].form_controls[0].questions = data
}
if(element.onchange_properties[0].form_controls[0].questions instanceof Array ){
element.onchange_properties[0].form_controls[0].questions.forEach(v => {
console.log(v.question)
if( v.question instanceof Array){
v.question.forEach(e => {
console.log(name)
if(e.question == name){
console.log(e.question)
if(e.onchange_properties instanceof Array && e.onchange_properties !=null){
if(e.onchange_properties[0] && e.onchange_properties[0].form_controls){
console.log(data)
// console.log(element.onchange_properties[0].form_controls[0].questions);
e.onchange_properties[0].form_controls[0].questions = data
}
}
}
});
}
});
}else{
console.log(element.question)
if(element.question == name ){
element.onchange_properties[0].form_controls[0].questions = data
}
}
}
}
}else{
if(element.onchange_properties instanceof Array && element.onchange_properties !=null){
if(element.onchange_properties[0] && element.onchange_properties[0].form_controls){
console.log(element.onchange_properties[0].form_controls[0].questions);
//element.onchange_properties[0].form_controls[0].questions = data
}
}
}
if(element.question instanceof Array){
console.log(data)
element.question.forEach(g => {
console.log(g)
if(g.question == name){
console.log(g)
if(g.onchange_properties instanceof Array ){
console.log(g.onchange_properties);
if( g.onchange_properties[0].form_controls[0].questions instanceof Array){
console.log(g.onchange_properties[0].form_controls[0].question);
if(g.question == name ){
console.log(g.question)
console.log(data)
g.onchange_properties[0].form_controls[0].questions = data
}
}
}
}
});
}
});
@ -656,13 +730,14 @@ drag_list(data, name){
let param = {"entity_id":entity_id,"product_id":product_id,"customer_segment_id":customer_segment,"map_id": map_id,"form_id": this.form_id, "json":this.full_data ,"form_status":form_status}
// let formValues;
console.log(param)
// console.log("worked")
console.log("worked")
this.masterService.saveupdatejsondetails(param).subscribe(
dataresult => {
if (dataresult.status == 200) {
console.log(dataresult);
this.notifier.notify('success', 'Your Changes Updated.!');
this.router.navigate(['../../', ], {relativeTo: this.route});
}
else {
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
@ -703,7 +778,7 @@ drag_list(data, name){
if (dataresult.status == 200) {
console.log(dataresult);
this.notifier.notify('success', 'Your Changes Updated.!');
this.router.navigate(['../../', ], {relativeTo: this.route});
}
else {
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
@ -720,6 +795,20 @@ drag_list(data, name){
}
check_disable(data){
// console.log(data)
if(data == true){
return true
}else if(data == 'undefined'){
return false
}else{
return false
}
}

View File

@ -253,9 +253,13 @@ export class SelectionListViewComponent implements OnInit {
console.log(details)
console.log(index)
let form_id = details.form_id;
let map_id = this.formvalue.template_lender_map_id;
// let map_id = this.formvalue.template_lender_map_id;
let map_id = details.map_id;
let disabled = disable_key
console.log(form_id)
console.log(map_id)
console.log(disabled)
this.masterService.disableform(form_id,map_id,disabled).subscribe(
dataresult => {
if (dataresult.status == 200) {

View File

@ -119,7 +119,7 @@
</div>
<!-- <input matInput maxlength="25" formControlName="width" placeholder="Questions width" required> -->
<div class="full-width">
<mat-radio-group maxlength="25" formControlName="width" aria-label="Select an option">
<mat-radio-group maxlength="25" formControlName="width" aria-label="Select an option" required>
<label class="full-width">Questions width</label> <br>
<mat-radio-button value="25">25%</mat-radio-button>
<mat-radio-button value="50">50%</mat-radio-button>
@ -127,7 +127,7 @@
<mat-radio-button value="100">100%</mat-radio-button>
</mat-radio-group>
</div>
<mat-form-field class="example-full-width">
<mat-form-field class="example-full-width" *ngIf="show_api == true">
<mat-select placeholder="Api" formControlName="api" (change)="get2()">
<mat-option *ngFor="let question of Api"
(onSelectionChange)="get3($event, question)" [value]="question.name">{{ question.name }}</mat-option>

View File

@ -27,12 +27,14 @@ export class ViewComponent implements OnInit {
depends_child: any=[];
Mandatory_checked = false;
score_card: any=[];
option_array: any=[];
public emailForm: FormGroup;
public emailLabels = ['Home', 'Work', 'Other'];
public validationMsgs = {
'emailAddress': [{ type: 'email', message: 'Enter a valid email' }]
}
show2: boolean;
show_api: boolean = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any,private fb: FormBuilder,private dialog: MatDialog, private _formBuilder: FormBuilder) {
console.log(this.data)
this.data.data
@ -67,13 +69,15 @@ export class ViewComponent implements OnInit {
this.dialoge_subcontent.push(this.data.form_name)
this.EditQuestions = this.data.data;
if(this.data.valid !=null){
if(!this.data.valid){
if(this.data.valid.length != 1){
this.Mandatory_checked = false;
}else{
this.Mandatory_checked = true;
}
}
console.log( this.EditQuestions)
// this.questionsForm.controls.questions.setValue( this.data.data);
//this.dialoge_content.push("This Question depends on another question")
@ -159,11 +163,17 @@ export class ViewComponent implements OnInit {
// console.log( w)
let w = this.userDetailsForm.value.question
if(w == "3" ||w == "4"){
if(w == "3" ||w == "4" || w == "2"){
this.show =true
}else{
this.show =false
}
if(w == "3" ||w == "4"){
this.show_api =true
}else{
this.show_api =false
}
}
@ -213,6 +223,31 @@ export class ViewComponent implements OnInit {
console.log( this.data.add);
this.emailForm.get('emails')
console.log(value);
console.log( value.option);
let answer;
this.option_array =[];
for(let i=0;i<=value.option.length-1;i++){
this.option_array.push( {
"answer_id":value.option[i].option,
"answer":value.option[i].option,
})
}
console.log( this.option_array);
this.option_array.forEach(element => {
if(element.answer_id == ''){
this.option_array = null
}
});
console.log( this.data.full_data);
console.log( this.emailForm.get('emails'));
console.log( this.data.form_name);
@ -233,20 +268,27 @@ export class ViewComponent implements OnInit {
var names = value.Field
var nameArr = names.split(',');
let tmp ;
if(value.api_name !=''){
tmp ={
"api":value.api_name,
"api_method":api,
"params":{
"master_name": value.params
},
"fields":[
''+nameArr[0]+'',''+nameArr[1]+''
]
} || null;
}else{
tmp = null
let api_properties = {
"api":value.api_name,
"api_method":api,
"params":{
"master_name": value.params
},
"fields":[
''+nameArr[0]+'',''+nameArr[1]+''
]
} || null;
}
let q_key = question_key.toLowerCase();
let api_properties = tmp
let valid;
console.log( this.Mandatory_checked )
if( this.Mandatory_checked == true){
if( this.Mandatory_checked == true ){
valid = [
{
"name":"required",
@ -257,19 +299,34 @@ export class ViewComponent implements OnInit {
}
]
}else{
valid = null;
valid = [];
if( value.mandatory == true){
valid = [
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
}else{
valid = [];
}
}
localStorage.setItem('question_edit_valid', JSON.stringify(valid))
let json = {'answers':null,
"validations":valid,
let json = {
'question':question,
'question_key':q_key.split(' ').join('_'),
'answers': this.option_array || null,
"validations":valid,
'api_properties': api_properties,
'disable': false,
'field_width': width,
'is_repeatable': null,
'required':value.mandatory,
'onchange_properties': Onchange,
'question':question,
'question_key':question_key,
'title': title,
'type': question_type,
}

View File

@ -37,8 +37,13 @@
"question_key":"Account_Holder_Name",
"question":"Account Holder's Name",
"place_holder":"Enter the text",
"type":"3",
"api_properties":null,
"type":"4",
"api_properties":
{
"purpose":"answer_options_local",
"master_name":"pd_applicants",
"fields":["pd_co_applicant_id","applicant_name"]
},
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
@ -320,8 +325,13 @@
"question_key":"Account_Holder_name",
"question":"Account Holder's Name",
"place_holder":"Enter the text",
"type":"3",
"api_properties":null,
"type":"4",
"api_properties":
{
"purpose":"answer_options_local",
"master_name":"pd_applicants",
"fields":["pd_co_applicant_id","applicant_name"]
},
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
@ -689,8 +699,38 @@
"field_width":"45",
"validations":[
]
}
},{"answers": null,
"api_properties": null,
"disable": false,
"field_width": "75",
"is_repeatable": null,
"onchange_properties": null,
"question": "sample question",
"question_key": "sample_question",
"raw_validations": null,
"required": true,
"title": null,
"type": 1,
"validations": []
},
{
"question_key":"sub_question",
"question":"sub question",
"place_holder":"Enter the text",
"type":"1",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string",
"field_width":"45",
"validations":[
]
}
]
}

File diff suppressed because it is too large Load Diff