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