Fairoj : Sales PD Changes

This commit is contained in:
venbatechnologies@gmail.com 2019-12-23 12:31:50 +05:30
parent 609e12f3ae
commit fdf4747fb6
40 changed files with 319535 additions and 242 deletions

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.sineedge.pdglender" version="0.0.14" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.sineedge.pdglender" version="0.0.15" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>PD Genie</name>
<description>info@pdgenie.com</description>
<author email="info@pdgenie.com" href="https://pdgenie.com">PD Genie</author>

View File

@ -13,7 +13,6 @@ import {AppVersion} from '@ionic-native/app-version'
import { SalesPDlistPage } from '../pages/sales_pd/pages/sales-p-dlist/sales-p-dlist';
import { HomePage, Section3, Section1, Section2, Section9, Section8 } from '../pages/sales_pd/pages/home/home';
import { ConstantsProvider } from '../providers/constants/constants';
import { SalesPdProvider } from '../pages/sales_pd/providers/sales-pd/sales-pd';

View File

@ -155,12 +155,12 @@
*ngFor="let single_ques of group_ques.controls.questions['controls'];let s_i=index;let s_l=last"
[formGroupName]="s_i">
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':single_ques.get('field_type').value == 'numtoword' ? '5%' : '0' }">
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'numtoword' ? '5%' : '0' : '' }">
<mat-label>{{single_ques.get('question').value}}</mat-label>
<input matInput [type]="single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value" formControlName="answer_value"
[placeholder]="single_ques.get('place_holder').value"
<input matInput [type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
<mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numToWords}}</mat-hint>
<mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numToWords}}</mat-hint>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
@ -352,7 +352,7 @@
<button class="btn-no-pad" medium ion-button round outline color="optblue" (click)="onSubmit(0)">Save as Draft</button>
</ion-col>
<ion-col *ngIf="!spinner_access">
<button class="btn-no-pad" medium ion-button type="submit" round color="optblue" (click)="onSubmit(1)"><ion-icon style="color:gray;font-size: 24px;" name="md-arrow-dropright-circle"></ion-icon>&nbsp; {{submit_btn ? 'Submit' : 'Proceed'}} </button>
<button class="btn-no-pad" medium ion-button type="submit" round color="optblue" (click)="onSubmit(1)"><ion-icon style="color:gray;font-size: 24px;" name="md-arrow-dropright-circle"></ion-icon>&nbsp; {{submit_btn ? 'Complete' : 'Proceed'}} </button>
</ion-col>
<ion-spinner name="dots" color="optblue" style="font-size: 24px;width:50px;height: 50px;" *ngIf="spinner_access"></ion-spinner>
</ion-buttons>

View File

