Fairoj : Amt in words wrap and edit option for sales pd
This commit is contained in:
parent
3d1e753539
commit
48569627ca
@ -15,6 +15,7 @@ import {AppVersion} from '@ionic-native/app-version'
|
||||
import { SalesPDlistPage } from '../pages/sales_pd/pages/sales-p-dlist/sales-p-dlist';
|
||||
import { HomePage, Section3 } from '../pages/sales_pd/pages/home/home';
|
||||
import { ConstantsProvider } from '../providers/constants/constants';
|
||||
import { SalesPdProvider } from '../pages/sales_pd/providers/sales-pd/sales-pd';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'app.html'
|
||||
@ -30,7 +31,7 @@ export class MyApp {
|
||||
pages: Array<{title: string,icon:any, method: any}>;
|
||||
protected app_version: string;
|
||||
|
||||
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen,public aws:AwsServiceProvider,public shared:CognitoServiceProvider,public AWS:AwsServiceProvider,public alertCtrl:AlertController,private appVersionProvide:AppVersion,private events:Events,private constant:ConstantsProvider) {
|
||||
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen,public aws:AwsServiceProvider,public shared:CognitoServiceProvider,public AWS:AwsServiceProvider,public alertCtrl:AlertController,private appVersionProvide:AppVersion,private events:Events,private constant:ConstantsProvider,private salesPDService:SalesPdProvider) {
|
||||
this.initializeApp();
|
||||
this.changeDecision();
|
||||
|
||||
@ -158,7 +159,8 @@ export class MyApp {
|
||||
break;
|
||||
case 2:
|
||||
this.AWS.logout().subscribe(()=>{
|
||||
|
||||
this.salesPDService.clearLocalData()
|
||||
localStorage.removeItem('product_id_salesPD');
|
||||
this.nav.setRoot(LoginPage);
|
||||
});
|
||||
break;
|
||||
|
||||
@ -235,4 +235,26 @@ ion-content {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FOR setAlertWithButtons Function
|
||||
|
||||
/* FOR ALERT */
|
||||
.buttoncss{
|
||||
color:rgb(13, 149, 212);
|
||||
//background: green
|
||||
button.alert-button:nth-child(1){
|
||||
color: red;
|
||||
border:1px solid red;
|
||||
border-radius: 10px;
|
||||
position: relative;
|
||||
right:20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
button.alert-button:nth-child(2){
|
||||
color: green;
|
||||
border:1px solid green;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,12 +8,13 @@
|
||||
|
||||
<div *ngIf="parent_ques.get('is_repeatable').value != '1'">
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '1'">
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':parent_ques.get('field_type').value == 'numtoword' ? '5%' : '0' }">
|
||||
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<input matInput [type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value"
|
||||
[placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'"
|
||||
autocomplete="off" (change)="onChangeProperty($event,parent_ques,p_i)">
|
||||
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"
|
||||
>
|
||||
<mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"₹"}}{{parent_ques.get('answer_value').value | numToWords}}</mat-hint>
|
||||
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
@ -23,7 +24,7 @@
|
||||
<!-- <mat-form-field> -->
|
||||
<div class="radio-gap" *ngIf="parent_ques.get('type').value == '2'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label><br/>
|
||||
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,parent_ques)">
|
||||
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-radio-button class="radio-btn-gap" *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
|
||||
</mat-radio-group>
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
@ -33,7 +34,7 @@
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '3'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,p_i)">
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-option *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
@ -94,7 +95,7 @@
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '8'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,p_i)">
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-option>
|
||||
<ngx-mat-select-search formControlName="select_search"
|
||||
[placeholderLabel]="'Search'"
|
||||
@ -145,7 +146,7 @@
|
||||
*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'">
|
||||
<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-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('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'Enter the Number' : 'Enter the Text'"
|
||||
@ -159,7 +160,7 @@
|
||||
|
||||
<div class="radio-gap" *ngIf="single_ques.get('type').value == '2'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label><br/>
|
||||
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,single_ques,group_ques,2)">
|
||||
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
|
||||
<mat-radio-button class="radio-btn-gap" *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
|
||||
</mat-radio-group>
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
@ -169,7 +170,7 @@
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '3'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,single_ques,group_ques,2)">
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
|
||||
<mat-option *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
|
||||
@ -35,6 +35,7 @@ export class QuesTemplateComponent {
|
||||
fileredSearchValue: any=[];
|
||||
protected _onDestroy=new Subject<void>();
|
||||
submit_btn: boolean=false;
|
||||
original_result_data: any;
|
||||
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) {
|
||||
console.log('Hello QuesTemplateComponent Component');
|
||||
this.text = 'Hello World';
|
||||
@ -58,8 +59,48 @@ export class QuesTemplateComponent {
|
||||
|
||||
this.quesAnsForm=this.questionService.assignFormControl_array(this.quesAnsForm,this.local_ques_JSON.questions)
|
||||
console.log(this.quesAnsForm);
|
||||
this.salesPDProvider.getData_fromLocal('sec'+this.local_ques_JSON.section_id).then(resultData=>{
|
||||
this.original_result_data=resultData
|
||||
if(resultData){
|
||||
this.checkGroupandPatchValues()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
checkGroupandPatchValues(){
|
||||
let modified=this.original_result_data
|
||||
let group_ques=modified.questions.map(val=>{
|
||||
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(res,index);
|
||||
if(index != 0){
|
||||
let parent_control=this.quesAnsForm.get('questions')['controls'][p_index] as FormArray
|
||||
console.log(parent_control);
|
||||
this.addData(index-1,parent_control,res.questions,'','')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log("rr",this.original_result_data.questions)
|
||||
this.quesAnsForm.get('questions').patchValue(this.original_result_data.questions);
|
||||
|
||||
}
|
||||
setStep(index: number) {
|
||||
this.step = index;
|
||||
@ -114,7 +155,9 @@ export class QuesTemplateComponent {
|
||||
}
|
||||
else {
|
||||
let control: any = parent_index['controls'].questions_group as FormArray
|
||||
if(event!= ''){
|
||||
event.stopPropagation()
|
||||
}
|
||||
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
|
||||
@ -362,7 +405,7 @@ export class QuesTemplateComponent {
|
||||
proceedValidationSet(validation_obj,group_ques,sec_index,validator_single?){
|
||||
let ques_control;
|
||||
if(validation_obj.validation_to == null){
|
||||
console.log("entered");
|
||||
console.log("entered",group_ques,sec_index);
|
||||
ques_control=group_ques.controls.questions['controls'][sec_index]
|
||||
|
||||
console.log('im* im',validation_obj,validator_single);
|
||||
|
||||
@ -23,7 +23,7 @@ import { LoadingProvider } from '../../../../providers/common-provider/loading';
|
||||
export class HomePage{
|
||||
productList: any;
|
||||
product:string='';
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,private toastProvider:ToastProvider,private pdTriggerProvider:PdtriggerProvider){
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,private toastProvider:ToastProvider,private pdTriggerProvider:PdtriggerProvider,private salesPDService:SalesPdProvider){
|
||||
this.getProducts()
|
||||
}
|
||||
getProducts(){
|
||||
@ -32,9 +32,32 @@ export class HomePage{
|
||||
this.pdTriggerProvider.getEntityPreferences(users.fk_entity_id).subscribe(result=>{
|
||||
if(result['dataStatus']){
|
||||
this.productList=result['records'].products;
|
||||
let old_product_id=localStorage.getItem('product_id_salesPD')
|
||||
this.product=old_product_id
|
||||
}
|
||||
})
|
||||
}
|
||||
getProductForAlert(event){
|
||||
let old_product_id=localStorage.getItem('product_id_salesPD')
|
||||
console.log(event.value,old_product_id)
|
||||
if(old_product_id && old_product_id != event.value){
|
||||
|
||||
let btns={button1:'Cancel',button2:'Ok'}
|
||||
let alert = this.toastProvider.setAlertWithButtons("<small>Data will be Lost<small>", "Your existing data will be lost if you change the Product",btns)
|
||||
alert.present();
|
||||
alert.onDidDismiss((data) => {
|
||||
if (data == false) {
|
||||
this.product=old_product_id
|
||||
}
|
||||
else {
|
||||
// let product= localStorage.getItem('product_id_salesPD')
|
||||
// this.navCtrl.push(Section1,{product_id:product})
|
||||
localStorage.removeItem('product_id_salesPD');
|
||||
this.salesPDService.clearLocalData()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
sendProduct(){
|
||||
if(this.product != ''){
|
||||
localStorage.setItem('product_id_salesPD',this.product)
|
||||
@ -395,6 +418,8 @@ export class Section7 {
|
||||
|
||||
|
||||
this.toastProvider.lenderappmessage("Saved Successfully..!");
|
||||
this.SalesPDService.clearLocalData()
|
||||
localStorage.removeItem('product_id_salesPD')
|
||||
setTimeout(()=>{
|
||||
this.navCtrl.setRoot(SalesPDlistPage)
|
||||
},2000)
|
||||
@ -454,6 +479,8 @@ export class Section8 {
|
||||
|
||||
|
||||
this.toastProvider.lenderappmessage("Saved Successfully..!");
|
||||
this.SalesPDService.clearLocalData()
|
||||
localStorage.removeItem('product_id_salesPD')
|
||||
setTimeout(()=>{
|
||||
this.navCtrl.setRoot(SalesPDlistPage)
|
||||
},2000)
|
||||
@ -518,6 +545,8 @@ export class Section9 {
|
||||
this.SalesPDService.clearLocalData()
|
||||
|
||||
this.toastProvider.lenderappmessage("Saved Successfully..!");
|
||||
this.SalesPDService.clearLocalData()
|
||||
localStorage.removeItem('product_id_salesPD')
|
||||
setTimeout(()=>{
|
||||
this.navCtrl.setRoot(SalesPDlistPage)
|
||||
},2000)
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
padding: 10px;
|
||||
margin: 5px;
|
||||
white-space: pre-line;
|
||||
border-radius: 10px;" *ngFor="let val of productList" [value]="val.product_id" ><span>{{val.product_abbr}}</span></mat-radio-button>
|
||||
border-radius: 10px;" *ngFor="let val of productList" [value]="val.product_id" (change)="getProductForAlert($event)"><span>{{val.product_abbr}}</span></mat-radio-button>
|
||||
</mat-radio-group><br/>
|
||||
<!-- </mat-form-field> -->
|
||||
<ion-buttons end>
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||
import { SalesPdProvider } from '../../providers/sales-pd/sales-pd';
|
||||
import { HomePage } from '../home/home';
|
||||
import { HomePage, Section1 } from '../home/home';
|
||||
import { ToastProvider } from '../../../../providers/common-provider/toast';
|
||||
|
||||
/**
|
||||
* Generated class for the SalesPDlistPage page.
|
||||
@ -18,13 +19,13 @@ import { HomePage } from '../home/home';
|
||||
export class SalesPDlistPage {
|
||||
sales_displayValue: any=[];
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,private salesPDService:SalesPdProvider) {
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,private salesPDService:SalesPdProvider,private toastProvider:ToastProvider) {
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad SalesPDlistPage');
|
||||
this.getListofPD()
|
||||
this.salesPDService.clearLocalData();
|
||||
// this.salesPDService.clearLocalData();
|
||||
}
|
||||
getListofPD(){
|
||||
this.salesPDService.getSalesPDList().subscribe(res=>{
|
||||
@ -35,7 +36,34 @@ export class SalesPDlistPage {
|
||||
})
|
||||
}
|
||||
newForm(){
|
||||
console.log("chec")
|
||||
this.navCtrl.push(HomePage)
|
||||
this.salesPDService.getData_fromLocal('sec1').then(result=>{
|
||||
console.log("image",result);
|
||||
if(result){
|
||||
this.alertDecision()
|
||||
}
|
||||
else{
|
||||
this.navCtrl.push(HomePage)
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
alertDecision(){
|
||||
let btns={button1:'FreshPD',button2:'Continue'}
|
||||
let alert = this.toastProvider.setAlertWithButtons("<small>You have one Incomplete PD<small>", "<strong>Are You Continue with that or Start with Fresh PD<br/><small>Note:Starting Fresh PD will Delete the existing one.</small></strong>",btns)
|
||||
alert.present();
|
||||
alert.onDidDismiss((data) => {
|
||||
if (data == false) {
|
||||
this.salesPDService.clearLocalData()
|
||||
localStorage.removeItem('product_id_salesPD')
|
||||
this.navCtrl.push(HomePage)
|
||||
console.log(data)
|
||||
}
|
||||
else {
|
||||
let product= localStorage.getItem('product_id_salesPD')
|
||||
this.navCtrl.push(Section1,{product_id:product})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ apiurl:any;
|
||||
|
||||
getlocale(){
|
||||
let session:any = this.shared.getToken() || null;
|
||||
let userid
|
||||
let userid=''
|
||||
if(session != null){
|
||||
userid= session.idToken.payload.locale;
|
||||
}
|
||||
|
||||
@ -34,4 +34,33 @@ export class ToastProvider {
|
||||
alert.present();
|
||||
|
||||
}
|
||||
setAlertWithButtons(title_name,msg,buttons){
|
||||
|
||||
|
||||
let alert=this.alertCtrl.create({
|
||||
title:title_name,
|
||||
message:msg,
|
||||
cssClass:'buttoncss',
|
||||
enableBackdropDismiss:false,
|
||||
buttons:[{
|
||||
text:buttons.button1,
|
||||
cssClass:'btnNo',
|
||||
handler:()=>{
|
||||
alert.dismiss(false)
|
||||
return false
|
||||
}
|
||||
},{
|
||||
text:buttons.button2,
|
||||
cssClass:'btnYes',
|
||||
handler:()=>{
|
||||
alert.dismiss('s')
|
||||
return false
|
||||
}
|
||||
},
|
||||
]
|
||||
});
|
||||
//alert.present()
|
||||
return alert
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
28772
www/build/main.css
28772
www/build/main.css
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
null
|
||||
5304
www/build/main.js
5304
www/build/main.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
202730
www/build/vendor.js
202730
www/build/vendor.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,9 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<script data-ionic="inject">
|
||||
(function(w){var i=w.Ionic=w.Ionic||{};i.version='3.9.2';i.angular='5.0.3';i.staticDir='build/';})(window);
|
||||
</script>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ionic App</title>
|
||||
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user