· 6 years ago · Nov 14, 2019, 02:34 PM
1import { PricingPage } from './../pricing/pricing';
2//(C) Copyright International Business Machines Corporation, 2015, 2018
3import { Component, ViewEncapsulation, NgZone , ChangeDetectorRef} from '@angular/core';
4import { IonicPage, NavController, NavParams , LoadingController,AlertController } from 'ionic-angular';
5import { AppStateProvider } from '../../providers/app-state/app-state';
6import { DetailPage } from '../detail/detail';
7import { RetrivenonautodiscountProvider } from '../../providers/retrivenonautodiscount/retrivenonautodiscount';
8import { QuoteService } from '../../providers/quote-service';
9import { SelectedsbclistProvider } from '../../providers/selectedsbclist/selectedsbclist';
10import { DomSanitizer} from '@angular/platform-browser';
11import { ViewquotesPage } from '../viewquotes/viewquotes';
12import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';
13import { HomePage } from '../home/home';
14import { Keyboard } from '@ionic-native/keyboard';
15import { UserData } from '../../providers/user-data';
16
17/**
18 * Generated class for the PriceRequestPage page.
19 *
20 * See http://ionicframework.com/docs/components/#navigation for more info
21 * on Ionic pages and navigation.
22 */
23@IonicPage()
24@Component({
25 selector: 'page-price-request',
26 templateUrl: 'price-request.html',
27 encapsulation: ViewEncapsulation.None,
28})
29export class PriceRequestPage {
30
31private rebalance: any;
32
33public cart : any[] =[];
34
35public pro_cart : any[] =[];
36
37public discomment: any;
38
39seenNames: any = {};
40
41count:any = 0;
42
43user:any;
44
45selSBC: any;
46
47public product_title : string = '';
48
49//Price Request Header List Show and Hide Variable
50
51public price_request_header_screen = true;
52
53//Price Request Footer Show and Hide Variable
54
55public submit_pricing_request_footer = false;
56
57//Change Background Color of Decision Maker and Channel Contact Page (boolean condition class check)
58
59isChanged: boolean = false;
60
61
62//Declaration variable of Decision Maker Edit Page
63
64custprojectname:string;
65
66decisionmakername:string;
67
68decisionmakertitle:string;
69
70decisionmakeremail:string;
71
72title:string;
73
74
75public decision_maker_edited = false;
76
77public discount_apply_edited = false;
78
79
80
81//End Declaration variable of Decision Maker Edit Page
82
83
84//Declaration variable of Channel Contact Edit Page
85
86sp1bptypedescription:string;
87
88sp1bpcontactname:string;
89
90sp1requesterphone:string;
91
92sp1bpcontactemail:string;
93
94public channel_contact_edited = false;
95
96//End Declaration variable of Channel Contact Edit Page
97
98
99//Declaration Variable of Pricing Information Bid Justification Page
100
101public pricing_information_comment_edited = false;
102
103public price_info :string;
104
105todo_justification:string;
106
107// End Declaration Variable of Pricing Information Bid Justification Page
108
109
110
111//Declaration Variable of Special Bid Code Page
112
113public pricing_special_bid_edited = false;
114
115tmp:any;
116
117private loader : any;
118
119sbcalreadyapplied:any;
120
121modelArray: RetrivenonautodiscountProvider[] = [];
122
123tmp_retrive:any;
124
125
126
127
128//End Declaration Variable of Special Bid Code Page
129
130
131//Start Declaration Variable of Edit Quote Level Page
132
133sb_special_code:string;
134
135sb_approval_name:string;
136
137usersJson: any = {};
138
139public submitpricingeditquotelevelspecialcode = false;
140
141
142//End Declaration Variable of Edit Quote Level Page
143
144//Start Declaration Variable of Add Quote Special Bid Code
145
146public add_approval_sub_item = false;
147
148public add_specialbid_head_item = false;
149
150public add_specialbid_sub_item = false;
151
152add_user:any;
153
154add_tmp:any;
155
156add_tmp_re:any[] = [];
157
158public add_cart : any[] =[];
159
160public sbcapprovalinfo_sbclist:any[]=[];
161
162public sbcinfo:any[] = [];
163
164public add_results : any[] = [];
165
166public add_modi_cart : any[] =[];
167
168private add_loader : any;
169
170 add_temp:any;
171
172 add_tmp_cart : any[] = [];
173
174 add_tre:any;
175
176 add_whatToDo: any = false;
177
178 add_bks: SelectedsbclistProvider[] = [];
179
180 add_seenNames: any = {};
181
182 add_sbcalreadyapplied:any[] = [];
183
184 public submit_pricing_addquotelevelspecialcode = false;
185
186 //Done Button show and hide
187
188 public price_request_done_button = false;
189
190//End Declaration Variable of Add Quote Special Bid Code
191
192// Start Declaration Variable of Product Level Special Bid Code
193
194extended_end_user_price:string|number;
195
196end_user_discount:string|number;
197
198pro_usersJson: any = {};
199
200 pro_tmp:any;
201
202 public submit_pricing_productlevelspecialcode = false;
203
204 public submit_pricing_subproductlevelspecialcode = false;
205
206// End Declaration Variable of Product Level Special Bid Code
207
208
209//Start Declaration Variable for Submit and Save Quote
210
211public header_val : any[] =[];
212
213public dealReglist_val : any[] =[];
214
215//public installAddress_val : any[] =[];
216
217public selectedSbcList_val : any[] =[];
218
219//Approval Variable Declaration
220
221add_approval_name:string;
222
223
224
225 //Header Object Declarartion Variable
226 geocode:string;
227 quotestatusdesc:string;
228 quotemanager:string;
229 tier1companyname:string;
230 creatortype:string;
231 bpreasoncode:string;
232 isquotevalid:string;
233 quotestatus:string;
234 currencycode:string;
235 parent_val:string; //countrycode and id are declared variable
236
237 deal_reg :any;
238
239//End----------------------
240
241
242
243// Declarartion Variable
244 ccmsnb:string;
245 customertypecode:string;
246 decMakersEmail:string;
247 decMakersName:string;
248 decMakersProjName:string;
249 decMakersTitle:string;
250 bidType:string;
251 country:string;
252 id:string;
253 countrycode:string;
254
255 quoteTitle:string;
256
257 addresstype:string;
258
259 custCode:string;
260
261
262ctrycode:string;
263
264quoteid: number;
265
266bpcomments:string;
267
268autoRebalancecheckFlag:string;
269
270componentpriceslist : string;
271
272//Take Final submit Value
273
274rt_val:any;
275
276submit_data :any;
277
278deal_id_val:string;
279
280 //End----------------------
281
282//Status Variable for Save and Submit
283
284save_status:any;
285
286//End
287
288//Collection data variable for Retrive Non Auto Discount
289
290dt_retri:any;
291
292pro_index:any;
293
294max_update_val:any[] = [];
295
296generic_val:any[]=[];
297
298generic_val_drop:any[]=[];
299
300//component SBC List
301
302compsbclist:any[]= [];
303
304//Take Model DecisionMaker Variable
305
306st_bck_decisionmaker:any;
307
308
309generic_modal_val:any;
310
311//Generid Component Hide and Show
312
313public generic_edited = false;
314
315public generic_edited_drop = false;
316
317//Increment SBC Value
318
319_autoincrement:number = 0;
320
321//Push SBC Exception Array Value
322
323sbc_exception:any[] = [];
324
325//Temporary Array for Product Level Special Bid Code
326
327sbc_temp_pro_array:any[] = [];
328
329//Tag Name Declaration Variable for Generic Editor
330
331tagName:any;
332
333 newItem:any = {
334
335 quotePriceRequest:{
336
337 addExtraSbcBox: [],
338 optionsOfSelectBox2 : [],
339 masterSbcList : [],
340 headerSbcList : [],
341 selectedSbcList : [],
342 selectedHeaderSBC : '',
343 previousLastSbc:'',
344 componentpriceslist:{
345 specialBidCodesList : [],
346 selectBox : [],
347 selectedOptionOfSelectedBox1 : '',
348 genericDropDownSelectArray:[],
349 countAppliedProductsSbc:[]
350
351 }
352
353 }
354 };
355
356
357channelInformationItem:any = {
358channelinfo:{pcs: {sp2bptype:'',sp1customernumber:'',sp1bptypedescription:'',sp1bptype:'',sp1requesterphone:'',sp2companyname:'',sp1contactemail:'',sp2contactemail:'',sp1contactname:'',sp1companyname:'',sp2bptypedescription:'',bptier2bpcompanynameasentryfield:'Y',bptier2option:'Y'},
359 redirectionappname:"PCS",
360 typecode:""
361 },
362
363 isVnsp:"N"
364
365
366 };
367
368
369
370
371Value:any = {};
372
373//Approved Quote Hide and Show Variable
374
375public removeForwardArrow = false;
376
377//Install Address
378
379public install_address_edited = false;
380
381//Install Address Id Count Variable
382
383installAddressCount:number = 0;
384
385//installAddressid:number =0;
386
387//Product Component Id
388
389proComponentId:number;
390
391
392
393
394 constructor(public sanitize: DomSanitizer ,public navCtrl: NavController, public navParams: NavParams,public state: AppStateProvider,private _ngZone: NgZone,public loading: LoadingController,public quoteService: QuoteService,private alertCtrl: AlertController,public state_retrivenonautoidscount: RetrivenonautodiscountProvider,public cdr: ChangeDetectorRef,private sanitizer: DomSanitizer,private nativePageTransitions: NativePageTransitions,private keyboard: Keyboard,public userData: UserData) {
395
396 //this.state.currentQuote.bidjustificationdata.comments = sanitize.bypassSecurityTrustHtml('<div style="font-size: 14pt">'+this.state.currentQuote.bidjustificationdata.comments+'</div>');
397 this.discomment = sanitize.bypassSecurityTrustHtml('<div style="color: red; font-size: 14pt">'+this.state.currentQuote.bidjustificationdata.returnedfromdiscomments+'</div>');
398
399 if(state.currentQuote.pricingdata.rebalance == 'true' || state.currentQuote.pricingdata.rebalance == 'YES'){
400 this.rebalance = true;
401 }else if(state.currentQuote.pricingdata.rebalance == ''){
402 this.rebalance = true;
403 state.currentQuote.pricingdata.rebalance == 'YES';
404 }
405 else {
406 this.rebalance = false;
407 }
408
409 if(this.price_request_header_screen){
410 this.submit_pricing_request_footer = true;
411 }
412
413 //Hide Decision Maker Fields Initial
414
415 this.decision_maker_edited = false;
416
417
418 }
419
420
421 ionViewDidLoad() {
422 console.log('ionViewDidLoad PriceRequestPage');
423
424 let sbc_non_combine: String[] = [] ;
425
426 this.state.currentQuote.installAddress_val = [];
427
428 this.state.currentQuote.htmlflag="false";
429
430this.st_bck_decisionmaker = this.state.currentQuote.decisionmaker;
431
432if ("sbclist" in this.state.currentQuote && typeof this.state.currentQuote.sbclist!== "undefined") {
433
434
435 if(this.state.currentQuote.hasOwnProperty('sbclist'))
436 {
437
438 if(this.state.currentQuote.sbclist[0].hasOwnProperty('componentsbc'))
439 {
440
441 this.user = this.state.currentQuote.sbclist[0].componentsbc;
442
443
444 for (let key of this.user)
445 {
446 for(var i in key)
447 {
448
449
450for(var m = 1; m <= 6;m++)
451{
452
453if('specialbidcode'+m == i)
454{
455
456if(key[i])
457{
458
459this.count++;
460
461this.cart.push(key[i]);
462
463}
464
465else
466{}
467
468}
469else
470{}
471}
472}
473}
474
475
476
477//Removing Duplicate Special codes
478
479
480for (let k = 0; k < this.cart.length; k++) {
481 if (this.seenNames.hasOwnProperty(this.cart[k])) {
482 //already has it
483 this.cart.splice(k, 1);
484 k--;
485
486 } else {
487 this.seenNames[this.cart[k]] = true;
488
489
490 }
491
492
493
494}
495
496
497
498 //Add Quote Onload Data
499
500
501
502
503 this.add_sbcalreadyapplied = this.cart;
504
505
506 for (let key of this.user) {
507 for(let i in key)
508 {
509
510
511 if(i == 'specialbidcodelist'){
512
513
514 this.add_temp = key[i];
515
516
517 for (let j of this.add_temp) {
518
519
520 this.add_cart.push(j);
521
522
523 }
524
525 }
526 else{ }
527
528 }
529}
530
531this.add_tmp_cart = this.add_cart;
532
533for (let i = 0; i < this.add_cart.length; i++) {
534 if (this.add_seenNames.hasOwnProperty(this.add_cart[i].code)) {
535 //already has it
536 this.add_cart.splice(i, 1);
537 i--;
538 } else {
539 this.add_seenNames[this.add_cart[i].code] = true;
540
541 }
542
543
544}
545
546
547for(let k=0 ; k < this.add_cart.length ; k++){
548 for(let z=0 ; z < this.add_sbcalreadyapplied.length; z++){
549 if(this.add_cart[k].code == this.add_sbcalreadyapplied[z]){
550 for(let l=0; l < this.add_cart[k].noncombinablespecialbidcodelist.split(',').length;l++){
551 sbc_non_combine.push(this.add_cart[k].noncombinablespecialbidcodelist.split(',')[l]);
552 }
553 }
554}
555}
556sbc_non_combine = sbc_non_combine.filter((item,index)=>sbc_non_combine.indexOf(item)=== index);
557console.log("sbc_non_combine");
558 for(let p=0; p<sbc_non_combine.length; p++){
559 for(let q=0; q<this.add_cart.length; q++){
560 if(this.add_cart[q] !== undefined || this.add_cart[q] !== null){
561 if(sbc_non_combine[p] === this.add_cart[q].code){
562 this.add_cart.splice(q,1);
563 }
564 }
565 }
566 }
567
568
569
570for(let u = 0; u < this.add_sbcalreadyapplied.length; u++)
571{
572
573for (let v =0; v < this.add_cart.length;v++)
574{
575
576
577
578if(this.add_cart[v].code == this.add_sbcalreadyapplied[u])
579 {
580
581
582 this.selectedSbcList_val.push(this.add_cart[v]);
583 this.add_cart.splice(v, 1);
584 }
585 else
586 {}
587
588}
589
590
591}
592
593
594
595 }
596 else{}
597
598 }
599 else{
600 }
601
602 if(this.add_sbcalreadyapplied != []){
603
604 this.loader = this.loading.create({
605 content: 'Loading...',
606 });
607 this.loader.present();
608
609 for(let m=0; m < this.add_sbcalreadyapplied.length; m++){
610 this.quoteService.sbcapprovalinfo(this.state.currentQuote.ctrycode,this.add_sbcalreadyapplied[m],this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid)
611 .then((data:any)=>{
612 if(data.items[0].selectedsbc[0].sbcapprprefix != ''){
613 this.sbcapprovalinfo_sbclist.push(data.items[0].selectedsbc[0]);
614 }
615 }).then(()=>{
616 for(let k=0 ; k < this.sbcapprovalinfo_sbclist.length; k++){
617 if(this.state.currentQuote.pricingdata.hasOwnProperty('sbcinfo')){
618 for(let l=0 ; l < this.state.currentQuote.pricingdata.sbcinfo.length ;l++){
619 if(this.state.currentQuote.pricingdata.sbcinfo[l].sbc.split('-')[0] == this.sbcapprovalinfo_sbclist[k].code){
620 this.sbcinfo.push({sbc : this.sbcapprovalinfo_sbclist[k].code+"-"+this.sbcapprovalinfo_sbclist[k].description, sbcapprnumber : this.state.currentQuote.pricingdata.sbcinfo[l].sbcapprnumber ,approvalnb: this.state.currentQuote.pricingdata.sbcinfo[l].sbcapprnumber ,...this.sbcapprovalinfo_sbclist[k]});
621 }
622 else{
623 this.sbcinfo.push({sbc : this.sbcapprovalinfo_sbclist[k].code+"-"+this.sbcapprovalinfo_sbclist[k].description, sbcapprnumber : '',...this.sbcapprovalinfo_sbclist[k]});
624 }
625 }
626 }
627 else{
628 this.sbcinfo.push({sbc : this.sbcapprovalinfo_sbclist[k].code+"-"+this.sbcapprovalinfo_sbclist[k].description, sbcapprnumber : '',...this.sbcapprovalinfo_sbclist[k]});
629 }
630 }
631 }).then(()=>{
632 // let temp_sbcinfo = this.sbcinfo;
633 // this.sbcinfo = [];
634 for(let i=0; i<this.sbcinfo.length; i++){
635 if(this.sbcinfo[i].sbcapprnumber != ""){
636 this.sbcinfo[i].approvalnb = this.sbcinfo[i].sbcapprnumber;
637 }
638 }
639 for(let k=0; k<this.sbcinfo.length; k++){
640 for(let l=k+1; l<this.sbcinfo.length; l++) {
641 if(this.sbcinfo[k].code == this.sbcinfo[l].code){
642 if(this.sbcinfo[k].sbcapprnumber == "" && this.sbcinfo[l].sbcapprnumber !== ""){
643 this.sbcinfo.splice(k,1);
644 }
645 }
646 }
647 }
648 this.sbcinfo = this.sbcinfo.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>this.sbcinfo[item]);
649 console.log(this.sbcinfo);
650
651 console.log(this.sbcinfo);
652 if(this.state.currentQuote.hasOwnProperty('sbcinfo')){
653 this.state.currentQuote.sbcinfo = this.sbcinfo.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>this.state.currentQuote.sbcinfo[item]);
654 this.sbcinfo = this.state.currentQuote.sbcinfo;
655 }
656 else{
657 this.state.currentQuote.sbcinfo = this.sbcinfo;
658 }
659 })
660 }
661 this.loader.dismiss();
662 }
663
664}
665//Approve Quote
666
667if(this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_SUBMITTED_TO_DISTRIBUTOR && this.state.currentQuote.issp2 != 'false'){
668 this.submit_pricing_request_footer = true;
669 this.removeForwardArrow = true;
670 }
671
672 if(this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_IBM_APPROVED || this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_VALUE_SELLER_APPROVED || this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_IBM_WITHDRAWN
673 || this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_REQUEST_PRICING || this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_ON_HOLD || this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_RETURNED_FROM_DISTRIBUTOR || this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_VALUE_SELLER_APPROVED || this.state.currentQuote.headerinfo.geocode != 'NA'){
674
675this.removeForwardArrow = true;
676
677this.submit_pricing_request_footer = false;
678
679if(this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_RETURNED_FROM_DISTRIBUTOR && this.state.currentQuote.issp2 != 'false'){
680 this.submit_pricing_request_footer = true;
681 this.removeForwardArrow = false;
682}
683
684 }
685 else{
686
687 this.submit_pricing_request_footer = true;
688
689 }
690
691
692
693//End
694
695
696
697 //Add Max Non Auto Discount
698
699 if(this.state.currentQuote.hasOwnProperty('pricingdata'))
700 {
701
702 if(this.state.currentQuote.pricingdata.hasOwnProperty('compinfo'))
703 {
704
705 for (let km = 0; km < this.state.currentQuote.pricingdata.compinfo.length; km++) {
706
707 this.max_update_val[km] = this.state.currentQuote.pricingdata.compinfo[km].maxnonaudeudiscount;
708
709 }
710 }
711 else{}
712
713
714
715 }
716 else{}
717
718
719
720 //End
721
722
723//Intialiaze to Null
724
725this.newItem.quotePriceRequest.selectedSbcList = [];
726
727this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList = [];
728
729
730
731
732//Product Level Sbc Code Functionality
733
734this.sbcDataToSpecialBidCodesList();
735
736//Decisionmaker Edit Page Onload Data
737
738 this.title = 'Submit Price Request';
739
740
741this.decisionmakername = this.state.currentQuote.decisionmaker.decisionmakername;
742
743this.decisionmakertitle = this.state.currentQuote.decisionmaker.decisionmakertitle;
744
745this.decisionmakeremail = this.state.currentQuote.decisionmaker.decisionmakeremail;
746
747this.custprojectname = this.state.currentQuote.decisionmaker.custprojectname;
748
749
750//End Decisionmaker Edit Page Onload Data
751
752
753
754//Channel Contact Edit Page OnLoad Data
755
756this.sp1bpcontactemail = this.state.currentQuote.channelinfo1.channelrepemailad;
757this.sp1bptypedescription = this.state.currentQuote.channelinfo1.ibmprodspecialist;
758this.sp1bpcontactname = this.state.currentQuote.channelinfo1.channelrepname;
759this.sp1requesterphone = this.state.currentQuote.channelinfo1.channelrepphone;
760
761//End Channel Contact Edit Page Onload Data
762
763
764//Start Pricing Information Onload Data
765
766this.todo_justification = this.htmlToPlaintext(this.state.currentQuote.bidjustificationdata.comments);
767this.todo_justification.replace(/ /g," ");
768
769//End Pricing Information Onload Data
770
771if(this.state.currentQuote.statuscode == this.state.BPQUOTESTATUS_INCOMPLETE){
772
773this.installAddressCount = 2;
774
775//this.installAddressid = 0;
776
777if(this.state.currentQuote.installaddress){
778
779 for (let kt = 0; kt < this.state.currentQuote.installaddress.length; kt++) {
780
781this.state.currentQuote.installAddress_val.push({'address1':this.state.currentQuote.installaddress[kt].streetaddress1,'address2':this.state.currentQuote.installaddress[kt].streetaddress2,'city':this.state.currentQuote.installaddress[kt].city,'state':this.state.currentQuote.installaddress[kt].regionid,"addressid":String(kt)});
782
783//this.installAddress_val.push({'address1':this.state.currentQuote.installaddress[kt].streetaddress1,'address2':this.state.currentQuote.installaddress[kt].streetaddress2,'city':this.state.currentQuote.installaddress[kt].city,'state':this.state.currentQuote.installaddress[kt].regionid,"addressid":String(this.installAddressid)});
784
785this.installAddressCount++;
786
787//this.installAddressid++;
788
789 }
790
791
792}
793else{}
794
795
796
797}
798
799 }
800
801
802 //Back Click event Call
803
804 st_bck()
805{
806
807if(this.decision_maker_edited || this.tagName == 'decisionMaker')
808{
809
810this._ngZone.run(() => {
811
812if(this.generic_modal_val)
813{
814
815
816 if(Object.keys(this.state.currentQuote.decisionmaker).length < 4){
817 //Only for these condition this.state.currentQuote.decisionmaker==={"custprojectname":" "} if decisionmaker has empty model value
818
819 //Check value if not present in model
820
821if(this.checkDecisionModelVal(this.generic_val[0].input_model_val) == -1)
822 {
823
824
825this.state.currentQuote.decisionmaker[this.generic_val[0].input_model_val] = this.generic_modal_val;
826
827 }
828 else{}
829
830 }
831
832 else{
833
834 let keyArr: any[] = Object.keys(this.state.currentQuote.decisionmaker);
835 keyArr.forEach((key: any) => {
836
837 if(key === this.generic_val[0].input_model_val)
838 {
839
840 this.state.currentQuote.decisionmaker[key] = this.generic_modal_val;
841
842 }
843
844 else {}
845
846
847 });
848
849 }
850
851
852
853}
854else{}
855
856});
857
858
859if(this.tagName == 'decisionMaker' && !this.decision_maker_edited)
860{
861
862this.tagName = '';
863
864this.decision_maker_edited = true;
865
866//Update all Values
867
868this.decisionmakername = this.state.currentQuote.decisionmaker.decisionmakername;
869
870this.decisionmakertitle = this.state.currentQuote.decisionmaker.decisionmakertitle;
871
872this.decisionmakeremail = this.state.currentQuote.decisionmaker.decisionmakeremail;
873
874this.custprojectname = this.state.currentQuote.decisionmaker.custprojectname;
875
876
877
878}
879
880else
881{
882
883this.isChanged = false;
884
885this.decision_maker_edited = false;
886
887this.channel_contact_edited = false;
888
889this.price_request_header_screen = true;
890
891if(this.removeForwardArrow){
892this.submit_pricing_request_footer = false;
893}
894else{
895this.submit_pricing_request_footer = true;
896}
897
898}
899
900
901this.generic_edited = false;
902
903this.generic_edited_drop = false;
904
905this.pricing_special_bid_edited = false;
906
907
908
909this.pricing_information_comment_edited = false;
910
911}
912else if(this.channel_contact_edited || this.tagName == 'channelContact')
913{
914
915
916this._ngZone.run(() => {
917
918if(this.generic_modal_val){
919
920let keyArr: any[] = Object.keys(this.state.currentQuote.channelinfo1);
921 keyArr.forEach((key: any) => {
922
923
924 if(key === this.generic_val[0].input_model_val)
925 {
926
927 this.state.currentQuote.channelinfo1[key] = this.generic_modal_val;
928
929
930 }
931});
932
933
934}else{}
935
936
937});
938
939
940if(this.tagName == 'channelContact' && !this.channel_contact_edited)
941{
942
943this.tagName = '';
944this.channel_contact_edited = true;
945
946this.sp1bpcontactemail = this.state.currentQuote.channelinfo1.channelrepemailad;
947this.sp1bptypedescription = this.state.currentQuote.channelinfo1.ibmprodspecialist;
948this.sp1bpcontactname = this.state.currentQuote.channelinfo1.channelrepname;
949this.sp1requesterphone = this.state.currentQuote.channelinfo1.channelrepphone;
950
951
952}
953else{
954
955this.decision_maker_edited = false;
956
957this.channel_contact_edited = false;
958
959this.price_request_header_screen = true;
960
961this.isChanged = false;
962
963if(this.removeForwardArrow){
964this.submit_pricing_request_footer = false;
965}
966else{
967this.submit_pricing_request_footer = true;
968}
969
970}
971
972this.generic_edited = false;
973
974this.generic_edited_drop = false;
975
976//Hide Special Bid Component module for ionic
977
978this.pricing_special_bid_edited = false;
979
980this.submit_pricing_productlevelspecialcode = false;
981
982this.pricing_information_comment_edited = false;
983
984
985
986}
987
988else if(this.pricing_information_comment_edited)
989{
990
991//this.state.currentQuote.bidjustificationdata.comments = this.todo_justification;
992
993
994this.decision_maker_edited = false;
995
996this.channel_contact_edited = false;
997
998this.price_request_header_screen = true;
999
1000this.pricing_information_comment_edited = false;
1001
1002this.pricing_special_bid_edited = false;
1003
1004if(this.removeForwardArrow){
1005this.submit_pricing_request_footer = false;
1006}
1007else{
1008this.submit_pricing_request_footer = true;
1009}
1010
1011this.submit_pricing_productlevelspecialcode = false;
1012
1013this.generic_edited = false;
1014
1015this.generic_edited_drop = false;
1016
1017}
1018
1019else if(this.tagName == 'quickDiscountApply'){
1020
1021this.pricing_special_bid_edited = false;
1022
1023this.decision_maker_edited = false;
1024
1025this.channel_contact_edited = false;
1026
1027this.price_request_header_screen = true;
1028
1029this.pricing_information_comment_edited = false;
1030
1031if(this.removeForwardArrow){
1032this.submit_pricing_request_footer = false;
1033}
1034else{
1035this.submit_pricing_request_footer = true;
1036}
1037
1038this.submit_pricing_productlevelspecialcode = false;
1039
1040this.price_request_done_button = false;
1041
1042this.generic_edited = false;
1043
1044this.generic_edited_drop = false;
1045
1046this.pricing_information_comment_edited = false;
1047
1048this.tagName = '';
1049
1050this.discount_apply_edited = false;
1051
1052this.cdr.detectChanges();
1053
1054}
1055
1056else if(this.pricing_special_bid_edited)
1057{
1058
1059this.pricing_special_bid_edited = false;
1060
1061this.decision_maker_edited = false;
1062
1063this.channel_contact_edited = false;
1064
1065this.price_request_header_screen = true;
1066
1067this.pricing_information_comment_edited = false;
1068
1069if(this.removeForwardArrow){
1070this.submit_pricing_request_footer = false;
1071}
1072else{
1073this.submit_pricing_request_footer = true;
1074}
1075
1076this.submit_pricing_productlevelspecialcode = false;
1077
1078this.price_request_done_button = false;
1079
1080this.generic_edited = false;
1081
1082this.generic_edited_drop = false;
1083
1084this.pricing_information_comment_edited = false;
1085
1086this.cdr.detectChanges();
1087
1088}
1089
1090
1091else if(this.submitpricingeditquotelevelspecialcode || this.submit_pricing_addquotelevelspecialcode){
1092
1093this.submitpricingeditquotelevelspecialcode = false;
1094
1095this.submit_pricing_addquotelevelspecialcode = false;
1096
1097this.decision_maker_edited = false;
1098
1099this.channel_contact_edited = false;
1100
1101this.price_request_header_screen = false;
1102
1103this.pricing_information_comment_edited = false;
1104
1105if(this.removeForwardArrow){
1106this.submit_pricing_request_footer = false;
1107}
1108else{
1109this.submit_pricing_request_footer = true;
1110}
1111
1112this.isChanged = false;
1113
1114this.pricing_special_bid_edited = false;
1115
1116this.price_request_header_screen = true;
1117
1118this.submit_pricing_productlevelspecialcode = false;
1119//shivam
1120//Hide Done Button
1121
1122this.price_request_done_button = false;
1123
1124//Check
1125
1126this.add_specialbid_head_item = false;
1127
1128this.add_specialbid_sub_item = false;
1129
1130this.generic_edited = false;
1131
1132this.generic_edited_drop = false;
1133
1134this.pricing_information_comment_edited = false;
1135
1136this.cdr.detectChanges();
1137}
1138
1139else if(this.install_address_edited)
1140{
1141
1142this.install_address_edited = false;
1143
1144this.price_request_header_screen = true;
1145
1146this.isChanged = false;
1147
1148
1149}
1150
1151else if(this.generic_edited_drop){
1152
1153this.submitpricingeditquotelevelspecialcode = false;
1154
1155this.submit_pricing_addquotelevelspecialcode = false;
1156
1157this.decision_maker_edited = false;
1158
1159this.channel_contact_edited = false;
1160
1161this.price_request_header_screen = false;
1162
1163this.pricing_information_comment_edited = false;
1164
1165if(this.removeForwardArrow){
1166this.submit_pricing_request_footer = false;
1167}
1168else{
1169this.submit_pricing_request_footer = true;
1170}
1171
1172this.isChanged = false;
1173
1174this.pricing_special_bid_edited = false;
1175
1176this.submit_pricing_productlevelspecialcode = true;
1177
1178//Hide Done Button
1179
1180this.price_request_done_button = false;
1181
1182//Check
1183
1184this.add_specialbid_head_item = false;
1185
1186this.add_specialbid_sub_item = false;
1187
1188this.generic_edited = false;
1189
1190this.generic_edited_drop = false;
1191
1192this.pricing_information_comment_edited = false;
1193
1194this.cdr.detectChanges();
1195
1196}
1197
1198else if(this.submit_pricing_productlevelspecialcode || this.tagName == 'submitPricingSubProductLevelSpecialCode'){
1199
1200
1201
1202if(!this.submit_pricing_productlevelspecialcode && this.tagName == 'submitPricingSubProductLevelSpecialCode')
1203{
1204
1205this.tagName = '';
1206
1207if(this.generic_modal_val){
1208
1209if(this.generic_val[0].input_model_val == 'extended_end_user_price'){
1210
1211// End User Discount Calculation Formula
1212
1213//((extented list price - entended end user price)/extented list price)*100
1214
1215this.end_user_discount = (((this.pro_usersJson.listprice - this.generic_modal_val)/this.pro_usersJson.listprice)*100).toFixed(2);
1216
1217this.extended_end_user_price = this.generic_modal_val;
1218
1219this.state.currentQuote.pricingdata.compinfo[this.pro_index].enduserdiscount = this.end_user_discount;
1220
1221this.pro_usersJson.enduserdiscount = this.end_user_discount;
1222
1223
1224}
1225else{
1226
1227//Extended End Price Calculation Formula
1228
1229//extented list price( 1 - end user discount/100) = entended end user price
1230
1231this.end_user_discount = this.generic_modal_val;
1232
1233this.extended_end_user_price = (this.pro_usersJson.listprice * ( 1 - this.generic_modal_val/100)).toFixed(2);
1234
1235this.state.currentQuote.pricingdata.compinfo[this.pro_index].enduserprice = this.extended_end_user_price;
1236
1237this.pro_usersJson.enduserdiscount = this.generic_modal_val;
1238
1239}
1240
1241}
1242else{}
1243
1244this.submit_pricing_productlevelspecialcode = true;
1245this.pricing_special_bid_edited = false;
1246}
1247else
1248{
1249this.submit_pricing_productlevelspecialcode = false;
1250this.pricing_special_bid_edited = false;
1251this.price_request_header_screen = true;
1252this.cdr.detectChanges();
1253//shivam
1254}
1255
1256this.submitpricingeditquotelevelspecialcode = false;
1257
1258this.submit_pricing_addquotelevelspecialcode = false;
1259
1260
1261this.decision_maker_edited = false;
1262
1263this.channel_contact_edited = false;
1264
1265// this.price_request_header_screen = false;
1266
1267this.pricing_information_comment_edited = false;
1268
1269if(this.removeForwardArrow){
1270this.submit_pricing_request_footer = false;
1271}
1272else{
1273this.submit_pricing_request_footer = true;
1274}
1275
1276this.isChanged = false;
1277
1278this.generic_edited = false;
1279
1280this.generic_edited_drop = false;
1281
1282this.pricing_information_comment_edited = false;
1283
1284}
1285else{
1286
1287this.isChanged = false;
1288
1289if(this.removeForwardArrow){
1290this.submit_pricing_request_footer = false;
1291}
1292else{
1293this.submit_pricing_request_footer = true;
1294}
1295
1296this.pricing_information_comment_edited = false;
1297
1298this.submitpricingeditquotelevelspecialcode = false;
1299
1300this.submit_pricing_addquotelevelspecialcode = false;
1301
1302this.generic_edited = false;
1303
1304this.generic_edited_drop = false;
1305
1306this.cdr.detectChanges();
1307
1308this.slideOptions();
1309
1310this.navCtrl.push(DetailPage);
1311
1312//this.navCtrl.pop();
1313
1314}
1315
1316}
1317
1318
1319//Slide option
1320
1321slideOptions(){
1322
1323let options: NativeTransitionOptions = {
1324 direction: 'right',
1325 duration: 400,
1326 iosdelay: 50,
1327 androiddelay: 50
1328 };
1329
1330this.nativePageTransitions.slide(options);
1331
1332
1333
1334}
1335
1336editContacts(){
1337 console.log("Price Request: Contacts");
1338
1339
1340 this.price_request_header_screen = false;
1341
1342 this.submit_pricing_request_footer = true;
1343
1344 this.decision_maker_edited = true;
1345
1346 this.channel_contact_edited = true;
1347
1348 this.decisionmakername = this.state.currentQuote.decisionmaker.decisionmakername;
1349
1350 this.decisionmakertitle = this.state.currentQuote.decisionmaker.decisionmakertitle;
1351
1352 this.decisionmakeremail = this.state.currentQuote.decisionmaker.decisionmakeremail;
1353
1354 this.custprojectname = this.state.currentQuote.decisionmaker.custprojectname;
1355
1356 this.sp1bpcontactemail = this.state.currentQuote.channelinfo1.channelrepemailad;
1357 this.sp1bptypedescription = this.state.currentQuote.channelinfo1.ibmprodspecialist;
1358 this.sp1bpcontactname = this.state.currentQuote.channelinfo1.channelrepname;
1359 this.sp1requesterphone = this.state.currentQuote.channelinfo1.channelrepphone;
1360
1361 this.isChanged = true;
1362
1363}
1364 editDecisionMaker()
1365 {
1366 console.log("Price Request: editDecisionMaker");
1367
1368
1369 this.price_request_header_screen = false;
1370
1371 this.submit_pricing_request_footer = false;
1372
1373 this.decision_maker_edited = true;
1374
1375 this.channel_contact_edited = false;
1376
1377 this.decisionmakername = this.state.currentQuote.decisionmaker.decisionmakername;
1378
1379 this.decisionmakertitle = this.state.currentQuote.decisionmaker.decisionmakertitle;
1380
1381 this.decisionmakeremail = this.state.currentQuote.decisionmaker.decisionmakeremail;
1382
1383 this.custprojectname = this.state.currentQuote.decisionmaker.custprojectname;
1384
1385 this.isChanged = true;
1386
1387
1388 }
1389
1390 // --------------------------------------------------------------------------
1391 editIBMChannelContact(){
1392 console.log("Price Request: editIBMChannelContact");
1393
1394 // this.navCtrl.setRoot(PriceRequestChannelcontactPage);
1395
1396this.price_request_header_screen = false;
1397
1398this.submit_pricing_request_footer = false;
1399
1400 this.channel_contact_edited = true;
1401
1402 this.decision_maker_edited = false;
1403
1404 //Channel Contact Edit Page OnLoad Data
1405this.sp1bpcontactemail = this.state.currentQuote.channelinfo1.channelrepemailad;
1406this.sp1bptypedescription = this.state.currentQuote.channelinfo1.ibmprodspecialist;
1407this.sp1bpcontactname = this.state.currentQuote.channelinfo1.channelrepname;
1408this.sp1requesterphone = this.state.currentQuote.channelinfo1.channelrepphone;
1409
1410 this.isChanged = true;
1411
1412 }
1413
1414 // --------------------------------------------------------------------------
1415 editSpecialBidCode(){
1416 console.log("Price Request: editSpecialBidCode");
1417 //TODO: popover text editor?
1418
1419if(this.state.currentQuote.hasOwnProperty('sbclist'))
1420{
1421this.sbcalreadyapplied = this.cart;
1422
1423}
1424else
1425{
1426
1427}
1428
1429
1430this.pricing_special_bid_edited = true;
1431
1432this.price_request_header_screen = false;
1433
1434 this.channel_contact_edited = false;
1435
1436 this.decision_maker_edited = false;
1437
1438 this.isChanged = false;
1439
1440 if(this.removeForwardArrow){
1441
1442 this.submit_pricing_request_footer = false;
1443
1444 }
1445 else{
1446
1447this.submit_pricing_request_footer = true;
1448
1449 }
1450
1451 this.cdr.detectChanges();
1452
1453 }
1454
1455 // --------------------------------------------------------------------------
1456 editRequestedPrice(){
1457 console.log("Price Request: editRequestedPrice");
1458 //TODO: popover text editor?
1459 }
1460
1461 // --------------------------------------------------------------------------
1462 editBidJustfication(){
1463 console.log("Price Request: editBidJustfication");
1464 //this.navCtrl.setRoot(PriceRequestBidjustificationPage);
1465
1466 this.decision_maker_edited = false;
1467
1468 this.channel_contact_edited = false;
1469
1470 this.price_request_header_screen = false;
1471
1472 this.pricing_information_comment_edited = true;
1473
1474 if(this.removeForwardArrow){
1475 this.submit_pricing_request_footer = false;
1476 }
1477 else{
1478 this.submit_pricing_request_footer = true;
1479 }
1480
1481 this.isChanged = false;
1482
1483 //this.keyboard.disableScroll(true);
1484
1485 this.keyboard.show();
1486
1487 }
1488
1489 // --------------------------------------------------------------------------
1490 changeRebalance(){
1491
1492 if(this.rebalance == true){
1493 this.state.currentQuote.pricingdata.rebalance = 'true';
1494 }
1495 else{
1496
1497 this.rebalance = false;
1498
1499 this.state.currentQuote.pricingdata.rebalance = 'false';
1500
1501 }
1502
1503 }
1504
1505
1506
1507 //Function Called for Generic Input Text Box
1508 showGenericEditor(label:string,input_model:any,$event:any,tagname:any){
1509
1510 //Clear tag Value
1511this.tagName = '';
1512
1513//Set tag Value
1514this.tagName = tagname;
1515
1516 if(this.removeForwardArrow){
1517
1518 //Disable ion-input
1519
1520 }
1521 else{
1522
1523this.generic_val = [];
1524
1525this.generic_modal_val = '';
1526
1527this.generic_edited = true;
1528
1529this.generic_edited_drop = false;
1530
1531
1532 if(this.decision_maker_edited){
1533
1534 //Main Input Hide and Show
1535
1536 this.decision_maker_edited = false;
1537
1538this.generic_val.push({'label':label,'input_model_val':input_model,'input_val':$event,'input_type':'text'});
1539
1540 }
1541
1542 else if(this.submit_pricing_productlevelspecialcode){
1543
1544 this.isChanged = true;
1545
1546this.submit_pricing_productlevelspecialcode = false;
1547 this.generic_val.push({'label':label,'input_model_val':input_model,'input_val':$event,'input_type':'number'
1548});
1549
1550 }
1551
1552 else if(this.pricing_special_bid_edited){
1553
1554 this.isChanged = true;
1555
1556this.pricing_special_bid_edited = false;
1557
1558this.price_request_done_button = true;
1559
1560this.generic_val.push({'label':label,'input_model_val':input_model,'input_val':$event,'input_type':'number'
1561});
1562
1563
1564 }
1565 else if(this.price_request_header_screen){
1566
1567 this.isChanged = true;
1568
1569 this.price_request_header_screen = false;
1570
1571 this.price_request_done_button = true;
1572
1573 this.discount_apply_edited = true;
1574
1575 this.generic_val.push({'label':label,'input_model_val':input_model,'input_val':$event,'input_type':'number'});
1576 }
1577
1578 else
1579 {
1580
1581//Main Input Channel Maker Hide and Show
1582
1583this.channel_contact_edited = false;
1584this.generic_val.push({'label':label,'input_model_val':input_model,'input_val':$event,'input_type':'text'
1585
1586});
1587
1588 }
1589
1590 }
1591
1592 }
1593 //End Function Calling Generic
1594
1595
1596 inputChanges(label:string,input_model:any,$event:any,tagname:any){
1597
1598 let input_val : any = '';
1599
1600 input_val = $event;
1601
1602 //Clear tag Value
1603 this.tagName = '';
1604
1605//Set tag Value
1606 this.tagName = tagname;
1607
1608 if(this.tagName == 'submitPricingSubProductLevelSpecialCode')
1609 {
1610
1611 if(input_model == 'extended_end_user_price'){
1612
1613 // End User Discount Calculation Formula
1614
1615 //((extented list price - entended end user price)/extented list price)*100
1616
1617 this.end_user_discount = (((this.pro_usersJson.listprice - input_val)/this.pro_usersJson.listprice)*100).toFixed(2);
1618
1619 this.extended_end_user_price = input_val;
1620
1621 this.state.currentQuote.pricingdata.compinfo[this.pro_index].enduserdiscount = this.end_user_discount;
1622
1623 this.state.currentQuote.pricingdata.compinfo[this.pro_index].enduserprice = this.extended_end_user_price;
1624
1625 this.pro_usersJson.enduserdiscount = this.end_user_discount;
1626
1627 }
1628 else{
1629
1630 //Extended End Price Calculation Formula
1631
1632 //extented list price( 1 - end user discount/100) = entended end user price
1633
1634 this.end_user_discount = input_val;
1635
1636 this.extended_end_user_price = (this.pro_usersJson.listprice * ( 1 - input_val/100)).toFixed(2);
1637
1638 this.state.currentQuote.pricingdata.compinfo[this.pro_index].enduserprice = this.extended_end_user_price;
1639
1640 this.state.currentQuote.pricingdata.compinfo[this.pro_index].enduserdiscount = input_val;
1641
1642 this.pro_usersJson.enduserdiscount = input_val;
1643
1644 }
1645
1646 }
1647
1648 }
1649
1650
1651//End Function Channel Contact Edit Page
1652
1653
1654//Function Calling Special Bid Code Page
1655
1656
1657approvalnbChange(sbccode,approvalnb){
1658 this.state.currentQuote.add_bks = [];
1659 for(let i=0; i< this.sbcinfo.length; i++){
1660 if(this.sbcinfo[i].sbc == sbccode){
1661 this.sbcinfo[i].approvalnb = approvalnb;
1662 }
1663 this.state.currentQuote.sbcinfo = this.sbcinfo;
1664 this.add_bks.push(...this.sbcinfo);
1665 this.add_bks = this.add_bks.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>this.add_bks[item]);
1666 this.state.currentQuote.add_bks = this.add_bks;
1667 }
1668
1669 console.log(approvalnb);
1670}
1671
1672// approvalnb_Done(){
1673// this.add_bks.push(...this.sbcinfo);
1674// this.add_bks = this.add_bks.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>this.add_bks[item]);
1675// this.state.currentQuote.add_bks = this.add_bks;
1676// // let alert = this.alertCtrl.create({
1677// // title: 'Submit Price Request',
1678// // subTitle: 'Approval Number Added',
1679// // buttons: ['Ok']
1680// // });
1681// this.state.currentQuote.add_bks.forEach((element)=>{
1682// if(element.sbcapprprefix !== null && element.sbcapprprefix !== ""){
1683// if(element.sbcapprnumber === null && element.sbcapprnumber === ""){
1684// // let alert = this.alertCtrl.create({
1685// // title: 'Submit Price Request',
1686// // subTitle: 'Missing Approval Number, please provide a valid approval number',
1687// // buttons: ['Ok']
1688// // });
1689// // alert.present();
1690// //'Missing Approval Number, please provide a valid approval number'
1691// this.state.validateMessageSbcCheck = 'Missing Approval Number, please provide a valid approval number'
1692// return true;
1693// }
1694// else if(element.sbcapprnumber.startsWith(element.sbcapprprefix)){
1695// console.log("approval number is correct")
1696// }
1697// else{
1698// // let alert = this.alertCtrl.create({
1699// // title: 'Submit Price Request',
1700// // subTitle: 'Invalid Approval Number, please provide a valid approval number',
1701// // buttons: ['Ok']
1702// // });
1703// // alert.present();
1704// //'Invalid Approval Number, please provide a valid approval number'
1705// this.state.validateMessageSbcCheck = 'Invalid Approval Number, please provide a valid approval number'
1706// return true;
1707// }
1708// }
1709// });
1710// this.loader = this.loading.create({
1711// content: 'Loading...',
1712// });
1713// this.loader.present();
1714
1715// this.quoteService.ValidateandSaveHeaderInfo(this.state.currentQuote.ctrycode,this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid,this.add_bks)
1716// .then((data: any) => {
1717// this._ngZone.run(() => {
1718// this.quoteService.load(this.state.currentQuote.quoteid)
1719// .then((data: any) => {
1720
1721// this.state.currentQuote = data;
1722
1723// // for (let i = 0; i < this.add_cart.length; i++) {
1724// // if(this.add_tre){
1725
1726// // if (this.add_tre.selectedsbc[0].code == this.add_cart[i].code) {
1727// // //already has it
1728// // this.add_cart.splice(i, 1);
1729
1730// // } else {}
1731
1732
1733// // }
1734// // }
1735// this.loader.dismiss();
1736// return false;
1737// // alert.present();
1738// });
1739// //remove the spinner
1740
1741
1742// });
1743// });
1744// }
1745
1746approvalnb_Done(){
1747 this.add_bks.push(...this.sbcinfo);
1748 this.add_bks = this.add_bks.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>this.add_bks[item]);
1749 this.state.currentQuote.add_bks = this.add_bks;
1750 let alert = this.alertCtrl.create({
1751 title: 'Submit Price Request',
1752 subTitle: 'Approval Number Added',
1753 buttons: ['Ok']
1754 });
1755 this.loader = this.loading.create({
1756 content: 'Loading...',
1757 });
1758 this.loader.present();
1759
1760 this.quoteService.ValidateandSaveHeaderInfo(this.state.currentQuote.ctrycode,this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid,this.add_bks)
1761 .then((data: any) => {
1762 this._ngZone.run(() => {
1763 this.quoteService.load(this.state.currentQuote.quoteid)
1764 .then((data: any) => {
1765
1766 this.state.currentQuote = data;
1767
1768 for (let i = 0; i < this.add_cart.length; i++) {
1769 if(this.add_tre){
1770
1771 if (this.add_tre.selectedsbc[0].code == this.add_cart[i].code) {
1772 //already has it
1773 this.add_cart.splice(i, 1);
1774
1775 } else {}
1776
1777
1778 }
1779 }
1780 this.loader.dismiss();
1781 alert.present();
1782 });
1783 //remove the spinner
1784
1785
1786 });
1787});
1788}
1789
1790pricing_comments(event){
1791 this.state.currentQuote.bidjustificationdata.comments = event.target.innerHTML;
1792 // event.preventDefault();
1793 event.stopPropagation();
1794 // this.state.currentQuote.htmlflag="false";
1795 // event.preventDefault();
1796}
1797
1798unApplySbcCodes()
1799 {
1800 let alert = this.alertCtrl.create({
1801 title: 'Submit Price Request',
1802 message: 'Do you want to unapply all Special Codes',
1803 buttons: [
1804 {
1805 text: 'Dismiss',
1806 role: 'cancel',
1807 handler: () => {
1808 console.log('Dismiss clicked');
1809 }
1810 },
1811 {
1812 text: 'Ok',
1813 handler: () => {
1814
1815 this.loader = this.loading.create({
1816 content: 'Loading...',
1817 });
1818 this.loader.present();
1819 this.quoteService.deleteSbcApprovalInfo(this.state.currentQuote.quoteid)
1820 .then((data: any) => {
1821
1822 this.tmp = data;
1823
1824 if(this.tmp.status == "1"){
1825
1826 this.quoteService.load(this.state.currentQuote.quoteid)
1827 .then((data: any) => {
1828
1829 this.compsbclist = [];
1830
1831 //Clear All Sbc Level to Null
1832
1833 for (let k = 0; k < this.state.currentQuote.sbclist[0].componentsbc.length; k++) {
1834
1835this.compsbclist.push({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
1836
1837
1838 }
1839
1840 this.quoteService.applyAndSaveHeaderSBC(this.state.currentQuote.quoteid,'false',this.compsbclist)
1841 .then((data: any) => {
1842 if(data.status == "1"){
1843 this.quoteService.load(this.state.currentQuote.quoteid)
1844 .then((data: any) => {
1845 this.cart = [];
1846 this.pro_cart = [];
1847 this.newItem.quotePriceRequest.selectedSbcList = [];
1848 this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList = [];
1849 //Already Applied Selected SBC
1850 this.newItem.quotePriceRequest.componentpriceslist.selectBox = [];
1851 this.state.currentQuote = {};
1852 this.state.currentQuote = data;
1853 //Load Quote Level SBC
1854 // for (let j of this.add_tmp_cart) {
1855 // this.add_cart.push(j);
1856 // }
1857 this.add_tmp_cart.forEach(element=>{
1858 return this.add_cart.push(element);
1859 })
1860
1861 this.selectedSbcList_val.forEach((element)=>{
1862 return this.add_cart.splice(0,0,element);
1863 })
1864 let clone_cart = this.add_cart;
1865 this.add_cart = [];
1866 this.add_cart = clone_cart.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>clone_cart[item]);
1867 this.add_sbcalreadyapplied = [];
1868 this.selSBC = null;
1869 this.sbcinfo = [];
1870 this.cdr.detectChanges();
1871 this.loader.dismiss();
1872 // this.cdr.detectChanges();
1873 //this.selsbc.setValue('');
1874
1875 });
1876 }
1877 })
1878 .catch((error:any)=>{
1879 this.loader.dismiss();
1880 });
1881 });
1882 }
1883 else
1884 {
1885
1886 let alert_pop = this.alertCtrl.create({
1887 title: 'Submit Price Request',
1888 subTitle: 'Error Occured When Unapply a Special Codes',
1889 buttons: ['Ok']
1890 });
1891 alert_pop.present();
1892
1893 this.loader.dismiss();
1894 this.cdr.detectChanges();
1895
1896 }
1897
1898 });
1899
1900
1901 }
1902 }
1903 ]
1904 });
1905 alert.present();
1906 this.cdr.detectChanges();
1907
1908 }
1909
1910
1911 edtproductquotesbc(val,index)
1912 {
1913
1914 this.newItem.quotePriceRequest.selectedSbcList = [];
1915
1916this.pro_usersJson = {};
1917
1918this.pro_usersJson = val;
1919
1920this.pro_index = index;
1921
1922this.proComponentId = val.id;
1923
1924this.product_title = val.identifier;
1925
1926
1927this.extended_end_user_price = this.pro_usersJson.enduserprice;
1928
1929this.end_user_discount = this.pro_usersJson.enduserdiscount;
1930
1931
1932//Hide and Show
1933
1934this.submitpricingeditquotelevelspecialcode = false;
1935
1936this.submit_pricing_addquotelevelspecialcode = false;
1937
1938this.submit_pricing_productlevelspecialcode = true;
1939
1940this.decision_maker_edited = false;
1941
1942this.channel_contact_edited = false;
1943
1944this.price_request_header_screen = false;
1945
1946this.pricing_information_comment_edited = false;
1947
1948if(this.removeForwardArrow){
1949this.submit_pricing_request_footer = false;
1950this.isChanged = false;
1951}
1952else{
1953this.submit_pricing_request_footer = true;
1954this.isChanged = true;
1955}
1956
1957
1958this.pricing_special_bid_edited = false;
1959
1960
1961//Already Applied Selected SBC
1962
1963 this.newItem.quotePriceRequest.componentpriceslist.selectBox = [];
1964
1965this.sbcToSpecialBidCodesList();
1966
1967//End
1968
1969
1970
1971
1972 }
1973
1974
1975 add_quote_sbc()
1976 {
1977
1978//Hide and Show of Add Special Code Component
1979
1980this.submitpricingeditquotelevelspecialcode = false;
1981
1982this.submit_pricing_addquotelevelspecialcode = true;
1983
1984this.decision_maker_edited = false;
1985
1986this.channel_contact_edited = false;
1987
1988this.price_request_header_screen = false;
1989
1990this.pricing_information_comment_edited = false;
1991
1992this.submit_pricing_request_footer = false;
1993
1994this.isChanged = true;
1995
1996this.pricing_special_bid_edited = false;
1997
1998this.price_request_done_button = true;
1999
2000this.add_specialbid_head_item = true;
2001
2002this.add_specialbid_sub_item = false;
2003
2004this.add_approval_sub_item = false;
2005
2006this.submit_pricing_productlevelspecialcode = false;
2007
2008 }
2009
2010 quote_ps(val)
2011 {
2012
2013 this.usersJson = val;
2014
2015 this.sb_special_code = this.usersJson.sbc;
2016
2017 this.sb_approval_name = this.usersJson.approvalnb;
2018
2019 this.pricing_special_bid_edited = false;
2020
2021 this.submitpricingeditquotelevelspecialcode = true;
2022
2023 this.decision_maker_edited = false;
2024
2025 this.channel_contact_edited = false;
2026
2027 this.price_request_header_screen = false;
2028
2029 this.pricing_information_comment_edited = false;
2030
2031 this.submit_pricing_request_footer = true;
2032
2033 this.isChanged = true;
2034
2035 this.cdr.detectChanges();
2036
2037 }
2038
2039
2040 retri_max(){
2041
2042 this.state_retrivenonautoidscount.id = this.state.currentQuote.quoteid;
2043
2044 this.state_retrivenonautoidscount.legacyquoteid = this.state.currentQuote.quoteid;
2045
2046 this.state_retrivenonautoidscount.partnerId = this.state.currentQuote.headerinfo.endusername;
2047
2048 this.state_retrivenonautoidscount.currency = this.state.currentQuote.headerinfo.currency;
2049
2050 this.state_retrivenonautoidscount.status = this.state.currentQuote.headerinfo.quotestatus;
2051
2052 this.state_retrivenonautoidscount.isreadonly = this.state.currentQuote.readonly;
2053
2054 this.state_retrivenonautoidscount.ctrycode = this.state.currentQuote.headerinfo.ctrycode;
2055
2056 this.state_retrivenonautoidscount.parent = this.state.currentQuote.headerinfo.ctrycode;
2057
2058 this.state_retrivenonautoidscount.geoCode = this.state.currentQuote.headerinfo.geocode;
2059
2060 this.state_retrivenonautoidscount.reasoncode = this.state.currentQuote.bpreasoncode;
2061
2062 this.state_retrivenonautoidscount.reasondesc = this.state.currentQuote.headerinfo.quotestatusdesc;
2063
2064 this.state_retrivenonautoidscount.onshorectrycode = this.state.currentQuote.headerinfo.ctrycode;
2065
2066 this.state_retrivenonautoidscount.onshoreflag = '';
2067
2068 this.state_retrivenonautoidscount.sp2Name = this.state.currentQuote.headerinfo.sp2name;
2069
2070 this.state_retrivenonautoidscount.bpType = this.state.currentQuote.headerinfo.bptype;
2071
2072 this.state_retrivenonautoidscount.endUserName = this.state.currentQuote.headerinfo.endusername;
2073
2074 this.state_retrivenonautoidscount.specialbidvaluesellerbid = this.state.currentQuote.headerinfo.specialbidvaluesellerbid;
2075
2076 this.state_retrivenonautoidscount.isHandleRequestPricingCallRequired = false;
2077
2078 this.state_retrivenonautoidscount.goecustomer = '';
2079
2080 this.state_retrivenonautoidscount.statusCode = this.state.currentQuote.headerinfo.quotestatus;
2081
2082 this.state_retrivenonautoidscount.showreplacedquotecode = this.state.currentQuote.headerinfo.showreplacedquotecode;
2083
2084 this.modelArray.push(this.state_retrivenonautoidscount);
2085
2086//Api Call Retrive Non Auto Discount
2087
2088 let loading_rt = this.loading.create({
2089 content: 'Loading...',
2090 });
2091
2092 loading_rt.present();
2093
2094
2095 this.quoteService.retrivenonautodiscountinfo(this.modelArray[0])
2096 .then((data: any) => {
2097
2098 this.tmp_retrive = data;
2099
2100 //remove the spinner
2101 loading_rt.dismiss();
2102
2103 if(this.tmp_retrive.hasOwnProperty('items')){
2104
2105
2106 this.dt_retri = this.tmp_retrive.items[0].bppcoutputs;
2107
2108 for(let v = 0; v < this.dt_retri.length; v++)
2109 {
2110
2111 this.max_update_val[v] = this.dt_retri[v].max_eu_disct_ongrid;
2112
2113 this.state.currentQuote.pricingdata.compinfo[v].maxnonaudeudiscount = this.max_update_val[v];
2114
2115
2116 }
2117
2118 }
2119 else{}
2120
2121 });
2122
2123 }
2124
2125
2126
2127
2128//End Function Calling Special Bid Code Page
2129
2130//Add Special Bid Code Function Call
2131
2132
2133fs_add_sp()
2134{
2135
2136 if(this.selSBC != null){
2137let val:any = this.selSBC;
2138this.add_approval_sub_item = false;
2139
2140this.add_loader = this.loading.create({
2141 content: 'Loading...',
2142 });
2143 this.add_loader.present();
2144 this.quoteService.sbcapprovalinfo(this.state.currentQuote.ctrycode,val,this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid)
2145 .then((data: any) => {
2146
2147
2148this.add_tmp_re = [];
2149
2150 this.add_tmp_re = data.items;
2151
2152
2153 if(this.add_tmp_re[0].isapprovalsectionrequired == 'false')
2154 {
2155
2156 this.add_approval_sub_item = false;
2157 this.add_loader.dismiss();
2158 //this.baz(this.add_tmp_re);
2159 }
2160 else
2161 {
2162 this.add_loader.dismiss();
2163
2164 this.add_approval_sub_item = true;
2165
2166
2167 }
2168
2169
2170
2171 });
2172
2173
2174
2175
2176 }
2177
2178}
2179
2180add_spclick(){
2181
2182
2183this.add_specialbid_head_item = false;
2184
2185this.add_specialbid_sub_item = true;
2186
2187this.cdr.detectChanges();
2188
2189
2190}
2191
2192//Done click event Call
2193
2194baz(add_val = this.add_tmp_re)
2195{
2196 let sbc_non_combine: String[] = []; // to remove sbcs from add_cart (when we apply a sbc some sbcs doesnot combine with the selcted sbc
2197
2198 if(this.selSBC == null && this.tagName !== 'quickDiscountApply')
2199 {
2200 let alert = this.alertCtrl.create({
2201 title: 'Submit Price Request',
2202 subTitle: 'Please select a special bid value',
2203 buttons: ['Ok']
2204 });
2205 alert.present();
2206 }
2207 else {
2208
2209if(this.tagName == 'quickDiscountApply'){
2210
2211 this.add_loader = this.loading.create({
2212 content: 'Loading...',
2213 });
2214
2215 this.add_loader.present();
2216 if(this.generic_modal_val == '')
2217 {
2218 let alert = this.alertCtrl.create({
2219 title: 'Submit Price Request',
2220 subTitle: 'Please enter discount value',
2221 buttons: ['Ok']
2222 });
2223 this.add_loader.dismiss();
2224 alert.present();
2225 }
2226
2227else if(this.generic_modal_val){
2228 if(!isNaN(this.generic_modal_val)){
2229for(let v = 0; v < this.state.currentQuote.pricingdata.compinfo.length; v++)
2230 {
2231
2232this.state.currentQuote.pricingdata.compinfo[v].enduserdiscount = this.generic_modal_val;
2233 this.state.currentQuote.pricingdata.compinfo[v].enduserprice = (this.state.currentQuote.pricingdata.compinfo[v].listprice * ( 1 - this.generic_modal_val/100)).toFixed(2);
2234
2235 }
2236 this.generic_modal_val = '';
2237 let alert = this.alertCtrl.create({
2238 title: 'Submit Price Request',
2239 subTitle: 'Discount added successfully',
2240 buttons: ['Ok']
2241 });
2242 this.add_loader.dismiss();
2243 alert.present();
2244
2245 }
2246 else{
2247 let alert = this.alertCtrl.create({
2248 title: 'Submit Price Request',
2249 subTitle: 'Please enter valid End User Discount',
2250 buttons: ['Ok']
2251 });
2252 this.add_loader.dismiss();
2253 alert.present();
2254 }
2255}
2256else{}
2257
2258}
2259
2260else if(this.generic_edited_drop){
2261
2262this._ngZone.run(() => {
2263
2264this.applyHeaderService();
2265
2266 });
2267
2268
2269this.cdr.detectChanges();
2270
2271
2272
2273
2274}
2275
2276else{
2277
2278this.add_loader = this.loading.create({
2279 content: 'Loading...',
2280 });
2281
2282this.add_loader.present();
2283
2284add_val[0].selectedsbc[0].approvalnb = this.add_approval_name;
2285
2286// if(add_val[0].selectedsbc[0].approvalnb!==null){
2287// let alert = this.alertCtrl.create({
2288// title:this.title,
2289// subTitle: 'Please provide Approval Number',
2290// buttons: ['Ok']
2291// });
2292// alert.present();
2293
2294// this.add_loader.dismiss();
2295
2296// }
2297
2298// else
2299//if(add_val[0].selectedsbc[0].approvalnb.startsWith(add_val[0].selectedsbc[0].sbcapprprefix)){
2300
2301if(this.add_approval_name == this.add_tmp_re[0].selectedsbc[0].approvalnb && this.add_tmp_re[0].selectedsbc[0].sbverifflag == 'Y' || this.add_tmp_re[0].selectedsbc[0].sbverifflag == 'N'){
2302
2303this.add_tre = add_val[0];
2304
2305this.add_bks.push({code: this.add_tre.selectedsbc[0].code, approvalnb:this.add_tre.selectedsbc[0].approvalnb, sbaddedverifflag:this.add_tre.selectedsbc[0].sbaddedverifflag, description: this.add_tre.selectedsbc[0].description, sbverifflag: this.add_tre.selectedsbc[0].sbverifflag,sbcapprprefix:this.add_tre.selectedsbc[0].sbcapprprefix});
2306
2307this.state.currentQuote.add_bks = this.add_bks;
2308
2309this.quoteService.ValidateandSaveHeaderInfo(this.state.currentQuote.ctrycode,this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid,this.add_bks)
2310 .then((data: any) => {
2311 this._ngZone.run(() => {
2312 this.quoteService.load(this.state.currentQuote.quoteid)
2313 .then((data: any) => {
2314
2315 this.state.currentQuote = data;
2316
2317 for (let i = 0; i < this.add_cart.length; i++) {
2318 if(this.add_tre){
2319
2320 if (this.add_tre.selectedsbc[0].code == this.add_cart[i].code) {
2321 //already has it
2322 this.add_cart.splice(i, 1);
2323
2324 } else {}
2325
2326
2327 }
2328 }
2329 });
2330 //remove the spinner
2331
2332
2333 });
2334 });
2335
2336for(let k=0; k<this.add_bks.length; k++){
2337 if(this.add_bks[k].sbcapprprefix != "" && this.add_bks[k].approvalnb == undefined){
2338 this.add_bks[k].approvalnb = "";
2339 }
2340 if(this.sbcinfo.length == 0){
2341 let add_data = {sbc :this.add_bks[k].code+"-"+this.add_bks[k].description,sbcapprnumber : this.add_bks[k].approvalnb,...this.add_bks[k]}
2342 this.sbcinfo.push(add_data);
2343 }
2344 else{
2345 for(let l=0 ;l< this.sbcinfo.length; l++){
2346 if(this.add_bks[k].code != this.sbcinfo[l].code){
2347 let add_data = {sbc :this.add_bks[k].code+"-"+this.add_bks[k].description,sbcapprnumber : this.add_bks[k].approvalnb,...this.add_bks[k]}
2348 this.sbcinfo.push(add_data);
2349 }
2350}
2351}
2352}
2353this.sbcinfo = this.sbcinfo.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>this.sbcinfo[item]);
2354this.state.currentQuote.sbcinfo = this.sbcinfo;
2355let temp;
2356temp = this.state.currentQuote.sbcinfo;
2357 //Clear All Sbc Level to Null
2358 this.compsbclist = [];
2359
2360
2361for (let k = 0; k < this.state.currentQuote.sbclist[0].componentsbc.length; k++) {
2362
2363if(this.state.currentQuote.sbclist[0].componentsbc[k].sbcexception.split(',').indexOf(this.add_tre.selectedsbc[0].code) != '-1'){
2364
2365for(let l = 0; l < this.state.currentQuote.sbclist[0].componentsbc[k].sbcexception.split(',').length; l++)
2366{
2367if(this.state.currentQuote.sbclist[0].componentsbc[k].sbcexception.split(',')[l] == this.add_tre.selectedsbc[0].code){
2368
2369 if(this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode5
2370 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode4
2371 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode3
2372 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode2
2373 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode1){
2374 this.compsbclist.unshift({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":this.add_tre.selectedsbc[0].code});
2375
2376 }else if(this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode4
2377 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode3
2378 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode2
2379 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode1){
2380 this.compsbclist.unshift({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":this.add_tre.selectedsbc[0].code,"specialBidcode6":""});
2381
2382 }else if(this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode3
2383 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode2
2384 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode1){
2385 this.compsbclist.unshift({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":"","specialBidcode4":this.add_tre.selectedsbc[0].code,"specialBidcode5":"","specialBidcode6":""});
2386
2387 }
2388 else if(this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode2
2389 && this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode1){
2390 this.compsbclist.unshift({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":this.add_tre.selectedsbc[0].code,"specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
2391
2392 }else if(this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcode1){
2393 this.compsbclist.unshift({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":this.add_tre.selectedsbc[0].code,"specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
2394
2395 }
2396 else {
2397
2398 this.compsbclist.unshift({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":this.add_tre.selectedsbc[0].code,"specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
2399
2400 }
2401
2402}
2403else{}
2404
2405}
2406
2407
2408}
2409else{
2410
2411 this.compsbclist.push({"id":this.state.currentQuote.sbclist[0].componentsbc[k].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
2412
2413}
2414
2415
2416
2417}
2418
2419
2420
2421this.quoteService.applyAndSaveHeaderSBC(this.state.currentQuote.quoteid,'true',this.compsbclist)
2422 .then((data: any) => {
2423
2424 if(data.status == "1"){
2425
2426
2427
2428 let alert = this.alertCtrl.create({
2429 title:this.title,
2430 subTitle: 'Special Bid Code Added',
2431 buttons: ['Ok']
2432 });
2433
2434
2435 //Update Load Data
2436
2437 this.quoteService.load(this.state.currentQuote.quoteid)
2438 .then((data: any) => {
2439
2440 this.cart = [];
2441
2442 this.add_cart = [];
2443
2444 this.pro_cart = [];
2445
2446 this.seenNames = {};
2447 this.selectedSbcList_val = [];
2448 this.add_cart = [];
2449this.add_seenNames = {};
2450
2451 this.state.currentQuote = data;
2452
2453
2454if(this.state.currentQuote.hasOwnProperty('sbclist'))
2455 {
2456
2457 if(this.state.currentQuote.sbclist[0].hasOwnProperty('componentsbc'))
2458 {
2459
2460 this.user = this.state.currentQuote.sbclist[0].componentsbc;
2461
2462
2463 for (let key of this.user)
2464 {
2465 for(var i in key)
2466 {
2467
2468
2469for(var m = 1; m <= 6;m++)
2470{
2471
2472if('specialbidcode'+m == i)
2473{
2474
2475if(key[i])
2476{
2477
2478this.count++;
2479
2480this.cart.push(key[i]);
2481
2482}
2483
2484else
2485{}
2486
2487}
2488else
2489{}
2490}
2491}
2492}
2493
2494
2495
2496//Removing Duplicate Special codes
2497
2498
2499for (let k = 0; k < this.cart.length; k++) {
2500 if (this.seenNames.hasOwnProperty(this.cart[k])) {
2501 //already has it
2502 this.cart.splice(k, 1);
2503 k--;
2504
2505 } else {
2506 this.seenNames[this.cart[k]] = true;
2507
2508 }
2509
2510}
2511
2512 }
2513 else{}
2514
2515 }
2516
2517 this.add_sbcalreadyapplied = this.cart;
2518
2519
2520 for (let key of this.user) {
2521 for(let i in key)
2522 {
2523
2524
2525 if(i == 'specialbidcodelist'){
2526
2527
2528 this.add_temp = key[i];
2529
2530
2531 for (let j of this.add_temp) {
2532
2533
2534 this.add_cart.push(j);
2535
2536
2537 }
2538
2539 }
2540 else{ }
2541
2542 }
2543}
2544
2545
2546
2547for (let i = 0; i < this.add_cart.length; i++) {
2548 if (this.add_seenNames.hasOwnProperty(this.add_cart[i].code)) {
2549 //already has it
2550 this.add_cart.splice(i, 1);
2551 i--;
2552 } else {
2553 this.add_seenNames[this.add_cart[i].code] = true;
2554
2555 }
2556
2557
2558}
2559
2560//remove non-combinable sbc codes from add_cart
2561
2562for(let k=0 ; k < this.add_cart.length ; k++){
2563 for(let z=0 ; z < this.add_sbcalreadyapplied.length; z++){
2564 if(this.add_cart[k].code == this.add_sbcalreadyapplied[z]){
2565 for(let l=0; l < this.add_cart[k].noncombinablespecialbidcodelist.split(',').length;l++){
2566 sbc_non_combine.push(this.add_cart[k].noncombinablespecialbidcodelist.split(',')[l]);
2567 }
2568 }
2569}
2570}
2571
2572sbc_non_combine = sbc_non_combine.filter((item,index)=>sbc_non_combine.indexOf(item)=== index);
2573console.log("sbc_non_combine");
2574 for(let p=0; p<sbc_non_combine.length; p++){
2575 for(let q=0; q<this.add_cart.length; q++){
2576 if(this.add_cart[q] !== undefined || this.add_cart[q] !== null){
2577 if(sbc_non_combine[p] === this.add_cart[q].code){
2578 this.add_cart.splice(q,1);
2579 }
2580 }
2581 }
2582 }
2583
2584
2585for(let u = 0; u < this.add_sbcalreadyapplied.length; u++)
2586{
2587
2588for (let v =0; v < this.add_cart.length;v++)
2589{
2590
2591
2592
2593if(this.add_cart[v].code == this.add_sbcalreadyapplied[u])
2594 {
2595
2596 this.selectedSbcList_val.push(this.add_cart[v]);
2597 this.add_cart.splice(v, 1);
2598 }
2599 else
2600 {}
2601
2602}
2603
2604
2605}
2606
2607this.state.currentQuote.sbcinfo = temp;
2608this.add_specialbid_head_item = true;
2609this.add_specialbid_sub_item = false;
2610
2611 this.selSBC = null;
2612 this.add_loader.dismiss();
2613 alert.present();
2614 if(this.add_tmp_re[0].selectedsbc[0].sbcapprprefix != ""){
2615// alert_save.present();
2616}
2617
2618 })
2619 // .then(()=>{
2620 // // this.sbcDataToSpecialBidCodesList();
2621 // // this.sbcToSpecialBidCodesList();
2622 // // this.add_loader.dismiss();
2623 // });
2624
2625 }
2626
2627 else{
2628
2629 let alert = this.alertCtrl.create({
2630 title:this.title,
2631 subTitle: 'Error Occured',
2632 buttons: ['Ok']
2633 });
2634 alert.present();
2635
2636 }
2637
2638
2639 });
2640
2641
2642
2643
2644}
2645//}
2646else{
2647
2648let alert = this.alertCtrl.create({
2649 title:this.title,
2650 subTitle: 'Invalid Approval Number',
2651 buttons: ['Ok']
2652 });
2653 alert.present();
2654
2655this.add_loader.dismiss();
2656
2657
2658}
2659
2660}
2661
2662}
2663
2664//this.selSBC = null;
2665
2666}
2667
2668//End Add Special Bid Code
2669
2670
2671//Save and Submit Price function Calling
2672
2673 retrivesubmitdata(){
2674
2675this.dealReglist_val = [];
2676
2677// submit data
2678
2679 if(this.state.currentQuote.hasOwnProperty('reginfolist'))
2680 {
2681this.deal_reg = this.state.currentQuote.reginfolist;
2682for (let l = 0; l < this.deal_reg.length; l++) {
2683
2684
2685if(this.deal_reg[l].regdescription == 'Storage registration number'){
2686
2687this.deal_id_val = 'S';
2688
2689}
2690else if(this.deal_reg[l].regdescription == 'Power registration number'){
2691
2692this.deal_id_val = 'P';
2693
2694}
2695else if(this.deal_reg[l].regdescription == 'Pureflex'){
2696
2697this.deal_id_val = 'XF';
2698
2699}
2700
2701else{
2702
2703this.deal_id_val = '';
2704
2705}
2706
2707this.dealReglist_val.push({
2708'dealregdes':this.deal_reg[l].regdescription,
2709'dealregid':this.deal_id_val,
2710'regnumber':this.deal_reg[l].registrationnumber
2711});
2712
2713}
2714}
2715else{}
2716
2717if(this.state.currentQuote.hasOwnProperty('channelinfo1')){
2718
2719//Channel Contact Edit Page OnLoad Data
2720
2721this.sp1bpcontactemail = this.state.currentQuote.channelinfo1.channelrepemailad;
2722this.sp1bptypedescription = this.state.currentQuote.channelinfo1.ibmprodspecialist;
2723this.sp1bpcontactname = this.state.currentQuote.channelinfo1.channelrepname;
2724this.sp1requesterphone = this.state.currentQuote.channelinfo1.channelrepphone;
2725}
2726
2727
2728if(this.state.currentQuote.hasOwnProperty('channelinfo')){
2729
2730//Channel Contact Edit Page OnLoad Data
2731
2732this.channelInformationItem.channelinfo.pcs.sp2bptype = this.state.currentQuote.channelinfo.pcs.sp2bptype;
2733
2734this.channelInformationItem.channelinfo.pcs.sp1customernumber = this.state.currentQuote.channelinfo.pcs.sp1customernumber;
2735
2736this.channelInformationItem.channelinfo.pcs.sp1bptypedescription = this.state.currentQuote.channelinfo.pcs.sp1bptypedescription;
2737
2738this.channelInformationItem.channelinfo.pcs.sp1bptype = this.state.currentQuote.channelinfo.pcs.sp1bptype;
2739
2740this.channelInformationItem.channelinfo.pcs.sp1requesterphone = this.state.currentQuote.channelinfo.pcs.sp1requesterphone;
2741
2742this.channelInformationItem.channelinfo.pcs.sp2companyname = this.state.currentQuote.channelinfo.pcs.sp2companyname;
2743
2744this.channelInformationItem.channelinfo.pcs.sp1contactemail = this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail;
2745
2746this.channelInformationItem.channelinfo.pcs.sp2contactemail = this.state.currentQuote.channelinfo.pcs.sp2contactemail;
2747
2748this.channelInformationItem.channelinfo.pcs.sp1companyname = this.state.currentQuote.channelinfo.pcs.sp1bpcompanyname;
2749
2750this.channelInformationItem.channelinfo.pcs.sp2bptypedescription = this.state.currentQuote.channelinfo.pcs.sp2bptypedescription;
2751
2752this.channelInformationItem.channelinfo.pcs.sp1contactname = this.state.currentQuote.channelinfo.pcs.sp1bpcontactname;
2753
2754this.channelInformationItem.channelinfo.typecode = this.state.currentQuote.channelinfo.pcs.sp1bptype;
2755
2756}
2757
2758
2759
2760 if(this.state.currentQuote.hasOwnProperty('enduserinfo'))
2761 {
2762
2763 this.ccmsnb = this.state.currentQuote.enduserinfo.ccmsnb;
2764 this.customertypecode = 'C';
2765 //Check
2766 this.addresstype = 'ZI01';
2767 this.custCode = 'C';
2768
2769 if(this.state.currentQuote.statuscode != this.state.BPQUOTESTATUS_INCOMPLETE){
2770
2771 //Clear Install Address Array
2772this.state.currentQuote.installAddress_val = [];
2773
2774this.state.currentQuote.installAddress_val.push({
2775'id':'installaddress1',
2776'addressid':'0',
2777'address1':this.state.currentQuote.enduserinfo.streetaddress1,
2778'address2':this.state.currentQuote.enduserinfo.streetaddress2,
2779'city':this.state.currentQuote.enduserinfo.city,
2780'state':this.regionState(this.state.currentQuote.enduserinfo.regionstate)
2781});
2782
2783 }
2784
2785 }
2786
2787 else
2788 {}
2789
2790 if(this.state.currentQuote.hasOwnProperty('decisionmaker')){
2791
2792 this.decMakersEmail = this.state.currentQuote.decisionmaker.decisionmakeremail;
2793 this.decMakersName = this.state.currentQuote.decisionmaker.decisionmakername;
2794 this.decMakersProjName = this.state.currentQuote.decisionmaker.custprojectname;
2795 this.decMakersTitle = this.state.currentQuote.decisionmaker.decisionmakertitle;
2796 }
2797
2798 if(this.state.currentQuote.hasOwnProperty('headerinfo')){
2799
2800 //Header Array Parameter
2801
2802 this.quotestatusdesc = this.state.currentQuote.headerinfo.quotestatusdesc;
2803
2804 this.quotemanager = this.state.currentQuote.headerinfo.quotemanager;
2805
2806 this.tier1companyname = this.state.currentQuote.headerinfo.tier1companyname;
2807
2808 this.creatortype = this.state.currentQuote.headerinfo.creatortype;
2809
2810 this.bpreasoncode = this.state.currentQuote.headerinfo.bpreasoncode;
2811
2812 this.isquotevalid = this.state.currentQuote.headerinfo.isquotevalid;
2813
2814 this.quotestatus = this.state.currentQuote.headerinfo.quotestatus;
2815
2816 this.currencycode = this.state.currentQuote.headerinfo.currency;
2817
2818this.geocode = this.state.currentQuote.headerinfo.geocode;
2819
2820 this.ctrycode = this.state.currentQuote.headerinfo.ctrycode;
2821
2822 this.parent_val = this.state.currentQuote.headerinfo.parentcode;
2823
2824 }
2825
2826 if(this.state.currentQuote.hasOwnProperty('overviewdata')){
2827
2828 this.country = this.state.currentQuote.overviewdata.country;
2829
2830 this.quoteTitle = this.state.currentQuote.overviewdata.quotetitle;
2831
2832 }
2833
2834
2835 if(this.state.currentQuote.hasOwnProperty('pricingdata')){
2836
2837 this.autoRebalancecheckFlag = this.state.currentQuote.pricingdata.rebalance;
2838 }
2839
2840if(this.state.currentQuote.hasOwnProperty('bidjustificationdata')){
2841
2842 this.bpcomments = this.state.currentQuote.bidjustificationdata.comments;
2843
2844}
2845
2846 this.bidType = this.state.currentQuote.bidtype;
2847
2848 this.quoteid = this.state.currentQuote.quoteid;
2849
2850 this.id = this.state.currentQuote.quoteid;
2851
2852//Clear Header Array
2853this.header_val = [];
2854
2855this.header_val.push({'geocode':this.geocode,
2856 'quotestatusdesc':this.quotestatusdesc,
2857 'quotemanager':this.quotemanager,
2858 'tier1companyname':this.tier1companyname,
2859 'creatortype':this.creatortype,
2860 'bpreasoncode':this.bpreasoncode,
2861 'isquotevalid':this.isquotevalid,
2862 'quotestatus':this.quotestatus,
2863 'currencycode':this.currencycode,
2864 'currency':this.currencycode,
2865 'parent':this.parent_val,
2866 'id':this.id,
2867 'ctrycode':this.ctrycode
2868});
2869
2870let componentpriceslist_arr :any[]= [];
2871this.state.currentQuote.pricingdata.compinfo.forEach(element => {
2872 componentpriceslist_arr.push({
2873 'eudiscount': element.enduserdiscount,
2874 'id': element.id,
2875 'enduserprice': element.enduserprice,
2876 'quantity': element.quantity
2877})
2878});
2879
2880this.componentpriceslist = JSON.stringify(componentpriceslist_arr);
2881//this.componentpriceslist = this.componentpriceslist.replace(/"/g,"\\\"");
2882
2883this.rt_val = {
2884'ccmsnb':this.ccmsnb,
2885'customertypecode':this.customertypecode,
2886'decMakersEmail':this.decMakersEmail,
2887'decMakersName':this.decMakersName,
2888'decMakersProjName':this.decMakersProjName,
2889'decMakersTitle':this.decMakersTitle,
2890'bidType':this.bidType,
2891'country':this.country,
2892'countrycode':this.countrycode,
2893'addresstype':this.addresstype,
2894'custCode':this.custCode,
2895'ctrycode':this.ctrycode,
2896'quoteid':this.quoteid,
2897'bpcomments':this.bpcomments,
2898'autoRebalancecheckFlag':this.autoRebalancecheckFlag,
2899'installAddress':JSON.stringify(this.state.currentQuote.installAddress_val),
2900'dealReglist':this.dealReglist_val,
2901'header':this.header_val,
2902'selectedSbcList':this.selectedSbcList_val,
2903'quoteTitle':this.quoteTitle,
2904'geocode':this.geocode,
2905'sp1bpcontactemail':this.sp1bpcontactemail,
2906'sp1bptypedescription':this.sp1bptypedescription,
2907'sp1bpcontactname':this.sp1bpcontactname,
2908'sp1requesterphone':this.sp1requesterphone,
2909'channelinfo':this.channelInformationItem.channelinfo,
2910'isVnsp':this.channelInformationItem.isVnsp,
2911'pricelevel': "Component",
2912'componentpriceslist': this.componentpriceslist
2913};
2914
2915//End
2916
2917return this.rt_val;
2918
2919}
2920
2921save()
2922{
2923
2924 let temp;
2925 temp = this.state.currentQuote.sbcinfo;
2926
2927if(this.valCheckForSave() === '1'){
2928
2929
2930this.submit_data = this.retrivesubmitdata();
2931
2932let loading_op = this.loading.create({
2933 content: 'Loading...',
2934 });
2935 loading_op.present();
2936
2937this.quoteService.saverequestpriceinfo(this.submit_data)
2938 .then((data_header: any[]) => {
2939 //set results to be displayed
2940
2941 this.save_status = data_header;
2942
2943 if(this.save_status.hasOwnProperty('_body')){
2944
2945 let alert = this.alertCtrl.create({
2946 title:this.title,
2947 subTitle: 'Technical Exception Occured !! Try Again',
2948 buttons: ['Ok']
2949 });
2950 alert.present();
2951
2952 //remove the spinner
2953 loading_op.dismiss();
2954
2955 }
2956 else{
2957
2958 if(this.save_status.status == '1' && this.save_status.items[0].degregsave[0].status == '1')
2959 {
2960
2961 this.quoteService.ValidateandSaveHeaderInfo(this.state.currentQuote.ctrycode,this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid,this.add_bks)
2962 .then((data: any) => {
2963
2964 if(data.validationfail === "true")
2965 {
2966
2967 let alert = this.alertCtrl.create({
2968 title: 'Submit Price Request',
2969 subTitle: 'Invalid Add Special Bid Request',
2970 buttons: ['Ok']
2971 });
2972 alert.present();
2973 loading_op.dismiss();
2974
2975}
2976 else
2977 {
2978
2979 this._ngZone.run(() => {
2980
2981 if(this.save_status.items[0].degregsave[0].items[0].dealregnumlist[0].errordescription == 'FAILURE'){
2982
2983 let alert = this.alertCtrl.create({
2984 title:this.title,
2985 subTitle: 'Invalid Deal Reg Id Found !!',
2986 buttons: ['Ok']
2987 });
2988 alert.present();
2989
2990//remove the spinner
2991loading_op.dismiss();
2992
2993 }
2994 else{
2995
2996 this.quoteService.load(this.state.currentQuote.quoteid)
2997 .then((data: any) => {
2998
2999 this.state.currentQuote = data;
3000
3001 this.state.currentQuote.sbcinfo = temp;
3002
3003 for (let i = 0; i < this.add_cart.length; i++) {
3004 if(this.add_tre){
3005
3006 if (this.add_tre.selectedsbc[0].code == this.add_cart[i].code) {
3007 //already has it
3008 this.add_cart.splice(i, 1);
3009
3010 } else {}
3011
3012
3013 }
3014
3015}
3016
3017 this.installAddressCount = 2;
3018 this.state.currentQuote.installAddress_val = [];//shivam
3019
3020 if(this.state.currentQuote.installaddress){
3021
3022 for (let kt = 0; kt < this.state.currentQuote.installaddress.length; kt++) {
3023
3024 this.state.currentQuote.installAddress_val.push({'address1':this.state.currentQuote.installaddress[kt].streetaddress1,'address2':this.state.currentQuote.installaddress[kt].streetaddress2,'city':this.state.currentQuote.installaddress[kt].city,'state':this.state.currentQuote.installaddress[kt].regionid,"addressid":String(kt)});
3025
3026 //this.installAddress_val.push({'address1':this.state.currentQuote.installaddress[kt].streetaddress1,'address2':this.state.currentQuote.installaddress[kt].streetaddress2,'city':this.state.currentQuote.installaddress[kt].city,'state':this.state.currentQuote.installaddress[kt].regionid,"addressid":String(this.installAddressid)});
3027
3028 this.installAddressCount++;
3029
3030 //this.installAddressid++;
3031
3032 }
3033
3034 this.cdr.detectChanges();
3035
3036 }
3037 let alert = this.alertCtrl.create({
3038 title:this.title,
3039 subTitle: 'Quote Saved',
3040 buttons: ['Ok']
3041 });
3042 alert.present();
3043
3044 //remove the spinner
3045loading_op.dismiss();
3046
3047 });
3048
3049
3050// let alert = this.alertCtrl.create({
3051// title:this.title,
3052// subTitle: 'Quote Saved',
3053// buttons: ['Ok']
3054// });
3055// alert.present();
3056
3057// //remove the spinner
3058// loading_op.dismiss();
3059
3060 }
3061
3062
3063
3064
3065 });
3066
3067
3068
3069
3070 }
3071
3072
3073
3074 });
3075
3076 }
3077 else{
3078
3079
3080
3081let alert = this.alertCtrl.create({
3082 title: this.title,
3083 subTitle: 'Error Found : Quote not Saved Successfully',
3084 buttons: ['Ok']
3085 });
3086 alert.present();
3087
3088
3089 //remove the spinner
3090loading_op.dismiss();
3091
3092 }
3093
3094
3095 }
3096
3097 }).catch((err) => {
3098 console.log("TODO:: save quote error, inform user.");
3099 console.log(err);
3100 //remove the spinner
3101 loading_op.dismiss();
3102 });
3103
3104
3105}else{
3106 let alert = this.alertCtrl.create({
3107 title:this.title,
3108 subTitle: String(this.valCheckForSave()),
3109 buttons: ['Ok']
3110 });
3111 alert.present();
3112}
3113
3114}
3115
3116submit()
3117{
3118
3119
3120 if(this.valcheck() == '1'){
3121
3122this.submit_data = this.retrivesubmitdata();
3123
3124
3125let loading_op = this.loading.create({
3126 content: 'Loading...',
3127 });
3128 loading_op.present();
3129
3130this.quoteService.submitrequestpriceinfo(this.submit_data)
3131 .then((data: any[]) => {
3132 //set results to be displayed
3133
3134 //remove the spinner
3135 loading_op.dismiss();
3136
3137 this.save_status = data;
3138
3139 if(this.save_status.status == '1'){
3140
3141 let alert = this.alertCtrl.create({
3142 title:this.title,
3143 subTitle: 'Quote Submited',
3144 buttons: ['Ok']
3145 });
3146 alert.present();
3147
3148this.quoteService.load(this.state.currentQuote.quoteid)
3149 .then((data: any) => {
3150
3151 //Update View Data
3152
3153 this._ngZone.run(() => {
3154 this.state.currentQuote = {};
3155 this.state.currentQuote = data;
3156
3157 if(this.userData.receivePushNotificationStatus){
3158
3159
3160this.quoteService.pushNotificationStatus(this.state.currentQuote.quoteid,this.state.uniqueid,this.userData.email,'S',this.userData.userid,this.state.currentQuote.quotestatus,'Y')
3161 .then((data: any) =>
3162{
3163
3164this.state.pushSubmitMessage = "Quote Submitted "+this.state.currentQuote.quoteid+"-"+this.state.currentQuote.headerinfo.quotestatusdesc;
3165
3166this.quoteService.pushNotificationSent(this.state.uniqueid,this.state.appguid,this.state.appsecret,this.state.pushSubmitMessage)
3167 .then((data: any) => {
3168
3169 // this.navCtrl.push(ViewquotesPage,{});
3170 this.navCtrl.popToRoot();
3171
3172 });
3173
3174});
3175
3176 }
3177
3178 else{
3179
3180 // this.navCtrl.push(ViewquotesPage,{});
3181 this.navCtrl.popToRoot();
3182
3183 }
3184
3185 });
3186
3187
3188 });
3189
3190 }
3191 else{
3192
3193 let alert = this.alertCtrl.create({
3194 title: this.title,
3195 subTitle: 'Error Found : Quote has not Submited Successfully',
3196 buttons: ['Ok']
3197 });
3198 alert.present();
3199
3200
3201 }
3202
3203
3204 }).catch((err) => {
3205 console.log("TODO:: submit quote error, inform user.");
3206 console.log(err);
3207 //remove the spinner
3208 loading_op.dismiss();
3209 });
3210
3211
3212
3213}
3214else{
3215
3216 let alert = this.alertCtrl.create({
3217 title: 'Submit Price Request',
3218 subTitle: String(this.valcheck()),
3219 buttons: ['Ok']
3220 });
3221 alert.present();
3222
3223}
3224
3225
3226}
3227
3228
3229returnToT2(){
3230
3231this.submit_data = this.retrivesubmitdata();
3232
3233let alert = this.alertCtrl.create({
3234 title: 'Comments to requester',
3235 inputs: [
3236 {
3237 name: 'comments',
3238 placeholder: 'Enter comments',
3239 type : 'textarea'
3240 },
3241 ],
3242 buttons: [
3243 {
3244 text: 'Cancel',
3245 role: 'cancel',
3246 handler: data => {
3247 console.log('Cancel clicked');
3248 }
3249 },
3250 {
3251 text: 'Ok',
3252 handler: data => {
3253 this.submit_data.content = "<p>"+data.comments+"</p>";
3254 return true;
3255 }
3256 }
3257 ]
3258});
3259alert.present();
3260
3261let loading_op = this.loading.create({
3262 content: 'Loading...',
3263 });
3264 loading_op.present();
3265
3266this.quoteService.returntotwoinfo(this.submit_data)
3267 .then((data: any[]) => {
3268 //set results to be displayed
3269
3270 //remove the spinner
3271 loading_op.dismiss();
3272 this.save_status = data;
3273 if(this.save_status.status == '1'){
3274
3275 let alert = this.alertCtrl.create({
3276 title:this.title,
3277 subTitle: 'Return to Distributor',
3278 buttons: ['Ok']
3279 });
3280 alert.present();
3281
3282 this.navCtrl.setRoot(HomePage);
3283
3284
3285 }
3286 else{
3287
3288 let alert = this.alertCtrl.create({
3289 title: this.title,
3290 subTitle: 'Error Found : Does not Return to Distributor',
3291 buttons: ['Ok']
3292 });
3293 alert.present();
3294
3295
3296 }
3297
3298
3299 }).catch((err) => {
3300 console.log("TODO:: returntoT2 error, inform user.");
3301 console.log(err);
3302 //remove the spinner
3303 loading_op.dismiss();
3304 });
3305
3306}
3307
3308
3309
3310//End
3311
3312//Round of Value into two digit after decimal
3313
3314Round(number):number
3315{
3316 return parseFloat(Number((number/1000) / 60).toFixed(2));
3317}
3318
3319
3320itemSelected(item){
3321
3322this.generic_modal_val = '';
3323
3324this.generic_modal_val = item;
3325
3326}
3327
3328
3329
3330//End
3331
3332
3333
3334
3335
3336//Collect Sub Product Special Bid Value
3337
3338sbcproval(val){
3339
3340this.generic_val_drop = [];
3341
3342this.generic_edited_drop = true;
3343
3344this.generic_edited = false;
3345
3346this.submit_pricing_productlevelspecialcode = false;
3347
3348this.price_request_done_button = true;
3349
3350this.generic_val_drop.push(val);
3351
3352this.cdr.detectChanges();
3353
3354}
3355
3356
3357sbcDataToSpecialBidCodesList(){
3358
3359this.pro_cart = [];
3360
3361
3362if ("sbclist" in this.state.currentQuote) {
3363
3364for(let m=0; m<this.state.currentQuote.productswithcfr.length;m++)
3365 {
3366
3367for(let j=0; j<this.state.currentQuote.productswithcfr[m].products.length;j++)
3368 {
3369 for(let i=0;i<this.state.currentQuote.sbclist[0].componentsbc.length;i++)
3370 {
3371 if(this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.state.currentQuote.productswithcfr[m].products[j].id)
3372 {
3373
3374 this.Value ={};
3375
3376 this.Value.options = this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcodelist;
3377 this.Value.optionsWithoutPrerequisite = [];
3378 this.Value.prerequisite = [];
3379 for(var k=0; k < this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcodelist.length;k++)
3380 {
3381 if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcodelist[k].prerequisitesbcodelist == "")
3382 {
3383
3384 this.Value.optionsWithoutPrerequisite.push(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcodelist[k]);
3385
3386 this.pro_cart.push(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcodelist[k]);
3387 }
3388 else
3389 {
3390 this.Value.prerequisite.push(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcodelist[k]);
3391 }
3392 }
3393
3394
3395
3396
3397 this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList.push(this.Value);
3398
3399 this.newItem.quotePriceRequest.componentpriceslist.selectedOptionOfSelectedBox1="";
3400
3401 break;
3402 }
3403 }
3404 }
3405
3406 }
3407
3408}
3409
3410
3411
3412
3413 }
3414
3415
3416//Already Applied Sbc
3417
3418sbcToSpecialBidCodesList(){
3419
3420if(!this.removeForwardArrow && "sbclist" in this.state.currentQuote && typeof this.state.currentQuote.sbclist!== "undefined"){
3421
3422for(let m=0; m<this.state.currentQuote.productswithcfr.length;m++){
3423
3424for(let j=0; j<this.state.currentQuote.productswithcfr[m].products.length;j++)
3425 {
3426 for(let i=0;i<this.state.currentQuote.sbclist[0].componentsbc.length;i++)
3427 {
3428
3429if(this.compareComponentId(this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.state.currentQuote.productswithcfr[m].products[j].id))
3430 {
3431
3432
3433 //Exception Filter of Sbc array
3434
3435
3436 this.filterSbcByException(this.state.currentQuote.sbclist[0].componentsbc[i].sbcexception,this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[0].options);
3437
3438 //Applied SBC Array
3439
3440
3441if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1 && this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.proComponentId)
3442{
3443
3444this.alreadyAppliedSbc('1',this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1,this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,'');
3445
3446this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'1','sbccode':this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1,'componentid':this.state.currentQuote.sbclist[0].componentsbc[i].componentid});
3447
3448
3449if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2 && this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.proComponentId){
3450
3451this.alreadyAppliedSbc('2',this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2,this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1);
3452
3453this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'2','sbccode':this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2,'componentid':this.state.currentQuote.sbclist[0].componentsbc[i].componentid});
3454
3455if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3 && this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.proComponentId){
3456
3457this.alreadyAppliedSbc('3',this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3,this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2);
3458
3459this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'3','sbccode':this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3,'componentid':this.state.currentQuote.sbclist[0].componentsbc[i].componentid});
3460
3461
3462if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode4 && this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.proComponentId){
3463
3464this.alreadyAppliedSbc('4',this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode4,this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3);
3465
3466this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'4','sbccode':this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode4,'componentid':this.state.currentQuote.sbclist[0].componentsbc[i].componentid});
3467
3468if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode4 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode5 && this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.proComponentId){
3469
3470this.alreadyAppliedSbc('5',this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode5,this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode4);
3471
3472this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'5','sbccode':this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode5,'componentid':this.state.currentQuote.sbclist[0].componentsbc[i].componentid});
3473
3474if(this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode1 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode2 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode3 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode4 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode5 && this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode6 && this.state.currentQuote.sbclist[0].componentsbc[i].componentid == this.proComponentId){
3475
3476this.alreadyAppliedSbc('6',this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode6,this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode5);
3477
3478this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'6','sbccode':this.state.currentQuote.sbclist[0].componentsbc[i].specialbidcode6,'componentid':this.state.currentQuote.sbclist[0].componentsbc[i].componentid});
3479
3480}}}}}
3481
3482this.addExtraSpecialBidCodesList(this.newItem.quotePriceRequest.headerSbcList);
3483
3484}
3485else{
3486
3487this.alreadyAppliedSbc('1','',this.state.currentQuote.sbclist[0].componentsbc[i].componentid,this.newItem.quotePriceRequest.headerSbcList,'');
3488
3489}
3490
3491
3492
3493
3494 }
3495 }
3496 }
3497
3498
3499}
3500
3501}
3502
3503
3504
3505}
3506
3507//End
3508
3509
3510//Compare Component Id
3511
3512compareComponentId(productcomponentId:any,sbccomponentid:any){
3513
3514if(productcomponentId == sbccomponentid){
3515
3516
3517return true;
3518}
3519else{
3520
3521return false;
3522
3523}
3524
3525
3526}
3527
3528
3529//Filter Data Through SBC Exception
3530
3531filterSbcByException(sbcexceptionvalue:any,sbcproductarray:any){
3532
3533
3534this.newItem.quotePriceRequest.headerSbcList = [];
3535
3536//Allow Only sbc array
3537
3538for(let l = 0; l < sbcexceptionvalue.split(',').length; l++)
3539{
3540
3541for(let m = 0; m < sbcproductarray.length; m++)
3542{
3543
3544if(sbcexceptionvalue.split(',')[l] == sbcproductarray[m].code)
3545{
3546
3547this.newItem.quotePriceRequest.headerSbcList.push(sbcproductarray[m]);
3548
3549}
3550
3551}
3552
3553}
3554
3555return this.newItem.quotePriceRequest.headerSbcList;
3556
3557
3558}
3559
3560
3561
3562
3563
3564//Already Applied SBC
3565
3566alreadyAppliedSbc(level:any,sbcdescription:any,componentid:any,headersbcarrray:any,previoussbc:any){
3567
3568
3569if(sbcdescription)
3570{
3571
3572this.newItem.quotePriceRequest.headerSbcList = [];
3573
3574let filterdArray: any[] = headersbcarrray.filter(f => f !== undefined && f !== null) as any;
3575
3576this.newItem.quotePriceRequest.headerSbcList = filterdArray;
3577
3578if(previoussbc == ''){
3579
3580this.newItem.quotePriceRequest.previousLastSbc = '';
3581
3582this.newItem.quotePriceRequest.previousLastSbc = sbcdescription;
3583
3584this.newItem.quotePriceRequest.selectedSbcList.push({'level':level,'componentid':componentid,'selectedsbc':sbcdescription,'selecteddescription':this.selDescriptionFind(sbcdescription),'item':headersbcarrray.filter(f => f !== undefined && f !== null)});
3585
3586}
3587else{
3588
3589for(let l = 0; l < headersbcarrray.filter(f => f !== undefined && f !== null).length; l++)
3590{
3591
3592if(headersbcarrray.filter(f => f !== undefined && f !== null)[l].code == previoussbc)
3593{
3594
3595//Noncombinational
3596
3597this.splicedArr(l,headersbcarrray.filter(f => f !== undefined && f !== null),previoussbc,sbcdescription,headersbcarrray.filter(f => f !== undefined && f !== null)[l].noncombinablespecialbidcodelist);
3598
3599this.newItem.quotePriceRequest.selectedSbcList.push({'level':level,'componentid':componentid,'selectedsbc':sbcdescription,'selecteddescription':this.selDescriptionFind(sbcdescription),'item':this.newItem.quotePriceRequest.headerSbcList});
3600
3601//End
3602
3603if(headersbcarrray.filter(f => f !== undefined && f !== null)[l] == 'undefined' || headersbcarrray.filter(f => f !== undefined && f !== null)[l] === undefined || headersbcarrray.filter(f => f !== undefined && f !== null)[l] === null || headersbcarrray.filter(f => f !== undefined && f !== null)[l] == ''){
3604
3605}
3606else{
3607//DependencyonSBC Logic
3608
3609if(headersbcarrray.filter(f => f !== undefined && f !== null)[l].dependencyonsbc && headersbcarrray.filter(f => f !== undefined && f !== null)[l].dependencyonsbc.split(',').length > 0){
3610
3611if(this.dependencyOnSbc(headersbcarrray.filter(f => f !== undefined && f !== null)[l].dependencyonsbc,level,componentid)){
3612if(this.spliceSelectSbcList(level,componentid) != -1){
3613this.newItem.quotePriceRequest.selectedSbcList.splice(this.spliceSelectSbcList(level,componentid),1);
3614}}
3615
3616}
3617
3618//End
3619
3620//Prequistic Logic
3621
3622if(headersbcarrray.filter(f => f !== undefined && f !== null)[l].prerequisitesbcodelist && headersbcarrray.filter(f => f !== undefined && f !== null)[l].prerequisitesbcodelist.split(',').length > 0){
3623
3624if(this.prequisticSbcList(headersbcarrray.filter(f => f !== undefined && f !== null)[l].prerequisitesbcodelist,level,componentid) == -1){
3625this.newItem.quotePriceRequest.selectedSbcList.splice(this.spliceSelectSbcList(level,componentid),1);
3626}}
3627
3628//End
3629
3630//MutualExclusiveList Logic
3631
3632if(headersbcarrray.filter(f => f !== undefined && f !== null)[l].mutualexclusivelist && headersbcarrray.filter(f => f !== undefined && f !== null)[l].mutualexclusivelist.split(',').length > 0){
3633
3634if(this.mutualexclusivelistSbcList(headersbcarrray.filter(f => f !== undefined && f !== null)[l].mutualexclusivelist,level) == -1){
3635this.newItem.quotePriceRequest.selectedSbcList.splice(this.spliceSelectSbcList(level,componentid),1);
3636}}
3637
3638//End
3639
3640}
3641
3642
3643}
3644
3645else{
3646
3647
3648}
3649
3650}
3651
3652}
3653
3654
3655
3656
3657}
3658else{
3659
3660//When SBC has not applied
3661
3662this.newItem.quotePriceRequest.selectedSbcList.push({'level':level,'componentid':componentid,'selectedsbc':'','selecteddescription':'','item':headersbcarrray});
3663
3664}
3665
3666}
3667
3668
3669
3670selDescriptionFind(sbccode:any){
3671
3672for(let l = 0; l < this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList.length; l++)
3673{
3674
3675for(let m = 0; m < this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[l].options.length; m++)
3676{
3677
3678if(sbccode == this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[l].options[m].code)
3679{
3680
3681return this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[l].options[m].description;
3682
3683}}}
3684
3685
3686}
3687
3688
3689splicedArr(dt_new:any,filterdArray:any,previoussbc:any,currentsbc:any,noncombinational:any){
3690
3691this.newItem.quotePriceRequest.optionsOfSelectBox2 = [];
3692
3693this.newItem.quotePriceRequest.optionsOfSelectBox2 = filterdArray;
3694
3695for(let m = 0; m < noncombinational.split(',').length; m++)
3696{
3697
3698for(let l= 0; l < filterdArray.length; l++)
3699{
3700
3701if(filterdArray[l] == 'undefined' || filterdArray[l] === undefined || filterdArray[l] === null || filterdArray[l] == ''){
3702
3703
3704}
3705else{
3706
3707if(parseInt(noncombinational.split(',')[m]) == parseInt(filterdArray[l].code) && parseInt(noncombinational.split(',')[m]) != currentsbc)
3708{
3709
3710filterdArray.splice(l,1);
3711
3712}
3713
3714}
3715
3716}
3717
3718}
3719
3720this.preSbc(filterdArray,previoussbc,currentsbc);
3721
3722}
3723
3724//Select One DropDown
3725
3726
3727addExtraSpecialBidCodesList(headerSbcList:any[])
3728{
3729
3730//Intialise MasterSbclist to Null
3731
3732this.newItem.quotePriceRequest.masterSbcList = [];
3733
3734this.newItem.quotePriceRequest.addExtraSbcBox = [];
3735
3736//this.newItem.quotePriceRequest.addExtraSbcBox.push(headerSbcList);
3737
3738
3739//Retrive Product Level component only in Master SbcList
3740
3741
3742for(let m = 0; m <this.newItem.quotePriceRequest.selectedSbcList.length;m++){
3743
3744if(this.newItem.quotePriceRequest.selectedSbcList[m].componentid == this.proComponentId){
3745
3746this.newItem.quotePriceRequest.masterSbcList.push(this.newItem.quotePriceRequest.selectedSbcList[m]);
3747
3748}
3749
3750
3751}
3752
3753
3754
3755headerSbcList.forEach((v, i) => {
3756 const val = (typeof v === 'object') ? Object.assign({}, v) : v;
3757 this.newItem.quotePriceRequest.addExtraSbcBox.push(val);
3758});
3759
3760//Add Additional Select DropDown
3761
3762for(let i = 0; i <this.newItem.quotePriceRequest.addExtraSbcBox.length;i++)
3763{
3764
3765if(this.newItem.quotePriceRequest.previousLastSbc == this.newItem.quotePriceRequest.addExtraSbcBox[i].code){
3766
3767this.newItem.quotePriceRequest.addExtraSbcBox.splice(i,1);
3768
3769}
3770
3771}
3772
3773
3774this.newItem.quotePriceRequest.selectedSbcList.push({'level':parseInt(this.newItem.quotePriceRequest.masterSbcList[this.newItem.quotePriceRequest.masterSbcList.length - 1].level) + 1,'componentid':this.newItem.quotePriceRequest.masterSbcList[this.newItem.quotePriceRequest.masterSbcList.length - 1].componentid,'selectedsbc':'','selecteddescription':'','item':this.newItem.quotePriceRequest.addExtraSbcBox});
3775
3776}
3777
3778
3779//Remove Previous SBC
3780
3781preSbc(filterdArray:any,previoussbc:any,currentsbc:any)
3782{
3783
3784this.newItem.quotePriceRequest.previousLastSbc = '';
3785
3786this.newItem.quotePriceRequest.previousLastSbc = currentsbc;
3787
3788
3789
3790if(previoussbc && filterdArray.length > 0)
3791{
3792
3793for(let l= 0; l < filterdArray.length; l++)
3794{
3795
3796if(filterdArray[l] == 'undefined' || filterdArray[l] === undefined || filterdArray[l] === null || filterdArray[l] == '' || filterdArray[l] == null){
3797
3798
3799}
3800else{
3801
3802
3803
3804if(filterdArray[l].code){
3805
3806if(parseInt(currentsbc) !== parseInt(filterdArray[l].code))
3807{
3808
3809if(parseInt(previoussbc) === parseInt(filterdArray[l].code)){
3810
3811
3812filterdArray.splice(l,1);
3813
3814}
3815
3816
3817}
3818
3819
3820}
3821
3822}
3823
3824}
3825
3826this.newItem.quotePriceRequest.headerSbcList = [];
3827
3828filterdArray.forEach((v, i) => {
3829 const val = (typeof v === 'object') ? Object.assign({}, v) : v;
3830 this.newItem.quotePriceRequest.headerSbcList.push(val);
3831});
3832
3833}
3834
3835else{}
3836
3837
3838}
3839
3840
3841
3842dependencyOnSbc(dependsbc:any,leval:any,componentid:any){
3843
3844if(dependsbc.length > 0){
3845
3846for(let m = 0; m < dependsbc.split(',').length; m++)
3847{
3848
3849for(let n = 0; n < this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[this.pro_index].options.length; n++)
3850{
3851if(componentid != this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[this.pro_index].options[n].id)
3852{
3853
3854if(dependsbc.split(',')[m] == this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[this.pro_index].options[n].code)
3855{
3856
3857return true;
3858
3859}}}}
3860
3861return false;
3862
3863}
3864}
3865
3866//Index of Splice Sbc List
3867spliceSelectSbcList(level:any,componentid:any){
3868
3869for(let n = 0; n < this.newItem.quotePriceRequest.selectedSbcList.length; n++)
3870{
3871
3872if(this.newItem.quotePriceRequest.selectedSbcList[n].level == level && this.newItem.quotePriceRequest.selectedSbcList[n].componentid == componentid){
3873
3874return n;
3875
3876}}
3877
3878return -1;
3879
3880}
3881
3882prequisticSbcList(prequisticsbc:any,leval:any,componentid:any){
3883
3884if(prequisticsbc.length > 0){
3885
3886for(let m = 0; m < prequisticsbc.split(',').length; m++)
3887{
3888
3889for(let n = 0; n < this.newItem.quotePriceRequest.componentpriceslist.selectBox.length; n++)
3890{
3891
3892if(this.newItem.quotePriceRequest.componentpriceslist.selectBox[n].sbccode == prequisticsbc.split(',')[m] && this.newItem.quotePriceRequest.componentpriceslist.selectBox[n].componentid != componentid)
3893{
3894
3895return true;
3896
3897}}
3898
3899}
3900
3901return -1;
3902}
3903}
3904
3905getSbcInfo(item:any,level:any){
3906
3907if(this.updateSelectedSbc(item,level) != -1){}
3908
3909else{
3910
3911if(this.newItem.quotePriceRequest.componentpriceslist.selectBox.length == 0){
3912
3913this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':'1','sbccode':item,'componentid':parseInt(this.pro_index) + 1});
3914
3915}
3916else{
3917
3918this.newItem.quotePriceRequest.componentpriceslist.selectBox.push({'level':parseInt(this.newItem.quotePriceRequest.componentpriceslist.selectBox[this.newItem.quotePriceRequest.componentpriceslist.selectBox.length - 1].level) + 1,'sbccode':item,'componentid':parseInt(this.pro_index) + 1});
3919
3920}
3921
3922
3923
3924}
3925
3926this.applyHeaderArray(this.newItem.quotePriceRequest.componentpriceslist.selectBox.length);
3927
3928}
3929
3930updateSelectedSbc(sbccode:any,level:any){
3931
3932for (var i = 0; i < this.newItem.quotePriceRequest.componentpriceslist.selectBox.length; i++) {
3933 if (this.newItem.quotePriceRequest.componentpriceslist.selectBox[i].level === level && this.newItem.quotePriceRequest.componentpriceslist.selectBox[i].componentid == parseInt(this.pro_index) + 1) {
3934 this.newItem.quotePriceRequest.componentpriceslist.selectBox[i].sbccode = sbccode;
3935 return i;
3936 }
3937 }
3938
3939 return -1;
3940}
3941
3942applyHeaderArray(len:any){
3943
3944//Initialize to null for Compound Array List
3945
3946this.compsbclist = [];
3947
3948if(len > 0){
3949
3950if(len == 1){
3951 this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 1].componentid,"specialBidcode1":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 1].sbccode,"specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
3952
3953 }
3954 else if(len == '2'){
3955 this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 2].componentid,"specialBidcode1":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 2].sbccode,"specialBidcode2":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len -1].sbccode,"specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
3956 }
3957
3958 else if(len == '3'){
3959 this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 3].componentid,"specialBidcode1":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 3].sbccode,"specialBidcode2":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len -2].sbccode,"specialBidcode3":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 1].sbccode,"specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
3960
3961 }
3962
3963 else if(len == '4'){
3964
3965 this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 4].componentid,"specialBidcode1":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 4].sbccode,"specialBidcode2":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len -3].sbccode,"specialBidcode3":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 2].sbccode,"specialBidcode4":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 1].sbccode,"specialBidcode5":"","specialBidcode6":""});
3966
3967
3968 }
3969
3970 else if(len == '5'){
3971
3972 this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 5].componentid,"specialBidcode1":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 5].sbccode,"specialBidcode2":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len -4].sbccode,"specialBidcode3":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 3].sbccode,"specialBidcode4":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 2].sbccode,"specialBidcode5":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 1].sbccode,"specialBidcode6":""});
3973
3974
3975 }
3976
3977 else{
3978
3979this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 6].componentid,"specialBidcode1":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 6].sbccode,"specialBidcode2":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len -5].sbccode,"specialBidcode3":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 4].sbccode,"specialBidcode4":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 3].sbccode,"specialBidcode5":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 2].sbccode,"specialBidcode6":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len - 1].sbccode});
3980
3981 }
3982
3983
3984}
3985else{
3986
3987this.compsbclist.unshift({"id":this.newItem.quotePriceRequest.componentpriceslist.selectBox[len].componentid,"specialBidcode1":"","specialBidcode2":"","specialBidcode3":"","specialBidcode4":"","specialBidcode5":"","specialBidcode6":""});
3988
3989}
3990
3991}
3992
3993
3994applyHeaderService(){
3995
3996 this.loader = this.loading.create({
3997 content: 'Loading...',
3998 });
3999 this.loader.present();
4000
4001this.quoteService.applyAndSaveHeaderSBC(this.state.currentQuote.quoteid,'false',this.compsbclist)
4002 .then((data: any) => {
4003 this.loader.dismiss();
4004
4005 if(data.status == "1"){
4006 this.quoteService.load(this.state.currentQuote.quoteid)
4007 .then((data: any) => {
4008
4009 //Update View Data
4010
4011 this._ngZone.run(() => {
4012 this.state.currentQuote = {};
4013 this.state.currentQuote = data;
4014
4015 this.price_request_done_button = false;
4016
4017this.edtproductquotesbc(data.pricingdata.compinfo[this.pro_index],this.pro_index);
4018
4019 });
4020
4021 });
4022
4023 }
4024 else{}
4025 });
4026
4027}
4028
4029
4030mutualexclusivelistSbcList(mutualexclusivelist:any,level:any){
4031
4032if(mutualexclusivelist.length > 0){
4033
4034for(let m = 0; m < mutualexclusivelist.split(',').length; m++)
4035{
4036
4037for(let n = 0; n < this.newItem.quotePriceRequest.componentpriceslist.selectBox.length; n++)
4038{
4039
4040if(this.newItem.quotePriceRequest.componentpriceslist.selectBox[n].sbccode == mutualexclusivelist.split(',')[m])
4041{
4042
4043return true;
4044
4045}}
4046
4047}
4048
4049return -1;
4050}
4051
4052
4053}
4054
4055
4056selectedSbcLevel(sbccode:any){
4057
4058for (var i = 0; i < this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList.length; i++) {
4059
4060for (var j = 0; j < this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[i].options.length; j++)
4061{
4062
4063if (this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[i].options[j].code === sbccode) {
4064
4065 return this.newItem.quotePriceRequest.componentpriceslist.specialBidCodesList[i].options[j].id;
4066 }
4067
4068
4069}
4070
4071
4072 }
4073
4074return -1;
4075
4076}
4077
4078
4079//Check array or object
4080
4081isArray(ob) {
4082 return (!!ob) && (ob.constructor === Array);
4083}
4084
4085//Check Validation
4086
4087valcheck(){
4088
4089 if(this.state.currentQuote.reginfolist.length < 1){
4090 return this.state.validateMessageDealRegNumber;
4091 }
4092
4093 else if(typeof this.state.currentQuote.reginfolist[0].registrationnumber == 'undefined'){
4094 return this.state.validateMessageDealRegNumber ;
4095 }
4096
4097 else if(!this.state.currentQuote.channelinfo.pcs.sp1bpcontactname){
4098 return this.state.validateMessageSP1ContactName;
4099 }
4100
4101 else if(!this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail) {
4102 return this.state.validateMessageSP1ContactEmail;
4103 }
4104
4105 else if(this.state.currentQuote.issp2 === "false"
4106 && !this.state.currentQuote.channelinfo.pcs.sp2companyname){
4107 return this.state.validateMessageSP2CompanyName;
4108 }
4109
4110 else if(this.state.currentQuote.channelinfo.pcs.sp2companyname == " "){
4111 return this.state.validateMessageSP2CompanyName;
4112 }
4113
4114 else if(!this.state.currentQuote.hasOwnProperty('enduserinfo')){
4115 return this.state.validateMessageEndUserInfo;
4116 }
4117
4118else if(!this.state.currentQuote.decisionmaker.decisionmakername){
4119
4120return this.state.validateMessageDecisionMakerName;
4121
4122}
4123
4124else if(this.state.currentQuote.decisionmaker.decisionmakername && !this.state.currentQuote.decisionmaker.decisionmakertitle){
4125
4126return this.state.validateMessageDecisionMakerTitle;
4127
4128}
4129else if(this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && !this.state.currentQuote.decisionmaker.decisionmakeremail){
4130
4131return this.state.validateMessageDecisionMakerEmailAddress;
4132
4133}
4134
4135else if(this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail && !this.state.currentQuote.decisionmaker.custprojectname){
4136
4137 return this.state.validateMessageDecisionMakerProjectName;
4138
4139}
4140
4141
4142
4143else if(!this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4144
4145return this.state.validateMessageChannelContactName;
4146
4147}
4148
4149else if(!this.state.currentQuote.channelinfo1.channelrepphone && this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4150
4151return this.state.validateMessageChannelContactPhoneNo;
4152
4153}
4154
4155else if(!this.state.currentQuote.channelinfo1.channelrepemailad && this.state.currentQuote.channelinfo1.channelrepphone && this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4156
4157return this.state.validateMessageChannelContactEmailAddress;
4158
4159}
4160
4161else if(!this.state.currentQuote.bidjustificationdata.comments && this.state.currentQuote.channelinfo1.channelrepemailad && this.state.currentQuote.channelinfo1.channelrepphone && this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4162
4163return this.state.validateMessageBidJustification;
4164
4165}
4166
4167else if(!this.ibmContactEmailValidOnSubmit() && !this.state.currentQuote.bidjustificationdata.comments && this.state.currentQuote.channelinfo1.channelrepemailad && this.state.currentQuote.channelinfo1.channelrepphone && this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4168
4169return this.state.validateMessageChannelContactEmailCheckAddress;
4170
4171}
4172
4173else if(!this.decisionMakerEmailValidOnSubmit() && !this.ibmContactEmailValidOnSubmit() && !this.state.currentQuote.bidjustificationdata.comments && this.state.currentQuote.channelinfo1.channelrepemailad && this.state.currentQuote.channelinfo1.channelrepphone && this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4174
4175return this.state.validateMessageDecisionMakerEmailCheckAddress;
4176
4177}
4178
4179else if(!this.sponeContactEmailValidOnSubmit() && !this.decisionMakerEmailValidOnSubmit() && !this.ibmContactEmailValidOnSubmit() && !this.state.currentQuote.bidjustificationdata.comments && this.state.currentQuote.channelinfo1.channelrepemailad && this.state.currentQuote.channelinfo1.channelrepphone && this.state.currentQuote.channelinfo1.channelrepname && this.state.currentQuote.channelinfo1.ibmprodspecialist && this.state.currentQuote.decisionmaker.decisionmakername && this.state.currentQuote.decisionmaker.decisionmakertitle && this.state.currentQuote.decisionmaker.decisionmakeremail){
4180
4181return this.state.validateMessageSP1ContactEmailCheckAddress;
4182
4183}
4184
4185else if(this.euPricesCheck()){
4186 return this.state.validateEuPricesCheck;
4187}
4188
4189else if(this.euPrices()){
4190 return this.state.validateEuPrices;
4191}
4192
4193else if(this.sbcCheck()){
4194
4195return this.state.validateMessageSbcCheck;
4196
4197}
4198
4199else{
4200
4201return '1';
4202
4203}
4204
4205}
4206
4207sbcCheck(){
4208 let sbc_check:any[] = [];
4209 let result = false;
4210 for(let k=0; k<this.state.currentQuote.pricingdata.compinfo.length; k++){
4211 if(this.state.currentQuote.pricingdata.compinfo[k].specialbidcode1 != ""){
4212 sbc_check.push({code : this.state.currentQuote.pricingdata.compinfo[k].specialbidcode1});
4213 }
4214 if(this.state.currentQuote.pricingdata.compinfo[k].specialbidcode2 != ""){
4215 sbc_check.push({code : this.state.currentQuote.pricingdata.compinfo[k].specialbidcode2});
4216 }
4217 if(this.state.currentQuote.pricingdata.compinfo[k].specialbidcode3 != ""){
4218 sbc_check.push({code : this.state.currentQuote.pricingdata.compinfo[k].specialbidcode3});
4219 }
4220 if(this.state.currentQuote.pricingdata.compinfo[k].specialbidcode4 != ""){
4221 sbc_check.push({code : this.state.currentQuote.pricingdata.compinfo[k].specialbidcode4});
4222 }
4223 if(this.state.currentQuote.pricingdata.compinfo[k].specialbidcode5 != ""){
4224 sbc_check.push({code : this.state.currentQuote.pricingdata.compinfo[k].specialbidcode5});
4225 }
4226 if(this.state.currentQuote.pricingdata.compinfo[k].specialbidcode6 != ""){
4227 sbc_check.push({code : this.state.currentQuote.pricingdata.compinfo[k].specialbidcode6});
4228 }
4229 }
4230 sbc_check = sbc_check.map(item=>item.code).map((item,index,array)=>array.indexOf(item)).filter((item,index,array)=>array.indexOf(item)==index).map((item)=>sbc_check[item]);
4231
4232 for(let x=0; x<this.state.currentQuote.sbclist[0].componentsbc.length; x++){
4233 for(let y=0; y<this.state.currentQuote.sbclist[0].componentsbc[x].specialbidcodelist.length; y++){
4234 for(let z=0; z<sbc_check.length;z++){
4235 if(this.state.currentQuote.sbclist[0].componentsbc[x].specialbidcodelist[y].description == sbc_check[z].code){
4236 if(this.state.currentQuote.sbclist[0].componentsbc[x].specialbidcodelist[y].sbcapprprefix != ""){
4237 sbc_check[z] = {sbcapprprefix : this.state.currentQuote.sbclist[0].componentsbc[x].specialbidcodelist[y].sbcapprprefix,...sbc_check[z]}
4238 }
4239 }
4240 }
4241
4242 }
4243 }
4244if(this.state.currentQuote.hasOwnProperty('add_bks')){
4245 for(let element=0; element< this.state.currentQuote.add_bks.length; element++){
4246 // this.state.currentQuote.add_bks.forEach((element)=>{
4247 let apprprefix = this.state.currentQuote.add_bks[element].sbcapprprefix.toLowerCase();
4248 let apprno = this.state.currentQuote.add_bks[element].approvalnb.substr(0,apprprefix.length).toLowerCase();
4249 if(this.state.currentQuote.add_bks[element].sbcapprprefix !== null && this.state.currentQuote.add_bks[element].sbcapprprefix !== ""){
4250 if(this.state.currentQuote.add_bks[element].approvalnb === ""){
4251 //'Missing Approval Number, please provide a valid approval number'
4252 this.state.validateMessageSbcCheck = 'Missing Approval Number, please provide a valid approval number'
4253 return true;
4254 }
4255 else if(apprno.startsWith(apprprefix)){
4256 console.log("approval number is correct")
4257 }
4258 else{
4259 //'Invalid Approval Number, please provide a valid approval number'
4260 this.state.validateMessageSbcCheck = 'Invalid Approval Number, please provide a valid approval number'
4261 return true;
4262 }
4263 }
4264 // });
4265 }
4266}
4267 for(let k=0; k < sbc_check.length; k++){
4268 if(sbc_check[k].hasOwnProperty('sbcapprprefix')){
4269 if(this.state.currentQuote.pricingdata.hasOwnProperty('sbcinfo')){
4270 for(let l=0; l<this.state.currentQuote.pricingdata.sbcinfo.length; l++){
4271 let apprprefix = sbc_check[k].sbcapprprefix.toLowerCase();
4272 let apprno = this.state.currentQuote.pricingdata.sbcinfo[l].sbcapprnumber.substr(0,apprprefix.length).toLowerCase();
4273 if(this.state.currentQuote.pricingdata.sbcinfo[l].sbc != sbc_check[k].code){
4274 result = true;
4275 return result;
4276 }
4277 else if(this.state.currentQuote.pricingdata.sbcinfo[l].sbc === sbc_check[k].code && !(apprno.startsWith(apprprefix))){
4278 result = true;
4279 return result;
4280 }
4281 }
4282 }
4283 else {
4284 if(this.add_bks == null || this.add_bks == [] || this.state.currentQuote.add_bks == null || this.state.currentQuote.add_bks == []){
4285 result = true;
4286 return result;
4287 }
4288 }
4289 }
4290 }
4291
4292 this.quoteService.ValidateandSaveHeaderInfo(this.state.currentQuote.ctrycode,this.state.currentQuote.headerinfo.geocode,this.state.currentQuote.quoteid,this.add_bks)
4293 .then((data: any) => {
4294 this._ngZone.run(() => {
4295 this.quoteService.load(this.state.currentQuote.quoteid)
4296 .then((data: any) => {
4297
4298 this.state.currentQuote = data;
4299
4300 for (let i = 0; i < this.add_cart.length; i++) {
4301 if(this.add_tre){
4302
4303 if (this.add_tre.selectedsbc[0].code == this.add_cart[i].code) {
4304 //already has it
4305 this.add_cart.splice(i, 1);
4306
4307 } else {}
4308
4309
4310 }
4311 }
4312 return result;
4313 });
4314 //remove the spinner
4315
4316
4317 });
4318 });
4319 //return result;
4320}
4321
4322installAddress(){
4323
4324this.price_request_header_screen = false;
4325
4326this.install_address_edited = true;
4327
4328this.isChanged = true;
4329
4330this.cdr.detectChanges();
4331
4332}
4333
4334
4335addInstallAddress(){
4336
4337this.state.currentQuote.installAddress_val.push({'address1':'','address2':'','city':'','state':'','id':'installaddress'+Number.parseInt(this.installAddressCount.toString())});
4338
4339this.installAddressCount++;
4340//this.installAddressid++;
4341this.cdr.detectChanges();
4342
4343}
4344
4345delInstallAddress(index:any){
4346
4347 if(this.state.currentQuote.installAddress_val[index].hasOwnProperty('addressid')){
4348 this.loader = this.loading.create({
4349 content: 'Loading...',
4350 });
4351 this.loader.present();
4352 this.quoteService.removeInstallAddress(this.state.currentQuote.installAddress_val[index].addressid).then(()=>{
4353
4354 this.installAddressCount--;
4355 this.state.currentQuote.installAddress_val.splice(index, 1);
4356
4357 this.cdr.detectChanges();
4358 this.loader.dismiss();
4359 });
4360 }
4361
4362 else{
4363this.installAddressCount--;
4364
4365this.state.currentQuote.installAddress_val.splice(index, 1);
4366
4367this.cdr.detectChanges();
4368
4369}
4370
4371}
4372
4373
4374checkDecisionModelVal(val:any){
4375
4376let keyArr: any[] = Object.keys(this.state.currentQuote.decisionmaker);
4377 keyArr.forEach((key: any) => {
4378
4379 if(key === val)
4380 {
4381
4382 return key;
4383
4384 }
4385
4386 else {}
4387
4388
4389 });
4390
4391return -1;
4392
4393}
4394
4395regionState(val:any){
4396
4397if ("regionlist" in this.state.currentQuote && typeof this.state.currentQuote.regionlist!== "undefined") {
4398 for(let v =0; v < this.state.currentQuote.regionlist[0].state.length;v++)
4399 {
4400
4401 if(this.state.currentQuote.regionlist[0].state[v].statecode === val){
4402
4403 return this.state.currentQuote.regionlist[0].state[v];
4404
4405 }
4406
4407 }
4408
4409}
4410
4411}
4412
4413
4414htmlToPlaintext(text:any) {
4415 return text ? String(text).replace(/<[^>]+>/gm, '') : '';
4416}
4417
4418ibmContactEmailValidOnSave(){
4419 //On Save IBM Channel Contact Check
4420 if(this.sp1bpcontactemail){
4421 let lastatrateindex = this.sp1bpcontactemail.lastIndexOf('@');
4422 let result = this.sp1bpcontactemail.substring(lastatrateindex + 1);
4423 if(result.toLowerCase().search('ibm.com') >= 0 ){
4424 return true;
4425 }else{
4426 return false;
4427 }
4428 }else{
4429 return true;
4430 }
4431}
4432
4433ibmContactEmailValidOnSubmit(){
4434 //On Save IBM Channel Contact Check
4435 if(this.sp1bpcontactemail){
4436 let lastatrateindex = this.sp1bpcontactemail.lastIndexOf('@');
4437 let result = this.sp1bpcontactemail.substring(lastatrateindex + 1);
4438 if(result.toLowerCase().search('ibm.com') >= 0){
4439 return true;
4440 }else{
4441 return false;
4442 }
4443 }else{
4444 return false;
4445 }
4446}
4447
4448decisionMakerEmailValidOnSave(){
4449
4450if(this.decisionmakeremail){
4451
4452let regExp = this.state.emailValidaionRegx;
4453
4454 if (!regExp.test(this.decisionmakeremail)) {
4455 return false;
4456 }
4457 else{
4458 return true;
4459 }
4460}
4461else{
4462
4463//If decision maker email id is null
4464
4465return true;
4466
4467}
4468
4469
4470}
4471
4472//----
4473
4474decisionMakerEmailValidOnSubmit(){
4475
4476if(this.decisionmakeremail){
4477
4478let regExp = this.state.emailValidaionRegx;
4479
4480 if (!regExp.test(this.decisionmakeremail)) {
4481 return false;
4482 }
4483 else{
4484 return true;
4485 }
4486}
4487else{
4488
4489//If decision maker email id is null
4490
4491return false;
4492
4493}
4494
4495
4496}
4497
4498
4499//-----
4500
4501
4502sponeContactEmailValidOnSave(){
4503
4504if(this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail){
4505
4506let regExp = this.state.emailValidaionRegx;
4507
4508if (!regExp.test(this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail)) {
4509 return false;
4510 }
4511 else{
4512 return true;
4513 }
4514
4515}
4516else{
4517
4518//If channel contact spone email id is null
4519
4520return true;
4521}
4522}
4523
4524//----
4525
4526sponeContactEmailValidOnSubmit(){
4527
4528if(this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail){
4529
4530let regExp = this.state.emailValidaionRegx;
4531
4532if (!regExp.test(this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail)) {
4533 return false;
4534 }
4535 else{
4536 return true;
4537 }
4538
4539}
4540else{
4541
4542//If channel contact spone email id is null
4543
4544return false;
4545}
4546}
4547
4548
4549//---
4550
4551
4552
4553sbcCode(item_k:any){
4554
4555 if(this.state.currentQuote.hasOwnProperty('sbclist'))
4556 {
4557
4558 if(this.state.currentQuote.sbclist[0].hasOwnProperty('componentsbc'))
4559 {
4560
4561for (let k = 0; k < this.state.currentQuote.sbclist[0].componentsbc.length; k++) {
4562
4563for(let l = 0; l < this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcodelist.length; l++){
4564
4565if(this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcodelist[l].description == item_k){
4566
4567return this.state.currentQuote.sbclist[0].componentsbc[k].specialbidcodelist[l].code;
4568
4569}
4570
4571}
4572}
4573
4574 }
4575
4576 }
4577
4578}
4579valCheckForSave(){
4580 if(this.state.currentQuote.channelinfo.pcs.sp1bpcontactemail && !this.sponeContactEmailValidOnSubmit()){
4581 return this.state.validateMessageSP1ContactEmailCheckAddress;
4582
4583 }else if(this.state.currentQuote.decisionmaker.decisionmakeremail && !this.decisionMakerEmailValidOnSubmit()){
4584 return this.state.validateMessageDecisionMakerEmailCheckAddress;
4585
4586 }else if(this.state.currentQuote.channelinfo1.channelrepemailad && !this.ibmContactEmailValidOnSubmit()){
4587 return this.state.validateMessageChannelContactEmailCheckAddress;
4588
4589 }
4590
4591 else{
4592 return '1';
4593
4594 }
4595}
4596
4597euPricesCheck(){
4598 for(let q=0 ; q<this.state.currentQuote.pricingdata.compinfo.length; q++){
4599if(this.state.currentQuote.pricingdata.compinfo[q].enduserdiscount === "" || this.state.currentQuote.pricingdata.compinfo[q].enduserdiscount === undefined || this.state.currentQuote.pricingdata.compinfo[q].enduserdiscount === null || this.state.currentQuote.pricingdata.compinfo[q].enduserprice === "" || this.state.currentQuote.pricingdata.compinfo[q].enduserprice === undefined || this.state.currentQuote.pricingdata.compinfo[q].enduserprice === null){
4600 return true;
4601}
4602else{
4603 return false;
4604}
4605 }
4606}
4607
4608euPrices(){
4609 for(let p=0 ; p<this.state.currentQuote.pricingdata.compinfo.length; p++){
4610 if(isNaN(this.state.currentQuote.pricingdata.compinfo[p].enduserdiscount)){
4611 return true;
4612 }
4613 else if(isNaN(this.state.currentQuote.pricingdata.compinfo[p].enduserprice)){
4614 return true;
4615 }
4616 else{
4617 return false;
4618 }
4619 }
4620}
4621
4622
4623}