18 define(
"FEATURE_LIMIT_MAX_VALUE",
"Set to No Limit");
19 define(
"FEATURE_LIMIT_MIN_VALUE",
"Set to 0");
23 <style type=
"text/css">
25 .local-hcu-container-margin {
29 .local-hcu-no-padding {
33 .local-hcu-full-width {
37 .local-hcu-half-width {
41 .local-hcu-quarter-width {
49 .local-hcu-max-width {
58 .local-hcu-nowrap br {
67 <!-- GRID ROW TEMPLATE -->
68 <script type=
"text/x-kendo-template" id=
"templateGridRow">
69 <tr
class=
"k-master-row">
71 <td><span
class=
"fa fa-plus" style=
"background-color: transparent;"></span></td>
72 <td colspan=
"2">Add New Limit</td>
74 <td><input type=
"checkbox" class=
"feature-checkbox" id=
"chk_#=fCode#"></td>
76 <span
class=
"local-hcu-nowrap">#= fDesc #</span>
79 <span
class=
"local-hcu-nowrap">
80 # if (fType == "B" || fType == "D") { # 81 # if (fApt >= FEATURE_LIMIT_MAX_AMOUNT || fApt == null) { # 82 Amount per transaction: No Limit, <br>
84 Amount per transaction: #= kendo.toString(fApt,
"c2") #, <br>
87 # if (fApa >= FEATURE_LIMIT_MAX_AMOUNT || fApa == null) { # 88 Amount per account per day: No Limit, <br>
90 Amount per account per day: #= kendo.toString(fApa,
"c2") #, <br>
93 # if (fApd >= FEATURE_LIMIT_MAX_AMOUNT || fApd == null) { # 94 Amount per day: No Limit, <br>
96 Amount per day: #= kendo.toString(fApd,
"c2") #, <br>
99 # if (fApm >= FEATURE_LIMIT_MAX_AMOUNT || fApm == null) { # 100 Amount per month: No Limit, <br>
102 Amount per month: #= kendo.toString(fApm,
"c2") #, <br>
106 # if (fType == "B" || fType == "Q") { # 107 # if (fCpa >= FEATURE_LIMIT_MAX_COUNT || fCpa == null) { # 108 Count per account per day: No Limit, <br>
110 Count per account per day: #= kendo.toString(fCpa,
"n0") #, <br>
113 # if (fCpd >= FEATURE_LIMIT_MAX_COUNT || fCpd == null) { # 114 Count per day: No Limit, <br>
116 Count per day: #= kendo.toString(fCpd,
"n0") #, <br>
119 # if (fCpm >= FEATURE_LIMIT_MAX_COUNT || fCpm == null) { # 120 Count per month: No Limit, <br>
122 Count per month: #= kendo.toString(fCpm,
"n0") #, <br>
126 # if (fType == "A") { # 130 # if (fType == "B" || fType == "D" ) { # 132 Confirmation Required: Yes
134 Confirmation Required: No
144 <!-- HTML CONTENT -->
145 <div
class=
"container-fluid">
148 <div
class=
"well well-sm col-sm-12 local-hcu-container-margin" id=
"profileView" style=
"max-width: 768px;">
150 <div
class=
"col-sm-12 local-hcu-no-padding">
154 <div
class=
"col-sm-9 local-hcu-no-padding">
156 <div
class=
"col-sm-6 local-hcu-container-margin">
157 <label> </label>
159 <input
class=
"local-hcu-full-width" id=
"inpProfileList" name=
"inpProfileList">
162 <div
class=
"col-sm-6 local-hcu-container-margin">
163 <label>Profile Code</label>
164 <input
class=
"local-hcu-full-width k-textbox" id=
"inpProfileCode" name=
"inpProfileCode" maxlength=
"20" 165 data-pcode=
"#inpProfileCode" 166 data-pcode-msg=
"Profile Code already exists" 167 data-required-msg=
"Profile Code is required" 171 <div
class=
"col-sm-12">
172 <label>Profile Description</label>
173 <input
class=
"local-hcu-full-width k-textbox" id=
"inpProfileDesc" name=
"inpProfileDesc" maxlength=
"255" 174 data-required-msg=
"Profile Description is required" 179 <div
class=
"col-sm-3 local-hcu-no-padding">
181 <div
class=
"col-sm-12 local-hcu-container-margin">
182 <label> </label>
183 <button
class=
"local-hcu-full-width k-button k-primary" id=
"btnProfileSave">
184 <span
class=
"fa fa-check"></span>
185 <span> Save</span>
189 <div
class=
"col-sm-12">
190 <label> </label>
191 <button
class=
"local-hcu-full-width k-button" id=
"btnProfileDelete">
192 <span
class=
"fa fa-times"></span>
193 <span> Delete</span>
199 <div
class=
"well well-sm col-sm-12 local-hcu-container-margin" style=
"max-width: 768px;">
202 <div
class=
"col-sm-12 local-hcu-no-padding">
203 <h3>Profile Features</h3>
206 <div
class=
"col-sm-3 local-hcu-container-margin">
207 <button
class=
"local-hcu-full-width k-button" id=
"btnLimitDelete">
208 <span
class=
"fa fa-times"></span>
209 <span> Delete</span>
213 <div
class=
"col-sm-3 local-hcu-container-margin">
214 <button
class=
"local-hcu-full-width k-button" id=
"btnLimitExpand">
215 <span
class=
"fa fa-expand"></span>
216 <span> Expand All</span>
220 <div
class=
"col-sm-12 local-hcu-container-margin">
221 <div
class=
"" id=
"grdProfileLimits"></div>
226 <div
class=
"local-hcu-hidden" id=
"wndProfileLimit">
229 <input
id=
"drpCodes" name=
"drpCodes" class=
"" style=
"min-width: 25%; width: auto;" 230 data-role=
"dropdownlist" 231 data-text-field=
"fDesc" 232 data-value-field=
"fCode" 233 data-bind=
"source: sourceFeatures, 235 value: sourceLimit.eCode, 236 events: { change: changeFeature }" 240 <br data-bind=
"visible: showDrop">
242 <div
class=
"well well-sm" id=
"viewAmount" data-bind=
"visible: showAmount">
244 <div
class=
"col-sm-12 local-hcu-no-padding">
245 <h3>Amount Limits Per</h3><br>
248 <div
class=
"col-sm-3">
250 <label><i>Transaction</i></label>
251 <span
class=
"k-invalid-msg" data-
for=
"inpApt"></span>
254 <input
class=
"local-hcu-full-width" id=
"inpApt" name=
"inpApt" maxlength=
"" 255 data-role=
"numerictextbox" 256 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 257 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 260 data-max=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 261 data-step=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 262 data-bind=
"value: sourceLimit.eApt, events: { spin: spinLimit }">
266 <div
class=
"col-sm-3">
268 <label><i>Account / Day</i></label>
269 <span
class=
"k-invalid-msg" data-
for=
"inpApa"></span>
272 <input
class=
"local-hcu-full-width" id=
"inpApa" name=
"inpApa" maxlength=
"" 273 data-role=
"numerictextbox" 274 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 275 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 278 data-max=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 279 data-step=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 280 data-bind=
"value: sourceLimit.eApa, events: { spin: spinLimit }">
284 <div
class=
"col-sm-3">
286 <label><i>Day</i></label>
287 <span
class=
"k-invalid-msg" data-
for=
"inpApd"></span>
290 <input
class=
"local-hcu-full-width" id=
"inpApd" name=
"inpApd" maxlength=
"" 291 data-role=
"numerictextbox" 292 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 293 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 296 data-max=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 297 data-step=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 298 data-bind=
"value: sourceLimit.eApd, events: { spin: spinLimit }">
302 <div
class=
"col-sm-3">
304 <label><i>Month</i></label>
305 <span
class=
"k-invalid-msg" data-
for=
"inpApm"></span>
308 <input
class=
"local-hcu-full-width" id=
"inpApm" name=
"inpApm" maxlength=
"" 309 data-role=
"numerictextbox" 310 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 311 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 314 data-max=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 315 data-step=
"<?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>" 316 data-bind=
"value: sourceLimit.eApm, events: { spin: spinLimit }">
320 <div style=
"clear: both;"> </div>
323 <br data-bind=
"visible: showAmount" id=
"viewAmountBr">
325 <div
class=
"well well-sm" id=
"viewCount" data-bind=
"visible: showCount">
327 <div
class=
"col-sm-12 local-hcu-no-padding">
328 <h3>Count Limits Per</h3> <br>
331 <div
class=
"col-sm-3">
332 <div
class=
""> </div>
333 <div
class=
""> </div>
336 <div
class=
"col-sm-3">
338 <label><i>Account / Day</i></label>
339 <span
class=
"k-invalid-msg" data-
for=
"inpCpa"></span>
342 <input
class=
"local-hcu-full-width" id=
"inpCpa" name=
"inpCpa" maxlength=
"" 343 data-role=
"numerictextbox" 344 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 345 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 348 data-max=
"<?php echo FEATURE_LIMIT_MAX_COUNT; ?>" 349 data-step=
"<?php echo FEATURE_LIMIT_MAX_COUNT; ?>" 350 data-bind=
"value: sourceLimit.eCpa, events: { spin: spinLimit }">
354 <div
class=
"col-sm-3">
356 <label><i>Day</i></label>
357 <span
class=
"k-invalid-msg" data-
for=
"inpCpd"></span>
360 <input
class=
"local-hcu-full-width" id=
"inpCpd" name=
"inpCpd" maxlength=
"" 361 data-role=
"numerictextbox" 362 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 363 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 366 data-max=
"<?php echo FEATURE_LIMIT_MAX_COUNT; ?>" 367 data-step=
"<?php echo FEATURE_LIMIT_MAX_COUNT; ?>" 368 data-bind=
"value: sourceLimit.eCpd, events: { spin: spinLimit }">
372 <div
class=
"col-sm-3">
374 <label><i>Month</i></label>
375 <span
class=
"k-invalid-msg" data-
for=
"inpCpm"></span>
378 <input
class=
"local-hcu-full-width" id=
"inpCpm" name=
"inpCpm" maxlength=
"" 379 data-role=
"numerictextbox" 380 data-up-arrow-text=
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>" 381 data-down-arrow-text=
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>" 384 data-max=
"<?php echo FEATURE_LIMIT_MAX_COUNT; ?>" 385 data-step=
"<?php echo FEATURE_LIMIT_MAX_COUNT; ?>" 386 data-bind=
"value: sourceLimit.eCpm, events: { spin: spinLimit }">
390 <div style=
"clear: both;"> </div>
393 <br data-bind=
"visible: showCount" id=
"viewCountBr">
395 <div
class=
"well well-sm" id=
"viewConfirm" data-bind=
"visible: showConfirm">
396 <div
class=
"row hcu-secondary">
397 <div
class=
"col-sm-12 vsgSecondary">
398 <span>Checking
this box will require confirmation from another group user to process a transaction.</span>
401 <div
class=
"row"> </div>
403 <div
class=
"col-sm-3">
404 <label data-bind=
"events: { click: changeLabel }">Confirmation Required</label>
406 <div
class=
"col-sm-3">
407 <input type=
"checkbox" class=
"" id=
"inpCfm" name=
"inpCfm" style=
"margin-top: -2px;" 408 data-bind=
"checked: sourceLimit.eCfm, 409 events: { change: changeCheck }">
410 <span data-bind=
"events: { click: changeLabel }"> Yes</span>
415 <br data-bind=
"visible: showAccess" id=
"viewAccessBr">
417 <div
class=
"well well-sm" id=
"viewAccess" data-bind=
"visible: showAccess">
418 <div
class=
"col-sm-12 local-hcu-no-padding">
419 <div
class=
"col-sm-3 local-hcu-no-padding">
420 <label data-bind=
"">Access Allowed</label>
422 <div
class=
"col-sm-9 local-hcu-no-padding">
423 <input type=
"checkbox" class=
"" id=
"inpCfm" name=
"inpCfm" style=
"margin-top: -2px;" 424 checked=
"true" disabled=
"true">
426 <span><i>To
remove access to
this feature,
delete it from the profile.</i></span>
433 <div
class=
"col-sm-4"></div>
434 <div
class=
"col-sm-4">
435 <button
id=
"btnLimitSave" class=
"local-hcu-full-width k-button k-primary" 436 data-bind=
"events: { click: saveLimit }">
437 <span
class=
"fa fa-check"></span>
441 <div
class=
"col-sm-4"></div>
443 <div style=
"clear: both;"></div>
446 <div
id=
"dialogDiscardProfile"></div>
447 <div
id=
"dialogDeleteProfile"></div>
448 <div
id=
"dialogDeleteLimit"></div>
449 <div
id=
"dialogWarningLimit"></div>
450 <div
id=
"dialogDiscardLimit"></div>
452 <!-- JAVASCRIPT CONTENT -->
453 <script type=
"text/javascript">
454 <?php getShowWaitFunctions(); ?>
456 var FEATURE_LIMIT_MAX_AMOUNT = <?php echo FEATURE_LIMIT_MAX_AMOUNT; ?>;
457 var FEATURE_LIMIT_MAX_COUNT = <?php echo FEATURE_LIMIT_MAX_COUNT; ?>;
458 var FEATURE_LIMIT_MIN_VALUE =
"<?php echo FEATURE_LIMIT_MIN_VALUE; ?>";
459 var FEATURE_LIMIT_MAX_VALUE =
"<?php echo FEATURE_LIMIT_MAX_VALUE; ?>";
461 var activeElement =
null;
462 var prInfoBar =
null;
463 var prDataSource =
null;
465 var prDataProfiles =
null;
466 var prDataProfileSelect =
null;
467 var prDataProfileNext =
null;
468 var prViewProfileSelect =
false;
469 var prViewProfileDropdown =
null;
470 var prViewProfileSave =
null;
471 var prViewProfileDelete =
null;
472 var prViewProfileCode =
null;
473 var prViewProfileDesc =
null;
474 var prViewProfileValidator =
null;
476 var prDataLimits =
null;
477 var prDataLimitStack =
null;
478 var prDataFeatures =
null;
479 var prDataFeaturesFiltered =
null;
480 var prViewLimitGrid =
null;
481 var prViewLimitDelete =
null;
482 var prViewLimitExpand =
null;
483 var prViewLimitExpanded =
false;
484 var prViewLimitWindow =
null;
485 var prViewLimitWindowOpen =
false;
486 var prObserveLimit =
null;
487 var prObserveLimitValidator =
null;
488 var prViewLimitAmount =
null;
489 var prViewLimitCount =
null;
490 var prViewLimitAmountBr =
null;
491 var prViewLimitCountBr =
null;
492 var prViewLimitConfirm =
null;
493 var prViewLimitAccess =
null;
495 var prDataWindowStack =
null;
496 var prViewDialogDiscardProfile =
null;
497 var prViewDialogDeleteProfile =
null 498 var prViewDialogDeleteLimit =
null;
499 var prViewDialogDiscardLimit =
null;
500 var prViewDialogWarningLimit =
null;
510 function StackInsertLimit(
id) {
512 if (
id ==
"chk_0") {
return; }
514 var limitCode =
id.substring(4,
id.length);
515 var limitIndex = DataSourceFindLimit(limitCode, prDataProfileSelect.pId);
516 var limit = prDataLimits[limitIndex];
518 prDataLimitStack.push(limit);
529 function StackRemoveLimit(
id) {
531 var limitCode =
id.substring(4,
id.length);
532 for (var i = 0; i < prDataLimitStack.length; i++) {
534 var limit = prDataLimitStack[i];
535 if (limit.fCode == limitCode) {
537 prDataLimitStack.splice(i, 1);
549 function ValidateProfileCode(e) {
553 var value = input.val();
554 value = value.trim();
555 value = value.toUpperCase();
557 for (var i = 0; i < prDataProfiles.length; i++) {
559 var pCode = prDataProfiles[i].pCode;
560 if (pCode == value) { pass =
false;
break; }
566 function ValidateProfileRequired(e) {
569 var value = input.val();
570 value = value.trim();
572 if (value ==
"") { pass =
false; }
584 function DataSourceFindFeature(fCode) {
587 for (var i = 0; i < prDataFeatures.length; i++) {
589 if (prDataFeatures[i].fCode == fCode) {
603 function DataSourceFilterFeatures() {
605 prDataFeaturesFiltered = [];
607 prDataFeaturesFiltered.push({
610 fDesc:
"Choose Feature",
615 for (var i = 0; i < prDataFeatures.length; i++) {
617 var lidx = DataSourceFindLimit(prDataFeatures[i].fCode, prDataProfileSelect.pId);
620 prDataFeaturesFiltered.push(prDataFeatures[i]);
625 prDataFeaturesFiltered = $.grep(prDataFeaturesFiltered,
function(n, i) {
626 return n.cuexists || n.fDesc ==
"Choose Feature";
637 function DataSourceBuildFeatures(data) {
639 for (var i = 0; i < data.length; i++) {
643 fCode: data[i].fcode.trim(),
644 fDesc: data[i].fdesc.trim(),
645 fType: data[i].ftype.trim(),
646 fEnabled: data[i].fenabled ==
"t" ? true :
false,
647 cuexists: data[i].cuexists ==
"t" ? true :
false 650 prDataFeatures.push(newFeature);
666 function DataSourceBuildLimits(data) {
667 for (var i = 0; i < data.length; i++) {
670 pId: parseInt(data[i].pid),
671 fCode: data[i].fcode.trim(),
672 fDesc: data[i].fdesc.trim(),
673 fApt: data[i].fapt ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapt),
674 fApd: data[i].fapd ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapd),
675 fApm: data[i].fapm ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapm),
676 fApa: data[i].fapa ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapa),
677 fCpd: data[i].fcpd ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(data[i].fcpd),
678 fCpm: data[i].fcpm ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(data[i].fcpm),
679 fCpa: data[i].fcpa ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(data[i].fcpa),
680 fCfm: data[i].fcfm ==
"t" ? true :
false,
681 fType: data[i].ftype.trim(),
683 eCode: data[i].fcode.trim(),
684 eDesc: data[i].fdesc.trim(),
685 eApt: data[i].fapt ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapt),
686 eApd: data[i].fapd ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapd),
687 eApm: data[i].fapm ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapm),
688 eApa: data[i].fapa ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(data[i].fapa),
689 eCpd: data[i].fcpd ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(data[i].fcpd),
690 eCpm: data[i].fcpm ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(data[i].fcpm),
691 eCpa: data[i].fcpa ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(data[i].fcpa),
692 eCfm: data[i].fcfm ==
"t" ? true :
false 695 prDataLimits.push(newLimit);
702 fApt: FEATURE_LIMIT_MAX_AMOUNT,
703 fApd: FEATURE_LIMIT_MAX_AMOUNT,
704 fApm: FEATURE_LIMIT_MAX_AMOUNT,
705 fApa: FEATURE_LIMIT_MAX_AMOUNT,
706 fCpd: FEATURE_LIMIT_MAX_COUNT,
707 fCpm: FEATURE_LIMIT_MAX_COUNT,
708 fCpa: FEATURE_LIMIT_MAX_COUNT,
714 eApt: FEATURE_LIMIT_MAX_AMOUNT,
715 eApd: FEATURE_LIMIT_MAX_AMOUNT,
716 eApm: FEATURE_LIMIT_MAX_AMOUNT,
717 eApa: FEATURE_LIMIT_MAX_AMOUNT,
718 eCpd: FEATURE_LIMIT_MAX_COUNT,
719 eCpm: FEATURE_LIMIT_MAX_COUNT,
720 eCpa: FEATURE_LIMIT_MAX_COUNT,
733 function DataSourceFindLimit(fCode, pId) {
735 for (var i = 0; i < prDataLimits.length; i++) {
737 if (prDataLimits[i].fCode == fCode && prDataLimits[i].pId == pId) {
756 function DataSourceInsertLimit(limit,
remove) {
757 var fidx = DataSourceFindFeature(limit.fcode);
758 var feature = prDataFeatures[fidx];
761 pId: parseInt(limit.pid),
762 fCode: limit.fcode.trim(),
763 fDesc: feature.fDesc,
764 fType: feature.fType,
765 fApt: limit.fapt ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapt),
766 fApd: limit.fapd ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapd),
767 fApm: limit.fapm ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapm),
768 fApa: limit.fapa ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapa),
769 fCpd: limit.fcpd ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(limit.fcpd),
770 fCpm: limit.fcpm ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(limit.fcpm),
771 fCpa: limit.fcpa ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(limit.fcpa),
772 fCfm: limit.fcfm ==
"t" ? true :
false,
774 eCode: limit.fcode.trim(),
775 eDesc: feature.fDesc,
776 eApt: limit.fapt ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapt),
777 eApd: limit.fapd ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapd),
778 eApm: limit.fapm ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapm),
779 eApa: limit.fapa ==
null ? FEATURE_LIMIT_MAX_AMOUNT : parseFloat(limit.fapa),
780 eCpd: limit.fcpd ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(limit.fcpd),
781 eCpm: limit.fcpm ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(limit.fcpm),
782 eCpa: limit.fcpa ==
null ? FEATURE_LIMIT_MAX_COUNT : parseInt(limit.fcpa),
783 eCfm: limit.fcfm ==
"t" ? true :
false 788 idx = DataSourceFindLimit(updLimit.fCode, updLimit.pId);
790 for (var i = 0; i < prDataLimits.length; i++) {
791 if (limit.fCode < prDataLimits[i].fCode) {
798 prDataLimits.splice(idx,
remove, updLimit);
799 prViewLimitGrid.dataSource.data(prDataLimits);
801 if (prViewLimitExpanded) {
802 prViewLimitExpanded =
false;
816 function DataSourceRemoveLimit(limits) {
818 for (var i = 0; i < limits.length; i++) {
822 fCode: limits[i].fcode
825 var idx = DataSourceFindLimit(rmvLimit.fCode, rmvLimit.pId);
826 prDataLimits.splice(idx, 1);
827 prViewLimitGrid.dataSource.data(prDataLimits);
831 if (prViewLimitExpanded) {
832 prViewLimitExpanded =
false;
848 function DataSourceBuildProfiles(data) {
849 for (var i = 0; i < data.length; i++) {
852 pId: parseInt(data[i].pid),
853 pCode: data[i].pcode.trim(),
854 pDesc: data[i].pdesc.trim(),
855 pText: data[i].pdesc.trim(),
856 pValue: parseInt(data[i].pid),
857 eCode: data[i].pcode.trim(),
858 eDesc: data[i].pdesc.trim(),
862 prDataProfiles.push(newProfile);
865 prDataProfiles.push({
869 pText:
"+ Add Profile",
884 function DataSourceFindProfile(pId) {
886 for (var i = 0; i < prDataProfiles.length; i++) {
888 if (prDataProfiles[i].pId == pId) {
905 function DataSourceRemoveProfile(profile) {
907 pId: parseInt(profile.pid)
910 var pidx = DataSourceFindProfile(rmvProfile.pId);
912 prDataProfiles.splice(pidx, 1);
913 prViewProfileDropdown.dataSource.data(prDataProfiles);
914 prViewProfileDropdown.select(0);
915 prViewProfileDropdown.trigger(
"select");
916 prViewProfileDropdown.trigger(
"change");
929 function DataSourceInsertProfile(profile,
remove) {
931 pId: parseInt(profile.pid),
932 pCode: profile.pcode.trim(),
933 pDesc: profile.pdesc.trim(),
934 pText: profile.pdesc.trim(),
935 pValue: parseInt(profile.pid),
936 eCode: profile.pcode.trim(),
937 eDesc: profile.pdesc.trim(),
944 pidx = DataSourceFindProfile(updProfile.pId);
945 prDataProfiles.splice(pidx, 1);
947 prDataProfiles[prDataProfiles.length-1].eCode =
"";
948 prDataProfiles[prDataProfiles.length-1].eDesc =
"";
951 for (var i = 0; i < prDataProfiles.length; i++) {
952 var comp = prDataProfiles[i].pDesc.localeCompare(updProfile.pDesc);
954 pidx = i >= 0 ? i : 0;
958 if (i == prDataProfiles.length-1) {
963 prDataProfiles.splice(pidx, 0, updProfile);
964 prViewProfileDropdown.dataSource.data(prDataProfiles);
965 prViewProfileDropdown.select(pidx);
966 prViewProfileDropdown.trigger(
"select");
967 prViewProfileDropdown.trigger(
"change");
978 function ViewProfileEnable(eView, eDisabled) {
979 eView.prop(
"disabled", eDisabled);
981 if (eDisabled) { eView.addClass(
"k-state-disabled"); }
982 else { eView.removeClass(
"k-state-disabled"); }
985 function ViewProfileNoLimit() {
987 if (prObserveLimit.showAmount) {
988 $(
"#inpApt, #inpApd, #inpApm, #inpApa").each(
function() {
990 var child = $(input.parent()[0].firstChild);
991 var value = input.val();
993 if (value >= FEATURE_LIMIT_MAX_AMOUNT || value ==
"") {
994 child.val(
"No Limit");
1000 if (prObserveLimit.showCount) {
1001 $(
"#inpCpd, #inpCpm, #inpCpa").each(
function() {
1002 var input = $(
this);
1003 var child = $(input.parent()[0].firstChild);
1004 var value = input.val();
1006 if (value >= FEATURE_LIMIT_MAX_COUNT || value ==
"") {
1007 child.val(
"No Limit");
1021 function ViewProfileFocus(eView, eFocus) {
1022 if (eFocus) { eView.focus(); }
1023 else { eView.blur(); }
1035 function ActionConfirmDiscardLimit(e) {
1037 prViewDialogDiscardLimit.close();
1038 prViewLimitWindow.close();
1050 function ActionConfirmDeleteLimit(e) {
1051 var codeString =
"";
1052 for (var i = 0; i < prDataLimitStack.length; i++) {
1054 var fCode = prDataLimitStack[i].fCode;
1055 var fDesc = prDataLimitStack[i].fDesc;
1056 codeString += fDesc +
":" + fCode;
1058 if (i < prDataLimitStack.length -1) {
1063 var limitRequest = {
1064 action:
"limit_delete",
1065 pId: prDataProfileSelect.pId,
1069 prDataSource.transport.options.read.type =
"POST";
1070 prDataSource.read(limitRequest);
1079 function ActionConfirmDeleteProfile(e) {
1080 var profileRequest = {
1081 action:
"profile_delete",
1082 pId: prDataProfileSelect.pId,
1083 pCode: prDataProfileSelect.eCode,
1084 pDesc: prDataProfileSelect.eDesc
1087 prDataSource.transport.options.read.type =
"POST";
1088 prDataSource.read(profileRequest);
1097 function ActionKeepProfileChanges(e) {
1109 function ActionDiscardProfileChanges(e) {
1111 if (prDataProfileSelect) {
1112 prDataProfileSelect.eCode = prDataProfileSelect.pCode;
1113 prDataProfileSelect.eDesc = prDataProfileSelect.pDesc;
1114 prDataProfileSelect.pDirty =
false;
1117 var idx = DataSourceFindProfile(prDataProfileNext.pId);
1118 prViewProfileDropdown.select(idx);
1119 prViewProfileDropdown.trigger(
"select");
1120 prViewProfileDropdown.trigger(
"change");
1123 $(
"#inpProfileCode").removeClass(
"k-invalid");
1124 $(
"#inpProfileCode").css(
"border",
"1px solid #ceced2");
1125 $(
"#inpProfileDesc").removeClass(
"k-invalid");
1126 $(
"#inpProfileDesc").css(
"border",
"1px solid #ceced2");
1129 $.homecuValidator.hideMessage();
1144 function EventCheckboxReset(enable) {
1146 for (var i = 0; i < prDataLimitStack.length; i++) {
1148 var feature = prDataLimitStack[i].fCode;
1149 var box = $(
"input[id=chk_" + feature +
"]");
1150 box.prop(
"checked", enable);
1155 prViewLimitDelete.prop(
"disabled", prDataLimitStack.length == 0);
1156 $(
"#chk_0").prop(
"checked",
false);
1159 prDataLimitStack = [];
1177 function EventCheckboxChange(e, source) {
1179 var boxId = box.attr(
"id");
1180 var boxValue = box.prop(
"checked");
1182 if (source ==
"BOX") {
1183 boxValue = !boxValue;
1187 $(
"input[id=chk_0]").prop(
"checked",
false);
1190 if (boxId ==
"chk_0") {
1192 $(
".feature-checkbox").each(
function() {
1194 if (!this.checked && !boxValue) {
1195 StackInsertLimit(this.
id);
1196 this.checked =
true;
1197 }
else if (this.checked && boxValue) {
1198 StackRemoveLimit(this.
id);
1199 this.checked =
false;
1206 StackRemoveLimit(boxId);
1208 StackInsertLimit(boxId);
1212 box.prop(
"checked", !boxValue);
1214 if (prDataLimitStack.length > 0) {
1215 prViewLimitDelete.prop(
"disabled",
false);
1217 prViewLimitDelete.prop(
"disabled",
true);
1228 function EventGridDataBound(e) {
1229 $(
"html .k-grid tr").hover(
function() {
1230 $(
this).css(
"cursor",
"pointer");
1233 $(
'input[id^=chk_]').off();
1234 $(
'input[id^=chk_]').css(
"cursor",
"pointer");
1235 $(
'input[id^=chk_]').css(
"margin-top",
"-2px");
1236 $(
'input[id^=chk_]').change(
function(e) {
1237 EventCheckboxChange(e.target,
"BOX");
1240 EventCheckboxReset(
true);
1242 if (prViewLimitExpanded) {
1243 prViewLimitExpanded =
false;
1257 function EventGridChange(e) {
1258 var cell = this.select();
1259 var cellIndex = cell.index();
1261 var dataIndex = cell.closest(
"tr").index(
".k-master-row");
1262 var dataSource = this.dataSource;
1263 var dataItem = dataSource.view()[dataIndex];
1265 if (cellIndex == 0 && dataItem.pId > 0) {
1267 var box = cell.find(
"input[id^=\"chk_\"]")[0];
1268 EventCheckboxChange(box,
"ROW");
1270 EventOpenLimit(dataItem);
1273 $(this.select()).removeClass(
'k-state-selected');
1284 function EventChangeLimitFeature(e) {
1285 var input = $(e.sender.element[0]);
1286 var value = input.val();
1287 var idx = DataSourceFindFeature(value);
1288 var feature = prDataFeatures[idx];
1290 if (feature != undefined) {
1292 var featureType = feature.fType;
1293 if (feature.fType ==
"B" || feature.fType ==
"D") {
1294 prViewLimitAmount.show();
1295 prViewLimitAmountBr.show();
1296 this.showAmount =
true;
1298 prViewLimitConfirm.show();
1299 this.showConfirm =
true;
1301 prViewLimitAmount.hide();
1302 prViewLimitAmountBr.hide();
1303 this.showAmount =
false;
1305 prViewLimitConfirm.hide();
1306 this.showConfirm =
false;
1309 if (feature.fType ==
"B" || feature.fType ==
"Q") {
1310 prViewLimitCount.show();
1311 prViewLimitCountBr.show();
1312 this.showCount =
true;
1314 prViewLimitCount.hide();
1315 prViewLimitCountBr.hide();
1316 this.showCount =
false;
1319 if (feature.fType ==
"A") {
1320 prViewLimitAccess.show();
1321 this.showAccess =
true;
1323 prViewLimitAccess.hide();
1324 this.showAccess =
false;
1327 this.sourceLimit.fDirty =
true;
1328 ViewProfileEnable($(
"#btnLimitSave"),
false);
1330 prViewLimitConfirm.hide();
1331 this.showConfirm =
false;
1333 prViewLimitCount.hide();
1334 prViewLimitCountBr.hide();
1335 this.showCount =
false;
1337 prViewLimitAmount.hide();
1338 prViewLimitAmountBr.hide();
1339 this.showAmount =
false;
1341 prViewLimitConfirm.hide();
1342 this.showConfirm =
false;
1344 prViewLimitAccess.hide();
1345 this.showAccess =
false;
1347 this.sourceLimit.fDirty =
false;
1348 ViewProfileEnable($(
"#btnLimitSave"),
true);
1352 input.removeClass(
"k-state-focused");
1354 ViewProfileNoLimit();
1362 function EventResetLimit() {
1363 prObserveLimit.sourceLimit.eCode = prObserveLimit.sourceLimit.fCode;
1364 prObserveLimit.sourceLimit.eApt = prObserveLimit.sourceLimit.fApt;
1365 prObserveLimit.sourceLimit.eApd = prObserveLimit.sourceLimit.fApd;
1366 prObserveLimit.sourceLimit.eApm = prObserveLimit.sourceLimit.fApm;
1367 prObserveLimit.sourceLimit.eApa = prObserveLimit.sourceLimit.fApa;
1368 prObserveLimit.sourceLimit.eCpd = prObserveLimit.sourceLimit.fCpd;
1369 prObserveLimit.sourceLimit.eCpm = prObserveLimit.sourceLimit.fCpm;
1370 prObserveLimit.sourceLimit.eCpa = prObserveLimit.sourceLimit.fCpa;
1371 prObserveLimit.sourceLimit.eCfm = prObserveLimit.sourceLimit.fCfm;
1372 prObserveLimit.sourceLimit.fDirty =
false;
1383 function EventCheckDirty() {
1384 var limit = prObserveLimit.sourceLimit;
1386 if (limit.eCode != limit.fCode) { limit.fDirty =
true; }
1387 else if (limit.eApt != limit.fApt) { limit.fDirty =
true; }
1388 else if (limit.eApa != limit.fApa) { limit.fDirty =
true; }
1389 else if (limit.eApd != limit.fApd) { limit.fDirty =
true; }
1390 else if (limit.eApm != limit.fApm) { limit.fDirty =
true; }
1391 else if (limit.eCpa != limit.fCpa) { limit.fDirty =
true; }
1392 else if (limit.eCpd != limit.fCpd) { limit.fDirty =
true; }
1393 else if (limit.eCpm != limit.fCpm) { limit.fDirty =
true; }
1394 else if (limit.eCfm != limit.fCfm) { limit.fDirty =
true; }
1395 else { limit.fDirty =
false; }
1397 ViewProfileEnable($(
"#btnLimitSave"), !limit.fDirty);
1407 function EventBlurLimitCount(e) {
1408 var input = $(
this);
1409 var child = $(input.parent()[0].firstChild);
1410 var value = input.val();
1411 var
id = input.attr(
"id");
1412 var field =
id.substring(3,
id.length);
1414 if (prObserveLimit.showCount) {
1415 if (value >= FEATURE_LIMIT_MAX_COUNT || value ==
"" || value ==
null) {
1416 value = FEATURE_LIMIT_MAX_COUNT;
1417 child.val(
"No Limit");
1422 prObserveLimit.sourceLimit.eCpa = parseInt(value);
1425 prObserveLimit.sourceLimit.eCpd = parseInt(value);
1428 prObserveLimit.sourceLimit.eCpm = parseInt(value);
1444 function EventBlurLimitAmount(e) {
1445 var input = $(
this);
1446 var child = $(input.parent()[0].firstChild);
1447 var value = input.val();
1448 var
id = input.attr(
"id");
1449 var field =
id.substring(3,
id.length);
1451 if (prObserveLimit.showAmount) {
1452 if (value >= FEATURE_LIMIT_MAX_AMOUNT || value ==
"") {
1453 value = FEATURE_LIMIT_MAX_AMOUNT;
1454 child.val(
"No Limit");
1459 prObserveLimit.sourceLimit.eApt = parseFloat(value);
1462 prObserveLimit.sourceLimit.eApa = parseFloat(value);
1465 prObserveLimit.sourceLimit.eApd = parseFloat(value);
1468 prObserveLimit.sourceLimit.eApm = parseFloat(value);
1485 function EventSpinLimit(e) {
1486 var input = $(e.sender.element[0]);
1496 function EventOpenLimit(limit) {
1497 if (prDataProfileSelect.pId == 0) {
1498 prViewDialogWarningLimit.open();
1502 DataSourceFilterFeatures();
1503 var idx = DataSourceFindFeature(limit.fCode);
1504 var feature = prDataFeatures[idx];
1506 prObserveLimit.set(
"sourceLimit", limit);
1507 prObserveLimit.set(
"sourceFeatures", prDataFeaturesFiltered);
1509 if (limit.pId == 0) {
1510 prObserveLimit.set(
"showAmount",
false);
1511 prObserveLimit.set(
"showCount",
false);
1512 prObserveLimit.set(
"showConfirm",
false);
1513 prObserveLimit.set(
"showDrop",
true);
1514 prObserveLimit.set(
"showAccess",
false);
1516 prObserveLimit.set(
"showAmount", feature.fType ==
"B" || feature.fType ==
"D");
1517 prObserveLimit.set(
"showCount", feature.fType ==
"B" || feature.fType ==
"Q");
1518 prObserveLimit.set(
"showConfirm", feature.fType ==
"B" || feature.fType ==
"D");
1519 prObserveLimit.set(
"showAccess", feature.fType ==
"A");
1520 prObserveLimit.set(
"showDrop",
false);
1523 kendo.bind(
"#wndProfileLimit", prObserveLimit);
1525 var title = limit.pId == 0 ?
"Add Feature Limit" :
"Edit " + limit.fDesc;
1526 prViewLimitWindow.title(title);
1527 prViewLimitWindow.center();
1528 prViewLimitWindow.open();
1530 ViewProfileEnable($(
"#wndProfileLimit #btnLimitSave"),
true);
1531 ViewProfileNoLimit();
1539 function EventSaveLimit(e) {
1540 var limit = prObserveLimit.sourceLimit;
1541 var idx = DataSourceFindFeature(limit.eCode);
1542 var feature = prDataFeatures[idx];
1544 if (limit != undefined && limit.fDirty) {
1546 var limitRequest = {
1547 action: limit.pId == 0 ?
"limit_create" :
"limit_update",
1548 pId: prDataProfileSelect.pId,
1549 fType: feature.fType,
1551 fApt: (feature.fType ==
"B" || feature.fType ==
"D") ? limit.eApt :
null,
1552 fApa: (feature.fType ==
"B" || feature.fType ==
"D") ? limit.eApa :
null,
1553 fApd: (feature.fType ==
"B" || feature.fType ==
"D") ? limit.eApd :
null,
1554 fApm: (feature.fType ==
"B" || feature.fType ==
"D") ? limit.eApm :
null,
1555 fCpa: (feature.fType ==
"B" || feature.fType ==
"Q") ? limit.eCpa :
null,
1556 fCpd: (feature.fType ==
"B" || feature.fType ==
"Q") ? limit.eCpd :
null,
1557 fCpm: (feature.fType ==
"B" || feature.fType ==
"Q") ? limit.eCpm :
null,
1561 prDataSource.transport.options.read.type =
"POST";
1562 prDataSource.read(limitRequest);
1566 prViewLimitWindow.close();
1575 function EventDeleteLimit(e) {
1577 var codeString =
"";
1578 codeString +=
"<p>You are about to delete the following limits:</p>";
1579 codeString +=
"<ul style=\"margin-left: 25px;\">";
1580 for (var i = 0; i < prDataLimitStack.length; i++) {
1581 var fDesc = prDataLimitStack[i].fDesc;
1582 codeString +=
"<li>" + fDesc +
"</li>";
1584 codeString +=
"</ul>";
1585 codeString +=
"<p>Do you wish to continue?</p>";
1587 if (codeString !=
"") {
1588 prViewDialogDeleteLimit.content(codeString);
1589 prViewDialogDeleteLimit.open();
1599 function EventExpandLimit(e) {
1601 if (prViewLimitExpanded) {
1602 btnText =
"<span class=\"fa fa-expand\"></span> <span>Expand All</span>";
1603 $(
"html .k-grid td span").addClass(
"local-hcu-nowrap");
1604 prViewLimitExpanded =
false;
1606 btnText =
"<span class=\"fa fa-expand\"></span> <span>Collapse All</span>";
1607 $(
"html .k-grid td span").removeClass(
"local-hcu-nowrap");
1608 prViewLimitExpanded =
true;
1611 prViewLimitExpand.html(btnText);
1619 function EventCheckLabel(e) {
1620 var chk = $(
"#inpCfm").prop(
"checked");
1621 $(
"#inpCfm").prop(
"checked", !chk);
1623 var dirt = prObserveLimit.sourceLimit.fDirty;
1624 prObserveLimit.sourceLimit.eCfm = !chk;
1635 function EventSaveProfile(e) {
1636 if ($.homecuValidator.validate()) {
1637 var profileRequest = {
1638 action: prDataProfileSelect.pId == 0 ?
"profile_create" :
"profile_update",
1639 pId: prDataProfileSelect.pId,
1640 pCode: prDataProfileSelect.eCode,
1641 pDesc: prDataProfileSelect.eDesc
1644 prDataProfileSelect.pDirty =
false;
1646 prDataSource.transport.options.read.type =
"POST";
1647 prDataSource.read(profileRequest);
1657 function EventDeleteProfile(e) {
1658 prViewDialogDeleteProfile.open();
1670 function EventChangeProfileInput(e) {
1671 var target = $(e.target);
1672 var
id = target.attr(
"id");
1673 var value = target.val();
1674 value = value.trim();
1676 if (
id ==
"inpProfileCode") {
1677 value = value.toUpperCase();
1680 if (RegExp(/[@#\\!$%^&*()+|~=`{}\[\]:
";'<>?,.\/]/).test(value)) { 1681 value = value.slice(0, -1); 1683 prDataProfileSelect.eCode = value; 1685 prDataProfileSelect.eDesc = value; 1688 if (prDataProfileSelect.pCode.trim() != prDataProfileSelect.eCode.trim() || 1689 prDataProfileSelect.pDesc.trim() != prDataProfileSelect.eDesc.trim()) { 1690 ViewProfileEnable(prViewProfileSave, false); 1691 prDataProfileSelect.pDirty = true; 1693 ViewProfileEnable(prViewProfileSave, true); 1694 prDataProfileSelect.pDirty = false; 1700 * EventProfileSelect: on profile sleection, this function will stop the dropdown change event 1701 * if the profile has been changed. A dialog will appear asking for confirmation of discarding the 1704 * The prViewprofileSelect is a flag variable. It is used to determine how many times the select 1705 * event has been called on the dropdown list. We need this because on change it is called once, 1706 * on blur it is called again. We want to avoid the second call or the data will be changed when the 1707 * confirmation dialog is open. 1710 function EventProfileSelect(e) { 1712 if (prDataProfileSelect && prDataProfileSelect.pDirty) { 1715 if (prViewProfileSelect) { 1716 prViewProfileSelect = false; 1718 prViewProfileSelect = true; 1719 prDataProfileNext = e.dataItem; 1720 prViewDialogDiscardProfile.open(); 1724 var value = e.dataItem == undefined ? parseInt(this.value()) : e.dataItem.pId; 1725 var idx = DataSourceFindProfile(value); 1726 var idx = (idx < 0) ? 0 : idx; 1728 prDataProfileSelect = prDataProfiles[idx]; 1729 prViewProfileCode.val(prDataProfileSelect.eCode); 1730 prViewProfileDesc.val(prDataProfileSelect.eDesc); 1736 * EventProfileChange: This function takes care of enabling the profile code/description and 1737 * save/delete buttons depening on which profile is selected. This function will also filter the 1738 * feature limit grid below depending on which profile is selected. 1741 function EventProfileChange(e) { 1742 switch (prDataProfileSelect.pId) { 1744 ViewProfileEnable(prViewProfileCode, true); 1745 ViewProfileEnable(prViewProfileDesc, true); 1746 ViewProfileEnable(prViewProfileDelete, true); 1749 ViewProfileEnable(prViewProfileCode, false); 1750 ViewProfileEnable(prViewProfileDesc, false); 1751 ViewProfileEnable(prViewProfileDelete, true); 1752 ViewProfileFocus(prViewProfileCode, true); 1755 ViewProfileEnable(prViewProfileCode, true); 1756 ViewProfileEnable(prViewProfileDesc, false); 1757 ViewProfileEnable(prViewProfileDelete, false); 1758 ViewProfileFocus(prViewProfileDesc, true); 1762 ViewProfileEnable(prViewProfileSave, true); 1764 btnText = "<span
class=\
"fa fa-expand\"></span> <span>Expand All</span>";
1765 prViewLimitExpand.html(btnText);
1766 prViewLimitExpanded =
false;
1768 EventCheckboxReset(
false);
1773 { field:
"pId",
operator:
"eq", value: prDataProfileSelect.pId },
1774 { field:
"pId",
operator:
"eq", value: 0 }
1777 prViewLimitGrid.dataSource.filter(gridFilter);
1780 function EventOpenDialog(e) {
1781 prDataWindowStack.push(
this);
1784 function EventCloseDialog(e) {
1785 prDataWindowStack.pop();
1793 function InitDataActions() {
1794 prViewProfileCode.on(
"input", EventChangeProfileInput);
1795 prViewProfileDesc.on(
"input", EventChangeProfileInput);
1796 prViewProfileSave.on(
"click", EventSaveProfile);
1797 prViewProfileDelete.on(
"click", EventDeleteProfile);
1799 prViewLimitDelete.on(
"click", EventDeleteLimit);
1800 prViewLimitDelete.prop(
"disabled",
true);
1801 prViewLimitExpand.on(
"click", EventExpandLimit);
1803 $(
"#inpApt, #inpApa, #inpApd, #inpApm").on(
"blur", EventBlurLimitAmount);
1804 $(
"#inpCpa, #inpCpd, #inpCpm").on(
"blur", EventBlurLimitCount);
1819 $(document).bind(
'mousewheel DOMMouseScroll',
function(e) {
1820 var scrollTo =
null;
1822 var
id = $(e.target).parent().attr(
"id");
1825 case "inpProfileList_listbox":
1826 element = prViewProfileDropdown.ul.parent();
1828 case "drpCodes_listbox":
1829 element = $(
"#drpCodes").data(
"kendoDropDownList").ul.parent();
1833 if (element !=
null || element != undefined) {
1834 if (!$(activeElement).closest(
".k-popup").length) {
1838 if (e.type ==
'mousewheel') {
1839 scrollTo = (e.originalEvent.wheelDelta * -1);
1841 else if (e.type ==
'DOMMouseScroll') {
1842 scrollTo = 40 * e.originalEvent.detail;
1847 element.scrollTop(scrollTo + element.scrollTop());
1852 $(document).on(
'mouseover',
function(e) {
1853 activeElement = e.target;
1862 function InitDataViews() {
1863 prViewProfileCode = $(
"#inpProfileCode");
1864 prViewProfileCode.css(
"text-transform",
"uppercase");
1865 prViewProfileDesc = $(
"#inpProfileDesc");
1866 prViewProfileSave = $(
"#btnProfileSave");
1867 prViewProfileDelete = $(
"#btnProfileDelete");
1868 prViewProfileDropdown = $(
"#inpProfileList").kendoDropDownList({
1869 dataValueField:
"pValue",
1870 dataTextField:
"pText",
1871 dataSource: { data: prDataProfiles },
1872 change: EventProfileChange,
1873 select: EventProfileSelect
1874 }).data(
"kendoDropDownList");
1876 prViewDialogDiscardProfile = $(
"#dialogDiscardProfile").kendoDialog({
1877 title:
"Discard Changes",
1878 content:
"<p>Changes have been made to this profile.</p><p>Do you wish to discard the changes?</p>",
1882 { text:
"No", action: ActionKeepProfileChanges },
1883 { text:
"Yes", action: ActionDiscardProfileChanges, primary:
true }
1885 show: EventOpenDialog,
1886 close: EventCloseDialog
1887 }).data(
"kendoDialog");
1889 prViewDialogDeleteProfile = $(
"#dialogDeleteProfile").kendoDialog({
1890 title:
"Delete Profile",
1891 content:
"<p>You are about to deleted this profile.</p><p>Do you wish to continue?</p>",
1896 { text:
"Yes", action: ActionConfirmDeleteProfile, primary:
true }
1898 show: EventOpenDialog,
1899 close: EventCloseDialog
1900 }).data(
"kendoDialog");
1902 prViewLimitDelete = $(
"#btnLimitDelete");
1903 prViewLimitExpand = $(
"#btnLimitExpand");
1904 prViewDialogDeleteLimit = $(
"#dialogDeleteLimit").kendoDialog({
1905 title:
"Delete Limit",
1910 { text:
"Yes", action: ActionConfirmDeleteLimit, primary:
true }
1912 show: EventOpenDialog,
1913 close: EventCloseDialog
1914 }).data(
"kendoDialog");
1916 prViewDialogWarningLimit = $(
"#dialogWarningLimit").kendoDialog({
1917 title:
"Profile Limit",
1918 content:
"You may only create new limit for existing profiles.",
1922 { text:
"OK", primary:
true }
1924 show: EventOpenDialog,
1925 close: EventCloseDialog
1926 }).data(
"kendoDialog");
1928 prViewDialogDiscardLimit = $(
"#dialogDiscardLimit").kendoDialog({
1929 title:
"Discard Changes",
1930 content:
"<p>Changes have been made to this feature.</p><p>Do you wish to discard these changes?</p>",
1935 { text:
"Yes", action: ActionConfirmDiscardLimit, primary:
true }
1937 show: EventOpenDialog,
1938 close: EventCloseDialog
1939 }).data(
"kendoDialog");
1941 prViewLimitGrid = $(
"#grdProfileLimits").kendoGrid({
1945 rowTemplate: kendo.template($(
"#templateGridRow").html()),
1946 dataBound: EventGridDataBound,
1947 change: EventGridChange,
1950 { headerTemplate:
"<input type=\"checkbox\" id=\"chk_0\">", width:
"25px" },
1951 { title:
"Feature", width:
"150px"},
1954 }).data(
"kendoGrid");
1956 prViewLimitAmount = $(
"#viewAmount");
1957 prViewLimitAmountBr = $(
"#viewAmountBr");
1958 prViewLimitCount = $(
"#viewCount");
1959 prViewLimitCountBr = $(
"#viewCountBr");
1960 prViewLimitConfirm = $(
"#viewConfirm");
1961 prViewLimitAccess = $(
"#viewAccess");
1962 prViewLimitWindow = $(
"#wndProfileLimit").kendoWindow({
1967 activate: EventOpenDialog,
1969 this.wrapper.css({ top: 100 });
1971 close:
function(e) {
1972 if (prObserveLimit.sourceLimit.fDirty) {
1974 prViewDialogDiscardLimit.open();
1976 prDataWindowStack.pop();
1977 kendo.unbind(
"#wndProfileLimit");
1980 if (prViewLimitExpanded) {
1981 prViewLimitExpanded =
false;
1986 }).data(
"kendoWindow");
1988 prObserveLimit =
new kendo.observable({
1990 sourceFeatures:
null,
1996 saveLimit: EventSaveLimit,
1997 changeFeature: EventChangeLimitFeature,
1998 spinLimit: EventSpinLimit,
1999 changeLabel: EventCheckLabel,
2000 changeCheck: EventCheckDirty
2003 prObserveLimitValidator = $(
"#wndProfileLimit").kendoValidator({
2005 }).data(
"kendoValidator");
2008 $.homecuValidator.setup({
2009 formStatusField:
"formStatus",
2010 formValidate:
"profileView",
2011 homecuCustomRules: {
2012 pcode: ValidateProfileCode,
2013 required: ValidateProfileRequired
2023 function InitDataSources() {
2024 prDataWindowStack = [];
2025 prDataProfiles = [];
2027 prDataLimitStack = [];
2028 prDataFeatures = [];
2029 prDataFeaturesFiltered = [];
2031 prDataSource =
new kendo.data.DataSource({
2036 contentType:
"application/x-www-form-urlencoded",
2045 requestStart:
function(request) {
2048 requestEnd:
function(response) {
2049 setTimeout(hideWaitWindow, 500);
2051 if (response.hasOwnProperty(
"response")) {
2052 if (response.response.hasOwnProperty(
"Results")) {
2053 var results = response.response.Results;
2055 if (results.hasOwnProperty(
"error")) {
2056 $.homecuValidator.homecuResetMessage =
true;
2057 $.homecuValidator.displayMessage(results.error, $.homecuValidator.settings.statusError);
2058 }
else if (results.hasOwnProperty(
"info")) {
2059 $.homecuValidator.homecuResetMessage =
true;
2060 $.homecuValidator.displayMessage(results.info, $.homecuValidator.settings.statusSuccess);
2063 $.homecuValidator.displayMessage(
"Error Parsing Server", $.homecuValidator.settings.statusError);
2066 $.homecuValidator.displayMessage(
"Error Parsing Server", $.homecuValidator.settings.statusError);
2070 parse:
function(response) {
2072 var results = response.Results;
2073 var resultData = results.data;
2074 var resultAction = results.action;
2076 if (results.hasOwnProperty(
"errors")) {
2080 if (resultData == undefined || resultData ==
null) {
2084 if (resultAction ==
"data_read") {
2085 DataSourceBuildProfiles(resultData.profiles);
2086 DataSourceBuildLimits(resultData.limits);
2087 DataSourceBuildFeatures(resultData.features);
2089 prDataLimitStack = [];
2090 if (resultAction ==
"profile_create") {
2091 DataSourceInsertProfile(resultData[0], 0);
2092 }
else if (resultAction ==
"profile_update") {
2093 DataSourceInsertProfile(resultData[0], 1);
2094 }
else if (resultAction ==
"profile_delete") {
2095 DataSourceRemoveProfile(resultData[0]);
2096 }
else if (resultAction ==
"limit_create") {
2097 DataSourceInsertLimit(resultData[0], 0);
2098 }
else if (resultAction ==
"limit_update") {
2099 DataSourceInsertLimit(resultData[0], 1);
2100 }
else if (resultAction ==
"limit_delete") {
2101 DataSourceRemoveLimit(resultData);
2111 $(document).ready(
function() {
2112 prInfoBar = $(
"#prInfoBar");
2115 prDataSource.read();
2117 setTimeout(
function() {
2121 prViewProfileDropdown.select(0);
2122 prViewProfileDropdown.trigger(
"select");
2123 prViewProfileDropdown.trigger(
"change");
2127 $(document).on(
'click',
'.k-overlay',
function() {
2129 if (prDataWindowStack.length > 0) {
2130 var wnd = prDataWindowStack[prDataWindowStack.length-1];