@ -6,11 +6,11 @@ import { Camera } from '@ionic-native/camera';
import { CameraProvider } from '../../providers/camera/camera';
import { ConstantsProvider } from '../../../../providers/constants/constants';
import { ToastProvider } from '../../../../providers/common-provider/toast';
import { takeUntil } from 'rxjs/operators';
import { takeUntil, single } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { LoadingProvider } from '../../../../providers/common-provider/loading';
import { NavController } from 'ionic-angular/navigation/nav-controller';
import { Section1 } from '../../pages/home/home';
import { Section1,Section2,Section3,Section4,Section5,Section6,Section7,Section8,Section9 } from '../../pages/home/home';
/**
@ -37,8 +37,9 @@ export class QuesTemplateComponent {
fileredSearchValue: any=[];
protected _onDestroy=new Subject<void>();
submit_btn: boolean=false;
original_result_data: any;
original_result_data: any={is_complete:''};
spinner_access:boolean=false
raw_data_Section: any={status:''};
constructor(private _fb:FormBuilder,private questionService:QuesServiceProvider,private salesPDProvider:SalesPdProvider,private camera:Camera,private cameraProvider:CameraProvider,private constantProvider:ConstantsProvider,private toastProvider:ToastProvider,private loadingProvider:LoadingProvider,private navCtrl:NavController) {
console.log('Hello QuesTemplateComponent Component');
this.text = 'Hello World';
@ -51,7 +52,7 @@ export class QuesTemplateComponent {
let raw_data_ques:any=localStorage.getItem('question_temp_salespd')
raw_data_ques=JSON.parse(raw_data_ques)
console.log("raa",raw_data_ques)
if(raw_data_ques != null){
if(raw_data_ques.hasOwnProperty('sections') ){
console.log("FROM COMPONENT",this.questions_JSON);
@ -90,8 +91,12 @@ export class QuesTemplateComponent {
let params={sales_pd_id:sales_pd_id,section_id:this.local_ques_JSON.section_id}
this.salesPDProvider.getSalesPDSectionData(params).subscribe(response=>{
if(response['dataStatus']){
this.raw_data_Section=response['records'][0]
this.original_result_data=response['records'][0].section_data
this.original_result_data=JSON.parse(this.original_result_data);
// this.original_result_data.questions=this.original_result_data.questions.filter(val=>val.question_key == 'selfie_with_person_met')
this.checkGroupandPatchValues()
}
this.loadingProvider.dismissLoader()
@ -99,81 +104,64 @@ export class QuesTemplateComponent {
this.loadingProvider.dismissLoader()
})
}
proceedonChangeProperty(){
proceedonChangeProperty(local_value_obj?){
console.log("On Change Property");
this.quesAnsForm.controls.questions['controls'].forEach((val,p_i)=>{
console.log(val);
// JSON QUESTION CHANGE FOR SINGLE
let form_c=val.value
if(this.original_result_data.questions[p_i] != undefined){
if(form_c.question_key != this.original_result_data.questions[p_i].question_key){
this.original_result_data.questions.splice(p_i,0,form_c)
}
}
//---- END OF JSON QUESTION CHANGE----
if(val.value.is_repeatable == '1'){
val.controls.questions_group.controls.forEach((group_ques,g_i)=>{
// console.clear()
console.log(">>>>>>>>>>",g_i,group_ques);
group_ques.value.questions.forEach((single_ques,s_i)=>{
// this.questionService.addAdditionalControl(single_ques,group_ques.controls.questions,g_i)
console.log(single_ques)
// --- FOR ONCHANGE PROPERTIES---
if(single_ques.onchange_properties != null){
let onChangeProperties_value=single_ques.onchange_properties
// let new_name=`{
// "purpose":"FORM_CTRL",
// "form_controls":[
// {
// "insert_index":"total_work_exp",
// "expression":"(total_work_exp > vintage_in_current_biz)",
// "value_keys":[
// "total_work_exp",
// "vintage_in_current_biz"],
// "questions":[
// {
// "question_key":"previous_experience_details2",
// "question":"Previous Experience2",
// "type":"1",
// "api_properties":null,
// "answers":null,
// "onchange_properties":null,
// "is_repeatable":null,
// "field_type":"string",
// "validations":[{
// "isactive": "1",
// "message": "Name Required",
// "name": "required",
// "validator": "Validators.required",
// "value": null
// }]
// }]
// },
// {
// "insert_index":"vintage_in_current_biz",
// "expression":"(total_work_exp > vintage_in_current_biz)",
// "value_keys":[
// "total_work_exp",
// "vintage_in_current_biz"],
// "questions":[{
// "question_key":"vintage1",
// "question":"Vintage check",
// "type":"1",
// "api_properties":null,
// "answers":null,
// "onchange_properties":null,
// "is_repeatable":null,
// "field_type":"string",
// "validations":[]
// }]
// }
// ]
// }`
// onChangeProperties_value.push(JSON.parse(new_name))
onChangeProperties_value.forEach(onChangeProperty=>{
if(onChangeProperty.purpose == 'FORM_CTRL'){
console.log("op",onChangeProperty.form_controls,this.original_result_data.questions[p_i].questions_group[g_i])
this.creteNewField(onChangeProperty,group_ques,'',this.original_result_data.questions[p_i].questions_group[g_i],"edit");
}
})
}
// ---END OF ON CHANGE PROPERTIES---
// ----FOR SUBFIELD GENERATION----
let control=this.quesAnsForm.get('questions')['controls'][p_i].get('questions_group')['controls'][g_i].get('questions')['controls'][s_i] as FormArray
if (control.value.answers != null && control.value.answers.length > 0) {
let answer_value_obj=local_value_obj.questions[p_i].questions_group[g_i].questions[s_i]
if(answer_value_obj != undefined){
this.creatSubField(control, answer_value_obj.answer_value)
}
}
// ----END OF SUBFIELD GENERATION----
// JSON QUESTION CHANGE FOR GROUP
// setTimeout(()=>{
let form_c=single_ques
let form_control=this.quesAnsForm.value.questions[p_i].questions_group[g_i].questions[s_i]
let local__g_data=this.original_result_data.questions[p_i].questions_group[g_i].questions
if(local__g_data[s_i] != undefined){
if(form_control.question_key != local__g_data[s_i].question_key){
local__g_data.splice(s_i,0,form_c)
}
}
// })
//---- END OF JSON QUESTION CHANGE----
})
})
}
@ -185,52 +173,29 @@ export class QuesTemplateComponent {
modified.questions.forEach((parent_ques,p_i)=>{
if(parent_ques.is_repeatable == '1'){
parent_ques.questions_group.forEach((group_ques,g_i)=>{
// if(val.hasOwnProperty('questions_group'))
// {
// return val.questions_group
// }
// });
// console.log("grou",group_ques);
// group_ques=group_ques.filter(val=>val != undefined)
// if(group_ques.length > 0){
// group_ques=group_ques[0]
// // let group_ques2=group_ques.splice(1,0)
// let group_ques2=group_ques
// // group_ques2= group_ques2.splice(1,1);
// group_ques.forEach((group_ques2,p_index)=>{
// console.log("after shift",group_ques2);
// if(group_ques2.length > 0){
// group_ques2.forEach((res,index)=>
// {
console.log(group_ques,g_i);
if(g_i != 0){
let parent_control=this.quesAnsForm.get('questions')['controls'][p_i] as FormArray
console.log(parent_control,p_i);
if(parent_control.value.hasOwnProperty('questions_group')){
this.addData(g_i-1,parent_control,group_ques.questions,'','')
}
}
// })
// }
// })
})
}
else {
let control=this.quesAnsForm.get('questions')['controls'][p_i]
console.log(control.value.answers)
if (control.value.answers != null && control.value.answers.length > 0) {
this.creatSubField(control, parent_ques.answer_value)
}
}
})
this.proceedonChangeProperty()
this.proceedonChangeProperty(modified)
console.log("rr",this.original_result_data.questions)
this.quesAnsForm.get('questions').patchValue(this.original_result_data.questions);
console.log(this.quesAnsForm)
}
setStep(index: number) {
this.step = index;
@ -246,7 +211,7 @@ console.log("rr",this.original_result_data.questions)
addData(group_index, parent_index, data, event, options?: any, single_ques?) {
console.clear();
data=data.filter(group_indi=>!group_indi.hasOwnProperty('additional_field') && group_indi.additional_field != 1 )
console.log(">>",data, parent_index, group_index, single_ques)
if (options == 'camera') {
this.cameraProvider.getpicture().then(res => {
@ -313,7 +278,7 @@ console.log("rr",this.original_result_data.questions)
if(event!= ''){
event.stopPropagation()
}
console.log(control)
this.step = control.length
control.push(this._fb.group({ 'questions': this._fb.array([]) }))
let sub_childControl: any = control.controls[group_index + 1].get('questions') as FormArray
@ -322,7 +287,7 @@ console.log("rr",this.original_result_data.questions)
this.questionService.addAdditionalControl(group_indi, sub_childControl, arr_index)
})
console.log("dd112", this.quesAnsForm, sub_childControl, this.step)
}
}
captureImg(parent_index,parent_control){
@ -362,38 +327,6 @@ console.log("rr",this.original_result_data.questions)
}, error => {
console.log("Camera Error ", JSON.stringify(error));
})
// this.camera.getPicture({
// quality:75,
// destinationType: this.camera.DestinationType.DATA_URL,
// targetWidth: 500,
// targetHeight: 600,
// correctOrientation: true
// }).then((imageData) => {
// // imageData is a base64 encoded string
// let base64 = "data:image/png;base64," + imageData;
// parent_control.controls.answer_value.setValue(base64)
// //console.log(this.base64Image);
// // this.pddocdata.push({'image':this.base64Image,'Name':''});
// //console.log(this.pddocdata);
// // this.processWebImage(this.base64Image);
// }, (err) => {
// console.log(err);
// let storage_param=this.questions_JSON
// storage_param.questions=this.quesAnsForm.getRawValue().questions
// this.salesPDProvider.insertData_Replace('sec'+storage_param.section_id,storage_param)
// });
}
@ -440,13 +373,13 @@ console.log("rr",this.original_result_data.questions)
onChangeProperty(event,sec_control,group_ques,options?,sec_index?){
this.fileredSearchValue=[]
console.log(event,sec_control,this.quesAnsForm,group_ques);
if( sec_control.value.answers!= null && sec_control.value.answers.length > 0){
this.creatSubField(sec_control,event.value)
}
//FOR API CALLS
if(sec_control.value.onchange_properties != null && sec_control.value.onchange_properties.length >0){
console.log("entere")
let onChangeProperties_value=sec_control.value.onchange_properties
// let new_name=`{
@ -516,8 +449,7 @@ console.log("rr",this.original_result_data.questions)
this.quesAnsForm.controls.questions['controls'].forEach((val,index)=>{
if(val.value.api_properties == 'local_city'){
// console.log("v",val)
console.log(this.local_city,this.local_pincode)
this.local_city=this.questionService.convertArrayNames(['city_id','city_name'],this.local_city)
val.controls.answers.setValue(this.local_city)
}
@ -525,7 +457,7 @@ console.log("rr",this.original_result_data.questions)
this.local_pincode=this.questionService.convertArrayNames(['pincode_id','pincode'],this.local_pincode)
val.controls.answers.setValue(this.local_pincode)
}
console.log("local",this.local_city,this.local_pincode)
})
}
@ -541,21 +473,21 @@ console.log("rr",this.original_result_data.questions)
if(options == 2){
ques_control=group_ques.controls.questions['controls']
}
console.log(options)
ques_control.forEach((val,index)=>{
if(val.value.api_properties == onChangeProperty.local_variable){
let values1=this.questionService.convertArrayNames(onChangeProperty.fields,result)
val.controls.answers.setValue(values1)
}
console.log("local",this.local_city,this.local_pincode)
})
}
})
}
}
if(onChangeProperty.purpose == 'validations'){
console.log("op",options,onChangeProperty.validations)
if(options == 2){
this.setValidations_onChange(onChangeProperty,group_ques,sec_control,sec_index)
}
@ -564,7 +496,7 @@ console.log("rr",this.original_result_data.questions)
}
}
if(onChangeProperty.purpose == 'FORM_CTRL'){
console.log("op",options,onChangeProperty.validations)
if(options == 2){
this.creteNewField(onChangeProperty,group_ques,sec_control,sec_index)
}
@ -598,12 +530,12 @@ console.log("rr",this.original_result_data.questions)
})
let calc_exp=eval(expression_value)
console.log("validation_obj",expression_value,calc_exp)
if(calc_exp != false){
if(form_control_obj.questions.length > 0){
let question_index_after
group_ques.value.questions.forEach((val,index,arr)=>{
console.log(index);
if(val.question_key == form_control_obj.insert_index){
question_index_after= arr.indexOf(val)
}
@ -631,7 +563,7 @@ console.log("rr",this.original_result_data.questions)
if(check_dup.length == 0){
val.raw_validations=val.validations
ques_control.insert(question_index_after+1,this.questionService.createValue(val))
console.log(ques_control)
this.questionService.addAdditionalControl(val, ques_control, question_index_after+1,"additional_field")
}
}
@ -645,7 +577,7 @@ console.log("rr",this.original_result_data.questions)
})
}
setValidations_onChange(validation_obj_raw,group_ques,sec_control,sec_index){
console.log("onchange validations",group_ques,sec_control,validation_obj_raw)
if(validation_obj_raw.validations.length > 0){
validation_obj_raw.validations.forEach(validation_obj=>{
@ -664,10 +596,10 @@ console.log("rr",this.original_result_data.questions)
expression_value=expression_value.replace(res,validator_value_obj.answer_value)
}
})
console.log("validation_obj",expression_value)
// validation_obj.value=expression_value
validation_obj.validator=eval(expression_value)
console.log("c",validation_obj);
if(validation_obj.validator == false){
validation_obj.isactive='0'
// // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
@ -685,7 +617,7 @@ console.log("rr",this.original_result_data.questions)
else{
// STARTING VALUE VALIDATION
let validator_value_obj
console.log("value key null");
validator_value_obj=group_ques.value.questions.filter(val=>val.question_key ==
@ -720,7 +652,7 @@ console.log("rr",this.original_result_data.questions)
console.log("entered",group_ques,sec_index);
ques_control=group_ques.controls.questions['controls'][sec_index]
console.log('im* im',validation_obj,validator_single);
// if(validation_obj.isactive == '1'){
// ques_control.controls.answer_value.setValidators(validator_single)
// ques_control.controls.answer_value.updateValueAndValidity()
@ -731,7 +663,7 @@ console.log("rr",this.original_result_data.questions)
// }
// validation_obj.validator=validator_single
let new_validation_obj=this.updateValidationMsg(ques_control,validation_obj)
console.log("new validations obj",new_validation_obj)
this.questionService.settingArrayofValidators({validations:new_validation_obj},ques_control,sec_index)
}
else{
@ -798,13 +730,13 @@ console.log("rr",this.original_result_data.questions)
let submitProperty=this.local_ques_JSON.onsubmit[i]
// console.log(parent_ques.questions_group[0].questions.filter(val=>val.question_key == submitProperty.key_name).length > 0)
if((parent_ques.is_repeatable == '1' && parent_ques.questions_group[0].questions.filter(val=>val.question_key == submitProperty.key_name).length > 0 ) || parent_ques.question_key == submitProperty.key_name){
// console.log(submitProperty,parent_ques,i);
return_val.length = 0
let val=this.calculation(parent_ques,submitProperty)
// console.log("vv",val)
if(val != true && val != 100){
this.toastProvider.lenderappmessage(submitProperty.msg)
return_val.push(false) ;
@ -914,13 +846,12 @@ console.log("rr",this.original_result_data.questions)
return;
}
}
console.log("submit",this.quesAnsForm.value)
let storage_param=this.questions_JSON
storage_param.questions=this.quesAnsForm.getRawValue().questions
storage_param.is_complete=flag
this.spinner_access=true
// this.questions_JSON.questions=this.quesAnsForm.value.questions
// console.log(this.questions_JSON);
if (this.submit_btn && flag == 0) {
// this.insertSectionDataLocally(storage_param)
storage_param.questions=this.questions_JSON.questions
@ -931,6 +862,8 @@ console.log("rr",this.original_result_data.questions)
})
return;
}
console.log(this.quesAnsForm.dirty)
if(this.quesAnsForm.dirty){
if(this.local_ques_JSON.section_id == 1 || this.submit_btn){
this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(result=>{
if(result != null && !this.submit_btn){
@ -945,6 +878,19 @@ console.log("rr",this.original_result_data.questions)
this.sendSectiontoApi(storage_param)
}
}
else if(!this.submit_btn){
if(flag == 1 && ((this.raw_data_Section.hasOwnProperty('status') && this.raw_data_Section.status == '0') || (this.original_result_data.hasOwnProperty('is_complete') && this.original_result_data.is_complete == 0))){
this.sendSectiontoApi(storage_param)
}
else{
this.spinner_access=false
this.insertSectionDataLocally(storage_param)
}
}
else{
this.sendDatatoApi(storage_param)
}
}
sendSectiontoApi(params){
this.salesPDProvider.saveSalesPDSection(params).subscribe(response=>{
if(response.dataStatus){
@ -961,75 +907,135 @@ console.log("rr",this.original_result_data.questions)
},err=>this.spinner_access=false)
}
sendDatatoApi(section_data?){
// let raw_data_ques:any=localStorage.getItem('question_temp_salespd')
// raw_data_ques=JSON.parse(raw_data_ques)
// let all_sections=raw_data_ques.sections.map(val=>val.section_id)
// this.loadingProvider.pdloader('Please Wait...')
// this.salesPDProvider.sendData(all_sections).then((res:any)=>{
// console.log(res)
this.spinner_access=true
// this.cameraProvider.getGeoTag().then(geo_cords=>{
// let params={pd_json:JSON.stringify(res),geo_location:geo_cords}
let params:any={}
if(this.submit_btn){
params.status="COMPLETED"
}
this.salesPDProvider.saveQuestions(params).subscribe((apiresult:any)=>{
if(apiresult['dataStatus']){
if(apiresult['records'] != true && typeof(apiresult['records']) != 'object'){
this.salesPDProvider.insertData_Replace('sales_pd_id_PRIMARYKEY',apiresult['records']).then(local_result=>{
if(!this.submit_btn){
this.sendSectiontoApi(section_data)
}
})
}
else
if(!this.submit_btn){
this.sendSectiontoApi(section_data)
}
else if(apiresult.hasOwnProperty('pd_status') && apiresult['pd_status'] == 'DRAFT'){
this.toastProvider.setAlert("<small>Personal Discussion is not completed<small>","Some of the sections are saved as draft. Kindly check and complete that.")
let product_id=localStorage.getItem('product_id_salesPD')
this.navCtrl.setRoot(Section1,{product_id:product_id})
}
else{
section_data.questions=this.questions_JSON.questions
setTimeout(()=>{
this.emitter.emit(section_data)
})
}
// this.insertSectionDataLocally(section_data)
// this.SalesPDService.clearLocalData()
// if(res.length > 1){
// this.toastProvider.lenderappmessage("Saved Successfully..!");
// }
// setTimeout(()=>{
// this.navCtrl.setRoot(SalesPDlistPage)
// },2000)
if(this.submit_btn){
let alert=this.toastProvider.setAlertWithButtons('<small>Personal Discussion Complete</small>','Once the PD is completed You Could not able to edit the PD',{button1:'Cancel',button2:'Complete'})
alert.present();
alert.onDidDismiss((data)=>{
if(data != false){
this.saveSalesPDAPI(section_data)
}
else{
this.toastProvider.lenderappmessage("Something went wrong");
// setTimeout(()=>{
// this.navCtrl.pop();
// })
this.spinner_access=false
}
// this.loadingProvider.dismissLoader();
this.spinner_access=false
},err=>{
// this.loadingProvider.dismissLoader();
this.spinner_access=false
console.log("error",err);
this.toastProvider.lenderappmessage('Network Error')
this.sendDatatoApi(section_data);
})
}
else{
this.saveSalesPDAPI(section_data)
}
// })
// })
}
saveSalesPDAPI(section_data){
let params:any={}
if(this.submit_btn){
params.status="COMPLETED"
}
this.salesPDProvider.saveQuestions(params).subscribe((apiresult:any)=>{
if(apiresult['dataStatus']){
if(apiresult['records'] != true && typeof(apiresult['records']) != 'object'){
this.salesPDProvider.insertData_Replace('sales_pd_id_PRIMARYKEY',apiresult['records']).then(local_result=>{
if(!this.submit_btn){
this.sendSectiontoApi(section_data)
}
})
}
else
if(!this.submit_btn){
this.sendSectiontoApi(section_data)
}
else if(apiresult.hasOwnProperty('pd_status') && apiresult['pd_status'] == 'DRAFT'){
// this.toastProvider.setAlert("<small>Personal Discussion is not completed<small>","Some of the sections are saved as draft. Kindly check and complete that.")
let section_redirect=apiresult['records']
let section_dis_names:any=[];
section_redirect.forEach(res=>{
section_dis_names.push(res.sectin_name)
})
let alert=this.toastProvider.setAlertWithOkButton("<small>Personal Discussion is incomplete<small>","The Following sections are in draft status <b>"+section_dis_names+'</b>')
alert.present()
alert.onDidDismiss(()=>{
this.redirect_to_section(section_redirect[0].section_id)
})
}
else{
section_data.questions=this.questions_JSON.questions
section_data.is_completed=true
setTimeout(()=>{
this.emitter.emit(section_data)
})
}
// this.insertSectionDataLocally(section_data)
// this.SalesPDService.clearLocalData()
// if(res.length > 1){
// this.toastProvider.lenderappmessage("Saved Successfully..!");
// }
// setTimeout(()=>{
// this.navCtrl.setRoot(SalesPDlistPage)
// },2000)
}
else{
this.toastProvider.lenderappmessage("Something went wrong");
// setTimeout(()=>{
// this.navCtrl.pop();
// })
}
// this.loadingProvider.dismissLoader();
this.spinner_access=false
},err=>{
// this.loadingProvider.dismissLoader();
this.spinner_access=false
this.toastProvider.lenderappmessage('Network Error')
this.sendDatatoApi(section_data);
})
}
redirect_to_section(section_id){
let re_section:any=Section1
switch (parseInt(section_id)) {
case 1:
re_section = Section1
break;
case 2:
re_section = Section2
break;
case 3:
re_section = Section3
break;
case 4:
re_section = Section4
break;
case 5:
re_section = Section5
break;
case 6:
re_section = Section6
break;
case 7:
re_section = Section7
break;
case 8:
re_section = Section8
break;
case 9:
re_section = Section9
break;
default:
re_section=''
break;
}
let product_id=localStorage.getItem('product_id_salesPD')
this.navCtrl.setRoot(re_section,{product_id:product_id})
}
insertSectionDataLocally(section_data){
this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{

View File

@ -543,8 +543,8 @@ export class Section9 {
console.log("else part")
// this.sendDatatoApi()
this.SalesPDService.clearLocalData()
this.toastProvider.lenderappmessage("Saved Successfully..!");
let msg=event.hasOwnProperty('is_completed') && event.is_completed == true ? "Completed Successfully" : 'Saved Successfully..!'
this.toastProvider.lenderappmessage(msg);
this.SalesPDService.clearLocalData()
localStorage.removeItem('product_id_salesPD')
setTimeout(()=>{

View File

@ -116,15 +116,6 @@ export class SalesPDlistPage {
let actionSheet = this.actionSheetCtrl.create({
title: 'Select Option',
buttons: [
{
text: 'Edit',
icon:'create',
role: 'destructive',
handler: () => {
this.editForm(value_obj);
// console.log('pdf check',this.salesPDpdf);
}
},
{
text: 'View Report',
icon:'eye',

View File

@ -166,7 +166,7 @@ export class CameraProvider {
}
},
err => {
alert(err);
console.log(err);
}
);
}

View File

@ -149,8 +149,15 @@ export class QuesServiceProvider {
createValue(data){
let is_amt_in_words=false
let answer_value_loc='';
if(data.type == '1' && data.hasOwnProperty('answer_value') && data.answer_value != '' || null){
answer_value_loc = this.getAnswerValue(data)
let answers_from_client=[]
if(data.hasOwnProperty('answer_value') && data.answer_value != '' || null){
let values_for_cli:any = this.getAnswerValue(data)
if(values_for_cli.flag == 1){
answer_value_loc=values_for_cli.values
}
else{
answers_from_client=values_for_cli.values
}
}
// if(data.hasOwnProperty('field_type')){
// if(data.field_type == 'num'){
@ -166,7 +173,7 @@ export class QuesServiceProvider {
"validations":[data.raw_validations],
"api_properties":[data.api_properties],
"onchange_properties":[data.onchange_properties],
"answers":[data.answers],
"answers":[answers_from_client.length != 0 ? answers_from_client: data.answers],
"is_repeatable":[data.is_repeatable || null],
"group_title":[data.group_title || null]
})
@ -209,13 +216,13 @@ export class QuesServiceProvider {
getAnswerValue(value_obj){
if(value_obj != null && value_obj.hasOwnProperty('answer_value')){
let return_value;
let return_value={flag:1,values:''};
let user_det:any=localStorage.getItem("user_details")
user_det=JSON.parse(user_det);
switch(value_obj.answer_value){
case 'CURRENT_USER':
console.log("current user",user_det)
return_value=user_det.user_first_name+' '+user_det.user_last_name
return_value.values=user_det.user_first_name+' '+user_det.user_last_name
break;
case "CURRENT_DESIGNATION":
console.log("current user",user_det)
@ -223,10 +230,14 @@ export class QuesServiceProvider {
break;
case "CURRENT_DATE":
let date=new Date()
return_value=this.datepipe.transform(date,'dd-MM-yyyy, h:mm:ss a')
return_value.values=this.datepipe.transform(date,'dd-MM-yyyy, h:mm:ss a')
break;
case "GET_FY_YEARS":
return_value.values=this.getCurrentFyYears()
return_value.flag=2
break;
default:
return_value=''
return_value.values=''
break
}
return return_value
@ -305,6 +316,22 @@ export class QuesServiceProvider {
value_obj.validator=String(value_of_validator)
return this.setValueForValidator(value_obj)
}
}
getCurrentFyYears(){
let month=new Date().getMonth()
let year=new Date().getFullYear()
let fy:any=[];
if(month >=3){
fy.push({fy_year:year-1+'-'+(year),curr:year})
}
else{
fy.push({fy_year:year-2+'-'+(year-1),curr:year-1})
}
console.log(fy)
for(let i=0;i<=2;i++){
fy.push({fy_year:(fy[i].curr-2)+'-'+(fy[i].curr-1),curr:fy[i].curr-1})
}
return fy.map(val=>({answer:val.fy_year,answer_id:val.fy_year}))
}
setValueForValidator(value_obj){
console.log("setvlaue of validator",value_obj.validator,typeof(value_obj.validator))

View File

@ -63,4 +63,23 @@ export class ToastProvider {
return alert
}
setAlertWithOkButton(title_name,msg){
let alert=this.alertCtrl.create({
title:title_name,
message:msg,
enableBackdropDismiss:false,
buttons:[{
text:'Ok',
handler:()=>{
alert.dismiss('ok')
return false
}
},
]
});
//alert.present()
return alert
}
}

Binary file not shown.

View File

@ -0,0 +1,50 @@
// Ionicons Icon Font CSS
// --------------------------
// Ionicons CSS for Ionic's <ion-icon> element
// ionicons-icons.scss has the icons and their unicode characters
$ionicons-font-path: $font-path !default;
@import "ionicons-icons";
@import "ionicons-variables";
@font-face {
font-family: "Ionicons";
src: url("#{$ionicons-font-path}/ionicons.woff2?v=#{$ionicons-version}") format("woff2"),
url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"),
url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype");
font-weight: normal;
font-style: normal;
}
ion-icon {
display: inline-block;
font-family: "Ionicons";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
text-rendering: auto;
text-transform: none;
speak: none;
@include rtl() {
&[aria-label^="arrow"]::before,
&[flip-rtl]::before {
transform: scaleX(-1);
}
&[unflip-rtl]::before {
transform: scaleX(1);
}
}
&::before {
display: inline-block;
}
}

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
// Noto Sans Font
// Google
// Apache License, version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
$noto-sans-font-path: $font-path !default;
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 300;
src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 400;
src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 500;
src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 700;
src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
// Roboto Font
// Google
// Apache License, version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
$roboto-font-path: $font-path !default;
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 300;
src: local("Roboto Light"), local("Roboto-Light"), url("#{$roboto-font-path}/roboto-light.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-light.woff") format("woff"), url("#{$roboto-font-path}/roboto-light.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: local("Roboto"), local("Roboto-Regular"), url("#{$roboto-font-path}/roboto-regular.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-regular.woff") format("woff"), url("#{$roboto-font-path}/roboto-regular.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: local("Roboto Medium"), local("Roboto-Medium"), url("#{$roboto-font-path}/roboto-medium.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-medium.woff") format("woff"), url("#{$roboto-font-path}/roboto-medium.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 700;
src: local("Roboto Bold"), local("Roboto-Bold"), url("#{$roboto-font-path}/roboto-bold.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-bold.woff") format("woff"), url("#{$roboto-font-path}/roboto-bold.ttf") format("truetype");
}

File diff suppressed because one or more lines are too long

1
www/build/0.js.map Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
www/build/main.css.map Normal file
View File

@ -0,0 +1 @@
null

File diff suppressed because one or more lines are too long

1
www/build/main.js.map Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
www/build/vendor.js.map Normal file

File diff suppressed because one or more lines are too long