Odyssey
hcuExternalAccts.prg
1 <?php
2  /*
3  * File: hcuExternalAccts.prg
4  *
5  * Purpose: Let the user configure external accounts for External Transfers. User will set up an external
6  * account and activate it. This will cause some micro transactions to occur behind the scenes. The user
7  * will eventually confirm the account by entering the micro amounts for validation. At that point the
8  * external account can be used by the Transfer feature. Logic exists to help avoid user re-trying the
9  * confirmation process.
10  *
11  * This feature will be a single screen with dialogs to help enter information.
12  *
13  *
14  */
15  require_once(dirname(__FILE__) . '/../library/permissions.i');
16 
17 
18  // ** SET SCRIPT LEVEL VARIABLES
19  $serviceShowInfo = true;
20  $serviceLoadMenu = true;
21  $serviceShowMenu = true;
22 
23  // ** INCLUDE MAIN GLOBAL SCRIPT -- Handles security / global variable values
24  require_once(dirname(__FILE__) . '/../library/hcuService.i');
25  require_once(dirname(__FILE__) . '/../library/hcuExternalAccts.i');
26 
27  // include common functions
28 
29  /********* functions ************/
30  /********* end functions ********/
31 
32 
33  // ** INSERT BUSINESS LOGIC FOR THIS FORM
34  try {
35  $Cu = $HB_ENV["Cu"];
36  $Cn = $HB_ENV["Cn"];
37  $chome = $HB_ENV["chome"];
38  $Flang = $HB_ENV["Flang"];
39 
40  // get initial variables
41  $inputVars = array();
42  $varOk = array(
43  );
44 
45  HCU_ImportVars($inputVars, "", $varOk);
46 
47  // ** INCLUDE PRE CONTENT SCRIPT
48  require_once(dirname(__FILE__) . '/../includes/hcuPreContent.i');
49 
50  // make sure the user can be here
51  PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_EXTERNAL_TRANSFERS, 'create');
52 
53  // ** Verify the feature is enabled for the Credit Union.
54  $featureEnabled = Check_ExternalTransfersEnabled( $dbh, $HB_ENV );
55  if ( $featureEnabled !== true ) {
56  // * Feature NOT set
57  throw new Exception( HCU_JsonEncode( $MC->msg('Option not set', HCU_DISPLAY_AS_HTML) ), 915 );
58  }
59 
60  // ** Verify the user can access this feature.
61  $permissionInputs = array( "feature" => FEATURE_EXTERNAL_TRANSFERS );
62  $accessRights = Perm_AccessRights( $dbh, $HB_ENV, $permissionInputs );
63 
64  if ( !$accessRights["create"] ) {
65  // * Rights NOT set
66  throw new Exception( HCU_JsonEncode( $MC->msg('Rights not set', HCU_DISPLAY_AS_HTML) ), 915 );
67  }
68 
69  // get some allowed amounts for client-side validation
70  $limits = Perm_GetValidationLimits( $dbh, $HB_ENV, $permissionInputs );
71 
72  if ( $limits === false || !isset( $limits["count_per_day"] ) || !isset( $limits["group"]["count_per_day"] ) ) {
73  // error occurred - assume count of zero
74  $allowedCount = 0;
75  } else {
76  $allowedCount = intval( $limits["count_per_day"] );
77  }
78 
79  $Fset = $HB_ENV["Fset"];
80 
81  // ** Retrieve the notice for External accounts
82  $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC, "D", "extAccountNotice", true);
83 
84  $hasNoticeEXT = false;
85  $hasNoticePopupEXT = false;
86  $noticeURLEXT = "";
87  $noticeLinkDisplayEXT = "";
88 
89  if ( $noticesAry["status"]["code"] == "000" && HCU_array_key_exists('0', $noticesAry['notice'])) {
90  if ($noticesAry["notice"][0]["notice_id"] ) {
91  $hasNoticeEXT = true;
92  $noticeLinkDisplayEXT = $noticesAry["notice"][0]["notice_linkdisplay"];
93 
94  $noticeOption = $noticesAry['notice'][0];
95 
96  $noticeOptions = Array (
97  'docsid' => $noticeOption['notice_id'],
98  'docstype' => $noticeOption['notice_type'],
99  'device' => 'D',
100  'noticeOnly' => '0',
101  'expireTime' => mktime() + 86400
102  );
103 
104  $encryptedDocDetails= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
105 
106  $noticeOptions['noticeOnly'] = 1;
107 
108  $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
109 
110  // build the url encoded string
111  // * For the popup terms
112  $noticeURLEXT = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetails);
113 
114  // * For the regular Button
115  $noticeURLNoticeOnly = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetailsNoticeOnly);
116 
117  // see if there is a popup notice
118  $hasNoticePopupEXT = $noticeOption["notice_popup"] ? true : false;
119  }
120  }
121 
122  // ** Retrieve the Terms of Use for External accounts
123  $noticesAry = Get_NoticeInfo($dbh, $HB_ENV, $MC, "D", "extAccountTerms", true);
124 
125  $hasTermsEXT = false;
126  $hasTermsPopupEXT = false;
127  $termsURLEXT = "";
128  $termsLinkDisplayEXT = "";
129 
130  if ( $noticesAry["status"]["code"] == "000" && HCU_array_key_exists('0', $noticesAry['notice'])) {
131  if ($noticesAry["notice"][0]["notice_id"] ) {
132  $hasTermsEXT = true;
133  $noticeOption = $noticesAry['notice'][0];
134 
135  $noticeOptions = Array (
136  'docsid' => $noticeOption['notice_id'],
137  'docstype' => $noticeOption['notice_type'],
138  'device' => 'D',
139  'noticeOnly' => '0',
140  'expireTime' => mktime() + 86400
141  );
142 
143  $encryptedDocDetails= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
144 
145  $noticeOptions['noticeOnly'] = 1;
146 
147  $encryptedDocDetailsNoticeOnly= HCU_PayloadEncode($HB_ENV['Cu'], $noticeOptions);
148 
149  // build the url encoded string
150  // * For the popup terms
151  $termsURLEXT = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetails);
152 
153  // * For the regular Button
154  $termsURLNoticeOnly = $HB_ENV['homebankingpath'] . '/hcuViewNotice.prg?cu=' . $HB_ENV['cu'] . '&x=' . urlencode($encryptedDocDetailsNoticeOnly);
155 
156  // see if there is a popup notice
157  $hasTermsPopupEXT = $noticeOption["notice_popup"] ? true : false;
158 
159  $termsButtonText = $noticeOption["notice_linkdisplay"];
160  }
161  }
162 
163  /*
164  * ** START CONTENT
165  */
166 
167 
168  // list the account types for remote account (for ach) - used in dropdown list
169  $accountTypes = array( array( "type" => ACCOUNT_TYPE_CHECKING, "display" => $MC->msg("ACH Checking", HCU_DISPLAY_AS_HTML) ),
170  array( "type" => ACCOUNT_TYPE_SAVINGS, "display" => $MC->msg("ACH Savings", HCU_DISPLAY_AS_HTML) )
171  );
172 
173  ?>
174  <div class="col-xs-12" style='font-size:12px;'>
175  <div id="hcuAchTables" class="k-content" style="max-width:700px;"></div>
176  <!-- set up the array with status names -->
177  <?php $statuses = Get_ExternalTransferStatusLookup( $MC ); ?>
178  </div>
179  <script >
180 
181  var extAcctGrid;
182  var achAccountTypes = <?php echo HCU_JsonEncode( $accountTypes ); ?>;
183  var extStatusLookup = <?php echo HCU_JsonEncode( $statuses ) ?>;
184  var extGridList = [];
185  var addAccountModel;
186  var addAccountDialog;
187  var window_stack = [];
188  var extDetailDialog;
189  var extValidateDialog;
190  var deleteDialog;
191  var dsHelper = null;
192 
193  // check for notices
194  var terms = <?php echo HCU_JsonEncode($hasTermsEXT && $hasTermsPopupEXT); ?>;
195  var notice = <?php echo HCU_JsonEncode($hasNoticeEXT && $hasNoticePopupEXT); ?>;
196 
197  // status will be shown in the default info location
198  function ShowStatus( statusMessage ) {
199  $.homecuValidator.settings.formStatusField = "formStatus";
200  $.homecuValidator.settings.formInfoTitle = "";
201  $.homecuValidator.displayMessage(statusMessage);
202  }
203 
204  function GetExternalAccounts( ) {
205  var request = { action: "get_accounts" };
206 
207  dsHelper.read( request );
208  }
209 
210  // This is to launch the dialog from a link (for screenreaders).
211  function LaunchValidationDialog( id ) {
212  // find the right entry
213  for ( var i = 0; i < extGridList.length; i++ ) {
214  if ( extGridList[i].id == id ) {
215  ShowValidationInput( extGridList[i] );
216  break;
217  }
218  }
219  } // end LaunchValidationDialog
220 
221  // This is to launch the dialog from a link (for screenreaders).
222  function LaunchUpdateDialog( id ) {
223  // find the right entry
224  for ( var i = 0; i < extGridList.length; i++ ) {
225  if ( extGridList[i].id == id ) {
226  ShowExtAcctDetail( extGridList[i] );
227  break;
228  }
229  }
230  } // end LaunchUpdateDialog
231 
232  // Show the detail of the External Account info.
233  function ShowExtAcctDetail( detailInfo ) {
234  // initialize the observable
235  updateAccountModel.ResetModel();
236  updateAccountModel.set( "extAcctId", detailInfo.id );
237  updateAccountModel.set( "extName", detailInfo.displayName );
238  updateAccountModel.set( "extNameOnAccount", detailInfo.nameOnAccount );
239 
240  var content =
241  "<div id='editFormStatus' class='homecu-formStatus k-block k-error-colored' style='display:none; margin-bottom:10px;max-width:800px;'></div>" +
242  "<div id='extAcctUpdate' class='well well-sm form-horizontal'>" +
243  "<div class='form-group'>" +
244  "<label class='col-xs-12 col-sm-5' for='extNameUpdate'><?php echo $MC->msg("EXT Display Name", HCU_DISPLAY_AS_JS) ?></label>" +
245  "<div class='col-xs-12 col-sm-7'>" +
246  "<input id='extNameUpdate' \
247  name='extNameUpdate' \
248  maxlength='20' \
249  data-bind='value: extName, events:{change: setDirty}' \
250  placeholder='<?php echo $MC->msg("ACH Required", HCU_DISPLAY_AS_JS) ?>' \
251  type='text' \
252  class='k-textbox k-autocomplete hcu-all-100' \
253  required \
254  validationMessage = '<?php echo $MC->msg("EXT Display Name required", HCU_DISPLAY_AS_JS) ?>' \
255  autocomplete='off' />" +
256  "</div>" +
257  "</div>" +
258  "<div class='form-group'>" +
259  "<label class='col-xs-12 col-sm-5' for='extNameOnAcctUpdate'><?php echo $MC->msg("EXT Name On Account", HCU_DISPLAY_AS_JS) ?></label>" +
260  "<div class='col-xs-12 col-sm-7'>" +
261  "<input id='extNameOnAcctUpdate' \
262  name='extNameOnAcctUpdate' \
263  maxlength='30' \
264  data-bind='value: extNameOnAccount, events:{change: setDirty}' \
265  placeholder='<?php echo $MC->msg("ACH Required", HCU_DISPLAY_AS_JS) ?>' \
266  type='text' \
267  class='k-textbox k-autocomplete hcu-all-100' \
268  required \
269  validationMessage = '<?php echo $MC->msg("EXT Name On Account required", HCU_DISPLAY_AS_JS) ?>' \
270  autocomplete='off'/>" +
271  "</div>" +
272  "</div>" +
273  "<div class='form-group'>" +
274  "<label class='col-xs-12 col-sm-5'><?php echo $MC->msg("Status", HCU_DISPLAY_AS_JS) ?></label>" +
275  "<div class='col-xs-12 col-sm-7'>" + detailInfo.statusName + "</div>" +
276  "</div>" +
277  "<div class='form-group'>" +
278  "<label class='col-xs-12 col-sm-5'><?php echo $MC->msg("Account", HCU_DISPLAY_AS_JS) ?></label>" +
279  "<div class='col-xs-12 col-sm-7'>" + detailInfo.account + "</div>" +
280  "</div>" +
281  "<div class='form-group'>" +
282  "<label class='col-xs-12 col-sm-5'><?php echo $MC->msg("Type", HCU_DISPLAY_AS_JS) ?></label>" +
283  "<div class='col-xs-12 col-sm-7'>" + detailInfo.type + "</div>" +
284  "</div>" +
285  "</div>" +
286  "<div class=\"hcu-template\">" +
287  "<div class=\"hcu-edit-buttons k-state-default\">" +
288  "<span class=\"hcu-icon-delete\">" +
289  "<a href=\"##\" id=\"lnkDelete\">" +
290  "<i class=\"fa fa-trash fa-lg\"></i>" +
291  "</a>" +
292  "</span>" +
293  "<a href=\"##\" id=\"lnkCancel\"><?php echo $MC->msg('Cancel', HCU_DISPLAY_AS_JS); ?></a>" +
294  "&emsp;" +
295  "<a href=\"##\" id=\"btnUpdate\" class=\"k-button k-primary\">" +
296  "<i class=\"fa fa-check fa-lg\"></i><?php echo $MC->msg('Update', HCU_DISPLAY_AS_JS); ?>" +
297  "</a>" +
298  "</div>" +
299  "</div>";
300 
301  extDetailDialog.content(content);
302  $.homecuValidator.setup( {formStatusField: "editFormStatus", formValidate: "extAcctUpdate"} );
303  kendo.bind($("#extAcctUpdate"), updateAccountModel);
304  extDetailDialog.center();
305  extDetailDialog.open();
306  } // end ShowExtAcctDetail
307 
308  // Let the user input the validation values
309  function ShowValidationInput( detailInfo ) {
310  // initialize the observable
311  updateAccountModel.ResetModel();
312  updateAccountModel.set( "extAcctId", detailInfo.id );
313  // set the retry and pending date
314  updateAccountModel.set( "retries", detailInfo.retries );
315  updateAccountModel.set( "pendingDate", detailInfo.pendingDate );
316 
317 
318  var content =
319  "<div id='validateFormStatus' class='homecu-formStatus k-block k-error-colored' style='display:none; margin-bottom:10px;max-width:800px;'></div>" +
320  "<div id='extAcctValidate' class='well well-sm form-horizontal'>" +
321  "<div class='form-group'>" +
322  "<div class='col-xs-12 hcu-secondary-text'><?php echo $MC->msg("EXT Validate message", HCU_DISPLAY_AS_JS) ?></div>" +
323  "</div>" +
324  "<div class='form-group'>" +
325  "<label class='col-xs-12 col-sm-7' for='textNameUpdate'><?php echo $MC->msg("EXT Micro First", HCU_DISPLAY_AS_JS) ?></label>" +
326  "<div class='col-xs-2 col-sm-1 leading-zero-fontsize local-align-leading-zero'>$0.</div>" +
327  "<div class='col-xs-4 col-sm-4'>" +
328  "<input id='extMicro1' \
329  name='extMicro1' \
330  maxlength='2' \
331  data-bind='value: extMicro1' \
332  type='number' \
333  class='hcu-all-100 validation-entry' \
334  required \
335  validationMessage = '<?php echo $MC->msg("EXT Micro required", HCU_DISPLAY_AS_JS) ?>' \
336  autocomplete='off' />" +
337  "</div>" +
338  "</div>" +
339  "<div class='form-group'>" +
340  "<label class='col-xs-12 col-sm-7' for='extMicro2'><?php echo $MC->msg("EXT Micro Second", HCU_DISPLAY_AS_JS) ?></label>" +
341  "<div class='col-xs-2 col-sm-1 leading-zero-fontsize local-align-leading-zero'>$0.</div>" +
342  "<div class='col-xs-4 col-sm-4'>" +
343  "<input id='extMicro2' \
344  name='extMicro2' \
345  maxlength='2' \
346  data-bind='value: extMicro2' \
347  type='number' \
348  class='hcu-all-100 validation-entry' \
349  required \
350  validationMessage = '<?php echo $MC->msg("EXT Micro required", HCU_DISPLAY_AS_JS) ?>' \
351  autocomplete='off' />" +
352  "</div>" +
353  "</div>" +
354  "<div class='form-group'>" +
355  "<label class='col-xs-12 col-sm-7' for='textNameUpdate'><?php echo $MC->msg("EXT Retries Left", HCU_DISPLAY_AS_JS) ?></label>" +
356  "<div class='col-xs-12 col-sm-5 leading-zero-fontsize'><span data-bind='text: retries'></span></div>" +
357  "</div>" +
358  "<div class='form-group'>" +
359  "<label class='col-xs-12 col-sm-7' for='textNameUpdate'><?php echo $MC->msg("EXT Date Started", HCU_DISPLAY_AS_JS) ?></label>" +
360  "<div class='col-xs-12 col-sm-5'><span data-bind='text: pendingDate'></span></div>" +
361  "</div>" +
362  "</div>" +
363  "<div class=\"hcu-template\">" +
364  "<div class=\"hcu-edit-buttons k-state-default\">" +
365  "<a href=\"##\" id=\"lnkCancel\"><?php echo $MC->msg("Cancel", HCU_DISPLAY_AS_JS); ?></a>" +
366  "&emsp;" +
367  "<a href=\"##\" id=\"btnUpdate\" class=\"k-button k-primary\">" +
368  "<i class=\"fa fa-check fa-lg\"></i><?php echo $MC->msg("Update", HCU_DISPLAY_AS_JS); ?>" +
369  "</a>" +
370  "</div>" +
371  "</div>";
372 
373  extValidateDialog.content(content)
374  $.homecuValidator.setup( {formStatusField: "validateFormStatus", formValidate: "extAcctValidate"} );
375  kendo.bind($("#extAcctValidate"), updateAccountModel);
376  extValidateDialog.center();
377  extValidateDialog.open();
378 
379  } // end ShowValidationInput
380 
381  // Handle the account info returned from server. Use the status to set up correct string for the link cell.
382  function HandleGetAccounts( accountInfo ) {
383  var hasPending = false;
384  extGridList = [];
385 
386  for ( var i = 0; i < accountInfo.length; i++ ) {
387  var remoteInfo = JSON.parse( accountInfo[i].remote_info );
388  var remoteAccount = accountInfo[i]["remoteAccount"];
389 
390  var retries = 0;
391  var verificationStart = "";
392  var linkStr = "<a title='<?php echo $MC->msg("EXT Edit Account Info", HCU_DISPLAY_AS_JS) ?>' href='javascript:LaunchUpdateDialog(" + accountInfo[i].id + ")'><div class='fa fa-pencil text-primary'></div></a>";
393  linkStr += "<span class='hcu-icon-spacer'></span>";
394  if ( accountInfo[i].status == 'p' ) {
395  retries = remoteInfo["verify"]["tries"];
396  verificationStart = remoteInfo["verify"]["pending_date"];
397  linkStr += "<a title='<?php echo $MC->msg("EXT Validate Account", HCU_DISPLAY_AS_JS) ?>' href='javascript:LaunchValidationDialog(" + accountInfo[i].id + ")'><div class='fa fa-flag text-info'></div></a>";
398  } else if ( accountInfo[i].status == 'a' ) {
399  linkStr += "<div class='fa fa-check text-success'></div>";
400  } else if ( accountInfo[i].status == 'i' ) {
401  linkStr += "<div class='fa fa-ban text-danger'></div>";
402  } else if ( accountInfo[i].status == 'l' ) {
403  // lowercase "L"
404  linkStr += "<div class='fa fa-lock text-danger'></div>";
405  } else {
406  linkStr += "<div class='fa fa-question text-danger'></div>";
407  }
408 
409  var newObject = {
410  id: accountInfo[i].id,
411  userId: accountInfo[i].user_id,
412  displayName: accountInfo[i].display_name,
413  nameOnAccount: accountInfo[i].name_on_account,
414  status: accountInfo[i].status,
415  statusName: extStatusLookup[accountInfo[i].status],
416  linksStr: linkStr,
417  account: remoteAccount,
418  type: (remoteInfo.rdfi.type == 20 ?
419  "<?php echo $MC->msg("ACH Savings", HCU_DISPLAY_AS_JS) ?>" :
420  "<?php echo $MC->msg("ACH Checking", HCU_DISPLAY_AS_JS) ?>"),
421  retries: retries,
422  pendingDate: verificationStart
423  };
424 
425  extGridList.push( newObject );
426 
427  // see if it is a pending
428  if ( accountInfo[i].status == 'p' ) {
429  hasPending = true;
430  }
431 
432  if ( hasPending ) {
433  $("#extValidationMsg").show();
434  } else {
435  $("#extValidationMsg").hide();
436  }
437  }
438 
439  // reset the data in the grid
440  extAcctGrid.dataSource.data(extGridList);
441 
442  } // end HandleGetAccounts
443 
444  function HandleUpdateAccount( updateInfo ) {
445  var idValidated = updateInfo["id"];
446 
447  // remove from the list
448  for ( var i = 0; i < extGridList.length; i++ ) {
449  if ( extGridList[i].id == idValidated ) {
450  extGridList[i].displayName = updateInfo["display_name"];
451  extGridList[i].nameOnAccount = updateInfo["name_on_account"];
452  break;
453  }
454  }
455 
456  // reset the data in the grid
457  extAcctGrid.dataSource.data(extGridList);
458 
459  } // end HandleUpdateAccount
460 
461  function HandleValidateAccount( validationInfo ) {
462  var idValidate = validationInfo["id"];
463 
464  // find the entry
465  for ( var i = 0; i < extGridList.length; i++ ) {
466  if ( extGridList[i].id == idValidate ) {
467  // what we do depends on the status
468  if ( validationInfo["status"] == "p" || validationInfo["status"] == "l" ) {
469  // validation failed
470  $.homecuValidator.displayMessage( validationInfo["message"], $.homecuValidator.settings.statusError );
471  extGridList[i].retries = validationInfo["tries"];
472  updateAccountModel.set( "retries", validationInfo["tries"] );
473  if ( validationInfo["status"] == "l" ) {
474  extGridList[i].status = validationInfo["status"];
475  extGridList[i].statusName = extStatusLookup[validationInfo["status"]];
476  var linkStr = "<a title='<?php echo $MC->msg("EXT Edit Account Info", HCU_DISPLAY_AS_JS) ?>' href='javascript:LaunchUpdateDialog(" + idValidate + ")'><div class='fa fa-pencil text-primary'></div></a><span class='hcu-icon-spacer'></span><div class='fa fa-lock text-danger'></div>";
477 
478  extGridList[i].linksStr = linkStr;
479  }
480  } else if ( validationInfo["status"] == "a" ) {
481  extGridList[i].status = validationInfo["status"];
482  extGridList[i].statusName = extStatusLookup[validationInfo["status"]];
483 
484  var linkStr = "<a title='<?php echo $MC->msg("EXT Edit Account Info", HCU_DISPLAY_AS_JS) ?>' href='javascript:LaunchUpdateDialog(" + idValidate + ")'><div class='fa fa-pencil text-primary'></div></a><span class='hcu-icon-spacer'></span><div class='fa fa-check text-success'></div>";
485  extGridList[i].linksStr = linkStr;
486 
487  $.homecuValidator.displayMessage( validationInfo["message"] );
488  }
489 
490  break;
491  }
492  }
493 
494  // reset the data in the grid
495  extAcctGrid.dataSource.data(extGridList);
496 
497  } // end HandleValidateAccount
498 
499  function HandleDeleteAccount( idToDelete ) {
500  // remove from the list
501  for ( var i = 0; i < extGridList.length; i++ ) {
502  if ( extGridList[i].id == idToDelete ) {
503  extGridList.splice(i, 1);
504  break;
505  }
506  }
507 
508  // reset the data in the grid
509  extAcctGrid.dataSource.data(extGridList);
510 
511  }
512 
513  function InitDataSources() {
514  dsHelper = new kendo.data.DataSource({
515  autoSync: false,
516  batch: false,
517  transport: {
518  read: {
519  url: 'hcuExternalAccts.data?cu=<?php echo $HB_ENV['cu']; ?>',
520  dataType: "json",
521  contentType: "application/x-www-form-urlencoded",
522  type: "POST",
523  cache: false
524  }
525  },
526  schema: {
527  parse: function(response) {
528  // not showing data, so return empty array
529  var display = [];
530  return display;
531  }
532  },
533  requestStart: function( e ) {
534  ShowWaitWindow();
535  },
536  requestEnd: function( e ) {
537  var error = null;
538  var results = null;
539 
540  CloseWaitWindow();
541 
542  if ( e.response && e.response.Results ) {
543  results = e.response.Results;
544 
545  // see if there is an error
546  if ( results && results.homecuErrors )
547  error = results.homecuErrors;
548 
549  if ( error && error.length > 0 ) {
550  e.preventDefault();
551  // make sure only old data
552  dsHelper.cancelChanges();
553  // show the error information
554  $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
555  } else {
556 
557  if ( results && results.homecuInfo && (results.homecuInfo.length > 0) ) {
558  ShowStatus( results.homecuInfo );
559  }
560 
561  // handle any returned data
562  if ( results && results.homecuData ) {
563  if ( results.homecuData.get_accounts ) {
564  HandleGetAccounts( results.homecuData.get_accounts);
565  } else if ( results.homecuData.add_account ) {
566  // close the window
567  addAccountDialog.close();
568 
569  // reset the default error form
570  $.homecuValidator.settings.formStatusField = "formStatus";
571 
572  // the same data gets returns as "get_accounts" if successful
573  HandleGetAccounts( results.homecuData.add_account );
574  } else if ( results.homecuData.update_account ) {
575  // close the window
576  extDetailDialog.close();
577 
578  // reset the default error form
579  $.homecuValidator.settings.formStatusField = "formStatus";
580 
581  // the same data gets returns as "get_accounts" if successful
582  HandleUpdateAccount( results.homecuData.update_account );
583  } else if ( results.homecuData.validate_account ) {
584  // could return success or failure - "a" active means success
585  if ( results.homecuData.validate_account["status"] == "a" ) {
586  // close the window
587  extValidateDialog.close();
588 
589  // reset the default error form
590  $.homecuValidator.settings.formStatusField = "formStatus";
591  }
592 
593  // update the local data with the new info
594  HandleValidateAccount( results.homecuData.validate_account );
595  } else if ( results.homecuData.delete_account ) {
596  // close the window
597  extDetailDialog.close();
598 
599  // reset the default error form
600  $.homecuValidator.settings.formStatusField = "formStatus";
601 
602  // the same data gets returns as "get_accounts" if successful
603  HandleDeleteAccount( results.homecuData.delete_account );
604  }
605 
606  }
607 
608  }
609  } else {
610  error = "<?php echo $MC->msg("Transport error", HCU_DISPLAY_AS_JS) ?>";
611  $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
612  }
613  },
614 
615  // code to run if the request fails; the raw request and
616  // status codes are passed to the function
617  error: function( e ) {
618  }
619  });
620  }
621 
622  function InitDataViews() {
623  addAccountModel = kendo.observable({
624  extName: "",
625  extNameOnAccount: "",
626  extDFIRouting: "",
627  extDFIAccount: "",
628  extDFIConfirm: "",
629  extDFISelectedType: "",
630  dirtyFlag: false,
631  ResetModel: function () {
632  this.set( "extName", "" );
633  this.set( "extNameOnAccount", "" );
634  this.set( "extDFIRouting", "" );
635  this.set( "extDFIAccount", "" );
636  this.set( "extDFIConfirm", "" );
637  this.set( "extDFISelectedType", "" );
638  this.set( "dirtyFlag", false );
639  },
640  setDirty: function(e) {
641  this.set( "dirtyFlag", true );
642  },
643  SendToServer: function () {
644  var action = "add_account";
645  var request = {
646  action: action,
647  display_name: this.extName,
648  name_on_account: this.extNameOnAccount,
649  dfi_routing: this.extDFIRouting,
650  dfi_account: this.extDFIAccount,
651  dfi_account_type: this.extDFISelectedType
652  };
653 
654  dsHelper.read( request );
655  }
656  });
657 
658  updateAccountModel = kendo.observable({
659  extAcctId: 0,
660  extName: "",
661  extNameOnAccount: "",
662  extMicro1: "",
663  extMicro2: "",
664  retries: 0, // read-only, for verfication step
665  pendingDate: "", // read-only, for verfication step
666  dirtyFlag: false,
667  ResetModel: function () {
668  this.set( "extAcctId", 0 );
669  this.set( "extName", "" );
670  this.set( "extNameOnAccount", "" );
671  this.set( "extMicro1", "" );
672  this.set( "extMicro2", "" );
673  this.set( "dirtyFlag", false );
674  },
675  setDirty: function(e) {
676  this.set( "dirtyFlag", true );
677  },
678  SendToServer: function () {
679  var action = "update_account";
680  var request = {
681  action: action,
682  id: this.extAcctId,
683  display_name: this.extName,
684  name_on_account: this.extNameOnAccount
685  };
686 
687  dsHelper.read( request );
688  },
689  SendMicros: function () {
690  var action = "validate_account";
691  var request = {
692  action: action,
693  id: this.extAcctId,
694  micro1: this.extMicro1,
695  micro2: this.extMicro2
696  };
697 
698  dsHelper.read( request );
699  }
700  });
701 
702  // set up an error validator in case of an error
703  $.homecuValidator.setup({formErrorTitle: "<?php echo $MC->msg("Error Occurred", HCU_DISPLAY_AS_JS) ?>"});
704 
705  extAcctGrid = $('#extAcctGrid').kendoGrid({
706 
707  dataSource: extGridList,
708  autoBind: true,
709  selectable: "cell",
710  scrollable: true,
711  toolbar: kendo.template($("#gridToolbar").html()),
712  noRecords: {template: "<span class='hcu-secondary-text'><?php echo $MC->msg("EXT No Accounts", HCU_DISPLAY_AS_JS) ?></span>"},
713  columns: [
714  { field: "status",
715  title: " ",
716  template: "#= data.linksStr #",
717  width: 65 },
718  { field: "displayName",
719  title: "<?php echo $MC->msg("Name", HCU_DISPLAY_AS_JS) ?>" },
720  { field: "statusName",
721  title: "<?php echo $MC->msg("Status", HCU_DISPLAY_AS_JS) ?>",
722  width: 160,
723  minScreenWidth: 567 },
724  { field: "account",
725  title: "<?php echo $MC->msg("ACH Account Info", HCU_DISPLAY_AS_JS) ?>",
726  minScreenWidth: 374 }
727  ],
728  change: function(e) {
729  e.preventDefault();
730  $.homecuValidator.displayMessage( "" );
731 
732  var selectedCell = this.select();
733  var selectedRow = selectedCell.closest("tr");
734  var cellIndex = selectedCell.index();
735 
736  // get the values
737  var currSelectedItem = extAcctGrid.dataItem(selectedRow);
738 
739  if ( cellIndex >= 1 ) {
740  ShowExtAcctDetail( currSelectedItem );
741  }
742 
743  selectedCell.removeClass( "k-state-selected" );
744  }
745  }).data('kendoGrid');
746 
747  var maxHeight = parseInt($(window).height() * .9, 10);
748  var widthDialog = parseInt($(window).width() * .8, 10);
749  var addAccountTemplate = $("#addAccountTemplate").html();
750  addAccountDialog = $(addAccountTemplate).kendoWindow({
751  modal: true,
752  visible: false,
753  resizable: false,
754  maxHeight: maxHeight,
755  width: widthDialog,
756  maxWidth: 700,
757  minWidth: 300,
758  title: "<?php echo $MC->msg("ACH Account Info", HCU_DISPLAY_AS_JS) ?>",
759  activate: function() {
760  // add the close function to the window stack
761  window_stack.push(function(e) {
762  if ( addAccountModel.dirtyFlag ) {
763  discardDialog.open();
764  } else {
765  addAccountDialog.close(e);
766  }
767  });
768 
769  // set the form status so validation errors show on the form
770  $.homecuValidator.setup({formValidate: "addAccountDialog", formStatusField: 'addFormStatus'});
771 
772  // clean out any existing data
773  addAccountModel.ResetModel();
774 
775  // need to strip out something Kendo added
776  $('#addAccountDialog').css('overflow', '');
777 
778  // add the dropdown, if doesn't already exist
779  if (!$("#achAccountType").data("kendoDropDownList")) {
780  $("#achAccountType").kendoDropDownList({
781  dataTextField: "display",
782  dataValueField: "type",
783  dataSource: achAccountTypes,
784  optionLabel: {type: "", display: "<?php echo $MC->msg("ACH Select Type", HCU_DISPLAY_AS_JS) ?>"},
785  });
786  }
787 
788  // masked for routing number (always 9 digits)
789  if (!$("#singleRecipientRouting").data("kendoMaskedTextBox")) {
790  $("#singleRecipientRouting").kendoMaskedTextBox({
791  mask: "000000000",
792  clearPromptChar: true
793  });
794  }
795 
796  // bind the add model to the template
797  kendo.bind($("#addAccountDialog"), addAccountModel);
798 
799  // setup cancel and update links
800  $("#addAccountDialog #btnUpdate").on("click", function(e) {
801  e.preventDefault();
802 
803  // also check other things
804  var otherErrors = Array();
805 
806  if ( addAccountModel.extDFIRouting.replace(/_/g, '').length != 9 || !(/^\d+$/.test(addAccountModel.extDFIRouting)) ) {
807  // get the validation message from the component
808  otherErrors.push( $("#singleRecipientRouting").attr( "validationMessage" ) );
809  }
810  if ( addAccountModel.extDFIAccount.length < 1 ) {
811  // get the validation message from the component
812  otherErrors.push( $("#singleRecipientAccount").attr( "validationMessage" ) );
813  }
814  if ( addAccountModel.extDFIAccount !== addAccountModel.extDFIConfirm ) {
815  // get the validation message from the component
816  otherErrors.push( $("#singleRecipientConfirm").attr( "data-homecuCustomEquals-msg" ) );
817  }
818  if ( addAccountModel.extDFISelectedType === "" ) {
819  // get the validation message from the component
820  otherErrors.push( $("#achAccountType").attr( "validationMessage" ) );
821  }
822 
823  $.homecuValidator.validate();
824  var totalErrors = $.homecuValidator.homecuKendoValidator.errors();
825 
826  // cannot concat errors together because there may be duplicate errors
827  for (var i = 0; i < otherErrors.length; i++) {
828  if ($.inArray(otherErrors[i], totalErrors) == -1) {
829  totalErrors.push(otherErrors[i]);
830  }
831  }
832 
833  if (totalErrors.length > 0) {
834  $.homecuValidator.displayMessage(totalErrors, $.homecuValidator.settings.statusError);
835  } else {
836  // set up to report to the dialog's form
837  $.homecuValidator.settings.formStatusField = "addFormStatus";
838 
839  if ( addAccountModel.dirtyFlag ) {
840  // send update to server
841  addAccountModel.SendToServer();
842 
843  // don't close, in case an error is returned
844  return false;
845  } else {
846  return true;
847  }
848  }
849  });
850 
851  $("#addAccountDialog #lnkCancel").on("click", function(e) {
852  e.preventDefault();
853  discardDialog.open();
854  });
855  },
856  close: function() {
857  // now remove the close function call
858  window_stack.pop();
859 
860  // remove cancel/update functions
861  $("#addAccountDialog #btnUpdate").off();
862  $("#addAccountDialog #lnkCancel").off();
863  }
864  }).data("kendoWindow");
865 
866  var maxHeight = parseInt($(window).height() * .9, 10);
867  extDetailDialog = $("#extDetailDialog").kendoWindow({
868  modal: true,
869  visible: false,
870  resizable: false,
871  title: "<?php echo $MC->msg("EXT Edit Account Info", HCU_DISPLAY_AS_JS) ?>",
872  maxHeight: maxHeight,
873  maxWidth: 700,
874  minWidth: 300,
875  activate: function() {
876  // add the close function to the window stack
877  window_stack.push(function(e) {
878  if ( updateAccountModel.dirtyFlag ) {
879  discardDialog.open();
880  } else {
881  extDetailDialog.close(e);
882  }
883  });
884 
885  // start with no focus
886  $("#extNameUpdate").blur();
887 
888  // setup cancel / update / delete buttons
889  $("#extDetailDialog #btnUpdate").on("click", function(e) {
890  e.preventDefault();
891  // validate the name
892  if ($.homecuValidator.validate()) {
893  if (updateAccountModel.dirtyFlag) {
894  updateAccountModel.SendToServer();
895  }
896  }
897  });
898 
899  $("#extDetailDialog #lnkCancel").on("click", function(e) {
900  e.preventDefault();
901  if (updateAccountModel.dirtyFlag) {
902  discardDialog.open();
903  } else {
904  extDetailDialog.close();
905  }
906  });
907 
908  $("#extDetailDialog #lnkDelete").on("click", function(e) {
909  e.preventDefault();
910  deleteDialog.open();
911  });
912  },
913  close: function() {
914  // now remove the close function call
915  window_stack.pop();
916 
917  // remove functions from cancel/delete/update
918  $("#extDetailDialog #lnkCancel").off();
919  $("#extDetailDialog #lnkDelete").off();
920  $("#extDetailDialog #btnUpdate").off();
921  }
922  }).data("kendoWindow");
923 
924  extValidateDialog = $("#extValidateDialog").kendoWindow({
925  modal: true,
926  visible: false,
927  resizable: false,
928  title: "<?php echo $MC->msg("EXT Validate Account", HCU_DISPLAY_AS_JS); ?>",
929  maxHeight: maxHeight,
930  maxWidth: 700,
931  minWidth: 300,
932  activate: function() {
933  // start with no focus
934  $("#extNameUpdate").blur();
935 
936  // make into a numeric textbox
937  if (!$("#extMicro1").data("kendoNumericTextBox")) {
938  $("#extMicro1").kendoNumericTextBox({
939  format: "00",
940  spinners: false
941  });
942  }
943 
944  // make into a numeric textbox
945  if (!$("#extMicro2").data("kendoNumericTextBox")) {
946  $("#extMicro2").kendoNumericTextBox({
947  format: "00",
948  spinners: false
949  });
950  }
951 
952  // add the close function to the window stack
953  window_stack.push(function(e) {
954  if ( updateAccountModel.dirtyFlag ) {
955  discardDialog.open();
956  } else {
957  extValidateDialog.close(e);
958  }
959  });
960 
961  // set focus on the contents after selecting
962  $(".validation-entry").focus(function() {
963  var input = $(this);
964 
965  clearTimeout(input.data("selectTimeId")); //stop started time out if any
966 
967  var selectTimeId = setTimeout(function() {
968  input.select();
969  }, 10);
970 
971  input.data("selectTimeId", selectTimeId);
972  }).blur(function(e) {
973  clearTimeout($(this).data("selectTimeId")); //stop started timeout
974  });
975 
976  // setup cancel / update / delete buttons
977  $("#extValidateDialog #btnUpdate").on("click", function(e) {
978  e.preventDefault();
979  // see if locked
980  if ( updateAccountModel.retries === 0 ) {
981  return false;
982  }
983 
984  $.homecuValidator.displayMessage("");
985 
986  // validate there are values
987  var m1 = $("#extMicro1").data("kendoNumericTextBox");
988  var m2 = $("#extMicro2").data("kendoNumericTextBox");
989  if ($.homecuValidator.validate()) {
990  if (m1.value() > 0 && m2.value() > 0) {
991  // send in the deposit amounts
992  updateAccountModel.SendMicros();
993  }
994 
995  } else {
996  $.homecuValidator.displayMessage( "<?php echo $MC->msg("EXT Micro required", HCU_DISPLAY_AS_JS) ?>", $.homecuValidator.settings.statusError );
997  }
998  });
999 
1000  $("#extValidateDialog #lnkCancel").on("click", function(e) {
1001  e.preventDefault();
1002  if ( updateAccountModel.dirtyFlag ) {
1003  discardDialog.open();
1004  } else {
1005  extValidateDialog.close();
1006  }
1007  });
1008  },
1009  close: function() {
1010  // now remove the close function call
1011  window_stack.pop();
1012 
1013  // remove functions from cancel/update
1014  $("#extValidateDialog #lnkCancel").off();
1015  $("#extValidateDialog #btnUpdate").off();
1016  }
1017  }).data("kendoWindow");
1018 
1019  deleteDialog = $("#deleteDialog").kendoDialog({
1020  visible: false,
1021  title: "<?php echo $MC->msg("Delete", HCU_DISPLAY_AS_JS) ?>",
1022  content: "<p><?php echo $MC->msg("EXT Continue delete", HCU_DISPLAY_AS_JS) ?></p><p><?php echo $MC->msg("ACH Continue", HCU_DISPLAY_AS_JS) ?></p>",
1023  show: function(e) {
1024  // add the close function to the window stack
1025  window_stack.push(function(e) {
1026  deleteDialog.close(e);
1027  });
1028  },
1029  close: function(e) {
1030  // remove the close function from the window stack
1031  window_stack.pop();
1032  },
1033  actions: [{text: "<?php echo $MC->msg("No", HCU_DISPLAY_AS_JS) ?>"},
1034  {
1035  text: "<?php echo $MC->msg("Yes", HCU_DISPLAY_AS_JS) ?>",
1036  action: function(e){
1037  var request = { action: "delete_account",
1038  id: updateAccountModel.extAcctId };
1039 
1040  dsHelper.read( request );
1041 
1042  // Returning false will prevent the closing of the dialog
1043  return true;
1044  },
1045  primary: true
1046  }]
1047  }).data("kendoDialog");
1048 
1049  $("#extAddAccount").on("click", function() {
1050  $.homecuValidator.setup( {formStatusField: "addFormStatus", formValidate: "addAccountDialog"} );
1051  addAccountModel.ResetModel();
1052  addAccountDialog.center();
1053  addAccountDialog.open();
1054  });
1055 
1056  GetExternalAccounts();
1057 
1058  discardDialog = $("#discardDialog").kendoDialog({
1059  visible: false,
1060  title: "<?php echo $MC->msg("ACH Discard Changes?", HCU_DISPLAY_AS_JS) ?>",
1061  content: "<p><?php echo $MC->msg("ACH Discard changes warning", HCU_DISPLAY_AS_JS) ?></p><p><?php echo $MC->msg("ACH Continue", HCU_DISPLAY_AS_JS) ?></p>",
1062  show: function(e) {
1063  // add the close function to the window stack
1064  window_stack.push(function(e) {
1065  discardDialog.close(e);
1066  });
1067  },
1068  close: function(e) {
1069  // remove the close function from the window stack
1070  window_stack.pop();
1071  },
1072  actions: [{
1073  text: "<?php echo $MC->msg("No", HCU_DISPLAY_AS_JS) ?>",
1074  action: function(e) {
1075  // ** Close the current dialog
1076  }
1077  }, {
1078  text: "<?php echo $MC->msg("Yes", HCU_DISPLAY_AS_JS) ?>",
1079  primary: true,
1080  action: function(e) {
1081  // clear any dirty flags
1082  addAccountModel.ResetModel();
1083  updateAccountModel.ResetModel();
1084 
1085  // remove this dialog's close
1086  window_stack.pop();
1087 
1088  /* ** DISCARD CHANGES by calling prior window's close ** */
1089  var fn = window_stack[window_stack.length - 1];
1090  var ret = fn(e);
1091  }
1092  }]
1093  }).data("kendoDialog");
1094  }
1095 
1096  function InitScreen() {
1097  InitDataSources();
1098  InitDataViews();
1099 
1100  // initialize then show
1101  $("#ach-payment").show();
1102  }
1103 
1104  $(document).ready(function() {
1105  if (terms) {
1106  ShowNotice('<?php echo $termsURLEXT; ?>', "<?php echo $termsLinkDisplayEXT ?>",
1107  function() {
1108  InitScreen();
1109  if (notice) {
1110  ShowNotice('<?php echo $noticeURLEXT; ?>', "<?php echo $noticeLinkDisplayEXT ?>");
1111  }
1112  },
1113  function() {
1114  // if they do not accept, send them to banking accounts screen
1115  ShowWaitWindow();
1116 
1117  var urlInit = window.location.href.substring(0, window.location.href.indexOf("hcu"));
1118  var urlCu = "<?php echo $Cu ?>";
1119  var urlPage = "hcuAccounts.prg";
1120  var urlRedirect = urlInit + urlPage + "?cu=" + urlCu;
1121 
1122  window.location.replace(urlRedirect);
1123  }
1124  );
1125  } else if (notice) {
1126  InitScreen();
1127  ShowNotice('<?php echo $noticeURLEXT; ?>', "<?php echo $noticeLinkDisplayEXT ?>");
1128  } else {
1129  InitScreen();
1130  }
1131  }); // end ready function
1132 
1133  // Handle clicking on the overlay
1134  $(document).on("click", ".k-overlay", function (e) {
1135  if(window_stack.length > 0) {
1136  // get the close function from the stack, without poping it (the close will pop it)
1137  var fn = window_stack[window_stack.length - 1];
1138  var ret = fn(e);
1139  }
1140  });
1141 
1142  // end HandleDeleteAccount
1143 
1144  </script>
1145  <script id="gridToolbar" type="text/x-kendo-template">
1146  <a class="k-button" href="\#" onclick="return addAccountDialog.center().open()"><span class="fa fa-plus"></span> <?php echo $MC->msg("EXT Add Account", HCU_DISPLAY_AS_JS) ?></a>
1147  <div id="extValidationMsg" class="hcu-secondary-text" style="margin-top: 10px; display:none;"><?php echo $MC->combo_msg("EXT Click to validate", HCU_DISPLAY_AS_RAW, "#validate_icon#", "<span class='fa fa-flag'></span>"); ?></div>
1148  </script>
1149  <script id="addAccountTemplate" type="text/x-kendo-template">
1150  <div id="addAccountDialog" class="container-fluid hcu-scrolling-dialog">
1151  <div id="addFormStatus" class="homecu-formStatus k-block k-error-colored" style="display:none; margin-bottom:10px;max-width:800px;"></div>
1152  <div class="well well-sm form-horizontal">
1153  <div class="form-group">
1154  <div class="col-xs-12 hcu-secondary-text">&nbsp;<?php echo $MC->msg("EXT All Required", HCU_DISPLAY_AS_HTML); ?></div>
1155  </div>
1156  <div class="form-group">
1157  <label for="singleDisplayName" class="col-xs-12 col-sm-4 control-label"><?php echo $MC->msg("ACH Display Name", HCU_DISPLAY_AS_HTML) ?></label>
1158  <div class="col-xs-12 col-sm-6">
1159  <input type="text"
1160  id="singleDisplayName"
1161  name=singleDisplayName"
1162  class="k-textbox hcu-all-100"
1163  maxlength="20"
1164  data-bind="value: extName, events:{change: setDirty}"
1165  validationMessage="<?php echo $MC->msg("ACH Unique display name required", HCU_DISPLAY_AS_HTML) ?>"
1166  required />
1167  </div>
1168  </div>
1169  <div class="form-group">
1170  <div class="col-xs-12 h4">&nbsp;<?php echo $MC->msg("ACH Remote Account", HCU_DISPLAY_AS_HTML); ?></div>
1171  </div>
1172  <div class="form-group">
1173  <label for="extNameOnAccount" class="col-xs-12 col-sm-4 control-label"><?php echo $MC->msg("EXT Name On Account", HCU_DISPLAY_AS_HTML); ?><span class="required-field"></label>
1174  <div class="col-xs-12 col-sm-6"><input id="extNameOnAccount"
1175  name="extNameOnAccount"
1176  class="k-textbox hcu-all-100"
1177  maxlength="30"
1178  data-bind="value: extNameOnAccount, events:{change: setDirty}"
1179  validationMessage="<?php echo $MC->msg("EXT Name On Account required", HCU_DISPLAY_AS_HTML); ?>"
1180  required /></div>
1181  </div>
1182  <div class="form-group">
1183  <label for="singleRecipientRouting" class="col-xs-12 col-sm-4 control-label"><?php echo $MC->msg("ACH Routing Number", HCU_DISPLAY_AS_HTML); ?><span class="required-field"></label>
1184  <div class="col-xs-12 col-sm-6"><input id="singleRecipientRouting"
1185  name="singleRecipientRouting"
1186  class="hcu-all-100"
1187  data-bind="value: extDFIRouting, events:{change: setDirty}"
1188  homecu-minlen="9"
1189  homecu-maxlen="9"
1190  validationMessage="<?php echo $MC->msg("ACH Routing number 9 digits", HCU_DISPLAY_AS_HTML); ?>"
1191  required /></div>
1192  </div>
1193  <div class="form-group">
1194  <label for="singleRecipientAccount" class="col-xs-12 col-sm-4 control-label"><?php echo $MC->msg("ACH Account", HCU_DISPLAY_AS_HTML) ?></label>
1195  <div class="col-xs-12 col-sm-6"><input type="text"
1196  name="singleRecipientAccount"
1197  id="singleRecipientAccount"
1198  class="k-textbox hcu-all-100 account-match"
1199  maxlength="20"
1200  data-bind="value: extDFIAccount, events:{change: setDirty}"
1201  validationMessage="<?php echo $MC->msg('ACH Need remote account', HCU_DISPLAY_AS_HTML); ?>"
1202  required /></div>
1203  </div>
1204  <div class="form-group">
1205  <label for="singleRecipientAccountConfirm" class="col-xs-12 col-sm-4 control-label"><?php echo $MC->msg('ACH Confirm Account', HCU_DISPLAY_AS_HTML); ?></label>
1206  <div class="col-xs-12 col-sm-6"><input type="text"
1207  id="singleRecipientConfirm"
1208  name="singleRecipientConfirm"
1209  class="k-textbox hcu-all-100 account-match"
1210  maxlength="20"
1211  homecu-equals="account-match"
1212  data-homecuCustomEquals-msg="<?php echo $MC->msg('ACH Accounts no match', HCU_DISPLAY_AS_HTML); ?>"
1213  data-bind="value: extDFIConfirm, events:{change: setDirty}"
1214  validationMessage="<?php echo $MC->msg('Account Number Missing', HCU_DISPLAY_AS_HTML); ?>"
1215  required /></div>
1216  </div>
1217  <div class="form-group">
1218  <label for="achAccountType" class="col-xs-12 col-sm-4 control-label"><?php echo $MC->msg('Account Type', HCU_DISPLAY_AS_HTML); ?></label>
1219  <div class="col-xs-12 col-sm-5"><input id="achAccountType"
1220  name="achAccountType"
1221  class="hcu-all-100"
1222  data-bind="value: extDFISelectedType, events:{change: setDirty}"
1223  validationMessage="<?php echo $MC->msg('ACH Need remote account type', HCU_DISPLAY_AS_HTML) ?>"
1224  required /></div>
1225  </div>
1226  </div>
1227  <div class="hcu-template">
1228  <div class="hcu-edit-buttons k-state-default">
1229  <a href="##" id="lnkCancel"><?php echo $MC->msg("Cancel", HCU_DISPLAY_AS_HTML); ?></a>
1230  &emsp;
1231  <a href="##" id="btnUpdate" class="k-button k-primary">
1232  <i class="fa fa-check fa-lg"></i><?php echo $MC->msg("Update", HCU_DISPLAY_AS_HTML); ?>
1233  </a>
1234  </div>
1235  </div>
1236  </div>
1237  </script>
1238  <div id="disclosureWindow" name="disclosureWindow"></div>
1239  <div id="discardDialog"></div>
1240  <style type="text/css">
1241  .hcu-scrolling-dialog {
1242  overflow-y: auto;
1243  }
1244  .k-grid-content {
1245  max-height: 400px;
1246  }
1247  .account-rows .k-grid-content tr td {
1248  border-left-width: 0;
1249  }
1250  .k-grid .k-grid-content tr:hover {
1251  cursor: pointer;
1252  }
1253  .leading-zero-fontsize {
1254  font-size: 1.8em;
1255  }
1256  .local-align-leading-zero {
1257  text-align: right;
1258  padding-top:5px;
1259  }
1260  .hcu-icon-spacer {
1261  margin-right: 20px;
1262  }
1263 
1264  /* Small devices @screen-sm-min (tablets, 768px and up) */
1265  @media (min-width: 768px) {
1266  }
1267 
1268  /* Medium devices @screen-md-min (desktops, 992px and up) */
1269  @media (min-width: 992px) {
1270  }
1271  </style>
1272  <div id="extDetailDialog"></div>
1273  <div id="extValidateDialog"></div>
1274  <div id="deleteDialog"></div>
1275  <div class="k-content col-xs-12" id="ach-payment" style="max-width:700px; display: none;">
1276  <div class="form-horizontal">
1277  <div class="well well-sm">
1278  <div class="form-group">
1279  <div class="col-xs-12 h4"><?php echo $MC->msg('EXT External Accounts', HCU_DISPLAY_AS_HTML) ?></div>
1280  </div>
1281  <div class="form-group">
1282  <div class="col-xs-12 "><div class="account-rows" id="extAcctGrid"></div></div>
1283  </div>
1284  </div>
1285  </div>
1286  </div>
1287 
1288  <?php
1289  } catch (Exception $ex) {
1290  // * Include the Error page and then end the content
1291  // NOTE: this is for when the page is first loading
1292  $serviceErrorMsg = HCU_JsonDecode($ex->getMessage());
1293 
1294  $serviceErrorCode = $ex->getCode(); // this chooses which error page to show
1295 
1296  require_once(dirname(__FILE__) . '/../includes/hcuErrorPage.i');
1297  }
1298  /*
1299  * ** END CONTENT
1300  */
1301 
1302 
1303  // ** INCLUDE POST CONTENT SCRIPT
1304  require_once(dirname(__FILE__) . '/../includes/hcuPostContent.i');
1305