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\ui-components\form\validation\validation-summary | validation-summary.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\ui-components\form\validation\validation-summary | validation-summary.js | Fri Dec 7 13:50:26 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 11 | 372 |
| Changed | 10 | 22 |
| 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'], fun ction (ang ular, app) { | |
| 2 | 'u se strict' ; | |
| 3 | ||
| 4 | ap p.directiv e('validat ionSummary ', functio n($q, $tim eout, focu sService) { | |
| 5 | retu rn { | |
| 6 | restri ct: 'A', | |
| 7 | transc lude: true , | |
| 8 | link: function(s cope, elem , attr, ct rl, transc lude) { | |
| 9 | elem.app end(transc lude()); | |
| 10 | var pare ntForm = a ngular.ele ment(elem. closest('f orm')[0]); | |
| 11 | var f DNS troller = parentForm .controlle r('form'); | |
| 12 | var $for mElement = elem; | |
| 13 | ||
| 14 | func tion prett ify(str) { | |
| 15 | return str .replace(/ (-|^)([^-] ?)/g, func tion(_, pr ep, letter ) { | |
| 16 | return (prep.toL owerCase() && ' ') + letter.to UpperCase( ); | |
| 17 | }); | |
| 18 | } | |
| 19 | ||
| 20 | // g et label t ext for mo delControl ler withou t * requir ed asteris k | |
| 21 | var getL abelTextFo r = functi on(modelCo ntroller) { | |
| 22 | var target ElementNam e = modelC ontroller. $name; | |
| 23 | var labelT ext; | |
| 24 | ||
| 25 | if (!!targ etElementN ame && tar getElement Name.trim( ).length > 0) { | |
| 26 | var $t argetEleme nt = $form Element.fi nd('[name= "' + model Controller .$name + ' "]'); | |
| 27 | ||
| 28 | var $l abel = $fo rmElement. find('labe l[for="' + $targetEl ement.attr ('id') + ' "]'); | |
| 29 | ||
| 30 | if (!! $label) { | |
| 31 | la belText = $label.con tents().fi lter(funct ion(){ | |
| 32 | return t his.nodeTy pe === 3; | |
| 33 | }) [0].nodeVa lue; | |
| 34 | } | |
| 35 | } | |
| 36 | ||
| 37 | return lab elText; | |
| 38 | }; | |
| 39 | ||
| 40 | var getPrettyE lementName = functio n(modelCon troller) { | |
| 41 | var target ElementNam e = modelC ontroller. $name; | |
| 42 | var labelT ext; | |
| 43 | ||
| 44 | if (!!targ etElementN ame && tar getElement Name.trim( ).length > 0) { | |
| 45 | var $t argetEleme nt = $form Element.fi nd('[name= "' + model Controller .$name + ' "]'); | |
| 46 | la belText = prettify($ targetElem ent.attr(' name').toL owerCase() ); | |
| 47 | } | |
| 48 | ||
| 49 | return lab elText; | |
| 50 | }; | |
| 51 | ||
| 52 | function arrayCont ainsElemen t(array, c ontroller) { | |
| 53 | for(var co ntrollerIn dex in arr ay) { | |
| 54 | va r arrayCon troller = array[cont rollerInde x]; | |
| 55 | if (arrayCont roller.$na me == cont roller.$na me) { | |
| 56 | retu rn true; | |
| 57 | } | |
| 58 | } | |
| 59 | return fal se; | |
| 60 | } | |
| 61 | ||
| 62 | f DNS troller.va lidationSu mmary = {} ; | |
| 63 | f DNS troller.va lidationSu mmary.vali date = fun ction(erro rGroup) { | |
| 64 | //make sur e a digest loop has run to upd ate form v alidation | |
| 65 | var defer = $q.defer (); | |
| 66 | $timeout(f unction(){ | |
| 67 | sc ope.errors = errorGr oup || []; | |
| 68 | sc ope.contro llers = [] ; | |
| 69 | ||
| 70 | // Collect th e controll ers; don't add the s ame contro ller twice | |
| 71 | var allErr ors = f DNS troller.$e rror; | |
| 72 | if (allErrors ) { | |
| 73 | for( var errorI ndex in al lErrors) { | |
| 74 | var er ror = allE rrors[erro rIndex]; | |
| 75 | for(va r controll erIndex in error) { | |
| 76 | var cont roller = e rror[contr ollerIndex ]; | |
| 77 | if(contr oller.erro rHandling && !arrayC ontainsEle ment(scope .controlle rs, contro ller)) { | |
| 78 | scope.cont rollers = scope.cont rollers.co ncat(contr oller); | |
| 79 | } | |
| 80 | } | |
| 81 | } | |
| 82 | } | |
| 83 | ||
| 84 | // Choose the highest p riority er ror | |
| 85 | fo r(var cont rollerInde x in scope .controlle rs) { | |
| 86 | var controller = scope.c ontrollers [controlle rIndex]; | |
| 87 | for( var priori ty = 1; pr iority < O bject.keys (controlle r.errorHan dling).len gth + 1; p riority++) { | |
| 88 | var fo und = fals e; | |
| 89 | for(va r errorInd ex in cont roller.err orHandling ) { | |
| 90 | var erro r = contro ller.error Handling[e rrorIndex] ; | |
| 91 | if(error.p riority == priority && f DNS troller[co ntroller.$ name].$err or[errorIn dex] == tr ue) { | |
| 92 | scope.erro rs.push(er ror.messag e); | |
| 93 | found = tr ue; | |
| 94 | break; | |
| 95 | } | |
| 96 | } | |
| 97 | if(fou nd) { | |
| 98 | break; | |
| 99 | } | |
| 100 | } | |
| 101 | } | |
| 102 | ||
| 103 | if (scope.err ors.length !== 0){ | |
| 104 | focu sService.f ocusElemen t('.valida tion-summa ry h5'); | |
| 105 | defe r.reject() ; | |
| 106 | } else { | |
| 107 | defe r.resolve( ); | |
| 108 | } | |
| 109 | }); | |
| 110 | ||
| 111 | return def er.promise ; | |
| 112 | }; | |
| 113 | ||
| 114 | f DNS troller.va lidationSu mmary.requ iredValida te = funct ion(errorG roup) { | |
| 115 | //make sur e a digest loop has run to upd ate form v alidation | |
| 116 | var defer = $q.defer (); | |
| 117 | $timeout(f unction(){ | |
| 118 | sc ope.errors = errorGr oup || []; | |
| 119 | ||
| 120 | var requir edModelCon trollers = f DNS troller.$e rror.requi red; | |
| 121 | ||
| 122 | if (!_.isUnd efined(req uiredModel Controller s)) { | |
| 123 | requ iredModelC ontrollers .forEach(f unction(mo delControl ler) { | |
| 124 | var la belText = getLabelTe xtFor(mode lControlle r); | |
| 125 | if (!! labelText && labelTe xt.trim(). length > 0 ) { | |
| 126 | scop e.errors.p ush(labelT ext + ' fi eld is req uired'); | |
| 127 | } else { | |
| 128 | labe lText = ge tPrettyEle mentName(m odelContro ller); | |
| 129 | if ( !!labelTex t && label Text.trim( ).length > 0) { | |
| 130 | scope.erro rs.push(la belText + ' is requ ired'); | |
| 131 | } | |
| 132 | } | |
| 133 | }); | |
| 134 | } | |
| 135 | ||
| 136 | if (scope.err ors.length !== 0){ | |
| 137 | focu sService.f ocusElemen t('.valida tion-summa ry h5'); | |
| 138 | defe r.reject() ; | |
| 139 | } else { | |
| 140 | defe r.resolve( ); | |
| 141 | } | |
| 142 | }); | |
| 143 | ||
| 144 | return def er.promise ; | |
| 145 | }; | |
| 146 | ||
| 147 | f DNS troller.va lidationSu mmary.summ arizeAsync = functio n(promises ) { | |
| 148 | scope.erro rs = []; | |
| 149 | ||
| 150 | $q.all(pro mises).the n( | |
| 151 | fu nction() { }, | |
| 152 | fu nction(pro mise) { | |
| 153 | var errors = p romise.dat a; | |
| 154 | func tion appen dErrorsToS ummary(req uestErrors ){ | |
| 155 | reques tErrors.er rors.forEa ch(functio n(error) { | |
| 156 | if (angu lar.isDefi ned(error. errorMessa ge)) { | |
| 157 | scope.erro rs.push(er ror.errorM essage); | |
| 158 | } | |
| 159 | }); | |
| 160 | } | |
| 161 | if ( errors && typeof err ors !== "s tring") { | |
| 162 | if(Arr ay.isArray (errors)) { | |
| 163 | errors.f orEach(fun ction(requ estErrors) { | |
| 164 | appendErro rsToSummar y(requestE rrors); | |
| 165 | }); | |
| 166 | } else if(errors ["objectTy pe"] === " Validation Errors" || errors["o bjectType" ] === "Loc alValidati onErrors") { | |
| 167 | appendEr rorsToSumm ary(errors ); | |
| 168 | } else { | |
| 169 | for(var key in err ors) { | |
| 170 | if(errors. hasOwnProp erty(key)) { | |
| 171 | ap pendErrors ToSummary( errors[key ]); | |
| 172 | } | |
| 173 | } | |
| 174 | } | |
| 175 | ||
| 176 | focusS ervice.foc usElement( '.validati on-summary h5'); | |
| 177 | } | |
| 178 | }) ; | |
| 179 | ||
| 180 | }; | |
| 181 | ||
| 182 | f DNS troller.va lidationSu mmary.push Error = fu nction(err or) { | |
| 183 | scope.erro rs.push(er ror); | |
| 184 | }; | |
| 185 | ||
| 186 | f DNS troller.va lidationSu mmary.clea r = functi on() { | |
| 187 | scope.erro rs = []; | |
| 188 | }; | |
| 189 | ||
| 190 | f DNS troller.va lidationSu mmary.hasE rror = fun ction() { | |
| 191 | return !!s cope.error s && scope .errors.le ngth > 0; | |
| 192 | }; | |
| 193 | }, | |
| 194 | templa teUrl: 'sr c/ui-compo nents/form /validatio n/validati on-summary /validatio n-summary_ template.h tml' | |
| 195 | }; | |
| 196 | }) ; | |
| 197 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.