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