299. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/2/2019 1:08:01 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

299.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ARS_Frontend\ars-app\src\app\ars\rfai-submission rfai-submission.component.ts Wed Mar 27 19:18:24 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\ARS_Frontend\ars-app\src\app\ars\rfai-submission rfai-submission.component.ts Fri Mar 29 18:09:26 2019 UTC

299.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1514
Changed 1 2
Inserted 0 0
Removed 0 0

299.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

299.4 Active regular expressions

No regular expressions were active.

299.5 Comparison detail

  1   import { A bstractCon trol, Form Array, For mBuilder,  FormGroup,  Validator s } from ' @angular/f orms';
  2   import { C hangeDetec torRef, Co mponent, E lementRef,  OnDestroy , OnInit,  ViewChild  } from '@a ngular/cor e';
  3   import { C odeAndLeve lModel, Li neModel, P DIInfoMode l, RfaiInf oModel, Rf aiSubmissi onRequestM odel } fro m './rfai- submission .model';
  4   import { C odeModel,  PayerModel  } from '. ./rfai-adm in/rfai-ad min.model' ;
  5  
  6   import { A ppSettings Service }  from './.. /../shared /app-setti ngs/app-se ttings.ser vice';
  7   import { A uthenticat ionService  } from '. ./../auth/ auth.servi ce';
  8   import { M enuModel }  from '../ ../shared/ menu/menu. component. model';
  9   import { R equestCode sComponent  } from '. /request-c odes/reque st-codes.c omponent';
  10   import { R faiSubmiss ionService  } from '. /rfai-subm ission.ser vice';
  11   import { S ubscriptio n } from ' rxjs/Subsc ription';
  12   import { n oPastDates Validator  } from '.. /../shared /validator s';
  13  
  14   @Component ({
  15     selector : 'app-rfa i-submissi on',
  16     template Url: './rf ai-submiss ion.compon ent.html',
  17     styleUrl s: ['./rfa i-submissi on.compone nt.scss']
  18   })
  19   export cla ss RfaiSub missionCom ponent imp lements On Init, OnDe stroy {
  20     menu: Me nuModel;
  21     formSubs cription:  Subscripti on = new S ubscriptio n();
  22     subscrip tion: Subs cription =  new Subsc ription();
  23     autoFill form: Form Group;
  24     manualFo rm: FormGr oup;
  25     prepopul ateForm: F ormGroup;
  26     linesFor mArray: Fo rmArray;
  27     lines: L ineModel[]  = [];
  28     codeAndL evelList:  CodeAndLev elModel[]  = [];
  29     modalClo sed = true ;
  30     errorMsg  = '';
  31     errorSta tus = fals e;
  32     successS tatus = fa lse;
  33     successM sg = '';
  34     prepopul atedInfo:  PDIInfoMod el = new P DIInfoMode l();
  35     addition alInfoPerm issions: a ny;
  36     disableP opulateInf o = false;
  37     disableS ubmitInfo  = false;
  38     roles: s tring[];
  39     // Initi al Values  for the dr opdown
  40     healthCa reClaimSta tusCodes:  CodeModel[ ] = [];
  41     loincCod esClaimLev el: CodeMo del[] = [] ;
  42     loincCod esLineLeve l: CodeMod el[] = [];
  43     loincCod eModifiers : CodeMode l[] = [];
  44     autoForm Model: Rfa iSubmissio nRequestMo del = new  RfaiSubmis sionReques tModel();
  45     manualFo rmModel: R faiSubmiss ionRequest Model = ne w RfaiSubm issionRequ estModel() ;
  46     pdiInfoM odel: PDII nfoModel =  new PDIIn foModel();
  47     line: Li neModel =  new LineMo del();
  48     manualLi neIdArray:  number[]  = [];
  49     prepopul atedLineId Array: num ber[] = [] ;
  50     resetChi ld = false ;
  51     warningM odalClosed  = true;
  52     errorMod alClosed =  true;
  53     populate Clicked =  false;
  54     validSer viceLineCo lumn = tru e;
  55     payers:  PayerModel [] = [];
  56       userName =   AI ;
  57     title =  '277 Reque st for Add itional In formation' ;
  58     tabIdx =  '0';
  59     dateRang eError = f alse;
  60     // Getti ng referen ce of the  child comp onent
  61     @ViewChi ld('manual Codes')
  62     manualCo des: Reque stCodesCom ponent;
  63     @ViewChi ld('autoCo des')
  64     autoCode s: Request CodesCompo nent;
  65     @ViewChi ld('popula tedInfo')
  66     populate dInfo: Ele mentRef =  new Elemen tRef('');
  67     @ViewChi ld('linesD iv')
  68     linesDiv : ElementR ef = new E lementRef( '');
  69     construc tor(
  70       privat e fb: Form Builder,
  71       privat e rfaiSubm issionServ ice: RfaiS ubmissionS ervice,
  72       privat e authenti cationServ ice: Authe nticationS ervice,
  73       privat e appSetti ngsService : AppSetti ngsService ,
  74       privat e changeDe tectorRef:  ChangeDet ectorRef
  75     ) {}
  76  
  77     ngOnInit () {
  78       this.a ppSettings Service
  79         .get Menu('ARS_ MENU')
  80         .sub scribe(men u => (this .menu = me nu));
  81       this.g etCodes();
  82       this.f ormInit();
  83       this.g etUserData ();
  84       this.p opulatedIn fo.nativeE lement.sty le.display  = 'none';
  85     }
  86     validate Dates() {
  87       this.f ormSubscri ption.add( this.manua lForm.cont rols['serv iceToDate' ].valueCha nges.subsc ribe(v =>  {
  88         if ( this.manua lForm.get( 'serviceFr omDate').v alid &&
  89         this .manualFor m.get('ser viceToDate ').value & &
  90          thi s.manualFo rm.get('se rviceToDat e').value. length ===  10 &&
  91          thi s.manualFo rm.get('se rviceFromD ate').valu e &&
  92          thi s.manualFo rm.get('se rviceFromD ate').valu e.length = == 10
  93         ) {
  94           th is.datesVa lidator();
  95         }
  96       }));
  97       this.f ormSubscri ption.add( this.manua lForm.cont rols['serv iceFromDat e'].valueC hanges.sub scribe(v = > {
  98         if ( this.manua lForm.get( 'serviceFr omDate').v alid &&
  99         this .manualFor m.get('ser viceToDate ').valid & &
  100         this .manualFor m.get('ser viceToDate ').value & &
  101         this .manualFor m.get('ser viceToDate ').value.l ength ===  10 &&
  102         this .manualFor m.get('ser viceFromDa te').value  &&
  103         this .manualFor m.get('ser viceFromDa te').value .length == = 10
  104       ) {
  105           th is.datesVa lidator();
  106         }
  107       }));
  108     }
  109  
  110     getCodes () {
  111       this.s ubscriptio n.add(
  112         this .rfaiSubmi ssionServi ce.getHccs cCodes().s ubscribe(
  113           da ta => {
  114              this.healt hCareClaim StatusCode s = data;
  115           },
  116           er ror => {
  117              console.lo g('getCode s() getHcc scCodes()  ', error.e rror.messa ge);
  118           }
  119         )
  120       );
  121  
  122       this.s ubscriptio n.add(
  123         this .rfaiSubmi ssionServi ce.getPaye rs().subsc ribe(
  124           da ta => {
  125              this.payer s = data;
  126           },
  127           er ror => {
  128              console.lo g('getCode s() getPay ers() ', e rror.error .message);
  129           }
  130         )
  131       );
  132  
  133       this.s ubscriptio n.add(
  134         this .rfaiSubmi ssionServi ce.getLoin cCodes().s ubscribe(
  135           da ta => {
  136              this.loinc CodesClaim Level = da ta[0].clai mList;
  137              this.loinc CodesLineL evel = dat a[0].lineL ist;
  138           },
  139           er ror => {
  140              console.lo g('getCode s() getLoi ncCodes()  ', error.e rror.messa ge);
  141           }
  142         )
  143       );
  144  
  145       this.s ubscriptio n.add(
  146         this .rfaiSubmi ssionServi ce.getLoin cCodeModif iers().sub scribe(
  147           da ta => {
  148              this.loinc CodeModifi ers = data ;
  149           },
  150           er ror => {
  151              console.lo g(
  152                'getCode s() getLoi nCodeModif iers() ',
  153                error.er ror.messag e
  154              );
  155           }
  156         )
  157       );
  158     }
  159  
  160     getUserD ata() {
  161       const  userInfo =  this.auth entication Service.ge tDecodedUs erInfo();
  162       if (us erInfo.per missions.a dditionalI nformation ) {
  163         this .additiona lInfoPermi ssions =
  164           us erInfo.per missions.a dditionalI nformation ;
  165         this .disablePo pulateInfo  = !this.a dditionalI nfoPermiss ions[
  166           'p opulateInf o'
  167         ];
  168         this .disableSu bmitInfo =  !this.add itionalInf oPermissio ns['submit Info'];
  169       }
  170       this.u serName =  userInfo.u serName;
  171       this.r oles = use rInfo.user Roles;
  172     }
  173  
  174     formInit () {
  175       this.a utoFillfor m = this.f b.group({
  176         clai mId: [
  177           th is.autoFor mModel.cla imId,
  178           [V alidators. pattern('[ 0-9]*'), V alidators. required]
  179         ]
  180       });
  181  
  182       this.p repopulate Form = thi s.fb.group ({
  183         cont actInfo: [
  184           th is.autoFor mModel.con tactInform ation,
  185           [V alidators. required,  Validators .email]
  186         ],
  187         resp onseDueDat eAutoCalen dar: this. fb.group({
  188           re sponseDueD ateAuto: [
  189              '',
  190              [
  191                Validato rs.require d,
  192                // noPas tDatesVali dator,
  193                Validato rs.pattern (
  194                  '(0[1- 9]|1[012]) [/](0[1-9] |[12][0-9] |3[01])[/] (19|20)\\d \\d'
  195                )
  196              ]
  197           ]
  198         })
  199       });
  200  
  201       this.m anualForm  = this.fb. group({
  202         serv iceFromDat e: ['', [  Validators .required,  Validator s.pattern( '[0-9]{2}\ /[0-9]{2}\ /[0-9]{4}' )]],
  203         serv iceToDate:  ['', [Val idators.re quired, Va lidators.p attern('[0 -9]{2}\/[0 -9]{2}\/[0 -9]{4}')]] ,
  204         cont actInfo: [
  205           th is.manualF ormModel.c ontactInfo rmation,
  206           [V alidators. required,  Validators .email]
  207         ],
  208           re sponseDueD ateManual:  [
  209              '',
  210              [
  211                Validato rs.require d,
  212                // noPas tDatesVali dator,
  213                Validato rs.pattern (
  214                  '[0-9] {2}\/[0-9] {2}\/[0-9] {4}'
  215                )
  216              ]
  217           ],
  218         paye rID: [this .pdiInfoMo del.payerI d, [Valida tors.requi red]],
  219         paye rClaimCont rolNumber:  [
  220           th is.pdiInfo Model.paye rClaimCont rolNumber,
  221           [V alidators. pattern('[ 0-9]*'), V alidators. required]
  222         ],
  223         bill ingProvide r: [
  224           th is.pdiInfo Model.prov iderInform ation,
  225           Va lidators.r equired
  226         ],
  227         prov iderNpi: [
  228           th is.pdiInfo Model.prov iderNpi,
  229           [V alidators. pattern('[ 0-9]{10}') , Validato rs.require d]
  230         ],
  231         bill ingProvide rTIN: [
  232           th is.pdiInfo Model.prov iderTin,
  233           [V alidators. pattern('[ 0-9]{9}'),  Validator s.required ]
  234         ],
  235         last Name: [thi s.pdiInfoM odel.patie ntLastname , Validato rs.require d],
  236         firs tName: [th is.pdiInfo Model.pati entFirstNa me, Valida tors.requi red],
  237         pati entID: [
  238           th is.pdiInfo Model.pati entIdentif ier,
  239           [V alidators. pattern('[ 0-9]*'), V alidators. required]
  240         ],
  241         pati entControl Number: [
  242           th is.pdiInfo Model.pati entcontrol Number,
  243           [V alidators. pattern('[ 0-9]*'), V alidators. required]
  244         ],
  245         info rmationRec eiver: [
  246           th is.pdiInfo Model.info rmationRec eiver,
  247           Va lidators.r equired
  248         ],
  249         bill Type: [thi s.pdiInfoM odel.billT ype, Valid ators.requ ired],
  250         clea ringHouseI D: [
  251           th is.pdiInfo Model.clea ringHouseI d,
  252           [V alidators. pattern('[ 0-9]*'), V alidators. required]
  253         ],
  254         medi calRecordN umber: [
  255           th is.pdiInfo Model.medi calRecordN umber,
  256           [V alidators. pattern('[ 0-9]*'), V alidators. required]
  257         ],
  258         leve l: [this.p diInfoMode l.level, V alidators. required],
  259         line sFormArray : this.fb. array([
  260           th is.fb.grou p({
  261              serviceLin e: [''],
  262              lineServic eFrom: ['' ],
  263              lineServic eTo: [''],
  264              revenueCod e: [''],
  265              procedureC ode: [''],
  266              modifiers:  [''],
  267              chargeAmou nt: ['']
  268           })
  269         ])
  270       });
  271       this.l inesFormAr ray = this .manualFor m.get('lin esFormArra y') as For mArray;
  272       this.o nLineChang es();
  273  
  274       this.s ubscriptio n.add(
  275         this .manualFor m.get('lev el').value Changes.su bscribe(le vel => {
  276           if  (level == = 'C') {
  277              this.manua lForm.get( 'serviceFr omDate')
  278                .setVali dators([
  279                  Valida tors.requi red,
  280                  Valida tors.patte rn(
  281                    '(0[ 1-9]|1[012 ])[/](0[1- 9]|[12][0- 9]|3[01])[ /](19|20)\ \d\\d'
  282                  )
  283                ]);
  284              this.manua lForm.get( 'serviceTo Date')
  285                .setVali dators(
  286                  Valida tors.patte rn(
  287                    '(0[ 1-9]|1[012 ])[/](0[1- 9]|[12][0- 9]|3[01])[ /](19|20)\ \d\\d'
  288                  )
  289                );
  290              this.manua lForm.get( 'serviceFr omDate')
  291                .updateV alueAndVal idity();
  292              this.manua lForm.get( 'serviceTo Date')
  293                .updateV alueAndVal idity();
  294              this.lines FormArray. controls.f orEach(con trol => {
  295                control[ 'controls' ]['service Line'].cle arValidato rs();
  296                control[ 'controls' ]['lineSer viceFrom'] .clearVali dators();
  297                control[ 'controls' ]['lineSer viceTo'].c learValida tors();
  298                control[ 'controls' ]['revenue Code'].cle arValidato rs();
  299                control[ 'controls' ]['procedu reCode'].c learValida tors();
  300                control[ 'controls' ]['modifie rs'].clear Validators ();
  301                control[ 'controls' ]['chargeA mount'].cl earValidat ors();
  302              });
  303              this.lines FormArray. controls.f orEach(con trol => {
  304                control[ 'controls' ]['service Line'].upd ateValueAn dValidity( );
  305                control[ 'controls' ]['lineSer viceFrom'] .updateVal ueAndValid ity();
  306                control[ 'controls' ]['lineSer viceTo'].u pdateValue AndValidit y();
  307                control[ 'controls' ]['revenue Code'].upd ateValueAn dValidity( );
  308                control[ 'controls' ]['procedu reCode'].u pdateValue AndValidit y();
  309                control[ 'controls' ]['modifie rs'].updat eValueAndV alidity();
  310                control[ 'controls' ]['chargeA mount'].up dateValueA ndValidity ();
  311              });
  312           }  else {
  313              // line le vel
  314              this.manua lForm.get( 'serviceTo Date')
  315                .clearVa lidators() ;
  316              this.manua lForm.get( 'serviceFr omDate')
  317                .clearVa lidators() ;
  318              this.manua lForm.get( 'serviceFr omDate')
  319                .updateV alueAndVal idity();
  320              this.manua lForm.get( 'serviceTo Date')
  321                .updateV alueAndVal idity();
  322              this.lines FormArray. controls.f orEach(gro up => {
  323                group['c ontrols'][ 'serviceLi ne'].setVa lidators([
  324                  Valida tors.requi red,
  325                  Valida tors.patte rn('[0-9]* ')
  326                ]);
  327                group['c ontrols'][ 'lineServi ceFrom'].s etValidato rs([
  328                  Valida tors.requi red,
  329                  Valida tors.patte rn(
  330                    '(0[ 1-9]|1[012 ])[/](0[1- 9]|[12][0- 9]|3[01])[ /](19|20)\ \d\\d'
  331                  )
  332                ]);
  333                group['c ontrols'][ 'lineServi ceTo'].set Validators (
  334                  Valida tors.patte rn(
  335                    '(0[ 1-9]|1[012 ])[/](0[1- 9]|[12][0- 9]|3[01])[ /](19|20)\ \d\\d'
  336                  )
  337                );
  338                group['c ontrols'][ 'revenueCo de'].setVa lidators([
  339                  Valida tors.requi red
  340                ]);
  341                group['c ontrols'][ 'procedure Code'].set Validators ([
  342                  Valida tors.requi red
  343                ]);
  344                group['c ontrols'][ 'chargeAmo unt'].setV alidators( [
  345                  Valida tors.requi red,
  346                  Valida tors.patte rn('[0-9]{ 1,}[.]?[0- 9]*')
  347                ]);
  348              });
  349              this.lines FormArray. controls.f orEach(con trol => {
  350                control[ 'controls' ]['service Line'].upd ateValueAn dValidity( );
  351                control[ 'controls' ]['lineSer viceFrom'] .updateVal ueAndValid ity();
  352                control[ 'controls' ]['lineSer viceTo'].u pdateValue AndValidit y();
  353                control[ 'controls' ]['revenue Code'].upd ateValueAn dValidity( );
  354                control[ 'controls' ]['procedu reCode'].u pdateValue AndValidit y();
  355                control[ 'controls' ]['modifie rs'].updat eValueAndV alidity();
  356                control[ 'controls' ]['chargeA mount'].up dateValueA ndValidity ();
  357              });
  358           }
  359         })
  360       );
  361     }
  362  
  363     addLineR ow(): void  {
  364       this.l inesFormAr ray.push(
  365         this .fb.group( {
  366           se rviceLine:  ['', [Val idators.re quired, Va lidators.p attern('[0 -9]*')]],
  367           li neServiceF rom: [
  368              '',
  369              [
  370                Validato rs.require d,
  371                Validato rs.pattern (
  372                  '(0[1- 9]|1[012]) [/](0[1-9] |[12][0-9] |3[01])[/] (19|20)\\d \\d'
  373                )
  374              ]
  375           ],
  376           li neServiceT o: [
  377              '',
  378              [
  379                Validato rs.pattern (
  380                  '(0[1- 9]|1[012]) [/](0[1-9] |[12][0-9] |3[01])[/] (19|20)\\d \\d'
  381                )
  382              ]
  383           ],
  384           re venueCode:  ['', Vali dators.req uired],
  385           pr ocedureCod e: ['', Va lidators.r equired],
  386           //  Validator s.required  removed
  387           mo difiers: [ ''],
  388           ch argeAmount : ['', Val idators.re quired]
  389         })
  390       );
  391     }
  392  
  393     removeLi neRow(inde x: number)  {
  394       this.l inesFormAr ray.remove At(index);
  395     }
  396  
  397     onLineCh anges() {
  398       this.s ubscriptio n.add(
  399         this .manualFor m.get('lin esFormArra y').status Changes.su bscribe(st atus => {
  400           if  (
  401              this.lines FormArray. dirty &&
  402              this.manua lForm.get( 'linesForm Array').va lid
  403           )  {
  404              this.manua lLineIdArr ay = [];
  405              this.manua lForm.get( 'linesForm Array')['c ontrols']. forEach(co ntrol => {
  406                if (
  407                  this.m anualLineI dArray.ind exOf(
  408                    cont rol['contr ols']['ser viceLine'] .value
  409                  ) ===  -1
  410                ) {
  411                  this.m anualLineI dArray.pus h(
  412                    cont rol['contr ols']['ser viceLine'] .value
  413                  );
  414                }
  415              });
  416           }
  417         })
  418       );
  419     }
  420  
  421     onSubmit Prepopulat ed() {
  422       consol e.log('thi s.autoFill form', thi s.prepopul ateForm);
  423       this.p repopulate dInfo.resp onseDate =  this.prep opulateFor m.controls [
  424         'res ponseDueDa teAutoCale ndar'
  425       ].get( 'responseD ueDateAuto ').value;
  426       let rf aiInfoMode l: RfaiInf oModel = n ew RfaiInf oModel();
  427       rfaiIn foModel =  Object.ass ign(
  428         {},
  429         this .autoFormM odel,
  430         this .prepopula tedInfo
  431       );
  432       rfaiIn foModel.cl aimId = th is.autoFor mModel.cla imId
  433         ? +t his.autoFo rmModel.cl aimId
  434         : nu ll;
  435       const  formGroupA rray: Abst ractContro l[] = this .autoCodes ['codeList '][
  436         'con trols'
  437       ];
  438       rfaiIn foModel.su bmittedBy  = this.use rName;
  439       this.s ubmitData( rfaiInfoMo del, formG roupArray) ;
  440     }
  441  
  442     onSubmit Manual() {
  443       let rf aiInfoMode l: RfaiInf oModel = n ew RfaiInf oModel();
  444       const  indexEleme nt = this. payers.fin dIndex(
  445         paye r => payer .payerIden tifier ===  this.pdiI nfoModel.p ayerId
  446       );
  447       this.p diInfoMode l.payerNam e = this.p ayers[inde xElement]. payerIdent ifierDesc;
  448       if (th is.pdiInfo Model.leve l === 'C')  {
  449         this .pdiInfoMo del.servic eFromDate  = this.man ualForm.ge t('service FromDate') .value;
  450         this .pdiInfoMo del.servic eToDate =  this.manua lForm.get( 'serviceTo Date').val ue;
  451  
  452         this .pdiInfoMo del.rfaiLi neItemResp onse = [];
  453       } else  {
  454         this .lines = [ ];
  455         for  (const lin eFormGroup  of this.l inesFormAr ray.contro ls) {
  456           co nst eachTe mpLine: Li neModel =  new LineMo del();
  457           ea chTempLine .chargeAmo unt =
  458              lineFormGr oup['contr ols'].char geAmount.v alue;
  459           ea chTempLine .modifiers  = lineFor mGroup['co ntrols'].m odifiers.v alue;
  460           ea chTempLine .procedure Code =
  461              lineFormGr oup['contr ols'].proc edureCode. value;
  462           ea chTempLine .revenueCo de = lineF ormGroup[' controls'] .revenueCo de.value;
  463           ea chTempLine .serviceFr om =
  464              lineFormGr oup['contr ols'].line ServiceFro m.value;
  465           ea chTempLine .serviceLi neId =
  466              lineFormGr oup['contr ols'].serv iceLine.va lue;
  467           ea chTempLine .serviceTo  = lineFor mGroup['co ntrols'].l ineService To.value;
  468           ea chTempLine .selected  = true;
  469           th is.lines.p ush(eachTe mpLine);
  470         }
  471         cons t serviceS tartDateAr ray: Date[ ] = [];
  472         cons t serviceE ndDateArra y: Date[]  = [];
  473         for  (const lin e of this. lines) {
  474           co nst tempSt art = new  Date(line. serviceFro m);
  475           co nst tempEn d = new Da te(line.se rviceTo);
  476           te mpStart.se tHours(0,  0, 0, 0);
  477           te mpEnd.setH ours(0, 0,  0, 0);
  478           se rviceStart DateArray. push(tempS tart);
  479           se rviceEndDa teArray.pu sh(tempEnd );
  480         }
  481         serv iceStartDa teArray.so rt((a, b)  => {
  482           re turn a.get Time() - b .getTime() ;
  483         });
  484         serv iceEndDate Array.sort ((a, b) =>  {
  485           re turn a.get Time() - b .getTime() ;
  486         });
  487         let  temp = ser viceStartD ateArray[0 ];
  488         let  month =
  489           te mp.getMont h() > 9 ?  '' : '0' +  (temp.get Month() +  1).toStrin g();
  490         let  day = (tem p.getDate( ) > 9 ? ''  : '0') +  temp.getDa te().toStr ing();
  491         let  year = tem p.getFullY ear().toSt ring();
  492         this .pdiInfoMo del.servic eFromDate  = month +  '/' + day  + '/' + ye ar;
  493         temp  = service EndDateArr ay[service EndDateArr ay.length  - 1];
  494         mont h = temp.g etMonth()  > 9 ? '' :  '0' + (te mp.getMont h() + 1).t oString();
  495         day  = (temp.ge tDate() >  9 ? '' : ' 0') + temp .getDate() .toString( );
  496         year  = temp.ge tFullYear( ).toString ();
  497         this .pdiInfoMo del.servic eToDate =  month + '/ ' + day +  '/' + year ;
  498       }
  499       this.p diInfoMode l.response Date = thi s.manualFo rm.get('re sponseDueD ateManual' ).value;
  500       rfaiIn foModel =  Object.ass ign({}, th is.manualF ormModel,  this.pdiIn foModel);
  501       rfaiIn foModel.cl aimId = th is.manualF ormModel.c laimId
  502         ? +t his.manual FormModel. claimId
  503         : +r faiInfoMod el.payerCl aimControl Number;
  504       const  formGroupA rray: Abst ractContro l[] = this .manualCod es['codeLi st'][
  505         'con trols'
  506       ];
  507       rfaiIn foModel.rf aiLineItem Response =  this.line s;
  508       rfaiIn foModel.su bmittedBy  = this.use rName;
  509       this.s ubmitData( rfaiInfoMo del, formG roupArray) ;
  510     }
  511  
  512     submitDa ta(rfaiInf oModel: Rf aiInfoMode l, formGro upArray: A bstractCon trol[]) {
  513       rfaiIn foModel.co deAndLevel List = [];
  514       let li neNumberNa me = '';
  515       let lo incCodeNam e = '';
  516       for (c onst child formGroup  of formGro upArray) {
  517         line NumberName  = Object. keys(child formGroup[ 'controls' ])[4];
  518         loin cCodeName  = Object.k eys(childf ormGroup[' controls'] )[1];
  519         cons t code = n ew CodeAnd LevelModel ();
  520         code .claimStat us =
  521           ch ildformGro up['contro ls']['heal thCareClai mStatusCod e']['value '];
  522         code .loincCode  = childfo rmGroup['c ontrols'][ loincCodeN ame]['valu e'];
  523         code .loincCode Modifier1  =
  524           ch ildformGro up['contro ls']['loin cCodeModif ier1']['va lue'];
  525         code .loincCode Modifier2  =
  526           ch ildformGro up['contro ls']['loin cCodeModif ier2']['va lue'];
  527         code .lineNumbe r = childf ormGroup[' controls'] ['levelDro pDown']['v alue'];
  528         rfai InfoModel. codeAndLev elList.pus h(code);
  529       }
  530       let ar r: LineMod el[] = [];
  531       rfaiIn foModel.co deAndLevel List.forEa ch(code =>  {
  532         if ( +code.line Number !==  0) {
  533           ar r.push(
  534              ...rfaiInf oModel.rfa iLineItemR esponse.fi lter(
  535                line =>  line.servi ceLineId.t oString()  === code.l ineNumber
  536              )
  537           );
  538         }
  539       });
  540       arr =  arr.filter (
  541         (lin e, i, self ) =>
  542           i  === self.f indIndex(t  => t.serv iceLineId  === line.s erviceLine Id)
  543       );
  544  
  545       rfaiIn foModel.rf aiLineItem Response =  arr;
  546       this.s ubscriptio n.add(
  547         this .rfaiSubmi ssionServi ce.submitR fai(rfaiIn foModel).s ubscribe(
  548           da ta => {
  549              this.onRes etManual() ;
  550              this.onRes etPrepopul ated();
  551              this.succe ssMsg = '2 77 RFAI su ccessfully  submitted .';
  552              this.succe ssStatus =  true;
  553              this.error Status = f alse;
  554              setTimeout (() => {
  555                this.suc cessStatus  = false;
  556              }, 8000);
  557           },
  558           er ror => {
  559              this.error Status = t rue;
  560              this.succe ssStatus =  false;
  561              this.error Msg = 'An  error occu rred durin g 277 RFAI  submissio n.';
  562              setTimeout (() => {
  563                this.err orStatus =  false;
  564              }, 8000);
  565           }
  566         )
  567       );
  568     }
  569     // Commo n code to  be resette d on both  forms
  570     resetCom mon() {
  571       this.p diInfoMode l = new PD IInfoModel ();
  572       this.l ines = [ne w LineMode l()];
  573       this.e rrorStatus  = false;
  574       this.s uccessStat us = false ;
  575       this.e rrorMsg =  '';
  576       this.s uccessMsg  = '';
  577       this.p diInfoMode l.level =  'C';
  578       this.f ormInit();
  579       this.p opulateCli cked = fal se;
  580     }
  581  
  582     onResetP repopulate d() {
  583       this.p opulatedIn fo.nativeE lement.sty le.display  = 'none';
  584       this.a utoCodes.o nResetForm ();
  585       this.p repopulate dLineIdArr ay = [];
  586       this.a utoFormMod el = new R faiSubmiss ionRequest Model();
  587       this.r esetCommon ();
  588     }
  589  
  590     onResetM anual() {
  591       this.m anualCodes .onResetFo rm();
  592       this.m anualLineI dArray = [ ];
  593       this.m anualFormM odel = new  RfaiSubmi ssionReque stModel();
  594       // thi s.serviceF romDate.na tiveElemen t.value =  '';
  595       // thi s.serviceT oDate.nati veElement. value = '' ;
  596       // thi s.response DueDateMan ual.native Element.va lue = '';
  597       this.l inesDiv.na tiveElemen t.style.di splay = 'n one';
  598       this.r esetCommon ();
  599     }
  600  
  601     toggleLi nes() {
  602       if (th is.pdiInfo Model.leve l === 'L')  {
  603         this .linesDiv. nativeElem ent.style. display =  'block';
  604       } else  {
  605         this .linesDiv. nativeElem ent.style. display =  'none';
  606       }
  607     }
  608  
  609     checkPen ding(input : any, pop ulateClick ed: boolea n) {
  610       let cl aimId = 0;
  611       if (po pulateClic ked) {
  612         clai mId = inpu t;
  613       } else  {
  614         clai mId = inpu t.target.v alue;
  615       }
  616       if (!! claimId) {
  617         this .subscript ion.add(
  618           th is.rfaiSub missionSer vice.check Pending(cl aimId).sub scribe(dat a => {
  619              if (data.p endingSubm ission) {
  620                this.ope nWarningMo dal();
  621              }
  622           })
  623         );
  624       }
  625     }
  626     openWarn ingModal()  {
  627       this.w arningModa lClosed =  false;
  628       this.t abIdx = '- 1';
  629     }
  630     closeWar ningModal( ) {
  631       this.w arningModa lClosed =  true;
  632       this.t abIdx = th is.errorMo dalClosed  ? '0' : '- 1';
  633     }
  634     openErro rModal() {
  635       this.e rrorModalC losed = fa lse;
  636       this.t abIdx = '- 1';
  637     }
  638     closeErr orModal()  {
  639       this.e rrorModalC losed = tr ue;
  640       this.t abIdx = th is.warning ModalClose d ? '0' :  '-1';
  641     }
  642  
  643     cancel()  {
  644       this.c loseWarnin gModal();
  645       this.c loseErrorM odal();
  646       if (th is.populat eClicked)  {
  647         this .onResetPr epopulated ();
  648       } else  {
  649         this .onResetMa nual();
  650       }
  651     }
  652     populate Info() {
  653       this.p opulateCli cked = tru e;
  654       // thi s.response DueDateAut o.nativeEl ement.valu e = '';
  655       this.e rrorStatus  = false;
  656       this.e rrorMsg =  '';
  657       this.c heckPendin g(this.aut oFormModel .claimId,  this.popul ateClicked );
  658       this.s ubscriptio n.add(
  659         this .rfaiSubmi ssionServi ce
  660           .p opulateInf o(this.aut oFormModel .claimId)
  661           .s ubscribe(
  662              data => {
  663                this.err orStatus =  false;
  664                this.err orMsg = '' ;
  665                this.pop ulatedInfo .nativeEle ment.style .display =  'block';
  666                this.pre populatedI nfo = data ;
  667                for (con st item of  Object.ke ys(this.pr epopulated Info)) {
  668                  if (
  669                    this .prepopula tedInfo[it em] === nu ll &&
  670                    item  !== 'subm ittedBy' & &
  671                    item  !== 'rfai LineItemRe sponse'
  672                  ) {
  673                    this .disableSu bmitInfo =  true;
  674                    this .errorModa lClosed =  false;
  675                    brea k;
  676                  } else  if (item  === 'rfaiL ineItemRes ponse') {
  677                    this .prepopula tedInfo[it em].forEac h(line =>  {
  678                      fo r (const l ineItem of  Object.ke ys(this.li ne)) {
  679                         if (
  680                           line[lin eItem] ===  null &&
  681                           lineItem  !== 'modi fiers' &&
  682                           lineItem  !== 'serv iceTo'
  683                         ) {
  684                           this.dis ableSubmit Info = tru e;
  685                           this.err orModalClo sed = fals e;
  686                           break;
  687                         }
  688                      }
  689                    });
  690                  }
  691                }
  692                this.pre populatedI nfo.rfaiLi neItemResp onse
  693                  ? (thi s.prepopul atedInfo.l evel = 'L' )
  694                  : (thi s.prepopul atedInfo.l evel = 'C' );
  695                if (this .prepopula tedInfo.le vel === 'L ') {
  696                  this.p repopulate dLineIdArr ay = [];
  697                  this.p repopulate dInfo.rfai LineItemRe sponse.for Each(lineI nfo => {
  698                    this .prepopula tedLineIdA rray.push( lineInfo.s erviceLine Id);
  699                  });
  700                }
  701              },
  702              error => {
  703                this.pop ulatedInfo .nativeEle ment.style .display =  'none';
  704                this.err orMsg = er ror.error. message;
  705                this.err orStatus =  true;
  706                this.pre populatedI nfo = new  PDIInfoMod el();
  707              }
  708           )
  709       );
  710       consol e.log('thi s.errorMod alClosed',  this.erro rModalClos ed);
  711     }
  712  
  713     // assig nResponseD ueDateManu al() {
  714     //   thi s.manualFo rm.control s['respons eDueDateMa nualCalend ar'].get(' responseDu eDateManua l').setVal ue(this.re sponseDueD ateManual. nativeElem ent.value) ;
  715     // }
  716     // assig nResponseD ueDateAuto () {
  717     //   thi s.prepopul ateForm
  718     //     . get('respo nseDueDate Auto')
  719     //     . setValue(t his.respon seDueDateA uto.native Element.va lue);
  720     // }
  721  
  722     showErro r(columnNa me: string ): boolean  {
  723       for (c onst item  of this.ma nualForm.c ontrols['l inesFormAr ray']['con trols']) {
  724         if (
  725           it em['contro ls'][colum nName].tou ched &&
  726           it em['contro ls'][colum nName].inv alid
  727         ) {
  728           re turn true;
  729         }
  730       }
  731  
  732       return  false;
  733     }
  734     datesVal idator():  void {
  735       this.d ateRangeEr ror = fals e;
  736       if (
  737         this .manualFor m.get('ser viceFromDa te').value .length == = 10 &&
  738         this .manualFor m.get('ser viceToDate ').value.l ength ===  10
  739       ) {
  740         cons t fromDate  = new Dat e(this.man ualForm.ge t('service FromDate') .value);
  741         cons t toDate =  new Date( this.manua lForm.get( 'serviceTo Date').val ue);
  742         if ( toDate.val ueOf() < f romDate.va lueOf()) {
  743           th is.dateRan geError =  true;
  744           th is.manualF orm.get('s erviceFrom Date').set Value('');
  745           th is.manualF orm.get('s erviceToDa te').setVa lue('');
  746           th is.changeD etectorRef .detectCha nges();
  747         } el se {
  748         this .dateRange Error = fa lse;
  749         }
  750       }
  751     }
  752  
  753     ngOnDest roy() {
  754       this.s ubscriptio n.unsubscr ibe();
  755       this.f ormSubscri ption.unsu bscribe();
  756       this.r esetChild  = false;
  757     }
  758   }