1/* Minification failed. Returning unminified contents. 2(2330,34249-34250): run-time error JS1010: Expected identifier: . 3(2330,34249-34250): run-time error JS1195: Expected expression: . 4(2330,34260-34264): run-time error JS1034: Unmatched 'else'; no 'if' defined: else 5 */ 6var SoDak = SoDak || {}; 7 8SoDak.Client = {}; 9SoDak.Client.Samples = {};; 10SoDak.Client.Samples = function () { 11 // PRIVATE VARIABLES 12 13 var testsPopupContentActionUrl = ''; 14 var stateNoxiousPopupContentActionUrl = ''; 15 var subAcctsPopupContentActionUrl = ''; 16 var dateTestingPopupContentActionUrl = ''; 17 var productionStatusPopupContentActionUrl = ''; 18 var saveSamplesActionUrl = ''; 19 var submitSamplesActionUrl = ''; 20 var createSamplesActionUrl = ''; 21 var readonlyColumns = {}; 22 var deletedSamples = new Array(); 23 var validationEnabled = true; 24 var cellToValidate = null; 25 var testRules = null; 26 var needToConfirm = false; 27 var hotInitialized = false; 28 var createSamplesViewModel = null; 29 var isRemingtonAccountLoggedIn = false; 30 const numberOfMaxRowsDisplayed = 100; 31 var dateTestingPopupNeeded = false; 32 var SeedTypeID = 0; 33 34 // END PRIVATE VARIABLES 35 36 var ToggleState = Object.freeze({ UNCHECKED: 0, INDETERMINATE: 1, CHECKED: 2 }); 37 var stateNoxiousInstructions = ""; 38 39 var getCellToValidate = function () { 40 return cellToValidate; 41 }; 42 43 var setTestsPopupContentActionUrl = function (url) { 44 testsPopupContentActionUrl = url; 45 }; 46 47 var setStateNoxiousPopupContentActionUrl = function (url) { 48 stateNoxiousPopupContentActionUrl = url; 49 }; 50 51 var setSubAcctsPopupContentActionUrl = function (url) { 52 subAcctsPopupContentActionUrl = url; 53 }; 54 55 var setdateTestingPopupContentActionUrl = function (url) { 56 dateTestingPopupContentActionUrl = url; 57 }; 58 59 var setProductionStatusPopupContentActionUrl = function (url) { 60 productionStatusPopupContentActionUrl = url; 61 }; 62 63 var setCreateSamplesActionUrl = function (url) { 64 createSamplesActionUrl = url; 65 }; 66 67 var setSaveSamplesActionUrl = function (url) { 68 saveSamplesActionUrl = url; 69 }; 70 71 var setSubmitSamplesActionUrl = function (url) { 72 submitSamplesActionUrl = url; 73 }; 74 75 var addDeletedSample = function (sample) { 76 deletedSamples.push(sample); 77 }; 78 79 var initSubAccountWindow = function () { 80 81 function updateSubAccounts() { 82 var selectedSubAccounts = $('#subAcctsPopup').data('selectedSubAccts'); 83 var originalSubAccounts = $('#subAcctsPopup').data('originalSubAccts'); 84 85 // Strip out any sub accounts that were in the original array 86 var selectedSubAccountsFiltered = Enumerable.from(selectedSubAccounts) 87 .except(originalSubAccounts, "[$.SampleId, $.AccountID, $.IsDeleted].join(':')").toArray(); 88 89 if (selectedSubAccountsFiltered.length > 0) { 90 $.ajax({
91 url: '/Samples/UpdateSubAccounts', 92 type: 'POST', 93 contentType: 'application/json; charset=utf-8;', 94 data: JSON.stringify({ 95 'subAccountsToUpdate': selectedSubAccountsFiltered 96 }), 97 dataType: 'json', 98 success: function (args) { 99 100 }, 101 error: function (exception) { 102 alert('Exeption:' + exception); 103 } 104 }); 105 } 106 } 107 108 /****** SAVE THE SELECTED SUB ACCOUNTS TO THE MODEL DEFINING THE WINDOW'S CONTEXT ******/ 109 function saveSelectedSubAcctsToModel() { 110 // We want to save the selected sub accounts, along with the ones that have been marked as deleted (perhaps the user unchecked them) 111 var subAccts = $('#subAcctsPopup [data-sub-acct-id]'); 112 var rowIndex = $('#subAcctsPopup').data('rowIndex'); 113 var rowData = 114 $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); // Get the data the sample is bound to 115 116 rowData.SubAccounts = new Array(); 117 118 if (subAccts != null) { 119 $(subAccts).each(function () { 120 var acctId = $(this).data('sub-acct-id'); 121 var isDeleted = $(this).data('isdeleted'); 122 123 // If it's deleted, we need to include it so that it can be deleted on the server. If it's checked, we obviously include it as the user 124 // has indicated the desire to add it... 125 if (isDeleted == true || $(this).children('input[type=checkbox]').is(':checked')) { 126 127 rowData.SubAccounts.push({ 128 "SampleId": rowData.SampleId, 129 "IsDeleted": isDeleted, 130 "AccountID": acctId 131 }); 132 } 133 }); 134 } 135 } 136 137 /****** RESTORES SELECTED SUB ACCOUTS ON THE POPUP WHOSE CONTEXT IS THE CURRENTLY SELECTED (CLICKED) SAMPLE ENTRY (ROW) ******/ 138 function restoreCheckedSubAccts(subAccounts, billToAccountID, sampleIDCount) { 139 // Get the row index that was clicked, along with the data associated with it 140 141 if (subAccounts != null) { 142 // For each sub account, get the checkbox associated with this sub account and check the box if previously saved 143 for (var i = 0; i < subAccounts.length; i++) { 144 var subAcct = subAccounts[i]; 145 var container = $('#subAcctsPopup [data-sub-acct-id=' + subAcct.AccountID + ']'); 146 147 if (subAcct.IsDeleted == false) { 148 container.data('isdeleted', false); 149 150 var filteredSubAccountCount = 151 Enumerable.from(subAccounts).count("$.AccountID == " + subAcct.AccountID); 152 153 if (filteredSubAccountCount != sampleIDCount) { 154 // If not all the samples have this sub account then mark the check box as indeterminate 155 $(container).children('input[type=checkbox]').prop('indeterminate', true); 156 $(container).children('input[type=checkbox]') 157 .data('indeterminate', ToggleState.INDETERMINATE); 158 $(container).children('input[type=checkbox]').data('checked', ToggleState.INDETERMINATE); 159 } else { 160 // All samples have this account as a sub account 161 // Set the checked state to checked if any sample has the sub account listed therefore if the user 162 // clicks a checkbox in the indeterminate state it will then be checked. 163 $(container).children('input[type=checkbox]').data('checked', ToggleState.CHECKED); 164 } 165 166 $(container).children('input[type=checkbox]').prop('checked', 'checked'); 167 } 168 } 169 } 170 171 var atLeastOneShown = false; 172 173 // Cycle through all check boxes - if any are equal to current bill-to account then disable it so they 174 // can't sub-account the same bill-to account 175 if (billToAccountID != null) { 176 $('div [data-sub-acct-id]').each(function () { 177 // Hide if the bill-to equals sub accountID, otherwise show 178 // Also hide all check boxes if bill to account # is 190 (RobSeeCo) 179 // who doesn't want any companies submitting for them to be able to sub themselves 180 // LOL/WFS (38) also doens't want Dupont Pioneer (216) to be able to sub themselves 181 // 08/10/2020 Mingi Hong : Rob See Co(190) was hard coded to be hidded -> it is now removed by policy 182 if (($(this).data('sub-acct-id') == billToAccountID) || 183 (billToAccountID == 38 && userAccountID == 216)) { 184 $(this).hide(); 185 } else { 186 atLeastOneShown = true; 187 $(this).show(); 188 } 189 }); 190 } 191 192 if (atLeastOneShown) 193 $('#noneShowing').hide(); 194 else 195 $('#noneShowing').show(); 196 } 197 198 /****** ESTABLISH KENDO WINDOW FOR DATE TESTING ******/ 199 $('#dateTestingPopup').kendoWindow({ 200 width: '600px', 201 visible: false, 202 modal: true, 203 title: 'Select all months for the germ test date...', 204 content: dateTestingPopupContentActionUrl, 205 draggable: false, 206 resizable: false, 207 open: function () { 208 // 09/17/2020 Mingi Hong 209 // Need to list months 210 $('#dateTestingPopup').parent().find('.k-window-action').css('visibility', 'hidden'); 211 212 $('#selectDateMonthBtnOK').off('click'); 213 $('#selectDateMonthBtnOK').on('click', 214 function () { 215 var checkedBox = $('#dateTestingPopup').find('input[type=checkbox]:checked'); 216 if (Enumerable.from(checkedBox).any()) { 217 var rowIndex = $('#testsPopup').data('rowIndex'); // Get the row index of the sample we're working with 218 var rowData = 219 $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); // Get the data the sample is bound to 220 var selectedMonthString = ''; 221 for (var i = 0; i < Enumerable.from(checkedBox).count(); i++) { 222 var selectedMonthID = checkedBox[i].id; 223 if (i == 0) { 224 selectedMonthString = selectedMonthString + selectedMonthID; 225 } else { 226 selectedMonthString = selectedMonthString + ',' + selectedMonthID; 227 } 228 } 229 // DateTestMonth should be integer 230 rowData.DateTestMonth = selectedMonthString; 231 dateTestingPopupNeeded = false; 232 $('#dateTestingPopup').data('kendoWindow').close(); 233 } else { 234 // Error 235 // Did not select anything, will not close 236 $('#selectDateTestingMonthErrorLabel').visible(); 237 } 238 }); 239 240 //$('#selectDateMonthBtnCancel').off('click'); 241 //$('#selectDateMonthBtnCancel').on('click', 242 // function () { 243 // $('#dateTestingPopup').data('kendoWindow').close(); 244 // });
245 }, 246 close: function () { 247 // Need to send month data to dateTesting 248 // Render the table so that the test lists column is updated 249 $('#samplesTable').data('handsontable').render(); 250 } 251 }); 252 253 /****** ESTABLISH KENDO WINDOW FOR PRODUCTION STATUS ******/ 254 $('#prodStatusPopup').kendoWindow({ 255 width: '600px', 256 visible: false, 257 modal: true, 258 title: 'Select a status...', 259 content: productionStatusPopupContentActionUrl, 260 draggable: false, 261 resizable: false, 262 open: function () { 263 264 $('#prodStatusPopup').parent().find('.k-window-action').css('visibility', 'hidden'); 265 266 $('#selectProdStatusBtnOK').off('click'); 267 $('#selectProdStatusBtnOK').on('click', 268 function () { 269 var checkedBox = $('#prodStatusPopup').find('input[type=checkbox]:checked'); 270 if (Enumerable.from(checkedBox).any()) { 271 var rowIndex = $('#testsPopup').data('rowIndex'); // Get the row index of the sample we're working with 272 var rowData = 273 $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); // Get the data the sample is bound to 274 //var selectedMonthString = ''; 275 //for (var i = 0; i < Enumerable.from(checkedBox).count(); i++) { 276 // var selectedMonthID = checkedBox[i].id; 277 // if (i == 0) { 278 // selectedMonthString = selectedMonthString + selectedMonthID; 279 // } else { 280 // selectedMonthString = selectedMonthString + ',' + selectedMonthID; 281 // } 282 //} 283 // DateTestMonth should be integer 284 285 var status = rowData; 286 287 //dateTestingPopupNeeded = false; 288 $('#prodStatusPopup').data('kendoWindow').close(); 289 } else { 290 // Error 291 // Did not select anything, will not close 292 $('#selectProdStatusErrorLabel').visible(); 293 } 294 }); 295 296 }, 297 close: function () { 298 // Need to send month data to dateTesting 299 // Render the table so that the test lists column is updated 300 $('#samplesTable').data('handsontable').render(); 301 } 302 }); 303 304 /****** ESTABLISH KENDO WINDOW FOR SUB ACCOUNTS ******/ 305 $('#subAcctsPopup').kendoWindow({ 306 width: '600px', 307 visible: false, 308 modal: true, 309 title: 'Select Sub Accounts...', 310 content: subAcctsPopupContentActionUrl, 311 draggable: false, 312 resizable: false, 313 open: function () { 314 // Open 315 var caller = $('#subAcctsPopup').data('caller'); 316 317 if (caller == 'CreateSamples') { 318 // Call/Window is coming from CreateSamples page 319 var rowIndex = $('#subAcctsPopup').data('rowIndex'); 320 var rowData = $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); 321 // Pull out the account number from the billToAccount field which is of format (eg. "11:Company Name") 322 var billToAccountID = rowData.BillToAccount.substr(0, rowData.BillToAccount.indexOf(":")); 323 324 restoreCheckedSubAccts(rowData.SubAccounts, 325 billToAccountID, 326 1); // Send 1 for the last paramenter as the CreateSamples page only works on one sample at a time 327 } else { 328 // Call is coming from dashboard page 329 // Get the count of samples in the subAccounts array to compare to below 330 var sampleIDCount = $('#SamplesGrid').data('kendoGrid').select().length; 331 332 restoreCheckedSubAccts($('#subAcctsPopup').data('selectedSubAccts'), null, sampleIDCount); 333 } 334 335 $('#selectSubAcctsBtnOk').off('click'); 336 $('#selectSubAcctsBtnOk').on('click', 337 function () { 338 if (caller == 'CreateSamples') { 339 saveSelectedSubAcctsToModel(); 340 } else { 341 // Change all the row's subAccountList to reflect any changes 342 var selectedSubAccounts = $('#subAcctsPopup').data('selectedSubAccts'); 343 var grid = $('#SamplesGrid').data('kendoGrid'); 344 var selectedGridRows = grid.select(); 345 346 selectedGridRows.each(function (index, row) { 347 var dataRow = grid.dataItem(row); 348 349 // Get the sub accouts not marked for deleti
349on for the corresponding row 350 var sampleSubAccounts = Enumerable.from(selectedSubAccounts) 351 .orderBy("$.AccountID") 352 .where("$.SampleId == " + dataRow.SampleID + " && $.IsDeleted == false") 353 .select("$.AccountID").toArray(); 354 355 // First line caused the grid to refresh after each row was updated which would cause any subsequent iterations to fail on getting the data row 356 // Changed it to the 2nd line and then call a grid.refresh() after all rows have been updated. 357 //dataRow.set("SubAccountList", sampleSubAccounts.join()); 358 dataRow.SubAccountList = sampleSubAccounts.join(); 359 }); 360 361 updateSubAccounts(); 362 grid.refresh(); 363 } 364 $('#subAcctsPopup').data('kendoWindow').close(); 365 }); 366 367 $('#selectSubAcctsBtnCancel').off('click'); 368 $('#selectSubAcctsBtnCancel').on('click', 369 function () { 370 $('#subAcctsPopup').data('kendoWindow').close(); 371 }); 372 }, 373 close: function () { 374 // Close and Clear all fields (uncheck all sub accounts) 375 $('#subAcctsPopup [data-sub-acct-id] input[type=checkbox]').each(function (index, elem) { 376 $(this).prop('checked', false); 377 $(this).data('checked', ToggleState.UNCHECKED); 378 $(this).prop('indeterminate', false); 379 $(this).data('indeterminate', ToggleState.UNCHECKED); 380 }); 381 var caller = $('#subAcctsPopup').data('caller'); 382 383 if (caller == 'CreateSamples') { 384 // Render the table so that the subaccount lists column is updated 385 $('#samplesTable').data('handsontable').render(); 386 } else { 387 var grid = $('#SamplesGrid').data('kendoGrid'); 388 // Clear the selected rows on dashboard page 389 //grid.clearSelection(); // decided to disable this call so the user will know which rows they edited after the subaccount form is closed 390 } 391 } 392 }); 393 }; 394 395 /****** EVENT HANDLER FOR THE CLICK EVENT OF EACH SUBACCOUNT's CHECKBOX ON THE SELECT Sub-Accounts POPUP WINDOW ******/ 396 var subAccountClickHandler = function (sender) { 397 var caller = $('#subAcctsPopup').data('caller'); 398 399 // Only process this event on the dashboard index page 400 if (caller != "DashboardIndex") return; 401 402 var el = $(sender); 403 var accountID = $(sender).parent().data('sub-acct-id'); 404 var allSubAccounts = $('#subAcctsPopup').data('selectedSubAccts'); 405 406 407 408 switch (el.data('checked')) { 409 // unchecked, going checked AND indeterminate, going checked 410 case ToggleState.UNCHECKED: 411 case ToggleState.INDETERMINATE: 412 el.data('checked', ToggleState.CHECKED); 413 el.prop('indeterminate', false); // indeterminate only an option on initial load so set it to false upon any click 414 el.prop('checked', true); 415 416 // get the distinct sampleIDs for the rows that are selected 417 var grid = $('#SamplesGrid').data('kendoGrid'); 418 var selectedRows = grid.select(); 419 var distinctSampleIDs = new Array(); 420 $.each(selectedRows, function (index, row) { 421 var dataRow = grid.dataItem(row); 422 distinctSampleIDs.push(dataRow.SampleID); 423 }); 424 425 distinctSampleIDs.forEach(function (sampleID) { 426 // If the sub account doesn't already exist, insert it 427 if (Enumerable.from(allSubAccounts).count('$.SampleId == ' + sampleID + ' && $.AccountID == ' + accountID) == 0) { 428 allSubAccounts.push({ 429 "SampleId": sampleID, 430 "IsDeleted": false, 431 "AccountID": accountID 432 }); 433 } else { 434 // Sub account exists, update its IsDeleted property 435 Enumerable.from(allSubAccounts).where('$.AccountID == ' + accountID).forEac
435h(function (subAccount) { 436 subAccount.IsDeleted = false; 437 }); 438 } 439 }); 440 441 break; 442 // checked, going unchecked 443 case ToggleState.CHECKED: 444 el.data('checked', ToggleState.UNCHECKED); 445 el.prop('indeterminate', false); // indeterminate only an option on initial load so set it to false upon any click 446 el.prop('checked', false); 447 // Mark all samples with this accountID as a sub account 448 Enumerable.from(allSubAccounts).where("$.AccountID == " + accountID).forEach(function (subAccount) { 449 subAccount.IsDeleted = true; 450 }); 451 break; 452 } 453 }; 454 455 /****** EVENT HANDLER FOR THE CLICK EVENT OF EACH SUBACCOUNT's CHECKBOX ON THE SELECT Sub-Accounts POPUP WINDOW ******/ 456 var datetestingGroupClickHandler = function () { 457 var window = $('#dateTestingPopup').data('kendoWindow'); 458 window.center(); 459 window.open(); 460 }; 461 462 /****** EVENT HANDLER FOR THE EVENT THAT IS RAISED AFTER CHANGES ARE MADE TO THE HANDSONTABLE ******/ 463 /* REMARKS: Ensures that after data has been pasted into the handsontable, the values on the row where 464 * the paste was initiated are copied to all the other rows that were pasted in 465 */ 466 var afterChangePasteDataHandler = function (changes) { 467 if (changes == null || changes.length == 0) 468 return; 469 470 // 1. Get index of first row (this one also contains other values to replicate accross all rows 471 var firstRowIndex = changes[0][0]; 472 473 // 1. Get starting row 474 var table = $('#samplesTable').data('handsontable'); 475 var firstRow = table.getSourceDataAtRow(firstRowIndex); 476 477 // Create an array so that we can establish which columns were pasted to the table 478 var pastedCols = new Array(); 479 480 var rowIndexes = new Array(); 481 for (var i = 0; i < changes.length; i++) { 482 var col = changes[i][0]; 483 if (rowIndexes.indexOf(col) < 0) { 484 rowIndexes.push(col); 485 } 486 487 // We are doing this inside this loop to prevent having to iterate through it a second time. 488 // The goal here is to determine which columns were pasted in. This is done given the way handsontable passes us the changes 489 if (changes[i][0] == rowIndexes) { 490 pastedCols.push(changes[i][1]); 491 } 492 } 493 494 // Start at index one since zero will be the row that actually contains the changes 495 var changeArray = new Array(); 496 var rowProps = Object.getOwnPropertyNames(firstRow); 497 for (var i = 0; i < rowIndexes.length; i++) { 498 var currentRow = table.getSourceDataAtRow(rowIndexes[i]); 499 500 for (var j = 0; j < rowProps.length; j++) { 501 var changeItem = new Array(); 502 changeItem.push(rowIndexes[i]); 503 changeItem.push(rowProps[j]); 504 505 var isPastedCol = false; 506 507 $.each(pastedCols, function (index, value) { 508 if (value == rowProps[j]) { 509 isPastedCol = true; 510 } 511 }); 512 513 // CHANGE (2015-10-05): Checking now if currentRows cell is null along with if pasted column. 514 // If not, keep the current value of that cell and don't copy value from first row 515 if ((isPastedCol) || (currentRow[rowProps[j]] != null)) { 516 // Use current value for the current property since it was one that was pasted into the table 517 changeItem.push(currentRow[rowProps[j]]); 518 } else { 519 // Copy value from first row, since this property was not one of the pasted columns nor was it already filled in 520 changeItem.push(firstRow[rowProps[j]]); 521 } 522 523 changeArray.push(changeItem); 524 } 525 } 526 527 table.setDataAtRowProp(changeArray); 528 }; 529 530 function subAccountExists(subAccounts, subAccountIDToFind) { 531 var subAccountIndex = -1; 532 533 $.each(subAccounts, function (index, value) { 534 if ((value.AccountID == subAccountIDToFind) && (value.IsDeleted == false)) { 535 subAccountIndex = index; 536 } 537 }); 538 539 return subAccountIndex; 540 } 541 542 var isRemingtonCornSample = function (rowData) { 543 544 if (rowData == null) return false; 545 if (rowData.Species == null) return false; 546 if (rowData.BillToAccount == null) return false; 547 548 return ((rowData.Species == 'CORN') && 549 (rowData.BillToAccount.toLowerCase().indexOf('remington') != -1)); 550 } 551 552 var isCornSample = function (rowData) { 553 if (rowData == null) return false; 554 if (rowData.Species == null) return false; 555 556 return (rowData.Species == 'CORN'); 557 } 558 559 var afterChangeHandler = function (changes, source) { 560 if (source == 'CopyPaste.paste' || source == 'edit') { 561 var currentRowIndex = changes[0][0]; 562 var newValue = changes[0][3]; 563 var rowData = $('#samplesTable').data('handsontable').getSourceDataAtRow(currentRowIndex); 564 565 // HANDLE PASTED DATA 566 if (source == 'CopyPaste.paste') { 567 afterChangePasteDataHandler(changes); 568 } 569 570 // HANDLE THE CHANGE OF THE BILL-TO-ACCOUNT FIELD 571 if (source == 'edit') { 572 // Check the edit is on the BillToAccount field - if so check subaccounts. 573 if ((changes.length == 1) && (changes[0][1] == "BillToAccount")) { 574 var newAccountID = newValue.substring(0, newValue.indexOf(":")); 575 var subAccountIndex = -1; // Signify if found or not based on index 576 577 if (rowData.SubAccounts != undefined) { 578 // Search if the newly selected account is a sub account 579 subAccountIndex = subAccountExists(rowData.SubAccounts, userAccountID); 580 } else { 581 rowData.SubAccounts = new Array(); 582 } 583
584 // Do not auto-add sub accounts for Acct #190 (RobSeeCo) as they don't 585 // want people submittting for them to be able to sub themselves 586 // LOL/WFS (38) also doesn't want Dupont Pioneer (216) to be able to sub themselves when submitting for them 587 if ((newAccountID != userAccountID) && 588 !((newAccountID == 190) || ((newAccountID == 38) && (userAccountID == 216)))) { 589 // Bill-to account is different than the current user account - add the current account as a SubAccount if it doesn't already exist 590 if (subAccountExists(rowData.SubAccounts, userAccountID) == -1) { 591 rowData.SubAccounts.push({ 592 "IsDeleted": false, 593 "AccountID": userAccountID 594 }); 595 } else { 596 // Sub account already exists - mark IsDelete to false in case it may have previously been marked to be deleted 597 if (subAccountIndex != -1) { 598 rowData.SubAccounts[subAccountIndex].IsDeleted = false; 599 } 600 } 601 } else { 602 // If the current user's account was listed as a sub account, remove it as it is now the 603 // same as the bill-to account no reason to sub the same account as the bill-to 604 if ((rowData.SubAccounts != undefined) && (subAccountIndex != -1)) { 605 rowData.SubAccounts[subAccountIndex].IsDeleted = true; 606 } 607 } 608 } 609 } 610 611 // Whether copy/paste or edit, retrieve the pedigree (femaleCode + maleCode) of each product code and fill in the variety column with it 612 for (var i = 0; i < changes.length; i++) { 613 if ((changes[i][1] == "ProductCode")) { 614 var newValueOfRow = changes[i][3]; 615 var currentRowData = $('#samplesTable').data('handsontable').getSourceDataAtRow(changes[i][0]); 616 var dataObject = Enumerable.from(createSamplesViewModel.RemProducts).where("$.ProductCode == '" + newValueOfRow + "'").orderByDescending("$.YearImported").firstOrDefault("$.ProductCode == '" + newValueOfRow + "'"); 617 618 if (dataObject != null) { 619 currentRowData.Var = dataObject.FemaleCode + "+" + dataObject.MaleCode; 620 currentRowData.Trait = dataObject.Trait; 621 } 622 } 623 } 624 625 // Render the table so it will show any newly added content 626 $('#samplesTable').data('handsontable').render(); 627 } 628 }; 629 630 var checkSeedSizeFormat = function (cellValue) { 631 if (cellValue == null) { 632 return false; 633 } 634 635 // if there is data, check that it conforms to remington's pre-defined format of ##/##(F|R|P) 636 var seedSizeRegex = /^(\d{2})\/(\d{2})(F|R|P)$/i; 637 var regExResult = cellValue.trim().match(seedSizeRegex); 638 639 if (regExResult == null) { 640 return false; 641 } else { 642 return true; 643 } 644 } 645 646 var customCellRenderer = function (instance, td, row, col, prop, value, cellProperties) { 647 Handsontable.renderers.TextRenderer.apply(this, arguments); 648 // Change this so it only runs this renderer when on the seed size column - need to go back to using GetColumnIndexFromHeaderText..... 649 var seedSizeColumnObject = Enumerable.from(columns) 650 .firstOrDefault("$.columnIndex == " + col + " && $.data == '" + prop + "' && $.nameInLowercase == 'seed size'"); 651 var rowData = $('#samplesTable').handsontable('getSourceDataAtRow', row); 652 653 654 if ((seedSizeColumnObject != null) && 655 (isRemingtonCornSample(rowData)) && 656 (instance.isEmptyRow(row) == false)) { // ignore the empty row (aka 'new row') 657 658 cellProperties.isValid = checkSeedSizeFormat(value); 659 660 td.className = (((cellProperties.isValid === undefined) || (cellProperties.isValid)) 661 ? 'hot-regular-cell' 662 : 'hot-red-cell'); 663 } 664 } 665 666 /****** BUILD A VIEW MODEL THAT CAN BE POSTED TO THE CONTROLLER ******/ 667 /* REMARKS: Ensures that data on the page is formatted in such a way that the MVC model binder 668 * will properly bind it to a CreateSamplesViewModel instance for controller action's receiving 669 * such a type as a parameter 670 */
671 function buildPostableViewModel(data) { 672 var model = {}; 673 var sampleEntries = new Array(); 674 var deletedEntries = new Array(); 675 var isOdProp; 676 var props; 677 var entry; 678 var ods; 679 var i; 680 var j; 681 682 for (i = 0; i < data.length; i++) { 683 props = Object.getOwnPropertyNames(data[i]); 684 entry = {}; 685 ods = new Array(); 686 for (j = 0; j < props.length; j++) { 687 isOdProp = (props[j].indexOf('od-') > -1); 688 if (isOdProp) { 689 ods.push({ 690 "OtherDesignationID": props[j].substring(3), 691 "CustomFieldNameValue": data[i][props[j]] 692 }); 693 } else { 694 entry[props[j]] = data[i][props[j]]; 695 } 696 } 697 698 entry.OtherDesignations = ods; 699 sampleEntries.push(entry); 700 } 701 702 // Deleted items 703 if (deletedSamples != null) { 704 for (i = 0; i < deletedSamples.length; i++) { 705 props = Object.getOwnPropertyNames(deletedSamples[i]); 706 entry = {}; 707 ods = new Array(); 708 for (j = 0; j < props.length; j++) { 709 isOdProp = (props[j].indexOf('od-') > -1); 710 if (isOdProp) { 711 ods.push({ 712 "OtherDesignationID": props[j].substring(3), 713 "CustomFieldNameValue": deletedSamples[i][props[j]] 714 }); 715 } else { 716 entry[props[j]] = deletedSamples[i][props[j]]; 717 } 718 } 719 720 entry.OtherDesignations = ods; 721 deletedEntries.push(entry); 722 } 723 } 724 model.BillToAccounts = createSamplesViewModel.BillToAccounts; 725 model.TestRules = createSamplesViewModel.TestRules; 726 model.TestIDs = createSamplesViewModel.Tests; 727 model.SeedNames = createSamplesViewModel.SeedNames; 728 model.Tests = createSamplesViewModel.Tests; 729 model.SampleEntries = sampleEntries; 730 model.DeletedEntries = deletedEntries; 731 732 733 return model; 734 } 735 736 var getCurrentCell = function () { 737 // NOTE: Works fine if you the active cell isn't moving. Doesn't work in cases of validation because by the 738 // time the validation calls are made the active cell is the cell the user moved to. 739 740 var selectedCell = $('#samplesTable').handsontable('getSelected'); 741 742 if (selectedCell == null) { return null; } 743 744 // make sure there is only one cell selected 745 var startRow = selectedCell[0]; 746 var startCol = selectedCell[1]; 747 var endRow = selectedCell[2]; 748 var endCol = selectedCell[3]; 749 750 if (startRow == endRow && startCol == endCol) { 751 // A single cell is selected, return its coordinates 752 return { 753 row: startRow, 754 col: startCol 755 } 756 } else { 757 // A range is selected - return null as there is no way to tell which cell in the range is active as of (2016-08-18) 758 return null; 759 } 760 } 761 762 /****** VALIDATE SAMPLE ENTRIES ******/ 763 function validateSampleEntryData(data) { 764 if (validationEnabled == false) { 765 return ""; 766 }; 767 // user tried submitting samples but didn't add any samples to submit - 768 // leaving only the empty/new row 769 if (data.length == 1 && deletedSamples.length == 0) 770 return "You must enter at least one sample before submitting or saving samples."; 771 772 var emptyColumns = []; 773 var errorText = ""; 774 var seedSizeIsValid = true; 775 776 for (var i = 0; i < data.length - 1; i++) { 777 var item = data[i]; 778 779 // Check Bill-to 780 //if (item.BillToAccount == null || item.BillToAccount == '') { 781 // if (emptyColumns.indexOf("Bill To") == -1) { 782 // emptyColumns.push("Bill To"); 783 // } 784 //} 785 786 // Check test rule 787 if ((item.TestRule != undefined) && (item.TestRule == null || item.TestRule == '')) { 788 if (emptyColumns.indexOf("Test Rule") == -1) { 789 emptyColumns.push("Test Rule"); 790 } 791 } 792
793 // Check species is filled in 794 if ((item.Species != undefined) && (item.Species == null || item.Species == '')) { 795 if (emptyColumns.indexOf("Species") == -1) { 796 emptyColumns.push("Species"); 797 } 798 } 799 800 // Check requested tests 801 if ((item.requestedTests == undefined) || (item.requestedTests.length == 0) || 802 (Enumerable.from(item.requestedTests).all('$.IsDeleted == true'))) { 803 if (emptyColumns.indexOf("Tests") == -1) { 804 emptyColumns.push("Tests"); 805 } 806 } 807 808 //check lot is filled in 809 if (item.Lot == undefined || item.Lot == null || item.Lot == '') { 810 if (emptyColumns.indexOf("Lot") == -1) { 811 emptyColumns.push("Lot"); 812 } 813 } 814 else if (item.Lot.length > 100) { 815 return "Lot cannot exceed 100 characters."; 816 } 817 818 // Remington corn samples 819 //if (isRemingtonCornSample(item)) { 820 // var seedSizeColumnObject = Enumerable.from(columns).firstOrDefault("$.nameInLowercase == 'seed size'"); 821 822 // // Make sure seed size is present and of the correct format 823 // if ((seedSizeColumnObject != null) && 824 // checkSeedSizeFormat(item[seedSizeColumnObject.data]) == false) { 825 // seedSizeIsValid = false; 826 // } 827 //} 828 829 // NOTE: isRemingtonCornSample() only checks if remington is bill-to account - 830 // this checks if remington is the loggedIn account and a rem location is submitting 831 // so isRemingtonCornSample() will not suffice here 832 //if (isCornSample(item) && isRemingtonAccountLoggedIn) { 833 // // Product code column is required for any corn sample submitted when a 834 // // remington location is submitting - regardless of bill - to - account 835 // // per Email from Kathy Ruemler (Subject: RE: Bloomington EV submission) on 2018-11-01 836 // if (item.ProductCode == null || item.ProductCode == '') { 837 // if (emptyColumns.indexOf("Product Code") == -1) { 838 // emptyColumns.push("Product Code"); 839 // } 840 // } 841 842 // // Per Kayln on 2019-03-25 - wants to require variety to be filled in on Rem corn samples 843 // if (item.Var == null || item.Var == '') { 844 // if (emptyColumns.indexOf("Variety/Pedigree") == -1) { 845 // emptyColumns.push("Variety/Pedigree"); 846 // } 847 // } 848 //} 849 } 850 851 // List of deactivated accounts. They are listed as a string how they appear in the dropdown on the 'New Samples' page 852 // {AccountID} + ": " + {CompanyName} 853 var deactivatedAccounts = ["273: Winfield-Minot", "99: GDM SEEDS (Arkansas)"]; 854 855 if (item === undefined) { 856 //errorText = "No Item"; 857 } 858 else { 859 if (deactivatedAccounts.includes(item.BillToAccount)) { 860 errorText = "You have selected a deactivated account in the Bill To column. Please contact SoDak Labs for more information.</br></br>" 861 } 862 } 863 864 if (emptyColumns.length > 0) { 865 errorText = "For each sample you are submitting, you must supply a value for the following columns:</br></br>"; 866 867 $(emptyColumns).each(function () { 868 errorText += this + "</br>"; 869 }); 870 } 871 872 if (seedSizeIsValid == false) { 873 errorText += (errorText.length > 0 ? "</br> Also, all " : "All ") + 874 "samples submitted by Remington locations must have a seed size of format ##/##(F|R|P)"; 875 } 876 877 return errorText; 878 }; 879 880 var showStateNoxiousSelector = function (sender) { 881 if (sender.checked == true) { 882 // Check if noxious test in MS lab is selected and if so, 883 // check if state noxious option is selected 884 if (isTestChecked(103)) { 885 // Now get the select state noxious option 886 var selectStateRadio = $('#noxiousOptions').find('#stateSpecific'); 887 if ($(selectStateRadio).is(':checked')) { 888 var window = $('#stateNoxiousPopup').data('kendoWindow'); 889 window.center(); 890 window.open(); 891 } 892 } 893 } 894 } 895 896 function changeNoxiousOptionsEnabled(disabled) { 897 var labels = $("#noxiousOptions").children("label"); 898 $(labels) 899 .each(function () { 900 (disabled ? $(this).addClass("noxious-label-disabled") : $(this).removeClass("noxious-label-disabled")); 901 $(this).prop('disabled', disabled); 902 }); 903 } 904 905 function isTestChecked(testID) { 906 var testContainer = $('#testsPopup [data-testid=' + testID + ']'); 907 if (testContainer != null) { 908 var checkbox = $(testContainer).children('input[type=checkbox]'); 909 return $(checkbox).is(':checked'); 910 } 911 912 return false; 913 } 914 915 function toggleTest(testID, isChecked) { 916 var testContainer = $('#testsPopup [data-testid=' + testID + ']'); 917 918 var checkBox = $(testContainer).children('input[type=checkbox]'); 919 if (checkBox != null) { 920 if ($(checkBox).prop('checked') == !isChecked) { 921 $(checkBox).prop('checked', isChecked).change(); 922 } 923 } 924 } 925 926 function setNumSeeds(testID, numSeeds) { 927 var testContainer = $('#testsPopup [data-testid=' + testID + ']'); 928 var numeric = $(testContainer).children('[data-numberofseeds]'); 929 $(numeric).val(numSeeds); 930 } 931 932 var testNumSeedChangeHandler = function (sender) { 933 var currentNumSeedsVal = $(sender).val(); 934 935 if (($(sender).parent().data('testid') == 154) || 936 ($(sender).parent().data('testid') == 6) || 937 ($(sender).parent().data('testid') == 9)) { 938 939 if (isTestChecked(154)) { 940 setNumSeeds(154, currentNumSeedsVal); 941 setNumSeeds(6, currentNumSeedsVal); 942 setNumSeeds(9, currentNumSeedsVal); 943 } 944 } 945 } 946 947 /****** EVENT HANDLER FOR THE CHANGED EVENT OF EACH TEST'S CHECKBOX ON THE SELECT TESTS POPUP WINDOW ******/ 948 var testRuleCheckedHandler = function (sender) { 949 // The "Number of seeds" input element and the client instructions text box 950 var numeric = $(sender).siblings('[data-numberofseeds]'); 951 var clientInstructions = $(sender).siblings('[data-clientinstructions]'); 952 953 // If the test is checked we need to enable the number of seeds field, and also indicate this as a test we should not delete 954 if ($(sender).is(':checked')) { 955 $(sender).parent().data('isdeleted', false); // TODO: don't actually set this unless the [data-isdeleted] attribute actually has a value... 956 $(numeric).prop('disabled', false); 957 $(clientInstructions).prop('disabled', false); 958 // If the US Noxious test in MS then enabled the noxioux options that are on the form 959 if ($(sender).parent().data('testid') == 103) { 960 changeNoxiousOptionsEnabled(false); 961 } 962 963 } else { 964 // If the checkbox is not checked, we need to make sure we disable the number of seeds field, and also flag it as an item 965 // to delete once we get back to the server... 966 $(sender).parent().data('isdeleted', true); 967 $(numeric).prop('disabled', true); 968 $(clientInstructions).prop('disabled', true); 969 // If the US Noxious test in MS then enabled the noxious options that are on the form 970 if ($(sender).parent().data('testid') == 103) { 971 changeNoxiousOptionsEnabled(true); 972 } 973 } 974 975 if ($(sender).parent().data('testid') == 154) { 976 // If a user selects AP Seed (154), also automatically check AP-Glyp (9) & AP-Gluf (6) 977 toggleTest(6, $(sender).is(':checked')); 978 toggleTest(9, $(sender).is(':checked')); 979 } 980 //if ($(sender).parent().data('testid') == 244) { 981 // // If a user selects veg Vigor, also automatically check Germ(36),86f(240),4dGerm(215),seedcount(87) 982 // toggleTest(215, $(sender).is(':checked')); 983 // toggleTest(240, $(sender).is(':checked')); 984 // toggleTest(36, $(sender).is(':checked')); 985 // /* toggleTest(87, $(sender).is(':checked'));*/ 986 //} 987 988 if ($(sender).parent().data('testid') == 213 || 989 $(sender).parent().data('testid') == 214 || 990 $(sender).parent().data('testid') == 215) { 991 // If a user selects A LeafAnalysis Test (213-215), also automatically check LeafAnalysis Day 2 (216-218)
992 toggleTest($(sender).parent().data('testid') + 3, $(sender).is(':checked')); 993 } 994 995 if ($(sender).parent().data('testid') == 216 || 996 $(sender).parent().data('testid') == 217 || 997 $(sender).parent().data('testid') == 218) { 998 // If a user selects A LeafAnalysis Day 2 Test (216-218), also automatically check LeafAnalysis Test (213-215) 999 toggleTest($(sender).parent().data('testid') - 3, $(sender).is(':checked')); 1000 } 1001 1002 // If user selects Purity test on a MS species and account has AOSA we should select Nox as a consecuence 1003 var currentSelectedTestId = $(sender).parent().data('testid'); 1004 var rowIndex = $('#testsPopup').data('rowIndex'); 1005 var rowData = $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); 1006 // If the current selected test id is purity and account has aosa test rule or has no test rule selected we have to check also on Nox test 1007 if (currentSelectedTestId == 66 && $(sender).is(':checked')) { //66: Purity 1008 if (rowData.TestRule == "AOSA" || rowData.TestRule == null) { 1009 1010 //103: Noxious 1011 toggleTest(103, $(sender).is(':checked')); 1012 1013 } 1014 } 1015 if (currentSelectedTestId == 103 && $(sender).is(':checked')) {//103: Noxious 1016 if (rowData.TestRule == "AOSA" || rowData.TestRule == null) { 1017 1018 //66: Purity 1019 toggleTest(66, $(sender).is(':checked')); 1020 1021 } 1022 } 1023 1024 //Gourav Padol 1025 if ($(sender).parent().data('testid') == 185) { 1026 var rowIndex = $("#testsPopup").data("rowIndex"); 1027 var row = data[rowIndex]; 1028 if (!row.SeedSize && $(sender).is(':checked')) { 1029 $('#seedSizeErrorLabel').css('display', ('block')); 1030 toggleTest(185, false); 1031 return; 1032 } 1033 } 1034 // Set the drop down to the first item which is the "-- Select --" item and clear the 1035 $(numeric).val(''); 1036 $(clientInstructions).val(''); 1037 }; 1038 1039 /****** INITIALIZE THE SAMPLES VIEW ******/ 1040 /* PARAMETERS: 1041 * colHeaders: Column headers to use no the handsontable 1042 * dataSchema: The schema definition of each object that the handsontable grid is bound to 1043 * columns: The actual columns for the handsontable (specifies their bindings, types, etc.) 1044 * roDefaults: Read-only defaults. The default values for the "read-only" columns (if applicable) 1045 * userTests: The tests the user can request as specified in their account settings 1046 * initialData: The initial data to bind the handsontable to 1047 */ 1048 var initCreateSamplesView = function (colHeaders, dataSchema, columns, roDefaults, userTests, initialData, viewModel, isRemingtonAccount) { 1049 readonlyColumns = roDefaults; 1050 createSamplesViewModel = viewModel; 1051 isRemingtonAccountLoggedIn = isRemingtonAccount; 1052 1053 // Set to true as of 2015-10-29 we always need to validate if tests are selected 1054 validationEnabled = true; //(dataSchema.TestRule !== undefined) && (dataSchema.Species !== undefined); 1055 1056 /****** HANDSON TABLE ******/ 1057 $('#samplesTable').handsontable({ 1058 afterChange: afterChangeHandler, 1059 data: initialData, 1060 maxRows: numberOfMaxRowsDisplayed, 1061 colHeaders: colHeaders, 1062 manualColumnMove: false, // turn off until we can implement saving column order 1063 manualColumnResize: true, 1064 dataSchema: dataSchema, 1065 renderer: customCellRenderer, 1066 colWidths: function (indexOfColumn) { 1067 var columnWidth; 1068 1069 switch (colHeaders[indexOfColumn]) { 1070 case ("Action"): 1071 { 1072 columnWidth = 55; 1073 break; 1074 } 1075 case ("Date"): 1076 { 1077 columnWidth = 110; 1078 break; 1079 } 1080 case ("Submit ID"): 1081 { 1082 columnWidth = 75; 1083 break; 1084 } 1085 case ("Species"): 1086 { 1087 columnWidth = 125; 1088 break; 1089 } 1090 case ("SubAccts"): 1091 { 1092 columnWidth = 70; 1093 break; 1094 } 1095 case ("Sub List"): 1096 { 1097 columnWidth = 70; 1098 break; 1099 } 1100 case ("Variety"): 1101 { 1102 columnWidth = 80; 1103 break; 1104 } 1105 case ("Lot"): 1106 { 1107 columnWidth = 80; 1108 break; 1109 } 1110 case ("Test Rule"): 1111 { 1112 columnWidth = 80; 1113 break; 1114 } 1115 case ("Tests"): 1116 { 1117 columnWidth = 65; 1118 break; 1119 } 1120 case ("Test List"): 1121 { 1122 columnWidth = 85; 1123 break; 1124 } 1125 case ("Carry Over"): 1126 { 1127 columnWidth = 85; 1128 break; 1129 } 1130 case ("Unblended"): 1131 { 1132 columnWidth = 85; 1133 break; 1134 } 1135 case ("Lab Instructions"): 1136 { 1137 columnWidth = 115; 1138 break; 1139 } 1140 case ("Product Code"): 1141 { 1142 columnWidth = 115; 1143 break; 1144 } 1145 case ("Date Testing"): 1146 { 1147 columnWidth = 115; 1148 break; 1149 } 1150 case ("Production Status"): 1151 { 1152 columnWidth = 130; 1153 break; 1154 } 1155 default: 1156 { 1157 columnWidth = 80; 1158 } 1159 } 1160 1161 return columnWidth; 1162 }, 1163 columns: columns, 1164 minSpareRows: 1, 1165 contextMenu: true, 1166 beforeKeyDown: function (e) { 1167 if (e.keyCode == 8 || e.keyCode == 46) { // 'Backspace' or 'Delete' keys 1168 var selected = $('#samplesTable').handsontable('getSelected'); 1169 1170 // Only allow these keys to effect single cells. 1171 // Refer to handsontable.com documentation of 'getSelected' method for more details 1172 if ((selected != null && (selected[0][0] != selected[0][2] || selected[0][1] != selected[0][3]))) { 1173 e.stopImmediatePropagation(); 1174 e.preventDefault(); 1175 } 1176 } 1177 }, 1178 beforeValidate: function (value, row, prop, source) { 1179 cellToValidate = { 1180 row: row, 1181 col: $('#samplesTable').handsontable('propToCol', prop) 1182 }; 1183 }, 1184 afterInit: function () { 1185 hotInitialized = true; 1186 checkTableHeight(); 1187 }, 1188 afterCreateRow: function (index, amount) { 1189 if (hotInitialized) { 1190 // This event fires when initial data is loaded, so we have to 1191 // wait till afterInit event is fired before needing to confirm 1192 needToConfirm = true; 1193 checkTableHeight(); 1194 } 1195 }, 1196 afterRemoveRow: function (index, amount) { 1197 if (hotInitialized) { 1198 needToConfirm = true; 1199 } 1200 }, 1201 afterSelectionEnd: function (row, col, row2, col2, selectionLayerLevel) { 1202 // If a single cell is selected, check if col type is a command cell and if so, 1203 // activate edit mode so the user doesn't have to click the link in the 1204 // command cell twice if grid is not in edit mode 1205 if (row == row2 && col == col2) { 1206 var cellProperties = $('#samplesTable').handsontable('getCellMeta', row, col); 1207 if (cellProperties.prop == "Tests" || cellProperties.prop == "SubAccounts") { 1208 //var activeEditor = $('#samplesTable').handsontable().getActiveEditor(); 1209 //var activeEditor = $('#samplesTable').data('handsontable').getActiveEditor(); 1210 //activeEditor.beginEditing(); 1211 // TODO: get it so that two clicks aren't required to click a link column when the grid is in edit mode: 1212 // https://forum.handsontable.com/t/two-clicks-required-for-a-cell-with-a-link/2596 1213 } 1214 } 1215 }, 1216 afterOnCellMouseDown: function (event, coords, td) { 1217 // Moved the opening of the popup windows to this event versus in the renderer so that we 1218 // can avoid having to click the link twice when the grid is not in edit mode 1219 var cellProperties = $('#samplesTable').handsontable('getCellMeta', coords.row, coords.col); 1220 var data = $('#samplesTable').handsontable('getSourceDataAtRow', coords.row); 1221 1222 if (data == null || cellProperties == null) return; 1223 1224 if (cellProperties.prop == "Tests") { 1225 if (viewModel.SeedNames.length == 0) { 1226 swal( 1227 { 1228 title: "", 1229 text: 1230 "You must have a at least one species set for your account before " + 1231 "entering new samples. You can do this in the settings area.", 1232 confirmButtonColor: "#002f86" 1233 }); 1234 } else { 1235 if (viewModel.SeedNames.length > 1 && (data.Species == null || data.Species == '')) { 1236 swal( 1237 { 1238 title: "", 1239 text: "You must select a species before proceeding.", 1240 confirmButtonColor: "#002f86" 1241 }); 1242 } else { 1243 $('#testsPopup').data('rowIndex', coords.row); 1244 var windowTests = $('#testsPopup').data('kendoWindow'); 1245 windowTests.center(); 1246 windowTests.open(); 1247 } 1248 } 1249 } 1250 1251 if (cellProperties.prop == "SubAccounts") { 1252 if ((viewModel.BillToAccounts.length > 1) && (data.BillToAccount == null || data.BillToAccount == '')) { 1253 swal( 1254 { 1255 title: "", 1256 text: "You must select a bill-to account before proceeding.", 1257 confirmButtonColor: "#002f86" 1258 }); 1259 } else { 1260 $('#subAcctsPopup').data('rowIndex', coords.row); 1261 $('#subAcctsPopup').data('caller', 'CreateSamples'); 1262 var windowSubAccounts = $('#subAcctsPopup').data('kendoWindow'); 1263 windowSubAccounts.center(); 1264 windowSubAccounts.open(); 1265 } 1266 } 1267 } 1268 }); 1269 1270 function checkTableHeight() { 1271 //Check if table height is greater than 400 px to make it scrollable and freeze column headers 1272 var tableHeight = document.getElementById('samplesTable').clientHeight; 1273 if (tableHeight >= 400) { 1274 $('#samplesTable').handsontable({ 1275 height: 400 1276 }); 1277 } 1278 } 1279 1280 // Confirm with the user they want to leave if they have entered any samples that have not been saved 1281 $(window).bind('beforeunload', function () { 1282 if (needToConfirm) { 1283 return "You have new or deleted samples that have not been saved. Are you sure you want to leave the page?"; 1284 } 1285 // ReSharper disable once NotAllPathsReturnValue - you only return a value in this event if you want messagebox to show up 1286 }); 1287 1288 //when browser closed - psedocode 1289 //$(window).unload(function () { 1290 // localStorage.removeItem('FarmerInfo'); 1291 //}); 1292 1293 function uuidv4() { 1294 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { 1295 var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); 1296 return v.toString(16); 1297 }); 1298 } 1299 $('#btnBack').on('click', function () { 1300 grecaptcha.reset(); 1301 var table = document.getElementById("summaryTable"); 1302 var rowCount = table.rows.length; 1303 // Start from the last row to the first one 1304 for (var i = rowCount - 1; i > 0; i--) { 1305 table.deleteRow(i); 1306 }
1307 //var btnSubmit = $('#btnSubmitSamples'); 1308 //btnSubmit.removeAttr('hidden'); 1309 //btnSubmit.removeAttr('none'); 1310 1311 //btnSubmit.val("Submit"); 1312 document.getElementById('btnSubmitSamples').style.visibility = ''; 1313 document.getElementById("btnSubmitSamples").style.display = ""; 1314 1315 document.getElementById('extraControls').style.visibility = 'hidden'; 1316 document.getElementById("extraControls").style.display = "none"; 1317 1318 // 01-06-2021 Mingi Hong 1319 // Here need to make step two 1320 var step2 = document.getElementById('nav-link-step-2'); 1321 step2.classList.remove("active"); 1322 //writeTable(state); 1323 $('.container-submitsamples').fadeIn("slow"); 1324 $('.container-submittest').fadeIn("slow"); 1325 $('#sumarryContainer').fadeOut("slow"); 1326 document.getElementById('btnContinuePayment').style.visibility = ''; 1327 1328 // Remove samples from the currentID 1329 $.ajax({
1330 async: true, 1331 url: '/SeedFarmers/DeleteCurrentSessionIdSamples', 1332 type: 'DELETE', 1333 dataType: 'json', 1334 data: 1335 { 1336 sessionId: localStorage["CurrentSessionId"] 1337 }, 1338 success: function (results) { 1339 var hot = $("#samplesTable").handsontable('getInstance'); 1340 hot.updateSettings({ 1341 readOnly: false 1342 }); 1343 } 1344 }).done(); 1345 1346 }); 1347 1348 /****** SUBMIT SAMPLES BUTTON CLICK REGISTRATION ******/ 1349 $('#btnSubmitSamples').on('click', function () { 1350 var captchaToken = document.getElementById("recaptcha-token").value; 1351 1352 if (typeof captchaToken !== 'undefined' && captchaToken !== '') 1353 { 1354 $('#samplesTable').handsontable('validateCells', function (e) { 1355 $('#samplesTable').handsontable('render'); // TODO: prevent validation styling for the trailing row 1356 }); 1357 1358 var data = $('#samplesTable').handsontable('getSourceData'); 1359 var errorText = validateSampleEntryData(data); // Client side validation before posting to the server 1360 var originalBtnText = $(this).val(); 1361 1362 var isDeactivated = localStorage != null && localStorage["IsDeactivated"] === "true"; 1363 1364 if (isDeactivated) { 1365 var messageBoxText = 1366 "The account related to this phone number is deactivated. Please call the lab (605-692-2758) for assistance."; 1367 swal({ 1368 title: "Deactivate account", 1369 text: messageBoxText, 1370 confirmButtonColor: "#002f86" 1371 }); 1372 var input = $('#Phone'); 1373 input.removeClass('valid').addClass('invalid'); 1374 return; 1375 } 1376 1377 if (errorText.length == 0) { 1378 $(this).val('Submitting...'); 1379 $(this).attr('disabled', 'disabled'); 1380 $('#btnSaveSamples').attr('disabled', 'disabled'); 1381 1382 if (data.length - 1 < numberOfMaxRowsDisplayed) { 1383 // Build a model that will model bind correctly to the controller action's parameter 1384 var model = buildPostableViewModel(data); 1385 1386 if (model.SampleEntries.length <= numberOfMaxRowsDisplayed) { 1387 var modelValue = model.SampleEntries[model.SampleEntries.length - 1].requestedTests; 1388 if (modelValue === undefined) { 1389 model.SampleEntries = model.SampleEntries.splice(0, model.SampleEntries.length - 1) 1390 } 1391 } 1392 1393 var companyName = document.getElementById("CompanyName").value; 1394 var address = document.getElementById("Address").value; 1395 var city = document.getElementById("City").value; 1396 var state = document.getElementById("State").value; 1397 var zipCode = document.getElementById("ZipCode").value; 1398 var phoneSpecialCha = document.getElementById("Phone").value; 1399 var phone = phoneSpecialCha.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s/g, ''); 1400 var email = document.getElementById("Email").value; 1401 1402 var farmerObj = { 1403 GuestName: companyName, 1404 Email: email, 1405 Phone: phone, 1406 Address: address, 1407 City: city, 1408 State: state, 1409 ZipCode: zipCode 1410 }; 1411 1412 model.FarmerAccount = farmerObj; 1413 1414 1415 1416 model.CurrentSessionID = localStorage != null ? localStorage["CurrentSessionId"] : null; 1417 model.AccountID = localStorage != null ? localStorage["AccountID"] : 0; 1418 model.CaptchaToken = captchaToken; 1419 1420 var form_data = $("#guestForm").serializeArray(); 1421 var error_free = true; 1422 for (var input in form_data) { 1423 var element = $("#" + form_data[input]['name']); 1424 if (element.selector != "#nds-pmd") {
1425 var valid = element.hasClass("valid"); 1426 var error_element = $("span", element.parent()); 1427 1428 if (!valid) { 1429 element.addClass("invalid"); 1430 error_free = false; 1431 1432 if (form_data[input]['name'] === 'Address') { 1433 event.preventDefault(); 1434 swal( 1435 { 1436 title: "Error", 1437 text: "Please enter a correct or more detailed address", 1438 confirmButtonColor: "#002f86" 1439 }); 1440 var btnSubmit = $('#btnSubmitSamples'); 1441 btnSubmit.removeAttr('disabled'); 1442 btnSubmit.val(originalBtnText); 1443 1444 return; 1445 } 1446 } 1447 else { 1448 error_element.removeClass("error_show").addClass("error"); 1449 } 1450 } 1451 1452 } 1453 if (!error_free) { 1454 event.preventDefault(); 1455 swal( 1456 { 1457 title: "Error", 1458 text: 1459 "There was an error validating the form. Please check the fields were correctly filled up", 1460 confirmButtonColor: "#002f86" 1461 }); 1462 var btnSubmit = $('#btnSubmitSamples'); 1463 btnSubmit.removeAttr('disabled'); 1464 btnSubmit.val(originalBtnText); 1465 1466 return; 1467 } else { 1468 var btnSubmit = $('#btnSubmitSamples'); 1469 btnSubmit.removeAttr('disabled'); 1470 btnSubmit.val(originalBtnText); 1471 }; 1472 1473 1474 //Farmer info will be used when clicking "Submit more samples" to auto refill 1475 localStorage["FarmerInfo"] = JSON.stringify(farmerObj); 1476 // Post to server 1477 1478 swal({ 1479 title: "Are you sure you want to continue to payment?", 1480 text: "You cannot make any changes after the payment is done. The sample information and tests will be saved for submission to the lab after payment. Labels to be applied to the sample will be available for printing after payment. ", 1481 type: "warning", 1482 showCancelButton: true, 1483 confirmButtonColor: "#002f86", 1484 confirmButtonText: "Continue to Payment", 1485 cancelButtonText: "No, cancel it!", 1486 //imageUrl: "../../Content/Images/DataTransfer.png", 1487 closeOnConfirm: false, 1488 closeOnCancel: true 1489 }, 1490 function (isConfirmPayment) { 1491 1492 if (isConfirmPayment) { 1493 1494 var warrantyText = "NOTICE: LIMITATION OF WARRANTY AND REMEDY." + 1495 "Requesting party acknowledges and agrees that the testing will be conducted only on the sample provided by the requesting party. " + 1496 "The test results shall represent only the condition of the sample at the time the tests are performed. " + 1497 "SODAK LABS, INC.MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, CONCERNING SAID SAMPLE TESTED OR ITS TEST RESULTS, " + 1498 "INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUALITY OR ABSENCE OF DISEASE. " + 1499 "Upon acceptance of the test results, requesting party expressly agrees that its exclusive remedy for any breach of duty owed or damages for any cause, " + 1500 "including breach of contract, breach of warranty and negligence, in regard to the test results or the test report shall be limited solely and exclusively " + 1501 "to a refund of the fee charged for testing the seed sample.In no event shall SoDak Labs, Inc. " + 1502 "or any of its employees, officers, directors or contractors be liable for any damages, whether incidental or consequential, including loss of profits. " + 1503 "This disclaimer of warranty and limitation of liability and remedy may not be altered or amended except in writing by SoDak Labs, Inc.and the requesting party. " 1504 1505 swal({ 1506 title: "Limitation of Warranty and Remedy", 1507 text: warrantyText, 1508 type: "warning", 1509 showCancelButton: true, 1510 confirmButtonColor: "#002f86", 1511 confirmButtonText: "I understand", 1512 cancelButtonText: "Disagree", 1513 //imageUrl: "../../Content/Images/DataTransfer.png", 1514 closeOnConfirm: true, 1515 closeOnCancel: true 1516 }, 1517 function (isConfirmWarranty) { 1518 if (isConfirmWarranty) { 1519 $.ajax({
1520 url: submitSamplesActionUrl, 1521 data: JSON.stringify(model), 1522 contentType: 'application/json; charset=utf-8;', 1523 type: 'POST', 1524 dataTpe: 'json', 1525 //timeout: 30000, // 30 Seconds 1526 success: function (args) { 1527 if (args.Success) { 1528 1529 localStorage["FarmerAccountID"] = args.FarmerAccountId; 1530 1531 //account ID created once the samples were submitted. 1532 localStorage["AccountID"] = args.AccountID; 1533 1534 // Move user to the next page after they've clicked OK on alert window 1535 var btnSubmit = $('#btnSubmitSamples'); 1536 btnSubmit.removeAttr('disabled'); 1537 needToConfirm = false; 1538 btnSubmit.val(originalBtnText); 1539 1540 document.getElementById('btnSubmitSamples').style.visibility = 'hidden'; 1541 document.getElementById("btnSubmitSamples").style.display = "none"; 1542 1543 // 01-06-2021 Mingi Hong 1544 // Here need to make step two 1545 var step2 = document.getElementById('nav-link-step-2'); 1546 step2.classList.add("active"); 1547 writeTable(state); 1548 $('.container-submitsamples').fadeOut("slow"); 1549 $('.container-submittest').fadeOut("slow"); 1550 $('#sumarryContainer').fadeIn("slow"); 1551 document.getElementById('btnContinuePayment').style.visibility = 'hidden'; 1552 var hot = $("#samplesTable").handsontable('getInstance'); 1553 hot.updateSettings({ 1554 readOnly: true 1555 }); 1556 } 1557 else if (args.IsInternetDown) { 1558 swal( 1559 { 1560 title: "", 1561 text: args.Message, 1562 type: "warning", 1563 confirmButtonColor: "#002f86" 1564 }, 1565 function () { 1566 var btnSubmit = $('#btnSubmitSamples'); 1567 btnSubmit.removeAttr('disabled'); 1568 btnSubmit.val(originalBtnText); 1569 }); 1570 } 1571 else { 1572 swal( 1573 { 1574 title: "Error", 1575 text: 1576 "There was an error submitting your samples. Please check your internet connection " + 1577 "Then try again and if the issue " + 1578 "persists, please contact SoDak Labs.", 1579 confirmButtonColor: "#002f86" 1580 }); 1581 $("#btnSubmitSamples").prop('disabled', true); 1582 } 1583 }, 1584 error: function () { 1585 swal( 1586 { 1587 title: "Error", 1588 text: 1589 "There was an error submitting your samples. Please check your internet connection " + 1590 "Then try again and if the issue " + 1591 "persists, please contact SoDak Labs.", 1592 confirmButtonColor: "#002f86" 1593 }, 1594 function () { 1595 var btnSubmit = $('#btnSubmitSamples'); 1596 btnSubmit.removeAttr('disabled'); 1597 btnSubmit.val(originalBtnText); 1598 1599 //var bt
1599nSave = $('#btnSaveSamples'); 1600 //btnSave.removeAttr('disabled'); 1601 }); 1602 1603 return; // return as this will suppress any default error message boxes 1604 } 1605 }); 1606 1607 } else { 1608 var btnSubmit = $('#btnSubmitSamples'); 1609 btnSubmit.removeAttr('disabled'); 1610 btnSubmit.val(originalBtnText); 1611 } 1612 }); 1613 1614 } else { 1615 var btnSubmit = $('#btnSubmitSamples'); 1616 btnSubmit.removeAttr('disabled'); 1617 btnSubmit.val(originalBtnText); 1618 } 1619 }); 1620 1621 1622 } else { 1623 swal( 1624 { 1625 title: "Error", 1626 text: "Make sure you are submitting less than 100 samples. Then try again and if the issue " + 1627 "persists, please contact SoDak Labs.", 1628 confirmButtonColor: "#002f86" 1629 }, 1630 function () { 1631 var btnSubmit = $('#btnSubmitSamples'); 1632 btnSubmit.removeAttr('disabled'); 1633 btnSubmit.val(originalBtnText); 1634 1635 //var btnSave = $('#btnSaveSamples'); 1636 //btnSave.removeAttr('disabled'); 1637 }); 1638 } 1639 } 1640 else { 1641 displayErrorText(errorText); 1642 } 1643 1644 } else { 1645 displaySpanError("Please provide a valid value for recaptcha2"); 1646 } 1647 }); 1648 1649 /****** SAVE SAMPLES BUTTON CLICK REGISTRATION ******/ 1650 //$('#btnSaveSamples').on('click', function () { 1651 1652 // $('#samplesTable').handsontable('validateCells', function (e) { 1653 // $('#samplesTable').handsontable('render'); // TODO: prevent validation styling for the trailing row 1654 // }); 1655 1656 // var data = $('#samplesTable').handsontable('getSourceData'); 1657 // var errorText = validateSampleEntryData(data); // Client side validation before posting to the server 1658 // var originalBtnText = $(this).val(); 1659 1660 // if (errorText.length == 0) { 1661 // $(this).val('Saving...'); 1662 // $(this).attr('disabled', 'disabled'); 1663 // $('#btnSubmitSamples').attr('disabled', 'disabled'); 1664 1665 // if (data.length - 1 < numberOfMaxRowsDisplayed) { 1666 // // Build a model that will model bind correctly to the controller action's parameter 1667 // var model = buildPostableViewModel(data); 1668 1669 // if (model.SampleEntries.length <= numberOfMaxRowsDisplayed) { 1670 // var modelValue = model.SampleEntries[model.SampleEntries.length - 1].requestedTests; 1671 // if (modelValue === undefined) { 1672 // model.SampleEntries = model.SampleEntries.splice(0, model.SampleEntries.length - 1) 1673 // } 1674 // } 1675 1676 // var errorText = "There was an error saving your samples. Please check your internet connection " + 1677 // "Then try again and if the issue " + 1678 // "persists, please contact SoDak Labs."; 1679 // // Post to server 1680 1681 // $.ajax({
1682 // url: saveSamplesActionUrl, 1683 // data: JSON.stringify(model), 1684 // contentType: 'application/json; charset=utf-8;', 1685 // type: 'POST', 1686 // dataTpe: 'json', 1687 // //timeout: 30000, // 30 Seconds 1688 // success: function (args) { 1689 // swal( 1690 // { 1691 // title: "", 1692 // text: args.Success ? "Your samples have been saved. You can now leave this page and your samples will be here when you return." : errorText, 1693 // confirmButtonColor: "#002f86" 1694 // }, 1695 // function () { 1696 // var btnSubmit = $('#btnSubmitSamples'); 1697 // btnSubmit.removeAttr('disabled'); 1698 // needToConfirm = false; 1699 // btnSubmit.val(originalBtnText); 1700 1701 // var btnSave = $('#btnSaveSamples'); 1702 // btnSave.removeAttr('disabled'); 1703 1704 // // Reload page so they saved samples will get reloaded into the grid with a new assigned sampleID. 1705 // // TODO: get rid of reload and try to assign the sampleIDs to the rows already in the grid. 1706 // window.location.reload(); 1707 // }); 1708 // }, 1709 // error: function () { 1710 // swal( 1711 // { 1712 // title: "Error", 1713 // text: errorText, 1714 // confirmButtonColor: "#002f86" 1715 // }, 1716 // function () { 1717 // var btnSave = $('#btnSaveSamples'); 1718 // btnSave.removeAttr('disabled'); 1719 // btnSave.val(originalBtnText); 1720 1721 // var btnSubmit = $('#btnSubmitSamples'); 1722 // btnSubmit.removeAttr('disabled'); 1723 // }); 1724 1725 // return; // return as this will suppress any default error message boxes 1726 // } 1727 // }); 1728 // } else { 1729 // swal( 1730 // { 1731 // title: "Error", 1732 // text: "Make sure you are saving less than 100 samples. Then try again and if the issue " + 1733 // "persists, please contact SoDak Labs.", 1734 // confirmButtonColor: "#002f86" 1735 // }, 1736 // function () { 1737 // var btnSave = $('#btnSaveSamples'); 1738 // btnSave.removeAttr('disabled'); 1739 // btnSave.val(originalBtnText); 1740 1741 // var btnSubmit = $('#btnSubmitSamples'); 1742 // btnSubmit.removeAttr('disabled'); 1743 // }); 1744 // } 1745 // } else { 1746 // // Inform user they must supply a value for Test Rule (if visible), Species (if Visible) and Tests 1747 // displayErrorText(errorText); 1748 // } 1749 //}); 1750 1751 function displayErrorText(errorText) { 1752 swal( 1753 { 1754 title: "Invalid Data", 1755 text: errorText, 1756 html: true, 1757 confirmButtonColor: "#002f86" 1758 }); 1759 } 1760 function displaySpanError(errorText) { 1761 if (!spanAlreadyExists()) { 1762 var spanElement = document.createElement("span"); 1763 spanElement.textContent = errorText; 1764 spanElement.classList.add("field-validation-error"); 1765 spanElement.id = "spanErrorReCaptcha"; 1766 document.getElementById("recaptcha-token").appendChild(spanElement); 1767 } 1768 } 1769 1770 function spanAlreadyExists() { 1771 return document.getElementById("spanErrorReCaptcha") !== null; 1772 } 1773 1774 /****** SAVE THE SELECTED TESTS TO THE MODEL DEFINING THE WINDOW'S CONTEXT ******/ 1775 function saveSelectedTestsToModel() { 1776 // We want to save the selected tests, along with the ones that have been marked as deleted (perhaps the user unchecked them) 1777 var tests = $('#testsPopup [data-testid]'); // Refer to window partial view for structure... 1778 var rowIndex = $('#testsPopup').data('rowIndex'); // Get the row index of the sample we're working with 1779 var rowData = 1780 $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); // Get the data the sample is bound to 1781 var numSeedsIsValid = true; 1782 var noxiousOptionIsValid = true; 1783 var noxiousPurityIsValid = true; 1784 var herbicideTestsAreValid = true; 1785 var cornGermTestsAreValid = true; 1786 var apSeedTestsAreValid = true; 1787 1788 var soyTestsAreValid = true; 1789 var GrowOutAreValid = true; 1790 var hasQPCInstructionTests = false; 1791 rowData.requestedTests = new Array(); 1792 var selectedTests = new Array(); 1793 1794 if (tests != null) { 1795 // For each of the tests, add it to the sample's list of requested tests only if 1796 // it has been marked as deleted (which is known by the presence of a 'data-IsDeleted' attribute, i.e. not 'undefined'), 1797 // OR if the test has been checked as one to add. 1798 $(tests).each(function () { 1799 var checkbox = $(this).children('input[type=checkbox]'); 1800 var numSeedsDropDown = $(this).children('.test-numseeds-show[data-numberofseeds]'); 1801 var numSeeds = null; 1802 1803 if ($(checkbox).is(':checked')) 1804 selectedTests.push(this); 1805 1806 // Check if the num seeds drop down was found 1807 if (numSeedsDropDown[0] != null) { 1808 // If found, get the drop down's value 1809 //numSeeds = $(this).children('[data-numberofseeds]').val(); 1810 1811 //// Alert user they must select a value for any selected test that has num seeds options 1812 //if (numSeeds == '' && $(checkbox).is(':checked')) { 1813 // $(this).children('.error-label').visible(); 1814 // numSeedsIsValid = false; 1815 // return; 1816 //} else { 1817 // // If they've successfully picked a number of seeds then clear the error asterick 1818 // $(this).children('.error-label').inv
1818isible(); 1819 //} 1820 } else { 1821 // If not found, check if default number of seeds exists, if it does, use that as the numSeeds value 1822 if ($(this).attr('data-defaultnumberofseeds') != '') { 1823 numSeeds = $(this).attr('data-defaultnumberofseeds'); 1824 } 1825 } 1826 1827 // Validate that the AP-Gluf & AP-Glyp tests are selected if AP-Seed is selected 1828 if (isTestChecked(154)) { 1829 if (isTestChecked(6) == false || 1830 isTestChecked(9) == false) { 1831 apSeedTestsAreValid = false; 1832 } 1833 } 1834 1835 1836 // test fee check 1837 if ($(checkbox).is(':checked')) { 1838 var testFees = rowData.availableTests.find(x => x.TestID == $(this).data('testid')).TestFees; 1839 var targetFee = testFees.find(x => x.SeedTypeID == rowData.SeedType && x.TestRuleID == 1); 1840 var uniqueprice = 0; 1841 if (targetFee != undefined) { 1842 if (Array.isArray(targetFee) && targetFee.length > 0) { 1843 uniqueprice = targetFee.find(x => x.NumberOfSeeds == numSeeds).Fee; 1844 } 1845 else { 1846 uniqueprice = targetFee.Fee; 1847 } 1848 } 1849 else { 1850 if ($(this).data('testid') != 103) { 1851 selectedTests.pop(); 1852 var testname = rowData.availableTests.find(x => x.TestID == $(this).data('testid')).TestName; 1853 alert("Test fee for " + testname + " is not ready yet"); 1854 return; 1855 } 1856 } 1857 if (uniqueprice == 0) { 1858 if ($(this).data('testid') != 103) { 1859 selectedTests.pop(); 1860 alert("Test fee is 0"); 1861 return; 1862 } 1863 } 1864 else { 1865 1866 } 1867 } 1868 1869 //var currentTestClientInstructions = $(this).children('[data-clientinstructions]'); 1870 1871 //// Make sure the user has selected a noxious option if they selected the noxious test 1872 //if ($(this).data('testid') == 103 && $(checkbox).is(':checked')) { 1873 // // TODO: only look at visible check boxes as there is a way that they can get MS tests onto a soybean test group if a species is switched 1874 // var noxiousOptions = $('#noxiousOptions').find('input[type=radio][name=noxiousOption]:checked'); 1875 // if (isTestChecked(66) == false) { 1876 // noxiousPurityIsValid = false; 1877 // return; 1878 // } 1879 // if (Enumerable.from(noxiousOptions).any()) { 1880 // // Place the noxious option in the client instructions for this noxious test 1881 // var noxiousOptionString = $(Enumerable.from(noxiousOptions).first()).val(); 1882 1883 // if (noxiousOptionString == "States") { 1884 // noxiousOptionString = stateNoxiousInstructions; 1885 // } 1886 1887 // // Check to see if there is already a noxious option in the text box by looking for a "(" 1888 // var currentNoxiousInstructions = $(currentTestClientInstructions).val(); 1889 // if (currentNoxiousInstructions.indexOf('(') > -1) { 1890 // // Replace those instructions with the new ones 1891 // currentNoxiousInstructions = 1892 // currentNoxiousInstructions.replace(/\(.*?\)/, "(" + noxiousOptionString + ")"); 1893 // } else { 1894 // currentNoxiousInstructions += " (" + noxiousOptionString + ")"; 1895 // } 1896 1897 // $(currentTestClientInstructions).val(currentNoxiousInstructions); 1898 // } else { 1899 // noxiousOptionIsValid = false; 1900 // return; 1901 // } 1902 //} 1903 1904 var testId = $(this).data('testid'); 1905 var abbrName = $(this).data('abbrname'); 1906 var isDeleted = $(this).data('isdeleted'); 1907 var testClass = $(this).data('testclass'); 1908 var clientInstructions = "";//$(currentTestClientInstructions).val().trim(); 1909 1910 // If it's deleted, we need to include it so it can be deleted on the server. If it's checked, we obviously include it as the user 1911 // has indicated the desire to add this test... 1912 if (isDeleted == true || $(checkbox).is(':checked')) { 1913 if (clientInstructions.includes("QPC")) { 1914 hasQPCInstructionTests = true; 1915 } 1916 1917 rowData.requestedTests.push({ 1918 "TestId": testId, 1919 "NumberOfSeeds": numSeeds, 1920 "IsDeleted": isDeleted, 1921 "AbbrName": abbrName, 1922 "TestClass": testClass, 1923 "ClientInstructions": clientInstructions, 1924 "Fee": uniqueprice 1925 }); 1926 } 1927 1928 // Mark each test isdeleted property to false in case the testPopup window is opened again 1929 $(this).data('isdeleted', false); 1930 }); 1931 } 1932 1933 // Check that these testID pairs aren't both selected at the same time 1934 var herbicideTestPairsToCheck = [[6, 46], [9, 70], [39, 71], [134, 47], [150, 140], [7, 45], [8, 72]]; 1935 herbicideTestsAreValid = checkTestPairs(herbicideTestPairsToCheck); 1936 1937 var cornGermTestsToCheck = [[38, 117], [38, 116], [38, 115], [116, 117], [116, 115], [38, 123], 1938 [38, 131], [38, 125], [125, 131], [125, 123], [131, 125], [131, 123]]; 1939 cornGermTestsAreValid = checkTestPairs(cornGermTestsToCheck); 1940 1941 var soyTestsToCheck = [[93, 64]]; 1942 soyTestsAreValid = checkTestPairs(soyTestsToCheck); 1943 1944 // Set auto-ehv flag if the correct tree node is selected 1945 var selectedTreeNodeDataItem = getSelectedTreeNodeLocation(); 1946 1947 1948 if (selectedTreeNodeDataItem != null) { 1949 if (selectedTreeNodeDataItem.TreeNodeLocation.toString().toLowerCase().indexOf("new crop") != -1) { 1950 //Disabled on 9/20/19 1951 // rowData.AutoAddEHV = true; 1952 } 1953 1954 if ( 1955 (selectedTreeNodeDataItem.TestGroupName.toString().toLowerCase().indexOf("date testing") != -1) 1956 ) { 1957 // If new crop and on or after a pre-determined date from Remington, 1958 // add date testing in customer remarks if it doesn't already exist 1959 // 09/16/2020 Mingi Hong 1960 // Requirement changed, All Lab instruction is deleted
1961 // Will make popup when test group is "Date Testing" 1962 1963 dateTestingPopupNeeded = true; 1964 } 1965 $('#samplesTable').data('handsontable').render(); 1966 if (selectedTreeNodeDataItem.TestGroupName === "Quality Point Check") { 1967 rowData.CustomerRemarks = "QPC " + 1968 (rowData.CustomerRemarks != null && 1969 rowData.CustomerRemarks.toLowerCase().indexOf("QPC") == -1 1970 ? rowData.CustomerRemarks 1971 : ""); 1972 } 1973 } else { 1974 if (hasQPCInstructionTests) { 1975 rowData.CustomerRemarks = "QPC " + 1976 (rowData.CustomerRemarks != null && 1977 rowData.CustomerRemarks.toLowerCase().indexOf("QPC") == -1 1978 ? rowData.CustomerRemarks 1979 : ""); 1980 } 1981 } 1982 1983 $('#selectTestsErrorLabelNumSeeds').css('display', (numSeedsIsValid ? 'none' : 'block')); 1984 $('#selectTestsErrorLabelNoxious').css('display', (noxiousOptionIsValid ? 'none' : 'block')); 1985 $('#selectTestsErrorLabelNoxiousAlone').css('display', (noxiousPurityIsValid ? 'none' : 'block')); 1986 $('#selectTestsErrorLabelHerbicide').css('display', (herbicideTestsAreValid ? 'none' : 'block')); 1987 $('#selectTestsErrorLabelCornGerm').css('display', (cornGermTestsAreValid ? 'none' : 'block')); 1988 $('#selectTestsErrorLabelAPSeed').css('display', (apSeedTestsAreValid ? 'none' : 'block')); 1989 1990 $('#selectTestsErrorLabelSoyTests').css('display', (soyTestsAreValid ? 'none' : 'block')); 1991 $('#seedSizeErrorLabel').css('display', (GrowOutAreValid ? 'none' : 'block')); 1992 1993 if (numSeedsIsValid && noxiousOptionIsValid && herbicideTestsAreValid && cornGermTestsAreValid && apSeedTestsAreValid && soyTestsAreValid && noxiousPurityIsValid) { 1994 return true; 1995 } else { 1996 rowData.requestedTests = new Array(); // Clear out the array if not valid 1997 return false; 1998 } 1999 }; 2000 2001 function getSelectedTreeNodeLocation() { 2002 // Get selected node from the test group tree if one exists 2003 var treeView = $('#testsPopup').find('#TestGroupTree').data('kendoTreeView'); 2004 if (treeView != null) { 2005 var selectedNode = treeView.select(), 2006 dataItem = treeView.dataItem(selectedNode); 2007 2008 if (dataItem != null) { 2009 return dataItem; 2010 } 2011 } 2012 2013 return null; 2014 } 2015 2016 function checkTestPairs(testPairsToCheck) { 2017 var isValid = true; 2018 2019 $(testPairsToCheck).each(function () { 2020 // Validate that the clients hasn't selected a herbicide test and it's conventional pair (eg. GT & AP GT (Corn) OR LL & LL-GMO (Soy)) 2021 var checkBox1 = $('#testsPopup [data-testid=' + this[0] + ']').children('input[type=checkbox]'); 2022 var checkBox2 = $('#testsPopup [data-testid=' + this[1] + ']').children('input[type=checkbox]'); 2023 2024 if ((checkBox1 != null) && (checkBox2 != null)) { 2025 if (($(checkBox1).prop('checked') == true) && ($(checkBox2).prop('checked') == true)) { 2026 isValid = false; 2027 return false; 2028 } 2029 } 2030 2031 return true; 2032 }); 2033 2034 return isValid; 2035 } 2036 2037 /****** RESTORES SELECTED TESTS ON THE POPUP WHOSE CONTEXT IS THE CURRENTLY SELECTED (CLICKED) SAMPLE ENTRY (ROW) ******/ 2038 function restoreSelectTestControls() { 2039 // Get the row index that was clicked, along with the data associated with it 2040 var rowIndex = $('#testsPopup').data('rowIndex'); 2041 var rowData = $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); 2042 2043 if (rowData != null && rowData.requestedTests != null) { 2044 // Now with rowData as an object that represents the sample we are working with, we can loop through each of the 2045 // tests associated with it, and set the appropriate state of the controls on this popup. 2046 for (var i = 0; i < rowData.requestedTests.length; i++) { 2047 var test = rowData.requestedTests[i]; 2048 2049 // Get the div that represents the test associated with the test ID we are workig for in this iteration (refer to window's view for HTML structure) 2050 var testContainer = $('#testsPopup [data-testid=' + test.TestId + ']'); 2051 2052 // We maintain a list of the items that have been deleted for when we post back to the controller, but 2053 // we don't actually want to populate the fields for a test that has been marked as deleted (this can happen 2054 // from the user checking and unchecking the box multiple times) 2055 if (testContainer != null && test.IsDeleted == false) { 2056 var checkBox = $(testContainer).children('input[type=checkbox]'); 2057 2058 if (checkBox != null) { 2059 $(checkBox).prop('checked', true); 2060 } 2061 2062 var numeric = $(testContainer).children('[data-numberofseeds]'); 2063 if (numeric != null) { 2064 $(numeric).val(test.NumberOfSeeds); 2065 $(numeric).prop('disabled', false); 2066 } 2067 2068 var clientInstructionsTextbox = $(testContainer).children('[data-clientinstructions]'); 2069 if (clientInstructionsTextbox != null) { 2070 $(clientInstructionsTextbox).val(test.ClientInstructions); 2071 $(clientInstructionsTextbox).prop('disabled', false); 2072 } 2073 2074 if (test.TestId == 103) { 2075 changeNoxiousOptionsEnabled(false); 2076 } 2077 } 2078 } 2079 } 2080 2081 // Hide invalid tests based upon the selected species 2082 $('div [data-testid]').each(function (index) { 2083 // Get ID 2084 var testId = $(this).data('testid'); 2085 var found = false; 2086 2087 // Change the default number of seeds for ISTA TZs to 400 2088 if ($(this).attr('data-testId') == 99) { 2089 if (rowData.TestRule == "ISTA") { 2090 $(this).attr('data-defaultnumberofseeds', 400); 2091 } else { 2092 $(this).attr('data-defaultnumberofseeds', 200);
2093 } 2094 } 2095 2096 for (var i = 0; i < rowData.availableTests.length; i++) { 2097 if (rowData.availableTests[i].TestID == testId) { 2098 found = true; 2099 break; 2100 } 2101 } 2102 2103 if (!found) { 2104 $(this).hide(); 2105 // TODO: Remove it from the requested tests list 2106 } else { 2107 $(this).show(); 2108 } 2109 }); 2110 2111 var oneGroupExists = false; 2112 2113 // Hide test groups that aren't related to this species 2114 $('div [data-commonname]').each(function (index) { 2115 var testGroupSpecies = $(this).data('commonname'); 2116 2117 if (testGroupSpecies != rowData.Species) { 2118 $(this).hide(); 2119 } else { 2120 $(this).show(); 2121 oneGroupExists = true; 2122 } 2123 }); 2124 2125 if (oneGroupExists) { 2126 $('#testgroups').show(); 2127 } else { 2128 $('#testgroups').hide(); 2129 } 2130 2131 // Hide/show the noxious options based on if the Noxious test in MS (103) is 2132 // one of the available tests 2133 if (rowData != null) { 2134 var noxiousOptions = $('#noxiousOptions'); 2135 (Enumerable.from(rowData.availableTests).any("$.TestID == 103") 2136 ? $(noxiousOptions).show() 2137 : $(noxiousOptions).hide()); 2138 } 2139 } 2140 2141 /****** ESTABLISH KENDO WINDOW FOR STATE NOXIOUS SELECTION ******/ 2142 initSubAccountWindow(); 2143 2144 $('#stateNoxiousPopup') 2145 .kendoWindow({ 2146 width: "400px", 2147 visible: false, 2148 modal: true, 2149 title: "Select Noxious States...", 2150 content: stateNoxiousPopupContentActionUrl, 2151 draggable: false, 2152 resizeable: false, 2153 open: function () { 2154 $('#stateNoxiousPopupBtnOk') 2155 .on('click', 2156 function () { 2157 // Validate they have at least one state selected 2158 var allCheckedCheckboxes = $('#stateNoxiousPopup').find('input[type=checkbox]:checked'); 2159 if (Enumerable.from(allCheckedCheckboxes).any()) { 2160 var noxiousStateString = "States: "; 2161 var i = 0; 2162 $(allCheckedCheckboxes) 2163 .each(function () { 2164 noxiousStateString += (i > 0 ? ", " : "") + this.value; 2165 i++; 2166 }); 2167 stateNoxiousInstructions = noxiousStateString; 2168 $('#stateNoxiousPopup').data('kendoWindow').close(); 2169 } else { 2170 $('#selectStateNoxiousMasterErrorLabel').visible(); 2171 } 2172 }); 2173 $('#stateNoxiousBtnCancel').off('click'); 2174 $('#stateNoxiousBtnCancel') 2175 .on('click', 2176 function () { 2177 $('#stateNoxiousPopup').data('kendoWindow').close(); 2178 }); 2179 }, 2180 close: function () { 2181 var allCbs = $('#stateNoxiousPopup input[type=checkbox]'); // Get the test checkboxes 2182 2183 // Clear the checkboxes 2184 if (allCbs != null) { 2185 $(allCbs) 2186 .each(function () { 2187 $(this).prop('checked', false); 2188 }); 2189 } 2190 } 2191 }); 2192 2193 /****** ESTABLISH KENDO WINDOW FOR TESTS ******/ 2194 $('#testsPopup') 2195 .kendoWindow({ 2196 width: "600px", 2197 visible: false, 2198 modal: true, 2199 title: "Select Tests...", 2200 content: testsPopupContentActionUrl, 2201 draggable: true, 2202 resizable: false, 2203 open: function () { 2204 // Get a list of valid selected tests based upon the currently selected species 2205 var rowIndex = $("#testsPopup").data("rowIndex"); 2206 if (rowIndex >= 0) { 2207 var data = $('#samplesTable').handsontable('getSourceDataAtRow', rowIndex); 2208 var selectedSpecies = data.Species; 2209 $('#selectTestsErrorLabelNumSeeds').css('display', 'none'); 2210 $('#selectTestsErrorLabelNoxious').css('display', 'none'); 2211 $('#selectTestsErrorLabelHerbicide').css('display', 'none'); 2212 $('#selectTestsErrorLabelCornGerm').css('display', 'none'); 2213 $('#selectTestsErrorLabelAPSeed').css('display', 'none'); 2214 2215 $('#selectTestsErrorLabelSoyTests').css('display', 'none'); 2216 $('#selectTestsLabelMaster').css('display', 'none'); 2217 $('#seedSizeErrorLabel').css('display', 'none'); 2218 $.ajax({
2219 async: false, 2220 url: '/SeedFarmers/TestResultsForSpecies?species=' + selectedSpecies, 2221 type: 'GET', 2222 dataType: 'json', 2223 success: function (result) { 2224 data.availableTests = result.tests; 2225 data.availableTestsFor = selectedSpecies; 2226 data.specieId = result.specie.SpeciesID; 2227 data.SeedType = result.specie.SeedType; 2228 if (data.TestRule == "ISTA") { 2229 Enumerable.from(data.availableTests).where("$.TestID == 99").forEach(function (test) { 2230 test.DefaultNumberOfSeeds = test.DefaultNumberOfSeeds * 2; 2231 }); 2232 } 2233 } 2234 }); 2235 } 2236 2237 // Restore the state of the window for the particular sample we are working with 2238 restoreSelectTestControls(); 2239 2240 $('#selectTestsBtnOk').off('click'); 2241 $('#selectTestsBtnOk') 2242 .on('click', 2243 function () { 2244 if (saveSelectedTestsToModel()) { 2245 $('#testsPopup').data('kendoWindow').close(); 2246 if (dateTestingPopupNeeded) { 2247 datetestingGroupClickHandler(); 2248 } 2249 } 2250 }); 2251 2252 $('#selectTestsBtnCancel').off('click'); 2253 $('#selectTestsBtnCancel') 2254 .on('click', 2255 function () { 2256 $('#testsPopup').data('kendoWindow').close(); 2257 }); 2258 }, 2259 close: function () {
2260 //////////////////////////// 2261 // CLEAR ALL POPUP FIELDS // 2262 //////////////////////////// 2263 var allCbs = $('#testsPopup [data-testid] input[type=checkbox]'); // Get the test checkboxes 2264 allCbs.push($('#testsPopup [data-testgroupid] input[type=checkbox]')); // Add the test group checkboxes 2265 2266 // Clear the checkboxes 2267 if (allCbs != null) { 2268 $(allCbs) 2269 .each(function () { 2270 $(this).prop('checked', false); 2271 }); 2272 } 2273 2274 var allNumerics = $('#testsPopup [data-testid] [data-numberofseeds] [data-clientinstructions]'); 2275 2276 if (allNumerics != null) { 2277 $(allNumerics) 2278 .each(function () { 2279 $(this).val(''); 2280 $(this).prop('disabled', true); 2281 }); 2282 } 2283 2284 // Clear all error messages 2285 $('#testsPopup .error-label').invisible(); 2286 2287 // Collapse and deselect all nodes if a test group test tree exists 2288 var treeView = $('#TestGroupTree').data('kendoTreeView'); 2289 if (treeView != null) { 2290 treeView.select($()); 2291 } 2292 2293 // Render the table so that the test lists column is updated 2294 $('#samplesTable').data('handsontable').render(); 2295 } 2296 }); 2297 2298 /****** STYLING FOR THE HORIZONTAL SCROLLBAR USED ON THE HANDSONTABLE ******/ 2299 //$('#samplesTable div.handle').html('<span class="glyphicon glyphicon-play" /><span class="glyphicon glyphicon-play" />'); 2300 }; 2301 2302 return { 2303 initCreateSamplesView: initCreateSamplesView, 2304 initSubAccountWindow: initSubAccountWindow, 2305 setCreateSamplesActionUrl: setCreateSamplesActionUrl, 2306 setSaveSamplesActionUrl: setSaveSamplesActionUrl, 2307 setSubmitSamplesActionUrl: setSubmitSamplesActionUrl, 2308 setTestsPopupContentActionUrl: setTestsPopupContentActionUrl, 2309 setStateNoxiousPopupContentActionUrl: setStateNoxiousPopupContentActionUrl, 2310 testRuleCheckedHandler: testRuleCheckedHandler, 2311 testNumSeedChangeHandler: testNumSeedChangeHandler, 2312 showStateNoxiousSelector: showStateNoxiousSelector, 2313 checkSeedSizeFormat: checkSeedSizeFormat, 2314 isRemingtonCornSample: isRemingtonCornSample, 2315 isCornSample: isCornSample, 2316 subAccountClickHandler: subAccountClickHandler, 2317 datetestingGroupClickHandler: datetestingGroupClickHandler, 2318 addDeletedSample: addDeletedSample, 2319 getCurrentCell: getCurrentCell, 2320 getCellToValidate: getCellToValidate, 2321 setSubAcctsPopupContentActionUrl: setSubAcctsPopupContentActionUrl, 2322 setdateTestingPopupContentActionUrl: setdateTestingPopupContentActionUrl, 2323 setProductionStatusPopupContentActionUrl: setProductionStatusPopupContentActionUrl 2324 }; 2325}();; 2326!function(e,t,n){function o(){function o(e){var t=p;return"undefined"!=typeof t[e]?t[e]:h[e]}function l(t){var o=t||e.event,r=o.keyCode||o.which;if(-1!==[9,13,32,27].indexOf(r)){for(var a=o.target||o.srcElement,i=-1,l=0;l<M.length;l++)if(a===M[l]){i=l;break}9===r?(a=-1===i?B:i===M.length-1?M[0]:M[i+1],z(o),a.focus(),s(a,g.confirmButtonColor)):(a=13===r||32===r?-1===i?B:n:27===r&&g.allowEscapeKey===!0?I:n,a!==n&&L(a,o))}}function f(t){var n=t||e.event,o=n.target||n.srcElement,r=n.relatedTarget,a=k(A,"visible");if(a){var i=-1;if(null!==r){for(var l=0;l<M.length;l++)if(r===M[l]){i=l;break}-1===i&&o.focus()}else v=o}}var p=arguments[0];if(arguments[0]===n)return m("SweetAlert expects at least 1 attribute!"),!1;var g=i({},h);switch(typeof arguments[0]){case"string":g.title=arguments[0],g.text=arguments[1]||"",g.type=arguments[2]||"";break;case"object":if(arguments[0].title===n)return m('Missing "title" argument!'),!1;g.title=arguments[0].title;
2326for(var b=["text","type","customClass","allowOutsideClick","showCancelButton","closeOnConfirm","closeOnCancel","timer","confirmButtonColor","cancelButtonText","imageUrl","imageSize","html","animation","allowEscapeKey"],w=b.length,x=0;w>x;x++){var C=b[x];g[C]=o(C)}g.confirmButtonText=g.showCancelButton?"Confirm":h.confirmButtonText,g.confirmButtonText=o("confirmButtonText"),g.doneFunction=arguments[1]||null;break;default:return m('Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]),!1}r(g),u(),c();for(var A=S(),T=function(t){var n=t||e.event,o=n.target||n.srcElement,r=-1!==o.className.indexOf("confirm"),i=k(A,"visible"),l=g.doneFunction&&"true"===A.getAttribute("data-has-done-function");switch(n.type){case"mouseover":r&&(o.style.backgroundColor=a(g.confirmButtonColor,-.04));break;case"mouseout":r&&(o.style.backgroundColor=g.confirmButtonColor);break;case"mousedown":r&&(o.style.backgroundColor=a(g.confirmButtonColor,-.14));break;case"mouseup":r&&(o.style.backgroundColor=a(g.confirmButtonColor,-.04));break;case"focus":var s=A.querySelector("button.confirm"),c=A.querySelector("button.cancel");r?c.style.boxShadow="none":s.style.boxShadow="none";break;case"click":if(r&&l&&i)g.doneFunction(!0),g.closeOnConfirm&&e.sweetAlert.close();else if(l&&i){var u=String(g.doneFunction).replace(/\s/g,""),f="function("===u.substring(0,9)&&")"!==u.substring(9,10);f&&g.doneFunction(!1),g.closeOnCancel&&e.sweetAlert.close()}else e.sweetAlert.close()}},E=A.querySelectorAll("button"),q=0;q<E.length;q++)E[q].onclick=T,E[q].onmouseover=T,E[q].onmouseout=T,E[q].onmousedown=T,E[q].onfocus=T;d=t.onclick,t.onclick=function(t){var n=t||e.event,o=n.target||n.srcElement,r=A===o,a=O(A,o),i=k(A,"visible"),l="true"===A.getAttribute("data-allow-ouside-click");!r&&!a&&i&&l&&e.sweetAlert.close()};var B=A.querySelector("button.confirm"),I=A.querySelector("button.cancel"),M=A.querySelectorAll("button[tabindex]");y=e.onkeydown,e.onkeydown=l,B.onblur=f,I.onblur=f,e.onfocus=function(){e.setTimeout(function(){v!==n&&(v.focus(),v=n)},0)}}function r(e){var t=S(),n=t.querySelector("h2"),o=t.querySelector("p"),r=t.querySelector("button.cancel"),a=t.querySelector("button.confirm");if(n.innerHTML=e.html?e.title:T(e.title).split("\n").join("<br>"),o.innerHTML=e.html?e.text:T(e.text||"").split("\n").join("<br>"),e.text&&q(o),e.customClass)C(t,e.customClass),t.setAttribute("data-custom-class",e.customClass);else{var i=t.getAttribute("data-custom-class");A(t,i),t.setAttribute("data-custom-class","")}if(I(t.querySelectorAll(".icon")),e.type&&!f()){for(var l=!1,c=0;c<w.length;c++)if(e.type===w[c]){l=!0;break}if(!l)return m("Unknown alert type: "+e.type),!1;var u=t.querySelector(".icon."+e.type);switch(q(u),e.type){case"success":C(u,"animate"),C(u.querySelector(".tip"),"animateSuccessTip"),C(u.querySelector(".long"),"animateSuccessLong");break;case"error":C(u,"animateErrorIcon"),C(u.querySelector(".x-mark"),"animateXMark");break;case"warning":C(u,"pulseWarning"),C(u.querySelector(".body"),"pulseWarningIns"),C(u.querySelector(".dot"),"pulseWarningIns")}}if(e.imageUrl){var p=t.querySelector(".icon.custom");p.style.backgroundImage="url("+e.imageUrl+")",q(p);var d=80,y=80;if(e.imageSize){var v=e.imageSize.toString().split("x"),g=v[0],b=v[1];g&&b?(d=g,y=b):m("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+e.imageSize)}p.setAttribute("style",p.getAttribute("style")+"width:"+d+"px; height:"+y+"px")}t.setAttribute("data-has-cancel-button",e.showCancelButton),e.showCancelButton?r.style.display="inline-block":I(r),e.cancelButtonText&&(r.innerHTML=T(e.cancelButtonText)),e.confirmButtonText&&(a.innerHTML=T(e.confirmButtonText)),a.style.backgroundColor=e.confirmButtonColor,s(a,e.confirmButtonColor),t.setAttribute("data-allow-ouside-click",e.allowOutsideClick);var h=e.doneFunction?!0:!1;t.setAttribute("data-has-done-function",h),e.animation?t.setAttribute("data-animation","pop"):t.setAttribute("data-animation","none"),t.setAttribute("data-timer",e.timer)}function a(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;var n,o,r="#";for(o=0;3>o;o++)n=parseInt(e.substr(2*o,2),16),n=Math.round(Math.min(Math.max(0,n+n*t),255)).toString(16),r+=("00"+n).substr(n.length);return r}function i(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function l(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16):null}function s(e,t){var n=l(t);e.style.boxShadow="0 0 2px rgba("+n+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"}function c(){var n=S();D(x(),10),q(n),C(n,"showSweetAlert"),A(n,"hideSweetAlert"),p=t.activeElement;var o=n.querySelector("button.confirm");o.focus(),setTimeout(function(){C(n,"visible")},500);var r=n.getAttribute("data-timer");"null"!==r&&""!==r&&(n.timeout=setTimeout(function(){e.sweetAlert.close()},r))}function u(){var e=S();e.style.marginTop=M(S())}function f(){return e.attachEvent&&!e.addEventListener?!0:!1}function m(t){e.console&&e.console.log("SweetAlert: "+t)}var p,d,y,v,g=".sweet-alert",b=".sweet-overlay",w=["error","warning","info","success"],h={title:"",text:"",type:null,allowOutsideClick:!1,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,
2326confirmButtonText:"OK",confirmButtonColor:"#AEDEF4",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0},S=function(){var e=t.querySelector(g);return e||(sweetAlertInitialize(),e=S()),e},x=function(){return t.querySelector(b)},k=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},C=function(e,t){k(e,t)||(e.className+=" "+t)},A=function(e,t){var n=" "+e.className.replace(/[\t\r\n]/g," ")+" ";if(k(e,t)){for(;n.indexOf(" "+t+" ")>=0;)n=n.replace(" "+t+" "," ");e.className=n.replace(/^\s+|\s+$/g,"")}},T=function(e){var n=t.createElement("div");return n.appendChild(t.createTextNode(e)),n.innerHTML},E=function(e){e.style.opacity="",e.style.display="block"},q=function(e){if(e&&!e.length)return E(e);for(var t=0;t<e.length;++t)E(e[t])},B=function(e){e.style.opacity="",e.style.display="none"},I=function(e){if(e&&!e.length)return B(e);for(var t=0;t<e.length;++t)B(e[t])},O=function(e,t){for(var n=t.parentNode;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},M=function(e){e.style.left="-9999px",e.style.display="block";var t,n=e.clientHeight;return t="undefined"!=typeof getComputedStyle?parseInt(getComputedStyle(e).getPropertyValue("padding"),10):parseInt(e.currentStyle.padding),e.style.left="",e.style.display="none","-"+parseInt(n/2+t)+"px"},D=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function(){e.style.opacity=+e.style.opacity+(new Date-n)/100,n=+new Date,+e.style.opacity<1&&setTimeout(o,t)};o()}e.style.display="block"},H=function(e,t){t=t||16,e.style.opacity=1;var n=+new Date,o=function(){e.style.opacity=+e.style.opacity-(new Date-n)/100,n=+new Date,+e.style.opacity>0?setTimeout(o,t):e.style.display="none"};o()},L=function(n){if("function"==typeof MouseEvent){var o=new MouseEvent("click",{view:e,bubbles:!1,cancelable:!0});n.dispatchEvent(o)}else if(t.createEvent){var r=t.createEvent("MouseEvents");r.initEvent("click",!1,!1),n.dispatchEvent(r)}else t.createEventObject?n.fireEvent("onclick"):"function"==typeof n.onclick&&n.onclick()},z=function(t){"function"==typeof t.stopPropagation?(t.stopPropagation(),t.preventDefault()):e.event&&e.event.hasOwnProperty("cancelBubble")&&(e.event.cancelBubble=!0)};e.sweetAlertInitialize=function(){var e='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert" tabIndex="-1"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p>Text</p><button class="cancel" tabIndex="2">Cancel</button><button class="confirm" tabIndex="1">OK</button></div>',n=t.createElement("div");for(n.innerHTML=e;n.firstChild;)t.body.appendChild(n.firstChild)},e.sweetAlert=e.swal=function(){var e=arguments;if(null!==S())o.apply(this,e);else var t=setInterval(function(){null!==S()&&(clearInterval(t),o.apply(this,e))},100)},e.sweetAlert.setDefaults=e.swal.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");i(h,e)},e.sweetAlert.close=e.swal.close=function(){var o=S();H(x(),5),H(o,5),A(o,"showSweetAlert"),C(o,"hideSweetAlert"),A(o,"visible");var r=o.querySelector(".icon.success");A(r,"animate"),A(r.querySelector(".tip"),"animateSuccessTip"),A(r.querySelector(".long"),"animateSuccessLong");var a=o.querySelector(".icon.error");A(a,"animateErrorIcon"),A(a.querySelector(".x-mark"),"animateXMark");var i=o.querySelector(".icon.warning");A(i,"pulseWarning"),A(i.querySelector(".body"),"pulseWarningIns"),A(i.querySelector(".dot"),"pulseWarningIns"),e.onkeydown=y,t.onclick=d,p&&p.focus(),v=n,clearTimeout(o.timeout)}}(window,document);; 2327/*-------------------------------------------------------------------------- 2328 * linq.js - LINQ for JavaScript 2329 * ver 3.0.2-RC (Sep. 16th, 2012) 2330 * 2331 * created and maintained by neuecc <[email protected]> 2332 * licensed under MIT License 2333 * http://linqjs.codeplex.com/ 2334 *------------------------------------------------------------------------*/ 2335(function(w,j){var l="enumerator is disposed",q="single:sequence contains more than one element.",a=false,b=null,e=true,g={Identity:function(a){return a},True:function(){return e},Blank:function(){}},i={Boolean:typeof e,Number:typeof 0,String:typeof"",Object:typeof{},Undefined:typeof j,Function:typeof function(){}}
2335,d={createLambda:function(a){if(a==b)return g.Identity;if(typeof a==i.String)if(a=="")return g.Identity;else if(a.indexOf("=>")==-1){var m=new RegExp("[$]+","g"),c=0,j;while(j=m.exec(a)){var e=j[0].length;if(e>c)c=e}for(var f=[],d=1;d<=c;d++){for(var h="",l=0;l<d;l++)h+="$";f.push(h)}var n=Array.prototype.join.call(f,",");return new Function(n,"return "+a)}else{var k=a.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);return new Function(k[1],"return "+k[2])}return a},isIEnumerable:function(b){if(typeof Enumerator!==i.Undefined)try{new Enumerator(b);return e}catch(c){}return a},defineProperty:Object.defineProperties!=b?function(c,b,d){Object.defineProperty(c,b,{enumerable:a,configurable:e,writable:e,value:d})}:function(b,a,c){b[a]=c},compare:function(a,b){return a===b?0:a>b?1:-1},dispose:function(a){a!=b&&a.dispose()}},o={Before:0,Running:1,After:2},f=function(d,f,g){var c=new u,b=o.Before;this.current=c.current;this.moveNext=function(){try{switch(b){case o.Before:b=o.Running;d();case o.Running:if(f.apply(c))return e;else{this.dispose();return a}case o.After:return a}}catch(g){this.dispose();throw g;}};this.dispose=function(){if(b!=o.Running)return;try{g()}finally{b=o.After}}},u=function(){var c=b;this.current=function(){return c};this.yieldReturn=function(a){c=a;return e};this.yieldBreak=function(){return a}},c=function(a){this.getEnumerator=a};c.Utils={};c.Utils.createLambda=function(a){return d.createLambda(a)};c.Utils.createEnumerable=function(a){return new c(a)};c.Utils.createEnumerator=function(a,b,c){return new f(a,b,c)};c.Utils.extendTo=function(i){var e=i.prototype,f;if(i===Array){f=h.prototype;d.defineProperty(e,"getSource",function(){return this})}else{f=c.prototype;d.defineProperty(e,"getEnumerator",function(){return c.from(this).getEnumerator()})}for(var a in f){var g=f[a];if(e[a]==g)continue;if(e[a]!=b){a=a+"ByLinq";if(e[a]==g)continue}g instanceof Function&&d.defineProperty(e,a,g)}};c.choice=function(){var a=arguments;return new c(function(){return new f(function(){a=a[0]instanceof Array?a[0]:a[0].getEnumerator!=b?a[0].toArray():a},function(){return this.yieldReturn(a[Math.floor(Math.random()*a.length)])},g.Blank)})};c.cycle=function(){var a=arguments;return new c(function(){var c=0;return new f(function(){a=a[0]instanceof Array?a[0]:a[0].getEnumerator!=b?a[0].toArray():a},function(){if(c>=a.length)c=0;return this.yieldReturn(a[c++])},g.Blank)})};c.empty=function(){return new c(function(){return new f(g.Blank,function(){return a},g.Blank)})};c.from=function(j){if(j==b)return c.empty();if(j instanceof c)return j;if(typeof j==i.Number||typeof j==i.Boolean)return c.repeat(j,1);if(typeof j==i.String)return new c(function(){var b=0;return new f(g.Blank,function(){return b<j.length?this.yieldReturn(j.charAt(b++)):a},g.Blank)});if(typeof j!=i.Function){if(typeof j.length==i.Number)return new h(j);if(!(j instanceof Object)&&d.isIEnumerable(j))return new c(function(){var c=e,b;return new f(function(){b=new Enumerator(j)},function(){if(c)c=a;else b.moveNext();return b.atEnd()?a:this.yieldReturn(b.item())},g.Blank)});if(typeof Windows===i.Object&&typeof j.first===i.Function)return new c(function(){var c=e,b;return new f(function(){b=j.first()},function(){if(c)c=a;else b.moveNext();return b.hasCurrent?this.yieldReturn(b.current):this.yieldBreak()},g.Blank)})}return new c(function(){var b=[],c=0;return new f(function(){for(var a in j){var c=j[a];!(c instanceof Function)&&Object.prototype.hasOwnProperty.call(j,a)&&b.push({key:a,value:c})}},function(){return c<b.length?this.yieldReturn(b[c++]):a},g.Blank)})},c.make=function(a){return c.repeat(a,1)};c.matches=function(h,e,d){if(d==b)d="";if(e instanceof RegExp){d+=e.ignoreCase?"i":"";d+=e.multiline?"m":"";e=e.source}if(d.indexOf("g")===-1)d+="g";return new c(function(){var b;return new f(function(){b=new RegExp(e,d)},function(){var c=b.exec(h);return c?this.yieldReturn(c):a},g.Blank)})};c.range=function(e,d,a){if(a==b)a=1;return new c(function(){var b,c=0;return new f(function(){b=e-a},function(){return c++<d?this.yieldReturn(b+=a):this.yieldBreak()},g.Blank)})};c.rangeDown=function(e,d,a){if(a==b)a=1;return new c(function(){var b,c=0;return new f(function(){b=e+a},function(){return c++<d?this.yieldReturn(b-=a):this.yieldBreak()},g.Blank)})};c.rangeTo=function(d,e,a){if(a==b)a=1;return d<e?new c(function(){var b;return new f(function(){b=d-a},function(){var c=b+=a;return c<=e?this.yieldReturn(c):this.yieldBreak()},g.Blank)}):new c(function(){var b;return new f(function(){b=d+a},function(){var c=b-=a;return c>=e?this.yieldReturn(c):this.yieldBreak()},g.Blank)})};c.repeat=function(a,d){return d!=b?c.repeat(a).take(d):new c(function(){return new f(g.Blank,function(){return this.yieldReturn(a)},g.Blank)})};c.repeatWithFinalize=function(a,e){a=d.createLambda(a);e=d.createLambda(e);return new c(function(){var c;return new f(function(){c=a()},function(){return this.yieldReturn(c)},function(){if(c!=b){e(c);c=b}})})};c.generate=function(a,e){if(e!=b)return c.generate(a).take(e);a=d.createLambda(a);return new c(function(){return new f(g.Blank,function(){return this.yieldReturn(a())},g.Blank)})};c.toInfinity=function(d,a){if(d==b)d=0;if(a==b)a=1;return new c(function(){var b;return new f(function(){b=d-a},function(){return this.yieldReturn(b+=a)},g.Blank)})};c.toNegativeInfinity=function(d,a){if(d==b)d=0;if(a==b)a=1;return new c(function(){var b;return new f(function(){b=d+a},function(){return this.yieldReturn(b-=a)},g.Blank)})};c.unfold=function(h,b){b=d.createLambda(b);return new c(function(){var d=e,c;return new f(g.Blank,function(){if(d){d=a;c=h;return this.yieldReturn(c)}c=b(c);return this.yieldReturn(c)},g.Blank)})};c.defer=function(a){return new c(function(){var b;return new f(function(){b=c.from(a()).getEnumerator()},function(){return b.moveNext()?this.yieldReturn(b.current()):this.yieldBreak()},function(){d.dispose(b)}
2335)})};c.prototype.traverseBreadthFirst=function(g,b){var h=this;g=d.createLambda(g);b=d.createLambda(b);return new c(function(){var i,k=0,j=[];return new f(function(){i=h.getEnumerator()},function(){while(e){if(i.moveNext()){j.push(i.current());return this.yieldReturn(b(i.current(),k))}var f=c.from(j).selectMany(function(a){return g(a)});if(!f.any())return a;else{k++;j=[];d.dispose(i);i=f.getEnumerator()}}},function(){d.dispose(i)})})};c.prototype.traverseDepthFirst=function(g,b){var h=this;g=d.createLambda(g);b=d.createLambda(b);return new c(function(){var j=[],i;return new f(function(){i=h.getEnumerator()},function(){while(e){if(i.moveNext()){var f=b(i.current(),j.length);j.push(i);i=c.from(g(i.current())).getEnumerator();return this.yieldReturn(f)}if(j.length<=0)return a;d.dispose(i);i=j.pop()}},function(){try{d.dispose(i)}finally{c.from(j).forEach(function(a){a.dispose()})}})})};c.prototype.flatten=function(){var h=this;return new c(function(){var j,i=b;return new f(function(){j=h.getEnumerator()},function(){while(e){if(i!=b)if(i.moveNext())return this.yieldReturn(i.current());else i=b;if(j.moveNext())if(j.current()instanceof Array){d.dispose(i);i=c.from(j.current()).selectMany(g.Identity).flatten().getEnumerator();continue}else return this.yieldReturn(j.current());return a}},function(){try{d.dispose(j)}finally{d.dispose(i)}})})};c.prototype.pairwise=function(b){var e=this;b=d.createLambda(b);return new c(function(){var c;return new f(function(){c=e.getEnumerator();c.moveNext()},function(){var d=c.current();return c.moveNext()?this.yieldReturn(b(d,c.current())):a},function(){d.dispose(c)})})};c.prototype.scan=function(i,g){var h;if(g==b){g=d.createLambda(i);h=a}else{g=d.createLambda(g);h=e}var j=this;return new c(function(){var b,c,k=e;return new f(function(){b=j.getEnumerator()},function(){if(k){k=a;if(!h){if(b.moveNext())return this.yieldReturn(c=b.current())}else return this.yieldReturn(c=i)}return b.moveNext()?this.yieldReturn(c=g(c,b.current())):a},function(){d.dispose(b)})})};c.prototype.select=function(e){e=d.createLambda(e);if(e.length<=1)return new m(this,b,e);else{var g=this;return new c(function(){var b,c=0;return new f(function(){b=g.getEnumerator()},function(){return b.moveNext()?this.yieldReturn(e(b.current(),c++)):a},function(){d.dispose(b)})})}};c.prototype.selectMany=function(g,e){var h=this;g=d.createLambda(g);if(e==b)e=function(b,a){return a};e=d.createLambda(e);return new c(function(){var k,i=j,l=0;return new f(function(){k=h.getEnumerator()},function(){if(i===j)if(!k.moveNext())return a;do{if(i==b){var f=g(k.current(),l++);i=c.from(f).getEnumerator()}if(i.moveNext())return this.yieldReturn(e(k.current(),i.current()));d.dispose(i);i=b}while(k.moveNext());return a},function(){try{d.dispose(k)}finally{d.dispose(i)}})})};c.prototype.where=function(b){b=d.createLambda(b);if(b.length<=1)return new n(this,b);else{var e=this;return new c(function(){var c,g=0;return new f(function(){c=e.getEnumerator()},function(){while(c.moveNext())if(b(c.current(),g++))return this.yieldReturn(c.current());return a},function(){d.dispose(c)})})}};c.prototype.choose=function(a){a=d.createLambda(a);var e=this;return new c(function(){var c,g=0;return new f(function(){c=e.getEnumerator()},function(){while(c.moveNext()){var d=a(c.current(),g++);if(d!=b)return this.yieldReturn(d)}return this.yieldBreak()},function(){d.dispose(c)})})};c.prototype.ofType=function(c){var a;switch(c){case Number:a=i.Number;break;case String:a=i.String;break;case Boolean:a=i.Boolean;break;case Function:a=i.Function;break;default:a=b}return a===b?this.where(function(a){return a instanceof c}):this.where(function(b){return typeof b===a})};c.prototype.zip=function(){var i=arguments,e=d.createLambda(arguments[arguments.length-1]),g=this;if(arguments.length==2){var h=arguments[0];return new c(function(){var i,b,j=0;return new f(function(){i=g.getEnumerator();b=c.from(h).getEnumerator()},function(){return i.moveNext()&&b.moveNext()?this.yieldReturn(e(i.current(),b.current(),j++)):a},function(){try{d.dispose(i)}finally{d.dispose(b)}})})}else return new c(function(){var a,h=0;return new f(function(){var b=c.make(g).concat(c.from(i).takeExceptLast().select(c.from)).select(function(a){return a.getEnumerator()}).toArray();a=c.from(b)},function(){if(a.all(function(a){return a.moveNext()})){var c=a.select(function(a){return a.current()}).toArray();c.push(h++);return this.yieldReturn(e.apply(b,c))}else return this.yieldBreak()}
2335,function(){c.from(a).forEach(d.dispose)})})};c.prototype.merge=function(){var b=arguments,a=this;return new c(function(){var e,g=-1;return new f(function(){e=c.make(a).concat(c.from(b).select(c.from)).select(function(a){return a.getEnumerator()}).toArray()},function(){while(e.length>0){g=g>=e.length-1?0:g+1;var a=e[g];if(a.moveNext())return this.yieldReturn(a.current());else{a.dispose();e.splice(g--,1)}}return this.yieldBreak()},function(){c.from(e).forEach(d.dispose)})})};c.prototype.join=function(n,i,h,l,k){i=d.createLambda(i);h=d.createLambda(h);l=d.createLambda(l);k=d.createLambda(k);var m=this;return new c(function(){var o,r,p=b,q=0;return new f(function(){o=m.getEnumerator();r=c.from(n).toLookup(h,g.Identity,k)},function(){while(e){if(p!=b){var c=p[q++];if(c!==j)return this.yieldReturn(l(o.current(),c));c=b;q=0}if(o.moveNext()){var d=i(o.current());p=r.get(d).toArray()}else return a}},function(){d.dispose(o)})})};c.prototype.groupJoin=function(l,h,e,j,i){h=d.createLambda(h);e=d.createLambda(e);j=d.createLambda(j);i=d.createLambda(i);var k=this;return new c(function(){var m=k.getEnumerator(),n=b;return new f(function(){m=k.getEnumerator();n=c.from(l).toLookup(e,g.Identity,i)},function(){if(m.moveNext()){var b=n.get(h(m.current()));return this.yieldReturn(j(m.current(),b))}return a},function(){d.dispose(m)})})};c.prototype.all=function(b){b=d.createLambda(b);var c=e;this.forEach(function(d){if(!b(d)){c=a;return a}});return c};c.prototype.any=function(c){c=d.createLambda(c);var b=this.getEnumerator();try{if(arguments.length==0)return b.moveNext();while(b.moveNext())if(c(b.current()))return e;return a}finally{d.dispose(b)}};c.prototype.isEmpty=function(){return!this.any()};c.prototype.concat=function(){var e=this;if(arguments.length==1){var g=arguments[0];return new c(function(){var i,h;return new f(function(){i=e.getEnumerator()},function(){if(h==b){if(i.moveNext())return this.yieldReturn(i.current());h=c.from(g).getEnumerator()}return h.moveNext()?this.yieldReturn(h.current()):a},function(){try{d.dispose(i)}finally{d.dispose(h)}})})}else{var h=arguments;return new c(function(){var a;return new f(function(){a=c.make(e).concat(c.from(h).select(c.from)).select(function(a){return a.getEnumerator()}).toArray()},function(){while(a.length>0){var b=a[0];if(b.moveNext())return this.yieldReturn(b.current());else{b.dispose();a.splice(0,1)}}return this.yieldBreak()},function(){c.from(a).forEach(d.dispose)})})}};c.prototype.insert=function(h,b){var g=this;return new c(function(){var j,i,l=0,k=a;return new f(function(){j=g.getEnumerator();i=c.from(b).getEnumerator()},function(){if(l==h&&i.moveNext()){k=e;return this.yieldReturn(i.current())}if(j.moveNext()){l++;return this.yieldReturn(j.current())}return!k&&i.moveNext()?this.yieldReturn(i.current()):a},function(){try{d.dispose(j)}finally{d.dispose(i)}})})};c.prototype.alternate=function(a){var g=this;return new c(function(){var j,i,k,h;return new f(function(){if(a instanceof Array||a.getEnumerator!=b)k=c.from(c.from(a).toArray());else k=c.make(a);i=g.getEnumerator();if(i.moveNext())j=i.current()},function(){while(e){if(h!=b)if(h.moveNext())return this.yieldReturn(h.current());else h=b;if(j==b&&i.moveNext()){j=i.current();h=k.getEnumerator();continue}else if(j!=b){var a=j;j=b;return this.yieldReturn(a)}return this.yieldBreak()}},function(){try{d.dispose(i)}finally{d.dispose(h)}})})};c.prototype.contains=function(f,b){b=d.createLambda(b);var c=this.getEnumerator();try{while(c.moveNext())if(b(c.current())===f)return e;return a}finally{d.dispose(c)}};c.prototype.defaultIfEmpty=function(g){var h=this;if(g===j)g=b;return new c(function(){var b,c=e;return new f(function(){b=h.getEnumerator()},function(){if(b.moveNext()){c=a;return this.yieldReturn(b.current())}else if(c){c=a;return this.yieldReturn(g)}return a},function(){d.dispose(b)})})};c.prototype.distinct=function(a){return this.except(c.empty(),a)};c.prototype.distinctUntilChanged=function(b){b=d.createLambda(b);var e=this;return new c(function(){var c,g,h;return new f(function(){c=e.getEnumerator()},function(){while(c.moveNext()){var d=b(c.current());if(h){h=a;g=d;return this.yieldReturn(c.current())}if(g===d)continue;g=d;return this.yieldReturn(c.current())}return this.yieldBreak()},function(){d.dispose(c)})})};c.prototype.except=function(e,b){b=d.createLambda(b);var g=this;return new c(function(){var h,i;return new f(function(){h=g.getEnumerator();i=new r(b);c.from(e).forEach(function(a){i.add(a)})},function(){while(h.moveNext()){var b=h.current();if(!i.contains(b)){i.add(b);return this.yieldReturn(b)}}return a},function(){d.dispose(h)})})};c.prototype.intersect=function(e,b){b=d.createLambda(b);var g=this;return new c(function(){var h,i,j;return new f(function(){h=g.getEnumerator();i=new r(b);c.from(e).forEach(function(a){i.add(a)});j=new r(b)},function(){while(h.moveNext()){var b=h.current();if(!j.contains(b)&&i.contains(b)){j.add(b);return this.yieldReturn(b)}}return a},function(){d.dispose(h)})})};c.prototype.sequenceEqual=function(h,f){f=d.createLambda(f);var g=this.getEnumerator();try{var b=c.from(h).getEnumerator();try{while(g.moveNext())if(!b.moveNext()||f(g.current())!==f(b.current()))return a;return b.moveNext()?a:e}finally{d.dispose(b)}
2335}finally{d.dispose(g)}};c.prototype.union=function(e,b){b=d.createLambda(b);var g=this;return new c(function(){var k,h,i;return new f(function(){k=g.getEnumerator();i=new r(b)},function(){var b;if(h===j){while(k.moveNext()){b=k.current();if(!i.contains(b)){i.add(b);return this.yieldReturn(b)}}h=c.from(e).getEnumerator()}while(h.moveNext()){b=h.current();if(!i.contains(b)){i.add(b);return this.yieldReturn(b)}}return a},function(){try{d.dispose(k)}finally{d.dispose(h)}})})};c.prototype.orderBy=function(b){return new k(this,b,a)};c.prototype.orderByDescending=function(a){return new k(this,a,e)};c.prototype.reverse=function(){var b=this;return new c(function(){var c,d;return new f(function(){c=b.toArray();d=c.length},function(){return d>0?this.yieldReturn(c[--d]):a},g.Blank)})};c.prototype.shuffle=function(){var b=this;return new c(function(){var c;return new f(function(){c=b.toArray()},function(){if(c.length>0){var b=Math.floor(Math.random()*c.length);return this.yieldReturn(c.splice(b,1)[0])}return a},g.Blank)})};c.prototype.weightedSample=function(a){a=d.createLambda(a);var e=this;return new c(function(){var c,d=0;return new f(function(){c=e.choose(function(e){var c=a(e);if(c<=0)return b;d+=c;return{value:e,bound:d}}).toArray()},function(){if(c.length>0){var f=Math.floor(Math.random()*d)+1,e=-1,a=c.length;while(a-e>1){var b=Math.floor((e+a)/2);if(c[b].bound>=f)a=b;else e=b}return this.yieldReturn(c[a].value)}return this.yieldBreak()},g.Blank)})};c.prototype.groupBy=function(i,h,e,g){var j=this;i=d.createLambda(i);h=d.createLambda(h);if(e!=b)e=d.createLambda(e);g=d.createLambda(g);return new c(function(){var c;return new f(function(){c=j.toLookup(i,h,g).toEnumerable().getEnumerator()},function(){while(c.moveNext())return e==b?this.yieldReturn(c.current()):this.yieldReturn(e(c.current().key(),c.current()));return a},function(){d.dispose(c)})})};c.prototype.partitionBy=function(j,i,g,h){var l=this;j=d.createLambda(j);i=d.createLambda(i);h=d.createLambda(h);var k;if(g==b){k=a;g=function(b,a){return new t(b,a)}}else{k=e;g=d.createLambda(g)}return new c(function(){var b,n,o,m=[];return new f(function(){b=l.getEnumerator();if(b.moveNext()){n=j(b.current());o=h(n);m.push(i(b.current()))}},function(){var d;while((d=b.moveNext())==e)if(o===h(j(b.current())))m.push(i(b.current()));else break;if(m.length>0){var f=k?g(n,c.from(m)):g(n,m);if(d){n=j(b.current());o=h(n);m=[i(b.current())]}else m=[];return this.yieldReturn(f)}return a},function(){d.dispose(b)})})};c.prototype.buffer=function(e){var b=this;return new c(function(){var c;return new f(function(){c=b.getEnumerator()},function(){var b=[],d=0;while(c.moveNext()){b.push(c.current());if(++d>=e)return this.yieldReturn(b)}return b.length>0?this.yieldReturn(b):a},function(){d.dispose(c)})})};c.prototype.aggregate=function(c,b,a){a=d.createLambda(a);return a(this.scan(c,b,a).last())};c.prototype.average=function(a){a=d.createLambda(a);var c=0,b=0;this.forEach(function(d){c+=a(d);++b});return c/b};c.prototype.count=function(a){a=a==b?g.True:d.createLambda(a);var c=0;this.forEach(function(d,b){if(a(d,b))++c});return c};c.prototype.max=function(a){if(a==b)a=g.Identity;return this.select(a).aggregate(function(a,b){return a>b?a:b})};c.prototype.min=function(a){if(a==b)a=g.Identity;return this.select(a).aggregate(function(a,b){return a<b?a:b})};c.prototype.maxBy=function(a){a=d.createLambda(a);return this.aggregate(function(b,c){return a(b)>a(c)?b:c})};c.prototype.minBy=function(a){a=d.createLambda(a);return this.aggregate(function(b,c){return a(b)<a(c)?b:c})};c.prototype.sum=function(a){if(a==b)a=g.Identity;return this.select(a).aggregate(0,function(a,b){return a+b})};c.prototype.elementAt=function(d){var c,b=a;this.forEach(function(g,f){if(f==d){c=g;b=e;return a}});if(!b)throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");return c};c.prototype.elementAtOrDefault=function(g,c){if(c===j)c=b;var f,d=a;this.forEach(function(c,b){if(b==g){f=c;d=e;return a}});return!d?c:f};c.prototype.first=function(c){if(c!=b)return this.where(c).first();var f,d=a;this.forEach(function(b){f=b;d=e;return a});if(!d)throw new Error("first:No element satisfies the condition.");return f};c.prototype.firstOrDefault=function(d,c){if(c===j)c=b;if(d!=b)return this.where(d).firstOrDefault(b,c);var g,f=a;this.forEach(function(b){g=b;f=e;return a});return!f?c:g};
2335c.prototype.last=function(c){if(c!=b)return this.where(c).last();var f,d=a;this.forEach(function(a){d=e;f=a});if(!d)throw new Error("last:No element satisfies the condition.");return f};c.prototype.lastOrDefault=function(d,c){if(c===j)c=b;if(d!=b)return this.where(d).lastOrDefault(b,c);var g,f=a;this.forEach(function(a){f=e;g=a});return!f?c:g};c.prototype.single=function(d){if(d!=b)return this.where(d).single();var f,c=a;this.forEach(function(a){if(!c){c=e;f=a}else throw new Error(q);});if(!c)throw new Error("single:No element satisfies the condition.");return f};c.prototype.singleOrDefault=function(f,c){if(c===j)c=b;if(f!=b)return this.where(f).singleOrDefault(b,c);var g,d=a;this.forEach(function(a){if(!d){d=e;g=a}else throw new Error(q);});return!d?c:g};c.prototype.skip=function(e){var b=this;return new c(function(){var c,g=0;return new f(function(){c=b.getEnumerator();while(g++<e&&c.moveNext());},function(){return c.moveNext()?this.yieldReturn(c.current()):a},function(){d.dispose(c)})})};c.prototype.skipWhile=function(b){b=d.createLambda(b);var g=this;return new c(function(){var c,i=0,h=a;return new f(function(){c=g.getEnumerator()},function(){while(!h)if(c.moveNext()){if(!b(c.current(),i++)){h=e;return this.yieldReturn(c.current())}continue}else return a;return c.moveNext()?this.yieldReturn(c.current()):a},function(){d.dispose(c)})})};c.prototype.take=function(e){var b=this;return new c(function(){var c,g=0;return new f(function(){c=b.getEnumerator()},function(){return g++<e&&c.moveNext()?this.yieldReturn(c.current()):a},function(){d.dispose(c)})})};c.prototype.takeWhile=function(b){b=d.createLambda(b);var e=this;return new c(function(){var c,g=0;return new f(function(){c=e.getEnumerator()},function(){return c.moveNext()&&b(c.current(),g++)?this.yieldReturn(c.current()):a},function(){d.dispose(c)})})};c.prototype.takeExceptLast=function(e){if(e==b)e=1;var g=this;return new c(function(){if(e<=0)return g.getEnumerator();var b,c=[];return new f(function(){b=g.getEnumerator()},function(){while(b.moveNext()){if(c.length==e){c.push(b.current());return this.yieldReturn(c.shift())}c.push(b.current())}return a},function(){d.dispose(b)})})};c.prototype.takeFromLast=function(e){if(e<=0||e==b)return c.empty();var g=this;return new c(function(){var j,h,i=[];return new f(function(){j=g.getEnumerator()},function(){while(j.moveNext()){i.length==e&&i.shift();i.push(j.current())}if(h==b)h=c.from(i).getEnumerator();return h.moveNext()?this.yieldReturn(h.current()):a},function(){d.dispose(h)})})};c.prototype.indexOf=function(d){var c=b;if(typeof d===i.Function)this.forEach(function(e,b){if(d(e,b)){c=b;return a}});else this.forEach(function(e,b){if(e===d){c=b;return a}});return c!==b?c:-1};c.prototype.lastIndexOf=function(b){var a=-1;if(typeof b===i.Function)this.forEach(function(d,c){if(b(d,c))a=c});else this.forEach(function(d,c){if(d===b)a=c});return a};c.prototype.asEnumerable=function(){return c.from(this)};c.prototype.toArray=function(){var a=[];this.forEach(function(b){a.push(b)});return a};c.prototype.toLookup=function(c,b,a){c=d.createLambda(c);b=d.createLambda(b);a=d.createLambda(a);var e=new r(a);this.forEach(function(g){var f=c(g),a=b(g),d=e.get(f);if(d!==j)d.push(a);else e.add(f,[a])});return new v(e)};c.prototype.toObject=function(b,a){b=d.createLambda(b);a=d.createLambda(a);var c={};this.forEach(function(d){c[b(d)]=a(d)});return c};c.prototype.toDictionary=function(c,b,a){c=d.createLambda(c);b=d.createLambda(b);a=d.createLambda(a);var e=new r(a);this.forEach(function(a){e.add(c(a),b(a))});return e};c.prototype.toJSONString=function(a,c){if(typeof JSON===i.Undefined||JSON.stringify==b)throw new Error("toJSONString can't find JSON.stringify. This works native JSON support Browser or include json2.js");return JSON.stringify(this.toArray(),a,c)};c.prototype.toJoinedString=function(a,c){if(a==b)a="";if(c==b)c=g.Identity;return this.select(c).toArray().join(a)};c.prototype.doAction=function(b){var e=this;b=d.createLambda(b);return new c(function(){var c,g=0;return new f(function(){c=e.getEnumerator()},function(){if(c.moveNext()){b(c.current(),g++);return this.yieldReturn(c.current())}return a},function(){d.dispose(c)})})};c.prototype.forEach=function(c){c=d.createLambda(c);var e=0,b=this.getEnumerator();try{while(b.moveNext())if(c(b.current(),e++)===a)break}finally{d.dispose(b)}
2335};c.prototype.write=function(c,f){if(c==b)c="";f=d.createLambda(f);var g=e;this.forEach(function(b){if(g)g=a;else document.write(c);document.write(f(b))})};c.prototype.writeLine=function(a){a=d.createLambda(a);this.forEach(function(b){document.writeln(a(b)+"<br />")})};c.prototype.force=function(){var a=this.getEnumerator();try{while(a.moveNext());}finally{d.dispose(a)}};c.prototype.letBind=function(b){b=d.createLambda(b);var e=this;return new c(function(){var g;return new f(function(){g=c.from(b(e)).getEnumerator()},function(){return g.moveNext()?this.yieldReturn(g.current()):a},function(){d.dispose(g)})})};c.prototype.share=function(){var i=this,c,h=a;return new s(function(){return new f(function(){if(c==b)c=i.getEnumerator()},function(){if(h)throw new Error(l);return c.moveNext()?this.yieldReturn(c.current()):a},g.Blank)},function(){h=e;d.dispose(c)})};c.prototype.memoize=function(){var j=this,h,c,i=a;return new s(function(){var d=-1;return new f(function(){if(c==b){c=j.getEnumerator();h=[]}},function(){if(i)throw new Error(l);d++;return h.length<=d?c.moveNext()?this.yieldReturn(h[d]=c.current()):a:this.yieldReturn(h[d])},g.Blank)},function(){i=e;d.dispose(c);h=b})};c.prototype.catchError=function(b){b=d.createLambda(b);var e=this;return new c(function(){var c;return new f(function(){c=e.getEnumerator()},function(){try{return c.moveNext()?this.yieldReturn(c.current()):a}catch(d){b(d);return a}},function(){d.dispose(c)})})};c.prototype.finallyAction=function(b){b=d.createLambda(b);var e=this;return new c(function(){var c;return new f(function(){c=e.getEnumerator()},function(){return c.moveNext()?this.yieldReturn(c.current()):a},function(){try{d.dispose(c)}finally{b()}})})};c.prototype.log=function(a){a=d.createLambda(a);return this.doAction(function(b){typeof console!==i.Undefined&&console.log(a(b))})};c.prototype.trace=function(c,a){if(c==b)c="Trace";a=d.createLambda(a);return this.doAction(function(b){typeof console!==i.Undefined&&console.log(c,a(b))})};var k=function(f,b,c,e){var a=this;a.source=f;a.keySelector=d.createLambda(b);a.descending=c;a.parent=e};k.prototype=new c;k.prototype.createOrderedEnumerable=function(a,b){return new k(this.source,a,b,this)};k.prototype.thenBy=function(b){return this.createOrderedEnumerable(b,a)};k.prototype.thenByDescending=function(a){return this.createOrderedEnumerable(a,e)};k.prototype.getEnumerator=function(){var h=this,d,c,e=0;return new f(function(){d=[];c=[];h.source.forEach(function(b,a){d.push(b);c.push(a)});var a=p.create(h,b);a.GenerateKeys(d);c.sort(function(b,c){return a.compare(b,c)})},function(){return e<c.length?this.yieldReturn(d[c[e++]]):a},g.Blank)};var p=function(c,d,e){var a=this;a.keySelector=c;a.descending=d;a.child=e;a.keys=b};p.create=function(a,d){var c=new p(a.keySelector,a.descending,d);return a.parent!=b?p.create(a.parent,c):c};p.prototype.GenerateKeys=function(d){var a=this;for(var f=d.length,g=a.keySelector,e=new Array(f),c=0;c<f;c++)e[c]=g(d[c]);a.keys=e;a.child!=b&&a.child.GenerateKeys(d)};p.prototype.compare=function(e,f){var a=this,c=d.compare(a.keys[e],a.keys[f]);return c==0?a.child!=b?a.child.compare(e,f):d.compare(e,f):a.descending?-c:c};var s=function(a,b){this.dispose=b;c.call(this,a)};s.prototype=new c;var h=function(a){this.getSource=function(){return a}};h.prototype=new c;
2335h.prototype.any=function(a){return a==b?this.getSource().length>0:c.prototype.any.apply(this,arguments)};h.prototype.count=function(a){return a==b?this.getSource().length:c.prototype.count.apply(this,arguments)};h.prototype.elementAt=function(a){var b=this.getSource();return 0<=a&&a<b.length?b[a]:c.prototype.elementAt.apply(this,arguments)};h.prototype.elementAtOrDefault=function(c,a){if(a===j)a=b;var d=this.getSource();return 0<=c&&c<d.length?d[c]:a};h.prototype.first=function(d){var a=this.getSource();return d==b&&a.length>0?a[0]:c.prototype.first.apply(this,arguments)};h.prototype.firstOrDefault=function(e,a){if(a===j)a=b;if(e!=b)return c.prototype.firstOrDefault.apply(this,arguments);var d=this.getSource();return d.length>0?d[0]:a};h.prototype.last=function(d){var a=this.getSource();return d==b&&a.length>0?a[a.length-1]:c.prototype.last.apply(this,arguments)};h.prototype.lastOrDefault=function(e,a){if(a===j)a=b;if(e!=b)return c.prototype.lastOrDefault.apply(this,arguments);var d=this.getSource();return d.length>0?d[d.length-1]:a};h.prototype.skip=function(d){var b=this.getSource();return new c(function(){var c;return new f(function(){c=d<0?0:d},function(){return c<b.length?this.yieldReturn(b[c++]):a},g.Blank)})};h.prototype.takeExceptLast=function(a){if(a==b)a=1;return this.take(this.getSource().length-a)};h.prototype.takeFromLast=function(a){return this.skip(this.getSource().length-a)};h.prototype.reverse=function(){var b=this.getSource();return new c(function(){var c;return new f(function(){c=b.length},function(){return c>0?this.yieldReturn(b[--c]):a},g.Blank)})};h.prototype.sequenceEqual=function(d,e){return(d instanceof h||d instanceof Array)&&e==b&&c.from(d).count()!=this.count()?a:c.prototype.sequenceEqual.apply(this,arguments)};h.prototype.toJoinedString=function(a,e){var d=this.getSource();if(e!=b||!(d instanceof Array))return c.prototype.toJoinedString.apply(this,arguments);if(a==b)a="";return d.join(a)};h.prototype.getEnumerator=function(){var a=this.getSource(),b=-1;return{current:function(){return a[b]},moveNext:function(){return++b<a.length},dispose:g.Blank}};var n=function(b,a){this.prevSource=b;this.prevPredicate=a};n.prototype=new c;n.prototype.where=function(a){a=d.createLambda(a);if(a.length<=1){var e=this.prevPredicate,b=function(b){return e(b)&&a(b)};return new n(this.prevSource,b)}else return c.prototype.where.call(this,a)};n.prototype.select=function(a){a=d.createLambda(a);return a.length<=1?new m(this.prevSource,this.prevPredicate,a):c.prototype.select.call(this,a)};n.prototype.getEnumerator=function(){var c=this.prevPredicate,e=this.prevSource,b;return new f(function(){b=e.getEnumerator()},function(){while(b.moveNext())if(c(b.current()))return this.yieldReturn(b.current());return a},function(){d.dispose(b)})};var m=function(c,a,b){this.prevSource=c;this.prevPredicate=a;this.prevSelector=b};m.prototype=new c;m.prototype.where=function(a){a=d.createLambda(a);return a.length<=1?new n(this,a):c.prototype.where.call(this,a)};m.prototype.select=function(a){var b=this;a=d.createLambda(a);if(a.length<=1){var f=b.prevSelector,e=function(b){return a(f(b))};return new m(b.prevSource,b.prevPredicate,e)}else return c.prototype.select.call(b,a)};m.prototype.getEnumerator=function(){var e=this.prevPredicate,g=this.prevSelector,h=this.prevSource,c;return new f(function(){c=h.getEnumerator()},function(){while(c.moveNext())if(e==b||e(c.current()))return this.yieldReturn(g(c.current()));return a},function(){d.dispose(c)})};var r=function(){var d=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},h=function(a){return a===b?"null":a===j?"undefined":typeof a.toString===i.Function?a.toString():Object.prototype.toString.call(a)},m=function(d,c){var a=this;a.key=d;a.value=c;a.prev=b;a.next=b},k=function(){this.first=b;this.last=b};k.prototype={addLast:function(c){var a=this;if(a.last!=b){a.last.next=c;c.prev=a.last;a.last=c}else a.first=a.last=c},replace:function(c,a){if(c.prev!=b){c.prev.next=a;a.prev=c.prev}else this.first=a;if(c.next!=b){c.next.prev=a;a.next=c.next}else this.last=a}
2335,remove:function(a){if(a.prev!=b)a.prev.next=a.next;else this.first=a.next;if(a.next!=b)a.next.prev=a.prev;else this.last=a.prev}};var l=function(c){var a=this;a.countField=0;a.entryList=new k;a.buckets={};a.compareSelector=c==b?g.Identity:c};l.prototype={add:function(i,j){var a=this,g=a.compareSelector(i),f=h(g),c=new m(i,j);if(d(a.buckets,f)){for(var b=a.buckets[f],e=0;e<b.length;e++)if(a.compareSelector(b[e].key)===g){a.entryList.replace(b[e],c);b[e]=c;return}b.push(c)}else a.buckets[f]=[c];a.countField++;a.entryList.addLast(c)},"get":function(i){var a=this,c=a.compareSelector(i),g=h(c);if(!d(a.buckets,g))return j;for(var e=a.buckets[g],b=0;b<e.length;b++){var f=e[b];if(a.compareSelector(f.key)===c)return f.value}return j},"set":function(k,l){var b=this,g=b.compareSelector(k),j=h(g);if(d(b.buckets,j))for(var f=b.buckets[j],c=0;c<f.length;c++)if(b.compareSelector(f[c].key)===g){var i=new m(k,l);b.entryList.replace(f[c],i);f[c]=i;return e}return a},contains:function(j){var b=this,f=b.compareSelector(j),i=h(f);if(!d(b.buckets,i))return a;for(var g=b.buckets[i],c=0;c<g.length;c++)if(b.compareSelector(g[c].key)===f)return e;return a},clear:function(){this.countField=0;this.buckets={};this.entryList=new k},remove:function(g){var a=this,f=a.compareSelector(g),e=h(f);if(!d(a.buckets,e))return;for(var b=a.buckets[e],c=0;c<b.length;c++)if(a.compareSelector(b[c].key)===f){a.entryList.remove(b[c]);b.splice(c,1);if(b.length==0)delete a.buckets[e];a.countField--;return}},count:function(){return this.countField},toEnumerable:function(){var d=this;return new c(function(){var c;return new f(function(){c=d.entryList.first},function(){if(c!=b){var d={key:c.key,value:c.value};c=c.next;return this.yieldReturn(d)}return a},g.Blank)})}};return l}(),v=function(a){var b=this;b.count=function(){return a.count()};b.get=function(b){return c.from(a.get(b))};b.contains=function(b){return a.contains(b)};b.toEnumerable=function(){return a.toEnumerable().select(function(a){return new t(a.key,a.value)})}},t=function(b,a){this.key=function(){return b};h.call(this,a)};t.prototype=new h;if(typeof define===i.Function&&define.amd)define("linqjs",[],function(){return c});else if(typeof module!==i.Undefined&&module.exports)module.exports=c;else w.Enumerable=c})(this); 2336(function ($) { 2337 $.fn.invisible = function () { 2338 return this.each(function () { 2339 $(this).css("visibility", "hidden"); 2340 }); 2341 }; 2342 $.fn.visible = function () { 2343 return this.each(function () { 2344 $(this).css("visibility", "visible"); 2345 }); 2346 }; 2347 $.fn.visibilityToggle = function() { 2348 return this.css('visibility', function(i, visibility) { 2349 return (visibility == 'visible') ? 'hidden' : 'visible'; 2350 }); 2351 }; 2352}(jQuery));; 2353/* Modernizr (Custom Build) | MIT & BSD 2354 * Build: http://modernizr.com/download/#-csstransforms3d-csstransitions-touch-shiv-load-cssclasses-prefixed-teststyles-testprops-testallprops-prefixes-domprefixes-history-video-svg-boxshadow-mq-respond 2355 */ 2356;window.Modernizr=function(e,t,n){function k(e){f.cssText=e}function L(e,t){return k(h.join(e+";")+(t||""))}function A(e,t){return typeof e===t}function O(e,t){return!!~(""+e).indexOf(t)}function M(e,t){for(var r in e){var i=e[r];if(!O(i,"-")&&f[i]!==n)return t=="pfx"?i:!0}return!1}function _(e,t,r){for(var i in e){var s=t[e[i]];if(s!==n)return r===!1?e[i]:A(s,"function")?s.bind(r||t):s}return!1}function D(e,t,n){var r=e.charAt(0).toUpperCase()+e.slice(1),i=(e+" "+d.join(r+" ")+r).split(" ");return A(t,"string")||A(t,"undefined")?M(i,t):(i=(e+" "+v.join(r+" ")+r).split(" "),_(i,t,n))}var r="2.8.3",i={},s=!0,o=t.documentElement,u="modernizr",a=t.createElement(u),f=a.style,l,c={}.toString,h=" -webkit- -moz- -o- -ms- ".split(" "),p="Webkit Moz O ms",d=p.split(" "),v=p.toLowerCase().split(" "),m={svg:"http://www.w3.org/2000/svg"},g={},y={},b={},w=[],E=w.slice,S,x=function(e,n,r,i){var s,a,f,l,c=t.createElement("div"),h=t.body,p=h||t.createElement("body");if(parseInt(r,10))while(r--)f=t.createElement("div"),f.id=i?i[r]:u+(r+1),c.appendChild(f);return s=["­",'<style id="s',u,'">',e,"</style>"].join(""),c.id=u,(h?c:p).innerHTML+=s,p.appendChild(c),h||(p.style.background="",p.style.overflow="hidden",l=o.style.overflow,o.style.overflow="hidden",o.appendChild(p)),a=n(c,e),h?c.parentNode.removeChild(c):(p.parentNode.removeChild(p),o.style.overflow=l),!!a},T=function(t){var n=e.matchMedia||e.msMatchMedia;if(n)return n(t)&&n(t).matches||!1;var r;return x("@media "+t+" { #"+u+" { position: absolute; } }",function(t){r=(e.getComputedStyle?getComputedStyle(t,null):t.currentStyle)["position"]=="absolute"}),r},N={}.hasOwnProperty,C;!A(N,"undefined")&&!A(N.call,"undefined")?C=function(e,t){return N.call(e,t)}:C=function(e,t){return t in e&&A(e.constructor.prototype[t],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError;
vendor: 9,697 bytes, lines 2356-2402
2356var r=E.call(arguments,1),i=function(){if(this instanceof i){var e=function(){};e.prototype=n.prototype;var s=new e,o=n.apply(s,r.concat(E.call(arguments)));return Object(o)===o?o:s}return n.apply(t,r.concat(E.call(arguments)))};return i}),g.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:x(["@media (",h.join("touch-enabled),("),u,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(e){n=e.offsetTop===9}),n},g.history=function(){return!!e.history&&!!history.pushState},g.boxshadow=function(){return D("boxShadow")},g.csstransforms3d=function(){var e=!!D("perspective");return e&&"webkitPerspective"in o.style&&x("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t,n){e=t.offsetLeft===9&&t.offsetHeight===3}),e},g.csstransitions=function(){return D("transition")},g.video=function(){var e=t.createElement("video"),n=!1;try{if(n=!!e.canPlayType)n=new Boolean(n),n.ogg=e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),n.h264=e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),n.webm=e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(r){}return n},g.svg=function(){return!!t.createElementNS&&!!t.createElementNS(m.svg,"svg").createSVGRect};for(var P in g)C(g,P)&&(S=P.toLowerCase(),i[S]=g[P](),w.push((i[S]?"":"no-")+S));return i.addTest=function(e,t){if(typeof e=="object")for(var r in e)C(e,r)&&i.addTest(r,e[r]);else{e=e.toLowerCase();if(i[e]!==n)return i;t=typeof t=="function"?t():t,typeof s!="undefined"&&s&&(o.className+=" "+(t?"":"no-")+e),i[e]=t}return i},k(""),a=l=null,function(e,t){function c(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}function h(){var e=y.elements;return typeof e=="string"?e.split(" "):e}function p(e){var t=f[e[u]];return t||(t={},a++,e[u]=a,f[a]=t),t}function d(e,n,r){n||(n=t);if(l)return n.createElement(e);r||(r=p(n));var o;return r.cache[e]?o=r.cache[e].cloneNode():s.test(e)?o=(r.cache[e]=r.createElem(e)).cloneNode():o=r.createElem(e),o.canHaveChildren&&!i.test(e)&&!o.tagUrn?r.frag.appendChild(o):o}function v(e,n){e||(e=t);if(l)return e.createDocumentFragment();n=n||p(e);var r=n.frag.cloneNode(),i=0,s=h(),o=s.length;for(;i<o;i++)r.createElement(s[i]);return r}function m(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return y.shivMethods?d(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/[\w\-]+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(y,t.frag)}function g(e){e||(e=t);var n=p(e);return y.shivCSS&&!o&&!n.hasCSS&&(n.hasCSS=!!c(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||m(e,n),e}var n="3.7.0",r=e.html5||{},i=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,s=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,o,u="_html5shiv",a=0,f={},l;(function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",o="hidden"in e,l=e.childNodes.length==1||function(){t.createElement("a");var e=t.createDocumentFragment();return typeof e.cloneNode=="undefined"||typeof e.createDocumentFragment=="undefined"||typeof e.createElement=="undefined"}()}catch(n){o=!0,l=!0}})();var y={elements:r.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:n,shivCSS:r.shivCSS!==!1,supportsUnknownElements:l,shivMethods:r.shivMethods!==!1,type:"default",shivDocument:g,createElement:d,createDocumentFragment:v};e.html5=y,g(t)}(this,t),i._version=r,i._prefixes=h,i._domPrefixes=v,i._cssomPrefixes=d,i.mq=T,i.testProp=function(e){return M([e])},i.testAllProps=D,i.testStyles=x,i.prefixed=function(e,t,n){return t?D(e,t,n):D(e,"pfx")},o.className=o.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(s?" js "+w.join(" "):""),i}(this,this.document),function(e,t,n){function r(e){return"[object Function]"==d.call(e)}function i(e){return"string"==typeof e}function s(){}function o(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function u(){var e=v.shift();m=1,e?e.t?h(function(){("c"==e.t?k.injectCss:k.injectJs)(e.s,0,e.a,e.x,e.e,1)},0):(e(),u()):m=0}function a(e,n,r,i,s,a,f){function l(t){if(!d&&o(c.readyState)&&(w.r=d=1,!m&&u(),c.onload=c.onreadystatechange=null,t)){"img"!=e&&h(function(){b.removeChild(c)},50);for(var r in T[n])T[n].hasOwnProperty(r)&&T[n][r].onload()}}var f=f||k.errorTimeout,c=t.createElement(e),d=0,g=0,w={t:r,s:n,e:s,a:a,x:f};1===T[n]&&(g=1,T[n]=[]),"object"==e?c.data=n:(c.src=n,c.type=e),c.width=c.height="0",c.onerror=c.onload=c.onreadystatechange=function(){l.call(this,g)},v.splice(i,0,w),"img"!=e&&(g||2===T[n]?(b.insertBefore(c,y?null:p),h(l,f)):T[n].push(c))}function f(e,t,n,r,s){return m=0,t=t||"j",i(e)?a("c"==t?E:w,e,t,this.i++,n,r,s):(v.splice(this.i++,0,e),1==v.length&&u()),this}function l(){var e=k;return e.loader={load:f,i:0},e}var c=t.documentElement,h=e.setTimeout,p=t.getElementsByTagName("script")[0],d={}.toString,v=[],m=0,g="MozAppearance"in c.style,y=g&&!!t.createRange().compareNode,b=y?c:p.parentNode,c=e.opera&&"[object Opera]"==d.call(e.opera),c=!!t.attachEvent&&!c,w=g?"object":c?"script":"img",E=c?"script":w,S=Array.isArray||function(e){return"[object Array]"==d.call(e)},x=[],T={},N={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}},C,k;k=function(e){function t(e){var e=e.split("!"),t=x.length,n=e.pop(),r=e.length,n={url:n,origUrl:n,prefixes:e},i,s,o;for(s=0;s<r;s++)o=e[s].split("="),(i=N[o.shift()])&&(n=i(n,o));for(s=0;s<t;s++)n=x[s](n);return n}function o(e,i,s,o,u){var a=t(e),f=a.autoCallback;a.url.split(".").pop().split("?").shift(),a.bypass||(i&&(i=r(i)?i:i[e]||i[o]||i[e.split("/").pop().split("?")[0]]),a.instead?a.instead(e,i,s,o,u):(T[a.url]?a.noexec=!0:T[a.url]=1,s.load(a.url,a.forceCSS||!a.forceJS&&"css"==a.url.split(".").pop().split("?").shift()?"c":n,a.noexec,a.attrs,a.timeout),(r(i)||r(f))&&s.load(function(){l(),i&&i(a.origUrl,u,o),f&&f(a.origUrl,u,o),T[a.url]=2})))}function u(e,t){function n(e,n){if(e){if(i(e))n||(f=function(){var e=[].slice.call(arguments);l.apply(this,e),c()}),o(e,f,t,0,u);else if(Object(e)===e)for(p in h=function(){var t=0,n;for(n in e)e.hasOwnProperty(n)&&t++;return t}(),e)e.hasOwnProperty(p)&&(!n&&!--h&&(r(f)?f=function(){var e=[].slice.call(arguments);l.apply(this,e),c()}:f[p]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),c()}}(l[p])),o(e[p],f,t,p,u))}else!n&&c()}var u=!!e.test,a=e.load||e.both,f=e.callback||s,l=f,c=e.complete||s,h,p;n(u?e.yep:e.nope,!!a),a&&n(a)}var a,f,c=this.yepnope.loader;if(i(e))o(e,0,c,0);else if(S(e))for(a=0;a<e.length;a++)f=e[a],i(f)?o(f,0,c,0):S(f)?k(f):Object(f)===f&&u(f,c);else Object(e)===e&&u(e,c)},k.addPrefix=function(e,t){N[e]=t},k.addFilter=function(e){x.push(e)},k.errorTimeout=1e4,null==t.readyState&&t.addEventListener&&(t.readyState="loading",t.addEventListener("DOMContentLoaded",C=function(){t.removeEventListener("DOMContentLoaded",C,0),t.readyState="complete"},0)),e.yepnope=l(),e.yepnope.executeStack=u,e.yepnope.injectJs=function(e,n,r,i,a,f){var l=t.createElement("script"),c,d,i=i||k.errorTimeout;l.src=e;for(d in r)l.setAttribute(d,r[d]);n=f?u:n||s,l.onreadystatechange=l.onload=function(){!c&&o(l.readyState)&&(c=1,n(),l.onload=l.onreadystatechange=null)},h(function(){c||(c=1,n(1))},i),a?l.onload():p.parentNode.insertBefore(l,p)},e.yepnope.injectCss=function(e,n,r,i,o,a){var i=t.createElement("link"),f,n=a?u:n||s;i.href=e,i.rel="stylesheet",i.type="text/css";for(f in r)i.setAttribute(f,r[f]);o||(p.parentNode.insertBefore(i,p),h(n,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};; 2357(function (n) { 2358 var t = { 2359 logo_align: "left", 2360 links_align: "left", 2361 socialBar_align: "left", 2362 searchBar_align: "right", 2363 trigger: "hover", 2364 effect: "fade", 2365 effect_speed: 400, 2366 sibling: !0, 2367 outside_click_close: !0, 2368 top_fixed: !1, 2369 sticky_header: !1, 2370 sticky_header_height: 200, 2371 menu_position: "horizontal", 2372 full_width: !0, 2373 mobile_settings: { 2374 collapse: !1, 2375 sibling: !0, 2376 scrollBar: !0, 2377 scrollBar_height: 400, 2378 top_fixed: !1, 2379 sticky_header: !1, 2380 sticky_header_height: 200 2381 } 2382 }; 2383 n.fn.megaMenu = function (i) { 2384 return i = n.extend({}, 2385 t, 2386 i || {}), 2387 this.each(function () { 2388 var t = n(this), 2389 o = "ul", 2390 f = "li", 2391 s = "a", 2392 y = t.find(".menu-logo"), 2393 b = y.children(f), 2394 h = t.find(".menu-links"), 2395 tt = h.children(f), 2396 p = t.find(".menu-social-bar"), 2397 w = t.find(".menu-search-bar"), 2398 k = ".menu-mobile-collapse-trigger", 2399 d = ".mobileTriggerButton", 2400 g = ".desktopTriggerButton", 2401 e = "active", c = "activeTrigger", 2402 l = "activeTriggerMobile",
2403 u = ".drop-down-multilevel, .drop-down, .drop-down-tab-bar", 2404 a = "desktopTopFixed", 2405 v = "mobileTopFixed", 2406 nt = "menuFullWidth", 2407 r; r = { 2408 menu_full_width: function () { 2409 i.full_width === !0 && t.addClass(nt) 2410 }, 2411 logo_Align: function () { 2412 i.logo_align === "right" && y.addClass("menu-logo-align-right") 2413 }, 2414 links_Align: function () { 2415 i.links_align === "right" && h.addClass("menu-links-align-right") 2416 }, 2417 social_bar_Align: function () { 2418 i.socialBar_align === "right" && p.addClass("menu-social-bar-right") 2419 }, 2420 search_bar_Align: function () { 2421 i.searchBar_align === "left" && w.addClass("menu-search-bar-left") 2422 }, 2423 collapse_trigger_button: function () { 2424 if (i.mobile_settings.collapse === !0) { b.append('<div class="menu-mobile-collapse-trigger"><span><\/span><\/div>'); var r = h.add(p); r.hide(0); w.addClass(e); t.find(k).on("click", function () { return r.is(":hidden") ? (n(this).addClass(e), r.show(0)) : (n(this).removeClass(e), r.hide(0)), !1 }) } 2425 }, 2426 switch_effects: function () { 2427 switch (i.effect) { 2428 case "fade": t.find(u).addClass("effect-fade"); break; case "scale": t.find(u).addClass("effect-scale"); break; case "expand-top": t.find(u).addClass("effect-expand-top"); break; case "expand-bottom": t.find(u).addClass("effect-expand-bottom"); break; case "expand-left": t.find(u).addClass("effect-expand-left"); break; case "expand-right": t.find(u).addClass("effect-expand-right") 2429 } 2430 }, 2431 transition_delay: function () { 2432 t.find(u).css({ webkitTransition: "all " + i.effect_speed + "ms ease ", transition: "all " + i.effect_speed + "ms ease " }) 2433 }, 2434 hover_trigger: function () { 2435 i.trigger === "hover" && (r.transition_delay(), t.find(u).parents(f).addClass("hoverTrigger"), r.switch_effects()) 2436 }, 2437 mobile_trigger: function () { 2438 t.find(u).prev(s).append('<div class="mobileTriggerButton"><\/div>'); t.find(d).on("click", function () { var r = n(this), e = r.parents(s), h = e.next(u); return h.is(":hidden") ? (i.mobile_settings.sibling === !0 && (r.parents(t).siblings(o + "," + f).find(u).hide(0), r.parents(t).siblings(f).removeClass(l), r.parents(t).siblings(o).find(f).removeClass(l)), e.parent(f).addClass(l), h.show(0)) : (e.parent(f).removeClass(l), h.hide(0)), !1 }); t.find("i.fa.fa-indicator").on("click", function () { return !1 }) 2439 }, 2440 click_trigger: function () { 2441 if (i.trigger === "click") { t.find(u).prev(s).append('<div class="desktopTriggerButton"><\/div>'); t.find(u).parents(f).addClass("ClickTrigger"); r.switch_effects(); r.transition_delay(); t.find(g).on("click", function (r) { r.stopPropagation(); r.stopImmediatePropagation(); var h = n(this), l = h.parents(s), a = l.next(u); a.hasClass(e) ? (l.parent(f).removeClass(c), a.removeClass(e)) : (i.sibling === !0 && (h.parents(t).siblings(o + "," + f).find(u).removeClass(e), h.parents(t).siblings(f).removeClass(c), h.parents(t).siblings(o).find(f).removeClass(c)), l.parent(f).addClass(c), a.addClass(e)) }) } 2442 }, 2443 scroll_bar: function () { 2444 i.mobile_settings.scrollBar === !0 && h.css({ maxHeight: i.mobile_settings.scrollBar_height + "px", overflow: "auto" }) 2445 }, 2446 top_Fixed: function () { 2447 i.top_fixed === !0 && t.addClass(a); i.mobile_settings.top_fixed && t.addClass(v) 2448 }, 2449 sticky_Header: function () { 2450 var r = n(window), 2451 u = !0, 2452 f = !0, 2453 e = n(".menu-logo").outerHeight(); 2454 /*if (n("#header").hasClass("logo-center") || n(".mega-menu .menu-list-items").height(e), i.sticky_header === !0 && i.menu_position === "horizontal" && i.top_fixed === !1) 2455 r.on("scroll", function () { 2456 r.scrollTop() > i.sticky_header_height ? u === !0 && (n("#header").hasClass("logo-center") || n(".mega-menu .menu-list-items").height("auto"), 2457 t.fadeOut(0, function () { 2458 if (n(this).addClass(a), !n("#header").hasClass("logo-center")) { var t = n(".menu-logo img").outerHeight(!0); n(".mega-menu .menu-list-items").height(t) } n(this).fadeIn(200) 2459 }), u = !1) : u === !1 && (t.fadeOut(200, function () { n("#header").hasClass("logo-center") || n(".mega-menu .menu-list-items").height(e); n(this).removeClass(a).fadeIn(200) }), u = !0) 2460 });*/ 2461 if (i.mobile_settings.sticky_header === !0 && i.top_fixed === !1) r.on("scroll", function () { r.scrollTop() > i.mobile_settings.sticky_header_height ? f === !0 && (t.addClass(v), f = !1) : f === !1 && (t.removeClass(v), f = !0) }) 2462 }, 2463 position: function () { 2464 i.menu_position === "vertical-left" ? t.addClass("vertical-left") : i.menu_position === "vertical-right" && t.addClass("vertical-right") 2465 } 2466 }; r.menu_full_width(); r.logo_Align(); r.links_Align(); r.social_bar_Align(); r.search_bar_Align(); r.collapse_trigger_button(); r.hover_trigger(); r.mobile_trigger(); r.click_trigger(); r.scroll_bar(); r.top_Fixed(); r.sticky_Header(); r.position(); n(window).resize(function () { }) 2467 }) 2468 } 2469})(jQuery);; 2470(function(n){"use strict";typeof define=="function"&&define.amd?define(["jquery"],n):typeof module!="undefined"&&module.exports?module.exports=n(require("jquery")):n(jQuery)})(function(n){var o=-1,r=-1,i=function(n){return parseFloat(n)||0},s=function(t){var f=1,e=n(t),u=null,r=[];return e.each(function(){var t=n(this),e=t.offset().top-i(t.css("margin-top")),o=r.length>0?r[r.length-1]:null;o===null?r.push(t):Math.floor(Math.abs(u-e))<=f?r[r.length-1]=o.add(t):r.push(t);u=e}),r},u=function(t){var i={byRow:!0,property:"height",target:null,remove:!1};return typeof t=="object"?n.extend(i,t):(typeof t=="boolean"?i.byRow=t:t==="remove"&&(i.remove=!0),i)},t=n.fn.matchHeight=function(i){var r=u(i),f;return r.remove?(f=this,this.css(r.property,""),n.each(t._groups,function(n,t){t.elements=t.elements.not(f)}),this):this.length<=1&&!r.target?this:(t._groups.push({elements:this,options:r}),t._apply(this,r),this)},f,e;t.version="master";t._groups=[];t._throttle=80;t._maintainScroll=!1;t._beforeUpdate=null;t._afterUpdate=null;t._rows=s;t._parse=i;t._parseOptions=u;t._apply=function(r,f){var e=u(f),o=n(r),c=[o],l=n(window).scrollTop(),a=n("html").outerHeight(!0),h=o.parents().filter(":hidden");return h.each(function(){var t=n(this);t.data("style-cache",t.attr("style"))}),h.css("display","block"),e.byRow&&!e.target&&(o.each(function(){var i=n(this),t=i.css("display");t!=="inline-block"&&t!=="flex"&&t!=="inline-flex"&&(t="block");i.data("style-cache",i.attr("style"));i.css({display:t,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px",overflow:"hidden"})}),c=s(o),o.each(function(){var t=n(this);t.attr("style",t.data("style-cache")||"")})),n.each(c,function(t,r){var u=n(r),f=0;if(e.target)f=e.target.outerHeight(!1);else{if(e.byRow&&u.length<=1){u.css(e.property,"");return}u.each(function(){var t=n(this),u=t.attr("style"),i=t.css("display"),r;i!=="inline-block"&&i!=="flex"&&i!=="inline-flex"&&(i="block");r={display:i};r[e.property]="";t.css(r);t.outerHeight(!1)>f&&(f=t.outerHeight(!1));u?t.attr("style",u):t.css("display","")})}u.each(function(){var t=n(this),r=0;e.target&&t.is(e.target)||(t.css("box-sizing")!=="border-box"&&(r+=i(t.css("border-top-width"))+i(t.css("border-bottom-width")),r+=i(t.css("padding-top"))+i(t.css("padding-bottom"))),t.css(e.property,f-r+"px"))})}),h.each(function(){var t=n(this);t.attr("style",t.data("style-cache")||null)}),t._maintainScroll&&n(window).scrollTop(l/a*n("html").outerHeight(!0)),this};t._applyDataApi=function(){var t={};n("[data-match-height], [data-mh]").each(function(){var i=n(this),r=i.attr("data-mh")||i.attr("data-match-height");t[r]=r in t?t[r].add(i):i});n.each(t,function(){this.matchHeight(!0)})};f=function(i){t._beforeUpdate&&t._beforeUpdate(i,t._groups);n.each(t._groups,function(){t._apply(this.elements,this.options)});t._afterUpdate&&t._afterUpdate(i,t._groups)};t._update=function(i,u){if(u&&u.type==="resize"){var e=n(window).width();if(e===o)return;o=e}i?r===-1&&(r=setTimeout(function(){f(u);r=-1},t._throttle)):f(u)};n(t._applyDataApi);e=n.fn.on?"on":"bind";n(window)[e]("load",function(n){t._update(!1,n)});n(window)[e]("resize orientationchange",function(n){t._update(!0,n)})});; 2471(function ($) { 2472 $(document).ready(function () { 2473 2474 // Make sure all pdf links open in a new window 2475 $("a[href$='.pdf']").attr("target", "_blank"); 2476 2477 // Make sure all external links open in a new window 2478 $("a[href^='http']").attr("target", "_blank"); 2479 2480 // iOS Safari hover fix 2481 if ($('html').hasClass('touch') && $('body').hasClass('is-safari')) { 2482 $('*').on('mouseenter', function () { 2483 $(this).trigger('hover'); 2484 //console.log('touch start'); 2485 }).on('mouseleave', function () { 2486 $(this).trigger('hover'); 2487 //console.log('touch end'); 2488 }); 2489 } 2490 2491 // Smooth scroll wire up 2492 $('a.smooth-scroll[href*="#"]:not([href="#"])').click(function () {
2493 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 2494 var target = $(this.hash); 2495 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 2496 if (target.length) { 2497 $('html, body').animate({ 2498 scrollTop: target.offset().top 2499 }, 1000); 2500 window.history.pushState("", "", this.hash); 2501 return false; 2502 } 2503 } 2504 }); 2505 2506 // Go to top 2507 var goToTop = $('#back-to-top').hide(); 2508 $(window).scroll(function () { 2509 if ($(window).scrollTop() > 100) { 2510 goToTop.fadeIn(); 2511 } else { 2512 goToTop.fadeOut(); 2513 } 2514 }); 2515 goToTop.on("click", function () { 2516 $('body,html').animate({ scrollTop: 0 }, 1000); 2517 return false; 2518 }); 2519 2520 // Wire up menu 2521 var nav = $('#menu'); 2522 var pos = 'horizontal'; 2523 if (nav.attr('data-pos')) { 2524 pos = nav.attr('data-pos'); 2525 } 2526 nav.megaMenu({ 2527 // Desktop settings 2528 logo_align: 'left', // align the logo left or right. options (left) or (right) 2529 links_align: 'left', // align the links left or right. options (left) or (right) 2530 socialBar_align: 'left', // align the socialBar left or right. options (left) or (right) 2531 searchBar_align: 'right', // align the search bar left or right. options (left) or (right) 2532 trigger: 'hover', // show drop down using click or hover. options (hover) or (click) 2533 effect: 'expand-top', // drop down effects. options (fade), (scale), (expand-top), (expand-bottom), (expand-left), (expand-right) 2534 effect_speed: 400, // drop down show speed in milliseconds 2535 sibling: true, // hide the others showing drop downs if this option true. this option works on if the trigger option is "click". options (true) or (false) 2536 outside_click_close: true, // hide the showing drop downs when user click outside the menu. this option works if the trigger option is "click". options (true) or (false) 2537 top_fixed: false, // fixed the menu top of the screen. options (true) or (false) 2538 sticky_header: true, // menu fixed on top when scroll down down. options (true) or (false) 2539 sticky_header_height: 250, // sticky header height top of the screen. activate sticky header when meet the height. option change the height in px value. 2540 menu_position: pos, // change the menu position. options (horizontal), (vertical-left) or (vertical-right) 2541 full_width: false, // make menu full width. options (true) or (false) 2542 // MOBILE MODE SETTINGS 2543 mobile_settings: { 2544 collapse: true, // collapse the menu on click. options (true) or (false) 2545 sibling: true, // hide the others showing drop downs when click on current drop down. options (true) or (false) 2546 scrollBar: true, // enable the scroll bar. options (true) or (false) 2547 scrollBar_height: 400, // scroll bar height in px value. this option works if the scrollBar option true. 2548 top_fixed: false, // fixed menu top of the screen. options (true) or (false) 2549 sticky_header: true, // menu fixed on top when scroll down down. options (true) or (false) 2550 sticky_header_height: 200 // sticky header height top of the screen. activate sticky header when meet the height. option change the height in px value. 2551 } 2552 }); 2553 2554 // Wire up search 2555 $('.search-btn').on("click", function () { 2556 $('.search').toggleClass("search-open"); 2557 return false; 2558 }); 2559 2560 $('html, body').on('click', function (e) { 2561 if (!$(e.target).hasClass("not-click")) { 2562 $('.search').removeClass("search-open"); 2563 } 2564 }); 2565 2566 });
2567 2568 // Wire up owl carousel 2569 if (typeof $.fn.owlCarousel != "undefined") { 2570 if ($(".owl-carousel").length) { 2571 var carousel = $(".owl-carousel").owlCarousel({ 2572 navigation: $(".owl-carousel").hasClass('show-controls') ? true : false, 2573 slideSpeed: 300, 2574 autoPlay: $(".owl-carousel .item").length > 1 ? 5000 : false, 2575 paginationSpeed: 400, 2576 pagination: $(".owl-carousel").hasClass('show-controls') ? true : false, 2577 singleItem: true, 2578 responsive: true, 2579 stopOnHover: true, 2580 //transitionStyle: "fadeUp", 2581 transitionStyle: "fade", 2582 lazyLoad: true 2583 }); 2584 2585 $('.owl-item').click(function () { 2586 window.setTimeout(function () { 2587 carousel.trigger('owl.next'); 2588 }, 2500); 2589 }); 2590 } 2591 } 2592 2593 if (typeof $.fn.jarallax != "undefined") { 2594 if ($(".jarallax, .parallax").length) { 2595 $(".jarallax, .parallax").jarallax({ 2596 speed: 0.2 2597 }); 2598 } 2599 } 2600 2601 // Equal height plugin 2602 if (typeof $.fn.matchHeight != "undefined") { 2603 if ($('.equal-height').length) { 2604 $('.equal-height').matchHeight(); 2605 } 2606 } 2607 2608})(jQuery); 2609 2610;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.