14 $monLibrary= dirname(__FILE__) .
"/../library";
15 $sharedLibrary= dirname(__FILE__) .
"/../../shared/library";
16 require_once(
"$monLibrary/cu_top.i");
17 require_once(
"$monLibrary/monitorView.i");
18 require_once(
"$monLibrary/ck_hticket.i");
19 require_once(
"$sharedLibrary/commonJsFunctions.i");
21 if (!CheckPerm($link, $Hu,
'loanAppConfig', $_SERVER[
'REMOTE_ADDR'])) {
24 header(
"Location: /hcuadm/hcu_noperm.prg");
29 $dataFile=
"lnappLookup.data";
32 printMonitorPageTop(
"Online Loan Application Lookup Options", $homecuKendoVersion, $cloudfrontDomainName);
36 .popupForm .grid_12, .formContainer .grid_12 {
50 .k-context-menu .k-item, .k-context-menu {
51 width: 150px !important;
55 <script type=
"text/javascript">
59 getErrorsAreShownFunction();
60 getSetupDeleteConfirmDialogFunction();
61 getAddMinifiedActionStyleFunction();
62 getEscapeHTMLFunction();
63 getShowSQLFunction($showSQL);
64 getSetupValidatorInGridFunction();
65 getUseValidatorInGridFunction();
66 getShowWaitFunctions();
72 var initialized=
false;
74 var grid= $(
"#grid").kendoGrid({
78 url:
"/hcuadm/<?php echo $dataFile; ?>?operation=read",
83 url:
"/hcuadm/<?php echo $dataFile; ?>?operation=createTop",
88 url:
"/hcuadm/<?php echo $dataFile; ?>?operation=updateTop",
92 parameterMap:
function (data, type) {
96 else if (type ==
"create")
97 return {topTitle: data.topTitle}
100 return {topTitle: data.topTitle, topId: data.topId};
108 topId: {type:
"number"},
109 topTitle: {type:
"title"},
110 details: {type:
"odata"}
113 parse:
function (data) {
116 $(
"#invalidRequestServerSide").val(errorsAreShown(data,
"formValidateMainDiv"));
118 if (data.operation ==
"update")
119 data.record[0].details= savedDetails;
123 sort: [{field:
"topTitle"}]
126 {field:
"topId", title:
"Id", width:
"80px"},
127 {field:
"topTitle", title:
"Option Title"}
130 filterable: {extra:
false},
131 toolbar: [{name:
"create", text:
""}],
132 detailTemplate:
"<div class=\"detailGrid\"></div>",
133 detailInit:
function (eOuter) {
134 initDetailGrid(eOuter);
138 template: kendo.template($(
"#topPopupTemplate").html()),
147 edit:
function (eOuter)
149 setupValidatorInGrid(eOuter,
false);
151 if (eOuter.model.isNew())
153 $(
".k-window-title").text(
"Add Lookup");
157 $(
".k-window-title").text(
"Edit Lookup");
160 save:
function (eOuter)
162 useValidatorInGrid(eOuter,
false);
164 if (!eOuter.model.isNew())
165 savedDetails= detailGrids[eOuter.model.topId+
""].dataSource.data().slice(0);
167 cancel:
function (eOuter)
171 var masterRows= $(this.tbody).find(
"tr.k-master-row");
173 $(masterRows).off(
"mouseenter mouseleave");
174 $(masterRows).on(
"mouseenter",
function () {
175 $(
this).addClass(
"k-state-hover");
176 dataItemForMenu= grid.dataItem($(
this));
179 $(masterRows).on(
"mouseleave",
function () {
180 $(
this).removeClass(
"k-state-hover");
183 $(masterRows).find(
"[role='gridcell']").on(
"click",
function () {
185 dataItemForMenu= grid.dataItem($(
this).parent());
186 grid.editRow($(
this).parent());
189 eOuter.preventDefault();
192 dataBound:
function (eOuter) {
193 var masterRows= $(this.tbody).find(
"tr.k-master-row");
197 addMinifiedActionStyle(
this,
true);
201 $(masterRows).each(
function() {
202 grid.expandRow($(
this));
203 grid.collapseRow($(
this));
207 initContextMenu(
this);
209 $(masterRows).on(
"mouseenter",
function () {
210 $(
this).addClass(
"k-state-hover");
211 dataItemForMenu= grid.dataItem($(
this));
214 $(masterRows).on(
"mouseleave",
function () {
215 $(
this).removeClass(
"k-state-hover");
218 $(masterRows).find(
"[role='gridcell']").on(
"click",
function () {
220 dataItemForMenu= grid.dataItem($(
this).parent());
221 grid.editRow($(
this).parent());
224 }).data(
"kendoGrid");
228 function initDetailGrid(eOuter)
230 var initialized=
false;
231 var detailData= eOuter.data.details.slice(0);
232 var detailGrid= eOuter.detailRow.find(
".detailGrid").kendoGrid({
235 read:
function (options) {
236 options.success(detailData);
238 create:
function (options) {
239 $.post(
"/hcuadm/<?php echo $dataFile; ?>?operation=createBottom", {bottomValue: options.data.bottomValue, bottomText: options.data.bottomText, topId: eOuter.data.topId},
242 if (!errorsAreShown(data,
"formValidatePopupDetailDiv"))
244 options.success(data.record);
245 eOuter.data.details= detailData.slice(0);
249 options.error(data.record);
254 update:
function (options) {
255 $.post(
"/hcuadm/<?php echo $dataFile; ?>?operation=updateBottom", {bottomValue: options.data.bottomValue, bottomText: options.data.bottomText, bottomId: options.data.bottomId},
258 if (!errorsAreShown(data,
"formValidatePopupDetailDiv"))
260 options.success(data.record);
261 eOuter.data.details= detailData.slice(0);
265 options.error(data.record);
275 bottomId: {type:
"number"},
276 bottomValue: {type:
"string"},
277 bottomText: {type:
"string"},
278 topId: {type:
"number"}
282 sort: [{field:
"bottomText", dir:
"asc"}, {field:
"bottomValue", dir:
"asc"}]
285 {field:
"bottomId", title:
"Id", width:
"80px"},
286 {field:
"bottomValue", title:
"Answer Value"},
287 {field:
"bottomText", title:
"Answer Display"}
290 filterable: {extra:
false},
293 template: kendo.template($(
"#bottomPopupTemplate").html()),
302 edit:
function (eInner)
304 setupValidatorInGrid(eInner,
true);
306 if (eInner.model.isNew())
308 $(
".k-window-title").text(
"Add Detail");
312 $(
".k-window-title").text(
"Edit Detail");
315 save:
function (eInner)
317 useValidatorInGrid(eInner,
true);
319 cancel:
function (eInner)
321 this.cancelChanges();
323 var detailRows= $(this.tbody).find(
"tr");
325 $(detailRows).off(
"mouseenter mouseleave click");
326 $(detailRows).on(
"mouseenter",
function () {
327 $(
this).addClass(
"k-state-hover");
329 dataItemForMenu= grid.dataItem($(
this));
332 $(detailRows).on(
"mouseleave",
function () {
333 $(
this).removeClass(
"k-state-hover");
336 $(detailRows).on(
"click",
function () {
338 dataItemForMenu= grid.dataItem($(
this));
339 grid.editRow($(
this));
342 eInner.preventDefault();
345 dataBound:
function (eInner)
348 var detailRows= $(this.tbody).find(
"tr");
349 $(detailRows).on(
"mouseenter",
function () {
350 $(
this).addClass(
"k-state-hover");
352 dataItemForMenu= grid.dataItem($(
this));
355 $(detailRows).on(
"mouseleave",
function () {
356 $(
this).removeClass(
"k-state-hover");
359 $(detailRows).on(
"click",
function () {
361 dataItemForMenu= grid.dataItem($(
this));
362 grid.editRow($(
this));
365 }).data(
"kendoGrid");
367 detailGrids[eOuter.data.topId]= detailGrid;
371 var dataItemForMenu=
null, gridForMenu=
null, rowForMenu=
null, detailGrids= [];
372 function initContextMenu(grid)
374 var contextMenu= $(
"#contextMenu").data(
"kendoContextMenu");
376 if (contextMenu ==
null)
378 var deleteConfirm= $(
"<div id='deleteDialog'></div>").kendoWindow({
379 content: {
template: $(
"#deleteConfirmTemplate").html()},
384 title:
"Confirm deletion",
388 }).data(
"kendoWindow");
390 $(
"#deleteDialog .deleteConfirmContinueBtn").click(
function () {
391 var deleteDetails= typeof(dataItemForMenu.details) !=
"undefined" && Number(dataItemForMenu.details.length) > 0 ?
"Y" :
"N";
392 var isMaster= $(gridForMenu.tbody).find(
"tr.k-master-row").length > 0;
393 var url=
"/hcuadm/<?php echo $dataFile; ?>?operation=" + (isMaster ?
"deleteTop" :
"deleteBottom");
394 var parameters= isMaster ? {topId: dataItemForMenu.topId, deleteDetails: deleteDetails} : {bottomId: dataItemForMenu.bottomId};
396 $.post(url, parameters,
function (data){
401 if (!errorsAreShown(data,
"formValidateMainDiv"))
403 var data= gridForMenu.dataSource.data().slice(0);
404 var
id= isMaster ?
"topId" :
"bottomId";
405 data= $.grep(data,
function(n,i) {
return n[id] != dataItemForMenu[id]; });
406 gridForMenu.dataSource.data(data);
410 var fullGridData= grid.dataSource.data().slice(0);
411 for(var i=0; i!= fullGridData.length; i++)
413 if (fullGridData[i].topId == dataItemForMenu.topId)
415 fullGridData[i].details= data;
419 grid.dataSource.data(fullGridData);
423 deleteConfirm.close();
427 $(
"#deleteDialog .deleteConfirmCancelBtn").click(
function () {
428 deleteConfirm.close();
432 var contextMenu= $(
"<div id='contextMenu'></div>").kendoContextMenu({
434 filter:
".k-master-row [role='gridcell'], .detailGrid .k-grid-content tr",
436 orientation:
"vertical",
437 popupCollision:
false,
443 var grid= $(e.event.target).closest(
".k-grid").data(
"kendoGrid");
444 var tr= $(e.event.target).closest(
"tr");
445 var dataItem= grid.dataItem($(tr));
447 if ($(grid.tbody).find(
".k-master-row").length != 0)
449 options= [{text:
"Edit", cssClass:
"editLi"}, {text:
"Delete", cssClass:
"deleteLi"}, {text:
"Add detail", cssClass:
"addDetailLi"}];
453 options= [{text:
"Edit", cssClass:
"editLi"}, {text:
"Delete", cssClass:
"deleteLi"}];
456 this.append(options);
461 var tr= $(e.target).closest(
"tr");
462 var grid= $(e.target).closest(
".k-grid").data(
"kendoGrid");
463 var dataItem= grid.dataItem($(tr));
465 if ($(item).hasClass(
"editLi"))
469 else if ($(item).hasClass(
"deleteLi"))
471 var numDetails= typeof(dataItem.details) ==
"undefined" ? 0 : Number(dataItem.details.length);
475 $(
"#detailDeleteMsg").show();
476 $(
"#detailDeleteMsg span").text(numDetails);
480 $(
"#detailDeleteMsg").hide();
482 deleteConfirm.open().center();
484 else if ($(item).hasClass(
"addDetailLi"))
486 detailGrids[dataItem.topId+
""].addRow();
489 }).data(
"kendoContextMenu");
493 $(document).ready(
function () {
498 <script
id=
"topPopupTemplate" type=
"text/x-kendo-template">
499 <div
id=
"formValidatePopupDiv" class=
"homecu-formStatus k-block k-error-colored" style=
"display:none;"></div>
500 <form
id=
"popupForm" class=
"popupForm" data-role=
"validator" novalidate>
501 <div
class=
"container_12">
502 <div
class=
"grid_12">
503 <div
class=
"grid_4 alpha">
504 <label>Title:</label>
507 <input type=
"text" class=
"k-input" name=
"topTitle" maxlength=
"50" required data-required-msg=
"Title is required" style=
"width: 100%">
509 <div
class=
"grid_1 omega">
510 <span data-
for=
'topTitle' class=
'k-invalid-msg'></span>
517 <script
id=
"bottomPopupTemplate" type=
"text/x-kendo-template">
518 <div
id=
"formValidatePopupDetailDiv" class=
"homecu-formStatus k-block k-error-colored" style=
"display:none;"></div>
519 <form
id=
"popupFormDetail" class=
"popupForm" data-role=
"validator" novalidate>
520 <div
class=
"container_12">
521 <div
class=
"grid_12" id=
"bottomIdRow" style=
"display: none;">
522 <div
class=
"grid_4 alpha">
526 <div>#: bottomId #</div>
528 <div
class=
"grid_1 omega">
532 <div
class=
"grid_12">
533 <div
class=
"grid_4 alpha">
534 <label>Value:</label>
537 <input type=
"text" class=
"k-input" name=
"bottomValue" maxlength=
"50" required data-required-msg=
"Value is required" style=
"width: 100%">
539 <div
class=
"grid_1 omega">
540 <span data-
for=
'bottomValue' class=
'k-invalid-msg'></span>
543 <div
class=
"grid_12">
544 <div
class=
"grid_4 alpha">
548 <input type=
"text" class=
"k-input" name=
"bottomText" maxlength=
"50" required data-required-msg=
"Text is required" style=
"width: 100%">
550 <div
class=
"grid_1 omega">
551 <span data-
for=
'bottomText' class=
'k-invalid-msg'></span>
557 <script
id=
"deleteConfirmTemplate" type=
"text/x-kendo-template">
558 <div
class=
"k-edit-form-container">
559 <div
class=
"container_12">
560 <div
class=
"grid_12 message">Are you sure that you want to
delete? <span
id=
"detailDeleteMsg" style=
"display:none;">This will also delete <span>1</span> detail(s) as well.</div>
562 <div
class=
"k-edit-buttons k-state-default">
563 <a
class=
"k-button k-button-icontext deleteConfirmContinueBtn" href=
"\#">
564 <span
class=
"k-icon k-i-check"></span>
567 <a
class=
"k-button k-button-icontext deleteConfirmCancelBtn" href=
"\#">
568 <span
class=
"k-icon k-i-cancel"></span>
575 <?php printMonitorPageMiddle(
"Online Loan Application Lookup Options"); ?>
576 <div
id=
'hideSubmitWait' style=
'position:relative; left:-2000px;top:-2000px;'>
577 <div
id=
'homecuSubmitWait' class=
'k-block' >
578 <div
class=
'k-loading-image'></div>
581 <input type=
"hidden" id=
"invalidRequestClientSide">
582 <input type=
"hidden" id=
"invalidRequestServerSide">
583 <div
class=
"container_12">
584 <div
class=
"grid_12">
585 <div
class=
"grid_7 alpha omega">
586 <div
id=
"sqlOutput"></div>
589 <div
class=
"grid_12">
590 <div
class=
"grid_7 alpha omega">
591 <div
id=
"formValidateMainDiv" class=
"k-block k-error-colored" style=
"display:none;"></div>
594 <div
class=
"grid_12">
595 <div
class=
"grid_7 alpha omega">
596 <div
id=
"grid" style=
"width:100%"></div>
601 <?php printMonitorPageBottom(); ?>