Produced by Araxis Merge on 12/7/2018 11:36:22 AM Central Standard 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\SCRUB\MHED\MHED\VATS 2.3.0\var-utility-web-2.3.0@19406cb7810\app\src\modules\var-utility\pages\requests | requests_controller.js | Thu Sep 13 18:55:48 2018 UTC |
| 2 | C:\MHED-scrubbed\MHED\MHED\VATS 2.3.0\var-utility-web-2.3.0@19406cb7810\app\src\modules\var-utility\pages\requests | requests_controller.js | Fri Dec 7 13:49:56 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 10 | 448 |
| Changed | 9 | 32 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | define(['a ngular', ' app', 'Req uestsServi ce', 'mome nt', 'VarU tilityCons tants'], f unction (a ngular, ap p) { | |
| 2 | 'u se strict' ; | |
| 3 | ap p.controll er('Reques tsControll er', funct ion ($scop e, $http, $q, | |
| 4 | Requ estsServic e, focusSe rvice, con nectionErr orService, modalServ ice, forma tter, requ estsConsta nts, activ eInstituti on) { | |
| 5 | focu sService.f ocusMain() ; | |
| 6 | $sco pe.formatt er = forma tter; | |
| 7 | $sco pe.today = new Date( ); | |
| 8 | $sco pe.institu tion = act iveInstitu tion.divis ionName; | |
| 9 | ||
| 10 | $sco pe.support edMenu = [ | |
| 11 | {value : 'No', re sponse: 'Y es - Any V eteran'}, | |
| 12 | {value : 'Yes', r esponse: ' Yes - Base d Upon Tim e Frame'} | |
| 13 | ]; | |
| 14 | ||
| 15 | $sco pe.lastSee nMenu = [ | |
| 16 | {value : 730, day s: '24 mon ths (730 d ays)'}, | |
| 17 | {value : 365, day s: '12 mon ths (365 d ays)'} | |
| 18 | ]; | |
| 19 | ||
| 20 | $sco pe.request = $scope. lastSavedR equest = { }; | |
| 21 | ||
| 22 | func tion saveC urrentStat e() { | |
| 23 | $scope.l astSavedRe quest = an gular.copy ($scope.re quest); | |
| 24 | $scope.l astSavedEx pressCare = angular. copy($scop e.expressC are); | |
| 25 | } | |
| 26 | ||
| 27 | fu nction con figureCust omSettings () { | |
| 28 | $scope.e xpressCare = _.find( $scope.req uest.custo mRequestSe ttings, fu nction (se tting) { | |
| 29 | retu rn setting .id === re questsCons tants.EXPR ESS_CARE_I D; | |
| 30 | }); | |
| 31 | ||
| 32 | if (!_.i sEmpty($sc ope.expres sCare)) { | |
| 33 | if ( $scope.exp ressCare.e nterpriseS ubmittedRe questLimit === undef ined || | |
| 34 | $scope.exp ressCare.e nterpriseS ubmittedRe questLimit === null || | |
| 35 | $scope.exp ressCare.e nterpriseS ubmittedRe questLimit === 0) { | |
| 36 | $scope.exp ressCare.s upported = false; | |
| 37 | $scope.exp ressCare.e nterpriseS ubmittedRe questLimit = 0; | |
| 38 | $scope.ent erpriseSub mittedRequ estLimitZe ro = true; | |
| 39 | } el se { | |
| 40 | $scope.max CustomSett ingsSubmit tedRequest Menu = bui ldMaxSubmi ttedReques tMenu($sco pe.express Care.enter priseSubmi ttedReques tLimit); | |
| 41 | } | |
| 42 | } | |
| 43 | } | |
| 44 | ||
| 45 | Requ estsServic e.fetch(ac tiveInstit ution.chil dName).the n(function (response) { | |
| 46 | if(res ponse.stat us !== 200 ) { | |
| 47 | return c onnectionE rrorServic e.showServ erErrorMsg (response) ; | |
| 48 | } | |
| 49 | ||
| 50 | // upd ate reques t model | |
| 51 | $scope.r equest = r esponse.da ta; | |
| 52 | ||
| 53 | configur eCustomSet tings(); | |
| 54 | ||
| 55 | // updat e form sta te | |
| 56 | saveCurr entState() ; | |
| 57 | ||
| 58 | $scope .maxSubmit tedRequest Menu = (fu nction() { | |
| 59 | var maxS ubmittedRe questLimit s = []; | |
| 60 | for (var i = 0; i < $scope.r equest.req uestSettin gs.length; i++) { | |
| 61 | if ($scope .request.r equestSett ings[i].en terpriseSu bmittedReq uestLimit === 0) { | |
| 62 | se tModelForD isabled(i) ; | |
| 63 | } else { | |
| 64 | if ($scope.r equest.req uestSettin gs[i].subm ittedReque stLimit > $scope.req uest.reque stSettings [i].enterp riseSubmit tedRequest Limit) { | |
| 65 | $sco pe.request .requestSe ttings[i]. submittedR equestLimi t = $scope .request.r equestSett ings[i].en terpriseSu bmittedReq uestLimit; | |
| 66 | $sco pe.lastSav edRequest. requestSet tings[i].s ubmittedRe questLimit = $scope. request.re questSetti ngs[i].ent erpriseSub mittedRequ estLimit; | |
| 67 | } | |
| 68 | ma xSubmitted RequestLim its.push($ scope.requ est.reques tSettings[ i].enterpr iseSubmitt edRequestL imit); | |
| 69 | } | |
| 70 | } | |
| 71 | var larg est = Math .max.apply (null, max SubmittedR equestLimi ts); | |
| 72 | return b uildMaxSub mittedRequ estMenu(la rgest); | |
| 73 | })(); | |
| 74 | }); | |
| 75 | ||
| 76 | var modalOptio ns = { | |
| 77 | action ButtonText : 'OK', | |
| 78 | header Text: 'Con firmation' , | |
| 79 | bodyTe xt: 'The R equest set tings have been save d.' | |
| 80 | }; | |
| 81 | ||
| 82 | $sco pe.$watch( 'expressCa re.support ed', funct ion (newVa l, oldVal) { | |
| 83 | if ($s cope.expre ssCare && !newVal) { | |
| 84 | _.ea ch($scope. expressCar e.scheduli ngDays, fu nction (da ilySchedul e) { | |
| 85 | dailySched ule.canSch edule = fa lse; | |
| 86 | dailySched ule.startT ime = ''; | |
| 87 | dailySched ule.endTim e = ''; | |
| 88 | }); | |
| 89 | } | |
| 90 | ||
| 91 | if (ol dVal === f alse && ne wVal === t rue) { | |
| 92 | $sco pe.express Care.submi ttedReques tLimit = $ scope.expr essCare.en terpriseSu bmittedReq uestLimit; | |
| 93 | } | |
| 94 | }, t rue); | |
| 95 | ||
| 96 | fu nction cap italize(in put) { | |
| 97 | return i nput.charA t(0).toUpp erCase() + input.sub str(1).toL owerCase() ; | |
| 98 | } | |
| 99 | ||
| 100 | fu nction isI nValidTime Format(inp ut) { | |
| 101 | return /^(\d{2}) \:(\d{2})$ /.test(inp ut); | |
| 102 | } | |
| 103 | ||
| 104 | $s cope.save = function (e){ | |
| 105 | var f DNS troller = this.reque stForm; | |
| 106 | f DNS troller.$s etSubmitte d(); | |
| 107 | ||
| 108 | if (!_.i sEmpty($sc ope.expres sCare) && $scope.exp ressCare.s upported) { | |
| 109 | var errorGroup = []; | |
| 110 | var numOfActiv eDailySche dule = 0; | |
| 111 | _.ea ch($scope. expressCar e.scheduli ngDays, fu nction (da ilySchedul e) { | |
| 112 | if (dailyS chedule.ca nSchedule) { | |
| 113 | ++numO fActiveDai lySchedule ; | |
| 114 | var re adyToCheck TimeRange = true; | |
| 115 | if (!! dailySched ule.startT ime && !is InValidTim eFormat(da ilySchedul e.startTim e)) { | |
| 116 | erro rGroup.pus h(capitali ze(dailySc hedule.day ) + ' Star t Time mus t be forma tted hh:mm .'); | |
| 117 | re adyToCheck TimeRange = false; | |
| 118 | // f DNS troller[da ilySchedul e.day + '- start-time '].$setVal idity('pat tern', fal se); | |
| 119 | } | |
| 120 | ||
| 121 | if (!! dailySched ule.endTim e && !isIn ValidTimeF ormat(dail ySchedule. endTime)) { | |
| 122 | er rorGroup.p ush(capita lize(daily Schedule.d ay) + ' En d Time mus t be forma tted hh:mm .'); | |
| 123 | re adyToCheck TimeRange = false; | |
| 124 | // f DNS troller[da ilySchedul e.day + '- end-time'] .$setValid ity('patte rn', false ); | |
| 125 | } | |
| 126 | ||
| 127 | if (re adyToCheck TimeRange && !!daily Schedule.s tartTime & & !! daily Schedule.e ndTime) { | |
| 128 | // c heck the t ime range | |
| 129 | var startDate = new Date ("12/12/12 12 " + dai lySchedule .startTime ); | |
| 130 | var endDate = new Date(" 12/12/1212 " + daily Schedule.e ndTime); | |
| 131 | ||
| 132 | if ( startDate >= endDate ) { | |
| 133 | errorG roup.push( capitalize (dailySche dule.day) + ' Start time must be before End Time.' ); | |
| 134 | // f DNS troller[da ilySchedul e.day + '- start-time '].$setVal idity('pat tern', fal se); | |
| 135 | } | |
| 136 | } | |
| 137 | } | |
| 138 | }); | |
| 139 | ||
| 140 | if ( numOfActiv eDailySche dule === 0 ) { | |
| 141 | errorGroup .push('At least one day must b e selected to suppor t an ' + $ scope.expr essCare.ty peOfCare + ' request .'); | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | f DNS troller.va lidationSu mmary.requ iredValida te(errorGr oup).then( function() { | |
| 146 | if (f DNS troller.va lidationSu mmary.hasE rror()) { | |
| 147 | focusServi ce.focusEl ement('.va lidation-s ummary h5' ); | |
| 148 | return; | |
| 149 | } | |
| 150 | ||
| 151 | var http RequestPro mise = Req uestsServi ce.save($s cope.reque st,activeI nstitution .childName ).then(fun ction(resp onse){ | |
| 152 | // update request mo del | |
| 153 | $scope.req uest = res ponse.data ; | |
| 154 | ||
| 155 | f DNS troller.$s etPristine (); | |
| 156 | f DNS troller.va lidationSu mmary.clea r(); | |
| 157 | ||
| 158 | configureC ustomSetti ngs(); | |
| 159 | ||
| 160 | // update form state | |
| 161 | saveCurren tState(); | |
| 162 | ||
| 163 | // show co nfirmation modal | |
| 164 | modalServi ce.showMod al({}, mod alOptions) .then(func tion () { | |
| 165 | fo cusService .focusPrim ary(); | |
| 166 | }); | |
| 167 | }); | |
| 168 | ||
| 169 | f DNS troller.va lidationSu mmary.summ arizeAsync ([httpRequ estPromise ]); | |
| 170 | }); | |
| 171 | }; | |
| 172 | ||
| 173 | $sco pe.resetTy peOfCare = function( ){ | |
| 174 | var f DNS troller = this.reque stForm; | |
| 175 | f DNS troller.va lidationSu mmary.clea r(); | |
| 176 | f DNS troller.$s etPristine (); | |
| 177 | $scope .request = angular.c opy($scope .lastSaved Request); | |
| 178 | ||
| 179 | _.find($ scope.requ est.reques tSettings, function( setting, i ndex) { | |
| 180 | if ( setting.id === 'CR1' ) { | |
| 181 | $scope.req uest.reque stSettings [index] = angular.co py($scope. lastSavedE xpressCare ); | |
| 182 | return tru e; | |
| 183 | } | |
| 184 | retu rn false; | |
| 185 | }); | |
| 186 | }; | |
| 187 | ||
| 188 | $s cope.reset ExpressCar e = functi on(){ | |
| 189 | var f DNS troller = this.reque stForm; | |
| 190 | f DNS troller.va lidationSu mmary.clea r(); | |
| 191 | f DNS troller.$s etPristine (); | |
| 192 | $scope.e xpressCare = angular .copy($sco pe.lastSav edExpressC are); | |
| 193 | ||
| 194 | _.find ($scope.re quest.cust omRequestS ettings, f unction(se tting, ind ex) { | |
| 195 | if ( setting.id === 'CR1' ) { | |
| 196 | $scope.req uest.custo mRequestSe ttings[ind ex] = $sco pe.express Care; | |
| 197 | return tru e; | |
| 198 | } | |
| 199 | return f alse; | |
| 200 | }); | |
| 201 | }; | |
| 202 | ||
| 203 | $sco pe.isDisab led = func tion(value ) { | |
| 204 | return value === 0; | |
| 205 | }; | |
| 206 | ||
| 207 | func tion setMo delForDisa bled(index ) { | |
| 208 | $scope .request.r equestSett ings[index ].patientH istoryRequ ired = ''; | |
| 209 | $scope .request.r equestSett ings[index ].submitte dRequestLi mit = 0; | |
| 210 | } | |
| 211 | ||
| 212 | func tion build MaxSubmitt edRequestM enu(number ) { | |
| 213 | var li mits = []; | |
| 214 | build( number); | |
| 215 | functi on build(n umber) { | |
| 216 | if (numb er > 0) { | |
| 217 | limits.pus h({value: number, ma x: number} ); | |
| 218 | return bui ld(number - 1); | |
| 219 | } else { | |
| 220 | return num ber; | |
| 221 | } | |
| 222 | } | |
| 223 | return limits.re verse(); | |
| 224 | } | |
| 225 | ||
| 226 | $sco pe.constru ctFieldNam e = functi on(day) { | |
| 227 | return (formatte r.toDashCa se($scope. expressCar e.typeOfCa re) + '-' + day); | |
| 228 | } | |
| 229 | }) ; | |
| 230 | ||
| 231 | app.co ntroller(' Scheduling DaysContro ller', fun ction ($sc ope, $cont roller) { | |
| 232 | // $controll er('Reques tsControll er', { $sc ope: $scop e }); | |
| 233 | $s cope.$watc h('schedul ingDay.can Schedule', function (newVal, o ldVal) { | |
| 234 | if (oldV al === tru e && newVa l === fals e) { | |
| 235 | $sco pe.schedul ingDay.sta rtTime = " "; | |
| 236 | $sco pe.schedul ingDay.end Time = ""; | |
| 237 | } | |
| 238 | }) | |
| 239 | }); | |
| 240 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.