1// NEW !!!!!!!!! 2$('selectpicker').selectpicker() 3 4 5 6 7// global vars 8var dragging = false, 9 sorting = false; 10 11function removeErrorClass(e){ 12 if($(e).is(":input")){ 13 $(e).on("input", function(){ 14 $(e).closest(".form-group").removeClass("has-error"); 15 }); 16 } else { 17 $(e).change(function(){ 18 $(e).closest(".form-group").removeClass("has-error"); 19 }) 20 } 21} 22 23function pageUp () { 24 $('html, body').animate({ 25 scrollTop: 100 26 }, 500); 27} 28 29function setJournalOptions(val){ 30 if (val > 0) { 31 $("#journalOptions").removeClass("hide"); 32 } else { 33 $("#journalOptions").addClass("hide"); 34 } 35} 36 37function makeDate(e){ 38 var date = ""; 39 if($("#" + e + "_Year").val() != ""){ 40 date = $("#" + e + "_Year").val(); 41 if($("#" + e + "_Month").val() != ""){ 42 date = $("#" + e + "_Month").val() + ". " + date; 43 if($("#" + e + "_Day").val() != ""){ 44 date = $("#" + e + "_Day").val() + ". " + date; 45 } 46 } 47 $("#" + e + "_Full").html(date); 48 } else { 49 50 $("#" + e + "_Full").html(""); 51 } 52} 53function checkDate(name){ 54 if($("#" + name + "_Year").val() != "" && $("#" + name + "_Month").val() != "" && $("#" + name + "_Day").val() != ""){ 55 var date = $("#" + name + "_Year").val()+"-"+$("#" + name + "_Month").val()+"-"+$("#" + name + "_Day").val(); 56 $.getJSON("/cfc/Case.cfc?method=check" + name + "&date=" + date, function(data){ 57 if(data.HASCASE){ 58 $("#check_" + name + "_Dialog").html(data.MODAL); 59 $("#check_" + name + "_Modal").modal("show"); 60 } 61 }) 62 } 63} 64function setLongDate(name){ 65 if($("#" + name + "_Year").val() != "" && $("#" + name + "_Month").val() != "" && $("#" + name + "_Day").val() != ""){ 66 $("#" + name + "_Long").val($("#" + name + "_Year").val()+"-"+$("#" + name + "_Month").val()+"-"+$("#" + name + "_Day").val()); 67 } else { 68 $("#" + name + "_Long").val(""); 69 } 70} 71function setShortDate(name){ 72 if($("#" + name + "_Year").val() != ""){ 73 $("#" + name + "_Short").val($("#" + name + "_Year").val()+"-"+$("#" + name + "_Month").val()); 74 } else { 75 $("#" + name + "_Short").val(""); 76 } 77} 78 79function displayCisgCitations(){ 80 if($("#cisgCaseCitationsInput").length){ 81 var c = $("#cisgCaseCitationsInput").val().split(","), 82 cs = ""; 83 for(var i=0; i<c.length; i++){ 84 if(c[i] != ""){ 85 cs += "<span id='cisgCaseCitationBadge_"+c[i]+"' class='badge'>"+c[i]+" <span id='removeCisgCitation' cisg-number='"+c[i]+"'>×</span></span>" 86 } 87 } 88 $("#cisgCaseCitations").html(cs); 89 } 90} 91// function displayCisgCaseLiteratureJournal(){ 92// if($("#cisgCaseLiteratureJournalsInput").length){ 93// var c = $("#cisgCaseLiteratureJournalsInput").val().split(","), 94// cs = ""; 95// for(var i=0; i<c.length; i++){ 96// if(c[i] != ""){ 97// var title = $("#cisgLiteratureJournalCaseSelect option[value="+c[i]+"]").html(); 98// cs += "<span id='cisgCisgCaseLiteratureJournalBadge_"+c[i]+"' class='badge'>"+title+" <span id='removeCisgCaseLiteratureJournal' id-number='"+c[i]+"'>×</span></span>" 99// } 100// } 101// $("#cisgCaseLiteratureJournals").html(cs); 102// } 103// } 104function displayCisgCaseLiteratureBook(){ 105 if($("#cisgCaseLiteratureBooksInput").length){ 106 var c = $("#cisgCaseLiteratureBooksInput").val().split(","), 107 cs = ""; 108 for(var i=0; i<c.length; i++){ 109 if(c[i] != ""){ 110 var title = $("#cisgLiteratureBooksCaseSelect option[value="+c[i]+"]").html(); 111 cs += "<span id='cisgCisgCaseLiteratureBookBadge_"+c[i]+"' class='badge'>"+title+" <span id='removeCisgCaseLiteratureBook' id-number='"+c[i]+"'>×</span></span>" 112 } 113 } 114 $("#cisgCaseLiteratureBooks").html(cs); 115 } 116} 117function displayCisgCaseLiteratureBookChapter(){ 118 if($("#cisgCaseLiteratureBookChaptersInput").length){ 119 var c = $("#cisgCaseLiteratureBookChaptersInput").val().split(","), 120 cs = ""; 121 for(var i=0; i<c.length; i++){ 122 if(c[i] != ""){ 123 var title = $("#cisgLiteratureBookChaptersCaseSelect option[value="+c[i]+"]").html(); 124 cs += "<span id='cisgCisgCaseLiteratureBookChapterBadge_"+c[i]+"' class='badge'>"+title+" <span id='removeCisgCaseLiteratureBookChapter' id-number='"+c[i]+"'>×</span></span>" 125 } 126 } 127 $("#cisgCaseLiteratureBookChapters").html(cs); 128 } 129} 130function getSearchResults(e){ 131 $("#" + e.rotator).fadeIn().css("display", "inline-block"); 132 $.getJSON("/cfc/SearchCase.cfc?method=searchForCase", { 133 orderBy: e.orderBy, 134 searchLastFive: e.searchLastFive, 135 searchHighRelevance: e.searchHighRelevance, 136 searchHighDifficulty: e.searchHighDifficulty, 137 searchForm: e.searchForm, 138 isAdmin: e.isAdmin 139 }, function(data){ 140 if(data.SUCCESS){ 141 $("#searchCaseResult").html(data.RESULT); 142 $('html, body').animate({ 143 scrollTop: $("#searchCaseResult").offset().top - 200 144 }, 500); 145 } 146 $("#" + e.rotator).fadeOut(); 147 }); 148} 149 150function checkHasCurrencyLitigation(){ 151 var e = true; 152 $("[id^='litPart']").each(function(){ 153 $(this).find("#select").closest(".form-group").removeClass("has-error"); 154 if($(this).find("#litArbitValue").val() != "" && $(this).find("#select").val() == -1 && $(this).find("#litArbitValue").val() != "-"){ 155 var tab = $(this).closest(".tab-pane").attr("id"); 156 $("li[role='" + tab + "']").addClass("has-error"); 157 $(this).find("#select").closest(".form-group").addClass("has-error"); 158 e = false; 159 } 160 }); 161 return e; 162} 163 164function checkHasCurrencyGoodsPrice(){ 165 var e = true; 166 if($("#goodsPrice").val() == ""){
167 $("#wrapperCurrencySelectGoods").find("#select").val($("#wrapperCurrencySelectGoods").find("#select option:first").val()); 168 } 169 $("#wrapperCurrencySelectGoods").find(".form-group").removeClass("has-error"); 170 if($("#goodsPrice").val() != "" && $("#wrapperCurrencySelectGoods").find("#select").val() == -1 && $("#goodsPrice").val() != "-"){ 171 var tab = $("#wrapperCurrencySelectGoods").closest(".tab-pane").attr("id"); 172 $("li[role='" + tab + "']").addClass("has-error"); 173 $("#wrapperCurrencySelectGoods").find(".form-group").addClass("has-error"); 174 e = false; 175 } 176 return e; 177} 178 179function checkHasCurrencyClaim(){ 180 var e = true; 181 $("[id^='claimPart']").each(function(){ 182 if($(this).find("[id^='claimSum']").val() == ""){ 183 $(this).find("#select").val($(this).find("#select option:first").val()); 184 } 185 $(this).find("#select").closest(".form-group").removeClass("has-error"); 186 if($(this).find("[id^='claimSum']").val() != "" && $(this).find("#select").val() == -1 && $(this).find("[id^='claimSum']").val() != "-"){ 187 var tab = $(this).closest(".tab-pane").attr("id"); 188 $("li[role='" + tab + "']").addClass("has-error"); 189 $(this).find("#select").closest(".form-group").addClass("has-error"); 190 e = false; 191 } 192 }); 193 return e; 194} 195 196function checkHasCurrencyCounterClaim(){ 197 var e = true; 198 $("[id^='counterClaimPart']").each(function(){ 199 if($(this).find("[id^='counterClaimSum']").val() == ""){ 200 $(this).find("#select").val($(this).find("#select option:first").val()); 201 } 202 $(this).find("#select").closest(".form-group").removeClass("has-error"); 203 if($(this).find("[id^='counterClaimSum']").val() != "" && $(this).find("#select").val() == -1 && $(this).find("[id^='counterClaimSum']").val() != "-"){ 204 var tab = $(this).closest(".tab-pane").attr("id"); 205 $("li[role='" + tab + "']").addClass("has-error"); 206 $(this).find("#select").closest(".form-group").addClass("has-error"); 207 e = false; 208 } 209 }); 210 return e; 211} 212 213function checkHasCurrencyCosts(){ 214 var e = true; 215 if($("#costOfLitigation").val() == ""){ 216 $("#wrapperCurrencySelectDecision").find("#select").val($("#wrapperCurrencySelectDecision").find("#select option:first").val()); 217 } 218 $("#wrapperCurrencySelectDecision").find("#select").closest(".form-group").removeClass("has-error"); 219 if($("#costOfLitigation").val() != "" && $("#wrapperCurrencySelectDecision").find("#select").val() == -1 && $("#costOfLitigation").val() != "-"){ 220 var tab = $("#wrapperCurrencySelectDecision").closest(".tab-pane").attr("id"); 221 $("li[role='" + tab + "']").addClass("has-error"); 222 $("#wrapperCurrencySelectDecision").find("#select").closest(".form-group").addClass("has-error"); 223 e = false; 224 } 225 return e; 226} 227function checkHasCurrencyClaimGranted(){ 228 var e = true; 229 if($("#claimGrantedCost").val() == ""){ 230 $("#wrapperCurrencySelectClaim").find("#select").val($("#wrapperCurrencySelectClaim").find("#select option:first").val()); 231 } 232 $("#wrapperCurrencySelectClaim").find("#select").closest(".form-group").removeClass("has-error"); 233 if($("#claimGrantedCost").val() != "" && $("#wrapperCurrencySelectClaim").find("#select").val() == -1 && $("#claimGrantedCost").val() != "-"){ 234 var tab = $("#wrapperCurrencySelectClaim").closest(".tab-pane").attr("id"); 235 $("li[role='" + tab + "']").addClass("has-error"); 236 $("#wrapperCurrencySelectClaim").find("#select").closest(".form-group").addClass("has-error"); 237 e = false; 238 } 239 return e; 240} 241function checkHasCurrencyCounterClaimGranted(){ 242 var e = true; 243 if($("#counterClaimGrantedCost").val() == ""){ 244 $("#wrapperCurrencySelectCounterClaim").find("#select").val($("#wrapperCurrencySelectCounterClaim").find("#select option:first").val()); 245 } 246 $("#wrapperCurrencySelectCounterClaim").find("#select").closest(".form-group").removeClass("has-error"); 247 if($("#counterClaimGrantedCost").val() != "" && $("#wrapperCurrencySelectCounterClaim").find("#select").val() == -1 && $("#counterClaimGrantedCost").val() != "-"){ 248 var tab = $("#wrapperCurrencySelectCounterClaim").closest(".tab-pane").attr("id"); 249 $("li[role='" + tab + "']").addClass("has-error"); 250 $("#wrapperCurrencySelectCounterClaim").find("#select").closest(".form-group").addClass("has-error"); 251 e = false; 252 } 253 return e; 254} 255 256function cleanPastedHTML(input) { 257 // 1. remove line breaks / Mso classes 258 var stringStripper = /(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g; 259 var output = input.replace(stringStripper, ' '); 260 // 2. strip Word generated HTML comments 261 var commentSripper = new RegExp('<!--(.*?)-->', 'g'); 262 var output = output.replace(commentSripper, ''); 263 var tagStripper = new RegExp('<(/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>
263', 'gi'); 264 // 3. remove tags leave content if any 265 output = output.replace(tagStripper, ''); 266 // 4. Remove everything in between and including tags '<style(.)style(.)>' 267 var badTags = ['style', 'script', 'applet', 'embed', 'noframes', 'noscript']; 268 269 for (var i = 0; i < badTags.length; i++) { 270 tagStripper = new RegExp('<' + badTags[i] + '.*?' + badTags[i] + '(.*?)>', 'gi'); 271 output = output.replace(tagStripper, ''); 272 } 273 // 5. remove attributes ' style="..."' 274 var badAttributes = ['style', 'start']; 275 for (var i = 0; i < badAttributes.length; i++) { 276 var attributeStripper = new RegExp(' ' + badAttributes[i] + '="(.*?)"', 'gi'); 277 output = output.replace(attributeStripper, ''); 278 } 279 return output; 280} 281 282$(document).ready(function(){ 283 284 // navbar top height 285 var timeout; 286 $(window).on('resize orientationchange', function() { 287 var header = parseInt($('.navbar-fixed-top').height()); 288 $('body').css('padding-top', header+'px'); 289 }); 290 $(window).trigger('resize'); 291 292 if ($("#jurisdictionTitle").data("has-bibliography") == 1) { 293 $("#byJurisdictionTab4").removeClass("hide"); 294 } 295 296 $('.summernote').summernote({ 297 toolbar: [ 298 ['style', ['bold', 'italic', 'underline']], 299 ['fontsize', ['fontsize']], 300 ['color', ['color']], 301 ['para', ['ul', 'ol', 'paragraph']], 302 ['insert', ['link']], 303 ['codeview', ['codeview']] 304 ], 305 callbacks: { 306 onPaste: function (e) { 307 var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text') 308 e.preventDefault() 309 document.execCommand('insertText', false, bufferText) 310 } 311 } 312 }); 313 314 setJournalOptions($("#journalSearchSelect").val()) 315 316 if($("#activeEditTab").length && $("#activeEditTab").attr("data-tab-name") != "") localStorage.activeEditTab = $("#activeEditTab").attr("data-tab-name"); 317 318 if(localStorage.activeEditTab && $("#editCaseNumber").attr("data-number") == localStorage.activeCaseId || $("#activeEditTab").length && $("#activeEditTab").attr("data-tab-name") != ""){ 319 $('#'+localStorage.activeEditTab+'Tab').tab('show'); 320 } else { 321 $('#rawDataTab').tab('show'); 322 localStorage.activeCaseId = $("#editCaseNumber").attr("data-number"); 323 } 324 325 $("#navTabs li a").click(function(){ 326 history.replaceState(null, "", location.href.split("&tab=")[0]); 327 localStorage.activeEditTab = $(this).attr("aria-controls"); 328 }); 329 330 $('[data-toggle="datepicker"]').datepicker({ 331 language: 'en-GB', 332 format: 'dd mm yyyy', 333 monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] 334 }); 335 336 $('#caseUploadInfo').on('hidden.bs.modal', function(){ 337 location.reload(true); 338 }); 339 340 $('[data-toggle="datepickerYear"]').datepicker({ 341 format: 'yyyy' 342 }); 343 $('[data-toggle="datepickerMonth"]').datepicker({ 344 format: 'mm', 345 template: '<div class="datepicker-container"><div class="datepicker-panel" data-view="months picker"><ul data-view="months"></ul></div></div>' 346 }); 347 $('[data-toggle="datepickerDay"]').datepicker({ 348 format: 'dd', 349 template: '<div class="datepicker-container"><div class="datepicker-panel" data-view="days picker"><ul data-view="days"></ul></div></div>', 350 }); 351 352 $("[id*='_Year']").each(function(){ 353 var name = $(this).attr("id").split("_")[0]; 354 setLongDate(name); 355 setShortDate(name); 356 makeDate(name); 357 }); 358 359 $("[id*='_Year']").click(function(){ 360 $(this).parent().removeClass("has-error"); 361 }); 362 $("[id*='_Month']").click(function(){ 363 var name = $(this).attr("id").split("_")[0]; 364 $(this).parent().removeClass("has-error"); 365 if($("#" + name + "_Year").val() == ""){ 366 $("#" + name + "_Month").datepicker('hide'); 367 $("#" + name + "_Year").parent().addClass("has-error"); 368 } 369 }); 370 $("[id*='_Day']").click(function(){ 371 var name = $(this).attr("id").split("_")[0], 372 hasError = false, 373 hasCheckDate = false; 374 if($("#" + name + "_Year").val() == ""){ 375 $("#" + name + "_Day").datepicker('hide'); 376 $("#" + name + "_Year").parent().addClass("has-error"); 377 hasError = true; 378 } 379 if($("#" + name + "_Month").val() == ""){ 380 $("#" + name + "_Day").datepicker('hide'); 381 $("#" + name + "_Month").parent().addClass("has-error"); 382 hasError = true; 383 } 384 if($("#" + name + "_Day").val() == ""){ 385 var day = "01"; 386 } else { 387 var day = $("#" + name + "_Day").val(); 388 } 389 if($(this).attr("checkDate")){ 390 $(this).removeAttr("checkDate"); 391 hasCheckDate = true; 392 } 393 if(!hasError) $("#" + name + "_Day").datepicker("setDate", new Date($("#" + name + "_Year").val() + "," + $("#" + name + "_Month").val() + "," + day)); 394 if(hasCheckDate) $(this).attr("checkDate", true); 395 }); 396 $("#dateOfDecisionFrom").on("pick.datepicker", function (e) { 397 $("#dateSpanFrom").val(moment(e.date).format("YYYY-MM-DD")); 398 });
399 $("#removeFromSpanDate").click(function(){ 400 $("#dateOfDecisionFrom").datepicker("reset"); 401 $("#dateSpanFrom").val(""); 402 }); 403 $("#dateOfDecisionTo").on("pick.datepicker", function (e) { 404 $("#dateSpanTo").val(moment(e.date).format("YYYY-MM-DD")); 405 }); 406 $("#removeToSpanDate").click(function () { 407 $("#dateOfDecisionTo").datepicker("reset"); 408 $("#dateSpanTo").val(""); 409 }); 410 $("#journalSearchSelect").change(function(e){ 411 setJournalOptions(e.target.value) 412 }) 413 $("[id*='_Year']").change(function(){ 414 console.log("CHANGED") 415 var name = $(this).attr("id").split("_")[0]; 416 setShortDate(name); 417 setLongDate(name); 418 makeDate($(this).attr("id").split("_")[0]); 419 if($("#" + name + "_Long").val() != "" && $(this).attr("checkDate")){ 420 checkDate(name); 421 } 422 }); 423 $("[id*='_Month']").change(function(){ 424 var name = $(this).attr("id").split("_")[0]; 425 $("#" + name + "_Day").val(""); 426 setLongDate(name); 427 setShortDate(name); 428 makeDate($(this).attr("id").split("_")[0]); 429 if($("#" + name + "_Long").val() != "" && $(this).attr("checkDate")){ 430 checkDate(name); 431 } 432 }) 433 $("[id*='_Day']").change(function(){ 434 var name = $(this).attr("id").split("_")[0]; 435 setShortDate(name); 436 setLongDate(name); 437 makeDate($(this).attr("id").split("_")[0]); 438 if($(this).val() != "" && $(this).attr("checkDate")){ 439 checkDate(name); 440 } 441 }); 442 443 $("[id^='respondantCounterClaimant']").each(function(){ 444 if($(this).is(":checked")){ 445 $("#" + $(this).attr("id") + "_Hidden").val("1"); 446 } else { 447 $("#" + $(this).attr("id") + "_Hidden").val("0"); 448 } 449 }) 450 $(document).on("click", "[id^='respondantCounterClaimant']", function(){ 451 if($(this).is(":checked")){ 452 $("#" + $(this).attr("id") + "_Hidden").val("1"); 453 } else { 454 $("#" + $(this).attr("id") + "_Hidden").val("0"); 455 } 456 }); 457 458 // opening edit modal for a dropdown 459 $(document).on("click", "[id='openEditModal']", function(){ 460 var selectPartId = $(this).attr("selector"), 461 selectedFunction = $(this).attr("modal-name"), 462 chosenOption = $("#" + selectPartId).find("#select option:selected").val(); 463 if(chosenOption != -1 && chosenOption != 0){ 464 $("#editModalDialog").load("/cfc/Case.cfc?method=get"+selectedFunction+"EditModal", 465 { 466 id: chosenOption 467 }, 468 function(){ 469 $("#editModal").modal("show"); 470 }); 471 } 472 }); 473 474 $(document).on("click", "[id='openEditJournalModal']", function(){ 475 var selectPartId = $(this).attr("selector"), 476 chosenOption = $("#" + selectPartId).find("#journalSelect option:selected").val(); 477 if(chosenOption != -1){ 478 $("#editJournalModalDialog").load("/cfc/Case.cfc?method=getJournalEditModal&id=" + chosenOption, function(){ 479 $("#editJournalModal").modal("show"); 480 }); 481 } 482 }); 483 $("#addJournal").click(function(){ 484 $.getJSON("/cfc/Case.cfc?method=addJournal", $("#addJournalForm").serialize(), function(data){ 485 if(data.SUCCESS){ 486 $("[id^='journalSelectWrapper']").each(function(){ 487 var name = $(this).find("#select").attr("name"), 488 id = $(this).find("#select option:selected").val(), 489 label = $(this).find("label").html(); 490 if(id == 0) id = ""; 491 $(this).load("/cfc/Case.cfc?method=getJournalSelect&id=" + id + "&name=" + name + "&label=" + encodeURIComponent(label)); 492 }); 493 $("#addJournalModal").modal("hide"); 494 } else { 495 alert(data.MSG); 496 } 497 }); 498 }); 499 $("#addJournalToForm").click(function(){ 500 $.get("/cfc/Case.cfc?method=getJournal", function(data){ 501 $("#journalsWrapper").append(data); 502 }); 503 }); 504 $(document).on("click", "[id='removeJournalFromForm']", function(e){ 505 e.preventDefault(); 506 $("#" + $(this).attr("partId")).remove(); 507 }); 508 509 // $(document).on("click", "[id='openEditBookModal']", function(){ 510 // var selectPartId = $(this).attr("selector"), 511 // chosenOption = $("#" + selectPartId).find("#bookSelect option:selected").val(); 512 // if(chosenOption != -1){ 513 // $("#editBookModalDialog").load("/cfc/Case.cfc?method=getBookEditModal&id=" + chosenOption, function(){ 514 // $("#editBookModal").modal("show"); 515 // }); 516 // } 517 // }); 518 // $("#addBook").click(function(){ 519 // $.getJSON("/cfc/Case.cfc?method=addBook", $("#addBookForm").serialize(), function(data){ 520 // if(data.SUCCESS){ 521 // $("[id^='bookSelectWrapper']").each(function(){ 522 // var name = $(this).find("#select").attr("name"), 523 // id = $(this).find("#select option:selected").val(), 524 // label = $(this).find("label").html(); 525 // if(id == 0) id = ""; 526 // $(this).load("/cfc/Case.cfc?method=getBookSelect&id=" + id + "&name=" + name + "&label=" + encodeURIComponent(label)); 527 // }); 528 // $("#addBookModal").modal("hide"); 529 // } else { 530 // alert(data.MSG); 531 // } 532 // }); 533 // }); 534 $("#addBookToForm").click(function(){ 535 $.get("/cfc/Case.cfc?method=getBook", function(data){ 536 $("#booksWrapper").append(data); 537 }); 538 }); 539 $(document).on("click", "[id='removeBookFromForm']", function(e){
540 e.preventDefault(); 541 $("#" + $(this).attr("partId")).remove(); 542 }); 543 $("#addChapterToForm").click(function(){ 544 $.get("/cfc/Case.cfc?method=getChapter", function(data){ 545 $("#chaptersWrapper").append(data); 546 }); 547 }); 548 $(document).on("click", "[id='removeChapterFromForm']", function(e){ 549 e.preventDefault(); 550 $("#" + $(this).attr("partId")).remove(); 551 }); 552 $("#addDecisionCommentBookToForm").click(function(){ 553 $.get("/cfc/Case.cfc?method=getDecisionCommentBook", function(data){ 554 $("#decisionCommentsBookWrapper").append(data); 555 }); 556 }); 557 $(document).on("click", "[id='removeDecisionCommentBookFromForm']", function(e){ 558 e.preventDefault(); 559 $("#commentBookPart" + $(this).attr("partId")).remove(); 560 }); 561 562 $("#addDecisionCommentToForm").click(function(){ 563 $.get("/cfc/Case.cfc?method=getDecisionComment", function(data){ 564 $("#decisionCommentsWrapper").append(data); 565 }); 566 }); 567 $(document).on("click", "[id='removeDecisionCommentFromForm']", function(e){ 568 e.preventDefault(); 569 $("#commentPart" + $(this).attr("partId")).remove(); 570 }); 571 572 $("[id='openEditCourtModal']").click(function(){ 573 var selectWrapperName = $(this).attr("selector"), 574 chosenOption = $("#" + selectWrapperName).find("#courtSelect option:selected").val(); 575 if(chosenOption != -1){ 576 $("#editCourtModalDialog").load("/cfc/Case.cfc?method=getCourtEditModal&courtId=" + chosenOption, function(){ 577 $("#editCourtModal").modal("show"); 578 }); 579 } 580 }); 581 582 $(document).on("change", "[id='courtSelect']", function(){ 583 var courtName = $(this).attr("name"); 584 $(this).find("#courtNameEnglish"+courtName).html($("option:selected", this).attr("nameEnglish")); 585 $(this).find("#courtNameGerman"+courtName).html($("option:selected", this).attr("nameGerman")); 586 }); 587 $("#addCourt").click(function(){ 588 // if($.trim($("#nameOrig").val()) != ""){ 589 $.getJSON("/cfc/Case.cfc?method=addCourt", $("#addCourtForm").serialize(), function(data){ 590 if(data.SUCCESS){ 591 $("[id^='wrapperCourtSelect']").each(function(){ 592 var courtId = $(this).find("#select option:selected").val(), 593 name = $(this).find("#select").attr("name"); 594 if(courtId == -1) courtId = ""; 595 $(this).load("/cfc/Case.cfc?method=getourtSelect&id=" + courtId + "&name=" + name); 596 }); 597 $("#addCourtModal").modal("hide"); 598 } else { 599 alert(data.MSG); 600 } 601 }); 602 }); 603 604 $("#openEditSeatModal").click(function(){ 605 if($("#seatSelect option:selected").val() != -1){ 606 $("#editSeatModalDialog").load("/cfc/Case.cfc?method=getSeatEditModal&seatId=" + $("#seatSelect option:selected").val(), function(){ 607 $("#editSeatModal").modal("show"); 608 }); 609 } 610 }); 611 $("#addSeat").click(function(){ 612 var errors = false; 613 if($.trim($("#nameCity").val()) == "" && $.trim($("#fk_countryIdSeat").val()) == ""){ 614 $("#nameCity").parent().addClass("has-error"); 615 $("#fk_countryIdSeat").parent().addClass("has-error"); 616 errors = true; 617 } 618 if(!errors){ 619 $.getJSON("/cfc/Case.cfc?method=addSeat", $("#addSeatForm").serialize(), function(data){ 620 if(data.SUCCESS){ 621 $("#seatSelect").load("/cfc/Case.cfc?method=getSeatSelect&seatId=" + data.SEATID); 622 $("#addSeatModal").modal("hide"); 623 } else { 624 alert(data.MSG); 625 } 626 }); 627 } else { 628 return; 629 } 630 }); 631 $("#openEditProceedingModal").click(function(){ 632 if($("#proceedingSelect option:selected").val() != -1){ 633 $("#editProceedingModalDialog").load("/cfc/Case.cfc?method=getProceedingEditModal&id=" + $("#proceedingSelect option:selected").val(), function(){ 634 $("#editProceedingModal").modal("show"); 635 }); 636 } 637 }); 638 $("#addProceeding").click(function(){ 639 var errors = false; 640 if($.trim($("#nameProceeding").val()) == ""){ 641 $("#nameProceeding").parent().addClass("has-error"); 642 errors = true; 643 } 644 if(!errors){ 645 $.getJSON("/cfc/Case.cfc?method=addProceeding", $("#addProceedingForm").serialize(), function(data){ 646 if(data.SUCCESS){ 647 $("#proceedingSelect").load("/cfc/Case.cfc?method=getProceedingSelect&seatId=" + data.ID); 648 $("#addProceedingModal").modal("hide"); 649 } else { 650 alert(data.MSG); 651 } 652 }); 653 } else { 654 return; 655 } 656 }); 657 658 $("#addIssueToForm").click(function () { 659 $.get("/cfc/Case.cfc?method=getSelectForIssues", function (data) {
660 $("#issuesWrapper").append(data); 661 }); 662 }); 663 $(document).on("click", "[id='removeIssueFromForm']", function (e) { 664 e.preventDefault(); 665 $("#issuePart" + $(this).attr("partId")).remove(); 666 }); 667 $(document).on("click", "[id^='openEditIssueModal']", function () { 668 var partId = $(this).attr("id").split("_")[1], 669 selectedIssueId = $("#issueSelect_" + partId + " option:selected").val(); 670 if (selectedIssueId != 0) { 671 console.log('hmmm'); 672 $("#editIssueModalDialog").load("/cfc/Case.cfc?method=getIssueEditModal&issueId=" + selectedIssueId, function () { 673 $("#editIssueModal").modal("show"); 674 }); 675 } 676 }); 677 $("#addIssue").click(function () { 678 $.getJSON("/cfc/Case.cfc?method=addIssue", $("#addIssueForm").serialize(), function (data) { 679 if (data.SUCCESS) { 680 var issueIds = []; 681 $("[id^='issueSelect_']").each(function () { 682 issueIds.push($(this).val()); 683 }); 684 $("#issuesWrapper").html(""); 685 for (var i = 0; i < issueIds.length; i++) { 686 var theId = ""; 687 if (i != -1) theId = issueIds[i]; 688 $.get("/cfc/Case.cfc?method=getSelectForIssues&issueId=" + theId, function (data) { 689 $("#issuesWrapper").append(data); 690 }); 691 } 692 $("#addIssueModal").modal("hide"); 693 } else { 694 alert(data.MSG); 695 } 696 }); 697 }); 698 699 // Inco Issue 700 $("#addIncoIssueToForm").click(function () { 701 $.get("/cfc/Case.cfc?method=getSelectForIncoIssues", function (data) { 702 $("#incoIssuesWrapper").append(data); 703 }); 704 }); 705 $(document).on("click", "[id='removeIncoIssueFromForm']", function (e) { 706 e.preventDefault(); 707 $("#incoIssuePart" + $(this).attr("partId")).remove(); 708 }); 709 $(document).on("click", "[id^='openEditIncoIssueModal']", function () { 710 var partId = $(this).attr("id").split("_")[1], 711 selectedIssueId = $("#incoIssueSelect_" + partId + " option:selected").val(); 712 if (selectedIssueId != 0) { 713 $("#editIncoIssueModalDialog").load("/cfc/Case.cfc?method=getIncoIssueEditModal&incoIssueId=" + selectedIssueId, function () { 714 $("#editIncoIssueModal").modal("show"); 715 }); 716 } 717 }); 718 $("#addIncoIssue").click(function () { 719 $.getJSON("/cfc/Case.cfc?method=addIncoIssue", $("#addIncoIssueForm").serialize(), function (data) { 720 if (data.SUCCESS) { 721 var issueIds = []; 722 $("[id^='incoIssueSelect_']").each(function () { 723 issueIds.push($(this).val()); 724 }); 725 $("#incoIssuesWrapper").html(""); 726 for (var i = 0; i < issueIds.length; i++) { 727 var theId = ""; 728 if (i != -1) theId = issueIds[i]; 729 $.get("/cfc/Case.cfc?method=getSelectForIncoIssues&incoIssueId=" + theId, function (data) { 730 $("#incoIssuesWrapper").append(data); 731 }); 732 } 733 $("#addIncoIssueModal").modal("hide"); 734 } else { 735 alert(data.MSG); 736 } 737 }); 738 }); 739 740 741 742 743 $(document).on("click", "[id^='openEditJudgeTypeModal']", function(){ 744 var partId = $(this).attr("id").split("_")[1], 745 id = $("#judgeTypeSelect_" + partId + " option:selected").val(); 746 if(id != -1){ 747 $("#editJudgeTypeModalDialog").load("/cfc/Case.cfc?method=getJudgeTypeEditModal&id=" + id, function(){ 748 $("#editJudgeTypeModal").modal("show"); 749 }); 750 } 751 }); 752 $("#addJudgeType").click(function(){ 753 var errors = false; 754 if($.trim($("#nameJudgeType").val()) == ""){ 755 $("#nameJudgeType").parent().addClass("has-error"); 756 errors = true; 757 } 758 if(!errors){ 759 $.getJSON("/cfc/Case.cfc?method=addJudgeType", $("#addJudgeTypeForm").serialize(), function(data){ 760 if(data.SUCCESS){ 761 var judgeIds = [], 762 judgeTypeIds = []; 763 $("[id^='judgeSelect_']").each(function(){ 764 judgeIds.push($(this).val()); 765 }); 766 $("[id^='judgeTypeSelect_']").each(function(){ 767 judgeTypeIds.push($(this).val()); 768 }); 769 $("#judgesWrapper").html(""); 770 for(var i=0;i<judgeIds.length;i++){ 771 var theId = ""; 772 if(i != -1) theId = judgeIds[i]; 773 if(i != -1) theTypeId = judgeTypeIds[i]; 774 $.get("/cfc/Case.cfc?method=getSelectForJudges&judgeId=" + theId + "&judgeTypeId=" + theTypeId, function(data){ 775 $("#judgesWrapper").append(data); 776 });
777 } 778 $("#addJudgeTypeModal").modal("hide"); 779 } else { 780 alert(data.MSG); 781 } 782 }); 783 } else { 784 return; 785 } 786 }); 787 788 $("#addJudgeToForm").click(function(){ 789 $.get("/cfc/Case.cfc?method=getSelectForJudges", function(data){ 790 $("#judgesWrapper").append(data); 791 }); 792 }); 793 $(document).on("click", "[id='removeJudgeFromForm']", function(e){ 794 e.preventDefault(); 795 $("#judgePart" + $(this).attr("partId")).remove(); 796 }); 797 $(document).on("click", "[id^='openEditJudgeModal']", function(){ 798 var partId = $(this).attr("id").split("_")[1], 799 selectedJudgeId = $("#judgeSelect_" + partId + " option:selected").val(), 800 selectedTypeId = $("#judgeTypeSelect_" + partId + " option:selected").val(); 801 if(selectedJudgeId != 0){ 802 $("#editJudgeModalDialog").load("/cfc/Case.cfc?method=getJudgeEditModal&judgeId=" + selectedJudgeId + "&judgeTypeId=" + selectedTypeId, function(){ 803 $("#editJudgeModal").modal("show"); 804 }); 805 } 806 }); 807 $("#addJudge").click(function(){ 808 $.getJSON("/cfc/Case.cfc?method=addJudge", $("#addJudgeForm").serialize(), function(data){ 809 if(data.SUCCESS){ 810 var judgeIds = [], 811 judgeTypeIds = []; 812 $("[id^='judgeSelect_']").each(function(){ 813 judgeIds.push($(this).val()); 814 }); 815 $("[id^='judgeTypeSelect_']").each(function(){ 816 judgeTypeIds.push($(this).val()); 817 }); 818 $("#judgesWrapper").html(""); 819 for(var i=0;i<judgeIds.length;i++){ 820 var theId = ""; 821 if(i != -1) theId = judgeIds[i]; 822 if(i != -1) theTypeId = judgeTypeIds[i]; 823 $.get("/cfc/Case.cfc?method=getSelectForJudges&judgeId=" + theId + "&judgeTypeId=" + theTypeId, function(data){ 824 $("#judgesWrapper").append(data); 825 }); 826 } 827 $("#addJudgeModal").modal("hide"); 828 } else { 829 alert(data.MSG); 830 } 831 }); 832 }); 833 834 $("#addRelatedCaseToForm").click(function(){ 835 $.get("/cfc/Case.cfc?method=getSelectForRelatedCases", function(data){ 836 $("#relatedCaseWrapper").append(data); 837 }); 838 }); 839 $(document).on("click", "[id='removeRelatedCaseFromForm']", function(e){ 840 e.preventDefault(); 841 $("#relatedCasePart" + $(this).attr("partId")).remove(); 842 }); 843 $("#addLitValueToForm").click(function(){ 844 $.get("/cfc/Case.cfc?method=getLitValue", function(data){ 845 $("#litValueWrapper").append(data); 846 }); 847 }); 848 $(document).on("click", "[id='removeLitValueFromForm']", function(e){ 849 e.preventDefault(); 850 $("#litPart" + $(this).attr("partId")).remove(); 851 }); 852 853 $("#addAbstractToForm").click(function(){ 854 console.log('ADDD') 855 $.get("/cfc/Case.cfc?method=getAbstract", function(data){ 856 $("#abstractsWrapper").append(data); 857 }); 858 }); 859 $(document).on("click", "[id='removeAbstractFromForm']", function(e){ 860 e.preventDefault(); 861 $("#abstractPart_" + $(this).attr("partId")).remove(); 862 }); 863 864 $("#addFullTextToForm").click(function(){ 865 $.get("/cfc/Case.cfc?method=getFullText", function(data){ 866 $("#fullTextWrapper").append(data); 867 }); 868 }); 869 $(document).on("click", "[id='removeFullTextFromForm']", function(e){ 870 e.preventDefault(); 871 $("#fullTextPart_" + $(this).attr("partId")).remove(); 872 }); 873 874 $("#addTranslationToForm").click(function(){ 875 $.get("/cfc/Case.cfc?method=getTranslation", function(data){ 876 $("#translationWrapper").append(data); 877 }); 878 }); 879 $(document).on("click", "[id='removeTranslationFromForm']", function(e){ 880 e.preventDefault(); 881 $("#translationPart_" + $(this).attr("partId")).remove(); 882 }); 883 $(document).on("click", "[id='removeRemarkFromForm']", function(e){ 884 e.preventDefault(); 885 $("#remarkPart_" + $(this).attr("partId")).find("#fileName").val(""); 886 $("#remarkPart_" + $(this).attr("partId")).find("#fileId").val(0); 887 $("#remarkPart_" + $(this).attr("partId")).find("#fileLink").remove(); 888 $("#remarkPart_" + $(this).attr("partId")).find("#removeRemarkFromForm").remove(); 889 890 }); 891 892 $("#addCurrency").click(function(){ 893 var errors = false; 894 if($.trim($("#nameCurrency").val()) != ""){ 895 $.getJSON("/cfc/Case.cfc?method=addCurrency", $("#addCurrencyForm").serialize(), function(data){ 896 if(data.SUCCESS){ 897 $("[id^='wrapperCurrencySelect']").each(function(){ 898 var currencyId = $(this).find("#select option:selected").val(); 899 name = $(this).find("#select").attr("name"), 900 label = $(this).find("label").html(); 901 if(currencyId == -1) currencyId = ""; 902 $(this).load("/cfc/Case.cfc?method=getCurrencySelect&id=" + currencyId + "&name=" + name + "&label=" + encodeURIComponent(label)); 903 });
904 $("#addCurrencyModal").modal("hide"); 905 } else { 906 alert(data.MSG); 907 } 908 }); 909 } else { 910 $("#nameCurrency").parent().addClass("has-error"); 911 } 912 }); 913 914 $("#addPaymentMethod").click(function(){ 915 var errors = false; 916 if($.trim($("#namePaymentMethod").val()) != ""){ 917 $.getJSON("/cfc/Case.cfc?method=addPaymentMethod", $("#addPaymentMethodForm").serialize(), function(data){ 918 if(data.SUCCESS){ 919 $("[id^='wrapperPaymentMethodSelect']").each(function(){ 920 var id = $(this).find("#select option:selected").val(), 921 name = $(this).find("#select").attr("name"), 922 label = $(this).find("label").html(); 923 if(id == 0) id = ""; 924 $(this).load("/cfc/Case.cfc?method=getPaymentMethodSelect&id=" + id + "&name=" + name + "&label=" + encodeURIComponent(label)); 925 }); 926 $("#addPaymentMethodModal").modal("hide"); 927 } else { 928 alert(data.MSG); 929 } 930 }); 931 } else { 932 $("#namePaymentMethod").parent().addClass("has-error"); 933 } 934 }); 935 936 $(document).on("change", "[id='countrySelect']", function(){ 937 var name = $(this).attr("name").split("[]")[0]; 938 $("#countryAltNames"+name).html($("option:selected", this).attr("altNames")); 939 }); 940 $("[id^='wrapperCountrySelect']").each(function(){ 941 var name = $(this).find("#select").attr("name").split("[]")[0]; 942 $("#countryAltNames"+name).html($(this).find("#select option:selected").attr("altNames")); 943 }); 944 945 $("[id='openEditLanguageModal']").click(function(){ 946 var selectWrapperName = $(this).attr("selector"), 947 chosenOption = $("#" + selectWrapperName).find("#languageSelect option:selected").val(); 948 if(chosenOption != 0){ 949 $("#editLanguageModalDialog").load("/cfc/Case.cfc?method=getLanguageEditModal&id=" + chosenOption, function(){ 950 $("#editLanguageModal").modal("show"); 951 }); 952 } 953 }); 954 $(document).on("change", "[class*='selectpicker-country']", function(){ 955 var name = $(this).attr("name"); 956 $("#languageAltNames"+name).html($("option:selected", this).attr("altNames")); 957 }); 958 $("[id^='wrapperLanguageSelect']").each(function(){ 959 var name = $(this).find("#select").attr("name").split("[]")[0]; 960 $("#languageAltNames"+name).html($(this).find("#select option:selected").attr("altNames")); 961 }); 962 $("#addLanguage").click(function(){ 963 var errors = false; 964 if($.trim($("#nameLanguage").val()) != ""){ 965 $.getJSON("/cfc/Case.cfc?method=addLanguage", $("#addLanguageForm").serialize(), function(data){ 966 if(data.SUCCESS){ 967 $("[id^='wrapperLanguageSelect']").each(function(){ 968 var languageId = $(this).find("#select option:selected").val(), 969 name = $(this).find("#select").attr("name"), 970 label = $(this).find("label").html(); 971 if(languageId == -1) languageId = ""; 972 $(this).load("/cfc/Case.cfc?method=getLanguageSelect&id=" + languageId + "&name=" + name + "&label=" + encodeURIComponent(label)); 973 }); 974 $("#addLanguageModal").modal("hide"); 975 } else { 976 alert(data.MSG); 977 } 978 }); 979 } else { 980 $("#nameLanguage").parent().addClass("has-error"); 981 } 982 }); 983 984 $("#addTextType").click(function(){ 985 986 var errors = false; 987 if($.trim($("#textTypeName").val()) != ""){ 988 $.getJSON("/cfc/Case.cfc?method=addTextType", $("#addTextTypeForm").serialize(), function(data){ 989 if(data.SUCCESS){ 990 $("[id^='wrapperTextTypeSelect']").each(function(){ 991 var textTypeId = $(this).find("#select option:selected").val(), 992 name = $(this).find("#select").attr("name"), 993 label = $(this).find("label").html(); 994 if(textTypeId == -1) textTypeId = ""; 995 $(this).load("/cfc/Case.cfc?method=getTextTypeSelect&id=" + textTypeId + "&name=" + name + "&label=" + encodeURIComponent(label)); 996 }); 997 $("#textTypeName").val("") 998 $("#addTextTypeModal").modal("hide"); 999 } else { 1000 alert(data.MSG); 1001 } 1002 }); 1003 } else { 1004 $("#textTypeName").parent().addClass("has-error"); 1005 } 1006 }); 1007 1008 $(document).on("click", "[id='openEditApplicableModal']", function(){ 1009 var selectWrapperName = $(this).attr("selector"), 1010 chosenOption = $("#" + selectWrapperName).find("#applicableSelect option:selected").val(); 1011 if(chosenOption != 0){ 1012 $("#editApplicableModalDialog").load("/cfc/Case.cfc?method=getApplicableEditModal&id=" + chosenOption, function(){ 1013 $("#editApplicableModal").modal("show"); 1014 }); 1015 } 1016 }); 1017 $("#addApplicable").click(function(){ 1018 var errors = false; 1019 if($.trim($("#nameApplicable").val()) != ""){ 1020 $.getJSON("/cfc/Case.cfc?method=addApplicable", $("#addApplicableForm").serialize(), function(data){ 1021 if(data.SUCCESS){ 1022 $("[id^='wrapperApplicableSelect']").each(function(){ 1023 var id = $(this).find("#select option:selected").val(), 1024 name = $(this).find("#select").attr("name"), 1025 label = $(this).find("label").html(); 1026 if(id == 0) id = ""; 1027 $(this).load("/cfc/Case.cfc?method=getApplicableSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1028 });
1029 $("#addApplicableModal").modal("hide"); 1030 } else { 1031 alert(data.MSG); 1032 } 1033 }); 1034 } else { 1035 $("#nameApplicable").parent().addClass("has-error"); 1036 } 1037 }); 1038 1039 // Limitation Convention applicable: mirror of #addApplicable (uses cisg_limitationApplicable) 1040 $("#addLimitationApplicable").click(function(){ 1041 var errors = false; 1042 if($.trim($("#nameLimitationApplicable").val()) != ""){ 1043 $.getJSON("/cfc/Case.cfc?method=addLimitationApplicable", $("#addLimitationApplicableForm").serialize(), function(data){ 1044 if(data.SUCCESS){ 1045 $("[id^='wrapperLimitationApplicableSelect']").each(function(){ 1046 var id = $(this).find("#select option:selected").val(), 1047 name = $(this).find("#select").attr("name"), 1048 label = $(this).find("label").html(); 1049 if(id == 0) id = ""; 1050 $(this).load("/cfc/Case.cfc?method=getLimitationApplicableSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1051 }); 1052 $("#addLimitationApplicableModal").modal("hide"); 1053 } else { 1054 alert(data.MSG); 1055 } 1056 }); 1057 } else { 1058 $("#nameLimitationApplicable").parent().addClass("has-error"); 1059 } 1060 }); 1061 1062 $(document).on("click", "[id='openEditDecisionDealsWithModal']", function(){ 1063 var selectWrapperName = $(this).attr("selector"), 1064 chosenOption = $("#" + selectWrapperName).find("#decisionDealsWithSelect option:selected").val(); 1065 if(chosenOption != 0){ 1066 $("#editDecisionDealsWithModalDialog").load("/cfc/Case.cfc?method=getDecisionDealsWithEditModal&id=" + chosenOption, function(){ 1067 $("#editDecisionDealsWithModal").modal("show"); 1068 }); 1069 } 1070 }); 1071 $("#addDecisionDealsWith").click(function(){ 1072 var errors = false; 1073 if($.trim($("#nameDecisionDealsWith").val()) != ""){ 1074 $.getJSON("/cfc/Case.cfc?method=addDecisionDealsWith", $("#addDecisionDealsWithForm").serialize(), function(data){ 1075 if(data.SUCCESS){ 1076 $("[id^='wrapperDecisionDealsWithSelect']").each(function(){ 1077 var id = $(this).find("#select option:selected").val(), 1078 name = $(this).find("#select").attr("name"), 1079 label = $(this).find("label").html(); 1080 if(id == 0) id = ""; 1081 $(this).load("/cfc/Case.cfc?method=getDecisionDealsWithSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1082 }); 1083 $("#addDecisionDealsWithModal").modal("hide"); 1084 } else { 1085 alert(data.MSG); 1086 } 1087 }); 1088 } else { 1089 $("#nameDecisionDealsWith").parent().addClass("has-error"); 1090 } 1091 }); 1092 1093 $(document).on("click", "[id='openEditSupplementaryLawModal']", function(){ 1094 var selectWrapperName = $(this).attr("selector"), 1095 chosenOption = $("#" + selectWrapperName).find("#supplementaryLawSelect option:selected").val(); 1096 if(chosenOption != 0){ 1097 $("#editSupplementaryLawModalDialog").load("/cfc/Case.cfc?method=getSupplementaryLawEditModal&id=" + chosenOption, function(){ 1098 $("#editSupplementaryLawModal").modal("show"); 1099 }); 1100 } 1101 }); 1102 $("#addSupplementaryLaw").click(function(){ 1103 var errors = false; 1104 if($.trim($("#nameSupplementaryLaw").val()) != ""){ 1105 $.getJSON("/cfc/Case.cfc?method=addSupplementaryLaw", $("#addSupplementaryLawForm").serialize(), function(data){ 1106 if(data.SUCCESS){ 1107 $("[id^='wrapperSupplementaryLaw']").each(function(){ 1108 var id = $(this).find("#select option:selected").val(), 1109 name = $(this).find("#select").attr("name"), 1110 label = $(this).find("label").html(); 1111 if(id == 0) id = ""; 1112 $(this).load("/cfc/Case.cfc?method=getSupplementaryLawSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1113 }); 1114 $("#addSupplementaryLawModal").modal("hide"); 1115 } else { 1116 alert(data.MSG); 1117 } 1118 }); 1119 } else { 1120 $("#nameSupplementaryLaw").parent().addClass("has-error"); 1121 } 1122 }); 1123 1124 $(document).on("click", "#openEditChamberModal", function(){ 1125 if($("#chamberSelect option:selected").val() != 0){ 1126 $("#editChamberModalDialog").load("/cfc/Case.cfc?method=getChamberEditModal&id=" + $("#chamberSelect option:selected").val(), function(){ 1127 $("#editChamberModal").modal("show"); 1128 }); 1129 } 1130 }); 1131 $("#addChamber").click(function(){ 1132 var errors = false; 1133 if($.trim($("#nameChamber").val()) != ""){ 1134 $.getJSON("/cfc/Case.cfc?method=addChamber", $("#addChamberForm").serialize(), function(data){ 1135 if(data.SUCCESS){ 1136 $("[id^='wrapperChamberSelect']").each(function(){ 1137 var id = $(this).find("#select option:selected").val(), 1138 name = $(this).find("#select").attr("name"), 1139 label = $(this).find("label").html(); 1140 if(id == 0) id = ""; 1141 $(this).load("/cfc/Case.cfc?method=getChamberSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1142 });
1143 $("#addChamberModal").modal("hide"); 1144 } else { 1145 alert(data.MSG); 1146 } 1147 }); 1148 } else { 1149 $("#nameChamber").parent().addClass("has-error"); 1150 } 1151 }); 1152 1153 $(document).on("click", "[id='openEditContractTypeModal']", function(){ 1154 var selectWrapperName = $(this).attr("selector"), 1155 chosenOption = $("#" + selectWrapperName).find("#contractTypeSelect option:selected").val(); 1156 if(chosenOption != 0){ 1157 $("#editContractTypeModalDialog").load("/cfc/Case.cfc?method=getContractTypeEditModal&id=" + chosenOption, function(){ 1158 $("#editContractTypeModal").modal("show"); 1159 }); 1160 } 1161 }); 1162 $("#addContractType").click(function(){ 1163 var errors = false; 1164 if($.trim($("#nameContractType").val()) != ""){ 1165 $.getJSON("/cfc/Case.cfc?method=addContractType", $("#addContractTypeForm").serialize(), function(data){ 1166 if(data.SUCCESS){ 1167 $("[id^='wrapperContractTypeSelect']").each(function(){ 1168 var id = $(this).find("#select option:selected").val(), 1169 name = $(this).find("#select").attr("name"), 1170 label = $(this).find("label").html(); 1171 $(this).load("/cfc/Case.cfc?method=getContractTypeSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1172 }); 1173 $("#addContractTypeModal").modal("hide"); 1174 } else { 1175 alert(data.MSG); 1176 } 1177 }); 1178 } else { 1179 $("#nameContractType").parent().addClass("has-error"); 1180 } 1181 }); 1182 1183 // INCOTERMS 1184 $("#addIncoTerm").click(function () { 1185 var errors = false; 1186 if ($.trim($("#nameIncoTerm").val()) != "") { 1187 $.getJSON("/cfc/Case.cfc?method=addIncoTerm", $("#addIncoTermForm").serialize(), function (data) { 1188 if (data.SUCCESS) { 1189 $("[id^='wrapperIncoTermSelect']").each(function () { 1190 var id = $(this).find("#select option:selected").val(), 1191 name = $(this).find("#select").attr("name"), 1192 label = $(this).find("label").html(); 1193 $(this).load("/cfc/Case.cfc?method=getIncoTermSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1194 }); 1195 $("#addIncoTermModal").modal("hide"); 1196 } else { 1197 alert(data.MSG); 1198 } 1199 }); 1200 } else { 1201 $("#nameIncoTerm").parent().addClass("has-error"); 1202 } 1203 });
1204 $("#addIncoRule").click(function () { 1205 var errors = false; 1206 if ($.trim($("#nameIncoRule").val()) != "") { 1207 $.getJSON("/cfc/Case.cfc?method=addIncoRule", $("#addIncoRuleForm").serialize(), function (data) { 1208 if (data.SUCCESS) { 1209 $("[id^='wrapperIncoRuleSelect']").each(function () { 1210 var id = $(this).find("#select option:selected").val(), 1211 name = $(this).find("#select").attr("name"), 1212 label = $(this).find("label").html(); 1213 $(this).load("/cfc/Case.cfc?method=getIncoRuleSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1214 }); 1215 $("#addIncoRuleModal").modal("hide"); 1216 } else { 1217 alert(data.MSG); 1218 } 1219 }); 1220 } else { 1221 $("#nameIncoRule").parent().addClass("has-error"); 1222 } 1223 }); 1224 $("#addIncoLocation").click(function () { 1225 var errors = false; 1226 if ($.trim($("#nameIncoLocation").val()) != "") { 1227 $.getJSON("/cfc/Case.cfc?method=addIncoLocation", $("#addIncoLocationForm").serialize(), function (data) { 1228 if (data.SUCCESS) { 1229 $("[id^='wrapperIncoLocationSelect']").each(function () { 1230 var id = $(this).find("#select option:selected").val(), 1231 name = $(this).find("#select").attr("name"), 1232 label = $(this).find("label").html(); 1233 $(this).load("/cfc/Case.cfc?method=getIncoLocationSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1234 }); 1235 $("#addIncoLocationModal").modal("hide"); 1236 } else { 1237 alert(data.MSG); 1238 } 1239 }); 1240 } else { 1241 $("#nameIncoLocation").parent().addClass("has-error"); 1242 } 1243 }); 1244 $("#addIncoCategory").click(function () { 1245 var errors = false; 1246 if ($.trim($("#nameIncoCategory").val()) != "") { 1247 $.getJSON("/cfc/Case.cfc?method=addIncoCategory", $("#addIncoCategoryForm").serialize(), function (data) { 1248 if (data.SUCCESS) { 1249 $("[id^='wrapperIncoCategorySelect']").each(function () { 1250 var id = $(this).find("#select option:selected").val(), 1251 name = $(this).find("#select").attr("name"), 1252 label = $(this).find("label").html(); 1253 $(this).load("/cfc/Case.cfc?method=getIncoCategorySelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1254 }); 1255 $("#addIncoCategoryModal").modal("hide"); 1256 } else { 1257 alert(data.MSG); 1258 } 1259 }); 1260 } else { 1261 $("#nameIncoCategory").parent().addClass("has-error"); 1262 } 1263 }); 1264 1265 $(document).on("click", "[id='openEditScholarModal']", function(){ 1266 var selectWrapperName = $(this).attr("selector"), 1267 chosenOption = $("#" + selectWrapperName).find("#scholarSelect option:selected").val(); 1268 if(chosenOption != 0){ 1269 $("#editScholarModalDialog").load("/cfc/Case.cfc?method=getScholarEditModal&id=" + chosenOption, function(){ 1270 $("#editScholarModal").modal("show"); 1271 }); 1272 } 1273 }); 1274 $("#addScholar").click(function(){ 1275 var errors = false; 1276 if($.trim($("#nameScholar").val()) != ""){ 1277 $.getJSON("/cfc/Case.cfc?method=addScholar", $("#addScholarForm").serialize(), function(data){ 1278 if(data.SUCCESS){ 1279 $("[id^='wrapperScholarSelect']").each(function(){ 1280 var id = $(this).find("#select option:selected").val(), 1281 name = $(this).find("#select").attr("name"), 1282 label = $(this).find("label").html(); 1283 $(this).load("/cfc/Case.cfc?method=getScholarSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1284 }); 1285 $("#addScholarModal").modal("hide"); 1286 } else { 1287 alert(data.MSG); 1288 } 1289 }); 1290 } else { 1291 $("#nameScholar").parent().addClass("has-error"); 1292 } 1293 }); 1294 1295 $(document).on("click", "[id='openEditRequestTypeModal']", function(){ 1296 var selectWrapperName = $(this).attr("selector"), 1297 chosenOption = $("#" + selectWrapperName).find("#requestTypeSelect option:selected").val(); 1298 if(chosenOption != 0){ 1299 $("#editRequestTypeModalDialog").load("/cfc/Case.cfc?method=getRequestTypeEditModal&id=" + chosenOption, function(){ 1300 $("#editRequestTypeModal").modal("show"); 1301 }); 1302 } 1303 }); 1304 $("#addRequestType").click(function(){ 1305 var errors = false; 1306 if($.trim($("#nameRequestType").val()) != ""){ 1307 $.getJSON("/cfc/Case.cfc?method=addRequestType", $("#addRequestTypeForm").serialize(), function(data){ 1308 if(data.SUCCESS){ 1309 $("[id^='wrapperRequestTypeSelect']").each(function(){ 1310 var id = $(this).find("#select option:selected").val(), 1311 name = $(this).find("#select").attr("name"), 1312 label = $(this).find("label").html(); 1313 $(this).load("/cfc/Case.cfc?method=getRequestTypeSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1314 });
1315 $("#addRequestTypeModal").modal("hide"); 1316 } else { 1317 alert(data.MSG); 1318 } 1319 }); 1320 } else { 1321 $("#nameRequestType").parent().addClass("has-error"); 1322 } 1323 }); 1324 1325 $(document).on("click", "[id='openEditCitedInModal']", function(){ 1326 var selectWrapperName = $(this).attr("selector"), 1327 chosenOption = $("#" + selectWrapperName).find("#citedInSelect option:selected").val(); 1328 if(chosenOption != 0){ 1329 $("#editCitedInModalDialog").load("/cfc/Case.cfc?method=getCitedInEditModal&id=" + chosenOption, function(){ 1330 $("#editCitedInModal").modal("show"); 1331 }); 1332 } 1333 }); 1334 $("#addCitedIn").click(function(){ 1335 var errors = false; 1336 if($.trim($("#nameCitedIn").val()) != ""){ 1337 $.getJSON("/cfc/Case.cfc?method=addCitedIn", $("#addCitedInForm").serialize(), function(data){ 1338 if(data.SUCCESS){ 1339 $("[id^='wrapperCitedInSelect']").each(function(){ 1340 var id = $(this).find("#select option:selected").val(), 1341 name = $(this).find("#select").attr("name"), 1342 label = $(this).find("label").html(); 1343 $(this).load("/cfc/Case.cfc?method=getCitedInSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1344 }); 1345 $("#addCitedInModal").modal("hide"); 1346 } else { 1347 alert(data.MSG); 1348 } 1349 }); 1350 } else { 1351 $("#nameCitedIn").parent().addClass("has-error"); 1352 } 1353 }); 1354 1355 $(document).on("click", "[id='openEditPartyRoleModal']", function(){ 1356 var selectWrapperName = $(this).attr("selector"), 1357 chosenOption = $("#" + selectWrapperName).find("#partyRoleSelect option:selected").val(); 1358 if(chosenOption != 0){ 1359 $("#editPartyRoleModalDialog").load("/cfc/Case.cfc?method=getPartyRoleEditModal&id=" + chosenOption, function(){ 1360 $("#editPartyRoleModal").modal("show"); 1361 }); 1362 } 1363 }); 1364 $("#addPartyRole").click(function(){ 1365 var errors = false; 1366 if($.trim($("#namePartyRole").val()) != ""){ 1367 $.getJSON("/cfc/Case.cfc?method=addPartyRole", $("#addPartyRoleForm").serialize(), function(data){ 1368 if(data.SUCCESS){ 1369 $("[id^='wrapperPartyRoleSelect']").each(function(){ 1370 var id = $(this).find("#select option:selected").val(), 1371 name = $(this).find("#select").attr("name"), 1372 label = $(this).find("label").html(); 1373 $(this).load("/cfc/Case.cfc?method=getPartyRoleSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1374 }); 1375 $("#addPartyRoleModal").modal("hide"); 1376 } else { 1377 alert(data.MSG); 1378 } 1379 }); 1380 } else { 1381 $("#namePartyRole").parent().addClass("has-error"); 1382 } 1383 }); 1384 1385 $(document).on("click", "[id='openEditFurtherInfoDecisionModal']", function(){ 1386 var selectWrapperName = $(this).attr("selector"), 1387 chosenOption = $("#" + selectWrapperName).find("#furtherInfoDecisionSelect option:selected").val(); 1388 if(chosenOption != 0){ 1389 $("#editFurtherInfoDecisionModalDialog").load("/cfc/Case.cfc?method=getFurtherInfoDecisionEditModal&id=" + chosenOption, function(){ 1390 $("#editFurtherInfoDecisionModal").modal("show"); 1391 }); 1392 } 1393 }); 1394 $("#addFurtherInfoDecision").click(function(){ 1395 var errors = false; 1396 if($.trim($("#nameFurtherInfoDecision").val()) != ""){ 1397 $.getJSON("/cfc/Case.cfc?method=addFurtherInfoDecision", $("#addFurtherInfoDecisionForm").serialize(), function(data){ 1398 if(data.SUCCESS){ 1399 $("[id^='wrapperFurtherInfoDecision']").each(function(){ 1400 var id = $(this).find("#select option:selected").val(), 1401 name = $(this).find("#select").attr("name"), 1402 label = $(this).find("label").html(); 1403 if(id == 0) id = ""; 1404 $(this).load("/cfc/Case.cfc?method=getFurtherInfoDecisionSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1405 }); 1406 $("#addFurtherInfoDecisionModal").modal("hide"); 1407 } else { 1408 alert(data.MSG); 1409 } 1410 }); 1411 } else { 1412 $("#nameFurtherInfoDecision").parent().addClass("has-error"); 1413 } 1414 }); 1415 1416 $(document).on("click", "[id='openEditLegalBasisModal']", function(){ 1417 var selectWrapperName = $(this).attr("selector"), 1418 chosenOption = $("#" + selectWrapperName).find("#legalBasisSelect option:selected").val(); 1419 if(chosenOption != 0){ 1420 $("#editLegalBasisModalDialog").load("/cfc/Case.cfc?method=getLegalBasisEditModal&id=" + chosenOption, function(){ 1421 $("#editLegalBasisModal").modal("show"); 1422 }); 1423 } 1424 }); 1425 $("#addLegalBasis").click(function(){ 1426 var errors = false; 1427 if($.trim($("#nameLegalBasis").val()) != ""){ 1428 $.getJSON("/cfc/Case.cfc?method=addLegalBasis", $("#addLegalBasisForm").serialize(), function(data){ 1429 if(data.SUCCESS){ 1430 $("[id^='wrapperLegalBasis']").each(function(){ 1431 var id = $(this).find("#select option:selected").val(), 1432 name = $(this).find("#select").attr("name"), 1433 label = $(this).find("label").html(); 1434 if(id == 0) id = ""; 1435 $(this).load("/cfc/Case.cfc?method=getLegalBasisSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1436 });
1437 $("#addLegalBasisModal").modal("hide"); 1438 } else { 1439 alert(data.MSG); 1440 } 1441 }); 1442 } else { 1443 $("#nameLegalBasis").parent().addClass("has-error"); 1444 } 1445 }); 1446 1447 $(document).on("click", "[id='openEditHistoryDescriptionModal']", function(){ 1448 var selectWrapperName = $(this).attr("selector"), 1449 chosenOption = $("#" + selectWrapperName).find("#historyDescriptionSelect option:selected").val(); 1450 if(chosenOption != 0){ 1451 $("#editHistoryDescriptionModalDialog").load("/cfc/Case.cfc?method=getHistoryDescriptionEditModal&id=" + chosenOption, function(){ 1452 $("#editHistoryDescriptionModal").modal("show"); 1453 }); 1454 } 1455 }); 1456 $("#addHistoryDescription").click(function(){ 1457 var errors = false; 1458 if($.trim($("#nameHistoryDescription").val()) != ""){ 1459 $.getJSON("/cfc/Case.cfc?method=addHistoryDescription", $("#addHistoryDescriptionForm").serialize(), function(data){ 1460 if(data.SUCCESS){ 1461 $("[id^='wrapperHistoryDescription']").each(function(){ 1462 var id = $(this).find("#select option:selected").val(), 1463 name = $(this).find("#select").attr("name"), 1464 label = $(this).find("label").html(); 1465 if(id == 0) id = ""; 1466 $(this).load("/cfc/Case.cfc?method=getHistoryDescriptionSelect&name=" + name + "&label=" + encodeURIComponent(label) + "&id=" + id); 1467 }); 1468 $("#addHistoryDescriptionModal").modal("hide"); 1469 } else { 1470 alert(data.MSG); 1471 } 1472 }); 1473 } else { 1474 $("#nameHistoryDescription").parent().addClass("has-error"); 1475 } 1476 }); 1477 1478 1479 $("#addClaimantToForm").click(function(){ 1480 $.get("/cfc/Case.cfc?method=getInputForClaimants", function(data){ 1481 $("#claimantsWrapper").append(data); 1482 }); 1483 }); 1484 $(document).on("click", "[id='removeClaimantFromForm']", function(e){ 1485 e.preventDefault(); 1486 $("#claimantPart" + $(this).attr("partId")).remove(); 1487 }); 1488 1489 $("#addRespondantToForm").click(function(){ 1490 $.get("/cfc/Case.cfc?method=getInputForRespondants", function(data){ 1491 $("#respondantsWrapper").append(data); 1492 }); 1493 }); 1494 $(document).on("click", "[id='removeRespondantFromForm']", function(e){ 1495 e.preventDefault(); 1496 $("#respondantPart" + $(this).attr("partId")).remove(); 1497 }); 1498 1499 $("#addBuyerSellerToForm").click(function(){ 1500 $.get("/cfc/Case.cfc?method=getInputForBuyerSeller", function(data){ 1501 $("#buyerSellerWrapper").append(data); 1502 }); 1503 }); 1504 $(document).on("click", "[id='removeBuyerSellerFromForm']", function(e){ 1505 e.preventDefault(); 1506 $("#buyerSellerPart" + $(this).attr("partId")).remove(); 1507 }); 1508 1509 $("#addClaimToForm").click(function(){ 1510 $.get("/cfc/Case.cfc?method=getInputForClaim", function(data){ 1511 $("#claimWrapper").append(data); 1512 }); 1513 }); 1514 $(document).on("click", "[id='removeClaimFromForm']", function(e){ 1515 e.preventDefault(); 1516 $("#claimPart" + $(this).attr("partId")).remove(); 1517 }); 1518 1519 $("#addCounterClaimToForm").click(function(){ 1520 $.get("/cfc/Case.cfc?method=getInputForCounterClaim", function(data){ 1521 $("#counterClaimWrapper").append(data); 1522 }); 1523 }); 1524 $(document).on("click", "[id='removeCounterClaimFromForm']", function(e){ 1525 e.preventDefault(); 1526 $("#counterClaimPart" + $(this).attr("partId")).remove(); 1527 }); 1528 1529 $("#addJournalCommentToForm").click(function(){ 1530 $.get("/cfc/Case.cfc?method=getIputForJournalComment", function(data){ 1531 $("#journalCommentWrapper").append(data); 1532 }); 1533 }); 1534 $(document).on("click", "[id='removeJournalCommentFromForm']", function(e){ 1535 e.preventDefault(); 1536 $("#journalCommentPart" + $(this).attr("partId")).remove(); 1537 }); 1538 1539 $("#addBookCommentToForm").click(function(){ 1540 $.get("/cfc/Case.cfc?method=getIputForBookComment", function(data){ 1541 $("#bookCommentWrapper").append(data); 1542 }); 1543 }); 1544 $(document).on("click", "[id='removeBookCommentFromForm']", function(e){ 1545 e.preventDefault(); 1546 $("#bookCommentPart" + $(this).attr("partId")).remove(); 1547 }); 1548 1549 $("#addChapterCommentToForm").click(function(){ 1550 $.get("/cfc/Case.cfc?method=getInputForChapterComment", function(data){ 1551 $("#chapterCommentWrapper").append(data); 1552 }); 1553 }); 1554 $(document).on("click", "[id='removeChapterCommentFromForm']", function(e){
1555 e.preventDefault(); 1556 $("#chapterCommentPart" + $(this).attr("partId")).remove(); 1557 }); 1558 1559 $(document).on("change", "#caseHistorySelect", function(){ 1560 if($(this).val() != -1){ 1561 var caseId = $("#caseEditId").length ? $("#caseEditId").val() : ""; 1562 $("#historyDescriptionSelect option:first").html("choose to edit"); 1563 $.get("/cfc/Case.cfc?method=getCaseHistoryForBranch&rootCaseId=" + $(this).val() + "&caseId=" + caseId, function(data){ 1564 $("#caseHistoryDisplay").html(data); 1565 $("#overrideContractTabDiv").removeClass("hide"); 1566 $("#overridePartiesTabDiv").removeClass("hide"); 1567 if($("#caseIdContractOverride").val() == caseId){ 1568 $("#overrideContractAll").prop("checked", true); 1569 } else { 1570 $("#overrideContractAll").prop("checked", false); 1571 } 1572 if($("#caseIdPartiesOverride").val() == caseId){ 1573 $("#overridePartiesAll").prop("checked", true); 1574 } else { 1575 $("#overridePartiesAll").prop("checked", false); 1576 } 1577 }); 1578 } else { 1579 $("#historyDescriptionSelect option:first").html("choose option"); 1580 $("#caseHistoryDisplay").html(""); 1581 $("#overrideContractAll").prop("checked", false); 1582 $("#overrideContractTabDiv").addClass("hide"); 1583 $("#overridePartiesTabDiv").addClass("hide"); 1584 } 1585 }); 1586 //console.log("case history val: " + $("#caseHistorySelect").val()); 1587 if($("#caseHistorySelect").length && $("#caseHistorySelect").val() != -1){ 1588 var caseId = $("#caseEditId").length ? $("#caseEditId").val() : ""; 1589 $("#historyDescriptionSelect option:first").html("choose to edit"); 1590 $.get("/cfc/Case.cfc?method=getCaseHistoryForBranch&rootCaseId=" + $("#caseHistorySelect").val() + "&caseId=" + caseId, function(data){ 1591 $("#caseHistoryDisplay").html(data); 1592 $("#overrideContractTabDiv").removeClass("hide"); 1593 $("#overridePartiesTabDiv").removeClass("hide"); 1594 if($("#caseIdContractOverride").val() == caseId){ 1595 $("#overrideContractAll").prop("checked", true); 1596 } else { 1597 $("#overrideContractAll").prop("checked", false); 1598 } 1599 if($("#caseIdPartiesOverride").val() == caseId){ 1600 $("#overridePartiesAll").prop("checked", true); 1601 } else { 1602 $("#overridePartiesAll").prop("checked", false); 1603 } 1604 }); 1605 } 1606 1607 $('form#caseForm').find('input, select').each(function(){ 1608 removeErrorClass($(this)); 1609 }); 1610 1611 $("#addCisgCaseCitation").click(function(){ 1612 var idArray = $("#cisgCaseCitationsInput").val().split(","); 1613 var i = idArray.indexOf($("#cisgCaseCitationSelect").val()); 1614 if($("#cisgCaseCitationSelect").val() != 0 && i < 0){ 1615 var n = $("#cisgCaseCitationsInput").val()+","+$("#cisgCaseCitationSelect").val(); 1616 $("#cisgCaseCitationsInput").val(n); 1617 $("#cisgCaseCitationsJS2").val(n); 1618 displayCisgCitations(); 1619 } 1620 }); 1621 $(document).on("click", "[id='removeCisgCitation']", function(){ 1622 var o = $("#cisgCaseCitationsInput").val(), 1623 n = o.replace(","+$(this).attr("cisg-number"), ""); 1624 $("#cisgCaseCitationsInput").val(n); 1625 $("#cisgCaseCitationsJS3").val(n); 1626 displayCisgCitations(); 1627 }); 1628 displayCisgCitations(); 1629 1630 $("#addCisgCaseLiteratureJournal").click(function(){ 1631 1632console.log("BOOOO") 1633 //var array = $("#cisgCaseLiteratureJournalsInput").val() === '' ? [] : JSON.parse($("#cisgCaseLiteratureJournalsInput").val()); 1634 1635 // var i = array.find((el) => el.jid !== $("#cisgLiteratureJournalCaseSelect").val()) 1636 1637 // if($("#cisgLiteratureJournalCaseSelect").val() != 0 && i < 0){ 1638 // var n = $("#cisgCaseLiteratureJournalsInput").val()+","+$("#cisgLiteratureJournalCaseSelect").val(); 1639 // $("#cisgCaseLiteratureJournalsInput").val(n); 1640 // displayCisgCaseLiteratureJournal(); 1641 // } 1642 }); 1643 $(document).on("click", "[id='removeCisgCaseLiteratureJournal']", function(){ 1644 // var o = $("#cisgCaseLiteratureJournalsInput").val(), 1645 // n = o.replace(","+$(this).attr("id-number"), ""); 1646 // $("#cisgCaseLiteratureJournalsInput").val(n); 1647 // displayCisgCaseLiteratureJournal(); 1648 }); 1649 // displayCisgCaseLiteratureJournal(); 1650 $("#addCisgCaseLiteratureBook").click(function(){ 1651 var idArray = $("#cisgCaseLiteratureBooksInput").val().split(","); 1652 var i = idArray.indexOf($("#cisgLiteratureBooksCaseSelect").val()) 1653 if($("#cisgLiteratureBooksCaseSelect").val() != 0 && i < 0){ 1654 var n = $("#cisgCaseLiteratureBooksInput").val()+","+$("#cisgLiteratureBooksCaseSelect").val(); 1655 $("#cisgCaseLiteratureBooksInput").val(n); 1656 displayCisgCaseLiteratureBook(); 1657 } 1658 }); 1659 $(document).on("click", "[id='removeCisgCaseLiteratureBook']", function(){ 1660 var o = $("#cisgCaseLiteratureBooksInput").val(), 1661 n = o.replace(","+$(this).attr("id-number"), ""); 1662 $("#cisgCaseLiteratureBooksInput").val(n); 1663 displayCisgCaseLiteratureBook(); 1664 }); 1665 displayCisgCaseLiteratureBook(); 1666 $("#addCisgCaseLiteratureBookChapter").click(function(){ 1667 var idArray = $("#cisgCaseLiteratureBookChaptersInput").val().split(","); 1668 var i = idArray.indexOf($("#cisgLiteratureBookChaptersCaseSelect").val()) 1669 if($("#cisgLiteratureBookChaptersCaseSelect").val() != 0 && i < 0){ 1670 var n = $("#cisgCaseLiteratureBookChaptersInput").val()+","+$("#cisgLiteratureBookChaptersCaseSelect").val(); 1671 $("#cisgCaseLiteratureBookChaptersInput").val(n); 1672 displayCisgCaseLiteratureBookChapter(); 1673 } 1674 }); 1675 $(document).on("click", "[id='removeCisgCaseLiteratureBookChapter']", function(){ 1676 var o = $("#cisgCaseLiteratureBookChaptersInput").val(), 1677 n = o.replace(","+$(this).attr("id-number"), ""); 1678 $("#cisgCaseLiteratureBookChaptersInput").val(n); 1679 displayCisgCaseLiteratureBookChapter(); 1680 }); 1681 displayCisgCaseLiteratureBookChapter(); 1682 1683 1684 $(document).on("click", "[id^='cisgCaseCitationBadge_']", function(e){
1685 if($(e.target).hasClass("badge")){ 1686 $.getJSON("/cfc/Case.cfc?method=getCaseInfo&caseId=" + $(this).attr("id").split("_")[1], function(data){ 1687 if(data.HASCASE){ 1688 $("#showCaseInfoModalDialog").html(data.MODAL); 1689 $("#showCaseInfoModal").modal("show"); 1690 } 1691 }); 1692 } 1693 }); 1694 1695 $("#userPageLink").html($("#scholarSelect :selected").attr("page-link")); 1696 $(document).on("change", "#scholarSelect", function(){ 1697 $("#userPageLink").html($(":selected", this).attr("page-link")); 1698 }); 1699 1700 $(document).on("change", "[id='partyRoleSelect']", function(){ 1701 if($("option:selected", this).html() == "Buyer" && $("#buyersCountry").length){ 1702 $("#wrapperCountrySelectClaimant" + $(this).closest("[id^='wrapperPartyRoleSelect']").attr("id").split("wrapperPartyRoleSelect")[1]).find("#countrySelect").selectpicker("val", $("#buyersCountry").attr("value")); 1703 } else if($("option:selected", this).html() == "Seller" && $("#sellersCountry").length){ 1704 $("#wrapperCountrySelectClaimant" + $(this).closest("[id^='wrapperPartyRoleSelect']").attr("id").split("wrapperPartyRoleSelect")[1]).find("#countrySelect").selectpicker("val", $("#sellersCountry").attr("value")); 1705 } else { 1706 $("#wrapperCountrySelectClaimant" + $(this).closest("[id^='wrapperPartyRoleSelect']").attr("id").split("wrapperPartyRoleSelect")[1]).find("#countrySelect").selectpicker("val", -1); 1707 } 1708 }); 1709 1710 $("#addCaseBtn").click(function(){ 1711 $(".nav-tabs").find("li").removeClass("has-error"); 1712 var noErrors = true; 1713 $('form#caseForm').find('input, select').each(function(){ 1714 if($(this).prop('required')){ 1715 var hasError = false; 1716 if($(this).is(":radio") && !$("[name="+$(this).attr("name")+"]").is(":checked")) hasError = true; 1717 if(($(this).val()) == "" || $(this).val() == -1) hasError = true; 1718 if(hasError){ 1719 var tab = $(this).closest(".tab-pane").attr("id"); 1720 $("li[role='" + tab + "']").addClass("has-error"); 1721 $(this).closest(".form-group").addClass("has-error"); 1722 noErrors = false; 1723 } 1724 } 1725 }); 1726 1727 if(!checkHasCurrencyLitigation()) noErrors = false; 1728 if(!checkHasCurrencyGoodsPrice()) noErrors = false; 1729 // if(!checkHasCurrencyClaim()) noErrors = false; 1730 // if(!checkHasCurrencyCounterClaim()) noErrors = false; 1731 if(!checkHasCurrencyCosts()) noErrors = false; 1732 if(!checkHasCurrencyClaimGranted()) noErrors = false; 1733 if(!checkHasCurrencyCounterClaimGranted()) noErrors = false; 1734 1735 if(noErrors){ 1736 // make all empty array inputs have at least an hyphen string 1737 $("[id^='issue'], [id^='special1'], [id^='special2'], [id^='pincite_start_'], [id^='pincite_end_'], [id^='start_no_'], [id^='end_no_'], [id='year'], [id='volume'], [id^='claimSum'], [id^='relatedCaseDescription'], [id^='costOfLitigation'], [id^='counterClaimSum'], [id='startPageNumber'], [id='author'], [id='title'], [id='goodsPrice'], [id='endPageNumber'], [id^='claimantName'], [id^='claimantRoleContractDefinition'], [id^='respondantName'], [id^='respondantRoleContractDefinition'], [id^='buyerSellerName'], [id^='buyerSellerRoleContractDefinition'], [id^='claimBasis'], [id^='counterClaimBasis'], [id^='abstractsCreator'], [id^='fullTextCreator'], [id^='translationCreator'], [id^='fileName']").each(function(){ 1738 if($(this).val() == "") $(this).val("-"); 1739 }); 1740 1741 $("#cisgCaseCitationsInput").val($("#cisgCaseCitationsInput").val().slice(0,-1)); 1742 1743 // sanitize inputs for commas 1744 $("[id^='relatedCaseDescription'], [id^='claimantName'], [name='commentTitle[]'], [id^='respondantName'], [id^='buyerSellerName']").each(function(){ 1745 $(this).val($(this).val().replace(/,/g, "*")); 1746 }); 1747 1748 // create form obj with all form input fields 1749 var form = $('#caseForm')[0]; 1750 var data = new FormData(form); 1751 1752 // add files to form 1753 var abstractAmount = 0; 1754 $("[id^='abstractPart']").each(function(){ 1755 var fileField = $(this).find("#abstractsFile"), 1756 creatorVal = $(this).find("#abstractsCreator").val().replace(/,/g , "*"), 1757 langVal = $(this).find("#select").val(), 1758 isClout = $(this).find("#abstractsCaseFilesIsClout:checked").val(); 1759 if(fileField.get(0).files.length === 0){ 1760 console.log("NO FILE"); 1761 } else {
1762 abstractAmount++; 1763 data.append("abstractsCaseFiles_" + abstractAmount, fileField[0].files[0], fileField[0].files[0].name); 1764 data.append("abstractsCaseFilesCreator[]", creatorVal); 1765 data.append("abstractsCaseFilesLang[]", langVal); 1766 data.append("abstractsCaseFilesIsClout[]", isClout); 1767 } 1768 }); 1769 data.append("abstractsCaseFilesAmount", abstractAmount); 1770 var fullTextAmount = 0; 1771 $("[id^='fullTextPart']").each(function(){ 1772 var fileField = $(this).find("#fullTextFile"), 1773 creatorVal = $(this).find("#fullTextCreator").val().replace(/,/g , "*"), 1774 langVal = $(this).find("#select").val(); 1775 if(fileField.get(0).files.length === 0){ 1776 console.log("NO FILE"); 1777 } else { 1778 fullTextAmount++; 1779 data.append("fullTextCaseFiles_" + fullTextAmount, fileField[0].files[0], fileField[0].files[0].name); 1780 data.append("fullTextCaseFilesCreator[]", creatorVal); 1781 data.append("fullTextCaseFilesLang[]", langVal); 1782 } 1783 }); 1784 data.append("fullTextCaseFilesAmount", fullTextAmount); 1785 var translationAmount = 0; 1786 $("[id^='translationPart']").each(function(){ 1787 var fileField = $(this).find("#translationFile"), 1788 creatorVal = $(this).find("#translationCreator").val().replace(/,/g , "*"), 1789 langVal = $(this).find("#select").val(); 1790 if(fileField.get(0).files.length === 0){ 1791 console.log("NO FILE"); 1792 } else { 1793 translationAmount++; 1794 data.append("translationCaseFiles_" + translationAmount, fileField[0].files[0], fileField[0].files[0].name); 1795 data.append("translationCaseFilesCreator[]", creatorVal); 1796 data.append("translationCaseFilesLang[]", langVal); 1797 } 1798 }); 1799 data.append("translationCaseFilesAmount", translationAmount); 1800 1801 var remarkAmount = 0; 1802 $("[id^='remarkPart']").each(function(){ 1803 var fileField = $(this).find("#remarkFile"); 1804 if(fileField.get(0).files.length === 0){ 1805 console.log("NO FILE"); 1806 } else { 1807 remarkAmount++; 1808 data.append("remarkCaseFiles_" + remarkAmount, fileField[0].files[0], fileField[0].files[0].name); 1809 } 1810 }); 1811 data.append("remarkCaseFilesAmount", remarkAmount); 1812 1813 $("[id^='commentPart']").each(function(){ 1814 var fileField = $(this).find("#commentFile"), 1815 partId = $(this).find("#partid"); 1816 if(fileField.get(0).files.length === 0){ 1817 console.log("NO FILE"); 1818 data.append("commentCaseHasFile[]", 0); 1819 } else { 1820 data.append("commentCaseFiles_" + partId, fileField[0].files[0], fileField[0].files[0].name); 1821 data.append("commentCaseHasFile[]", 1); 1822 } 1823 }); 1824 $("[id^='commentBookPart']").each(function(){ 1825 var fileField = $(this).find("#commentBookFile"), 1826 partId = $(this).find("#partid"); 1827 if(fileField.get(0).files.length === 0){ 1828 console.log("NO FILE"); 1829 data.append("commentBookCaseHasFile[]", 0); 1830 } else { 1831 data.append("commentBookCaseFiles_" + partId, fileField[0].files[0], fileField[0].files[0].name); 1832 data.append("commentBookCaseHasFile[]", 1); 1833 } 1834 }); 1835 1836 var xhr = new XMLHttpRequest(); 1837 1838 xhr.onload = function(e){ 1839 if (xhr.status === 200){ 1840 var res = JSON.parse(this.responseText); 1841 console.log("JSON RESPONSE: " + JSON.stringify(res)); 1842 console.log("UPLOADED"); 1843 $("#caseUploadInfoDialog").html(res.MODAL); 1844 $("#caseUploadInfo").modal("show"); 1845 } else { 1846 console.log("ERROR: " + JSON.stringify(e)); 1847 } 1848 }; 1849 xhr.onprogress = function(e){ 1850 console.log("Progress: " + e.loaded); 1851 console.log("Total: " + e.total); 1852 }; 1853 1854 xhr.open("POST", "/cfc/Case.cfc?method=addCaseToDb"); 1855 1856 xhr.send(data); 1857 } else { 1858 $('html,body').animate({ scrollTop: 0 }); 1859 } 1860 1861 }); 1862 1863 $("#editCaseBtn").click(function(){ 1864 $(".nav-tabs").find("li").removeClass("has-error"); 1865 var noErrors = true; 1866 $('form#caseForm').find('input, select').each(function(){ 1867 if($(this).prop('required')){ 1868 var hasError = false; 1869 if($(this).is(":radio") && !$("[name="+$(this).attr("name")+"]").is(":checked")) hasError = true; 1870 if(($(this).val()) == "" || $(this).val() == -1) hasError = true; 1871 if(hasError){ 1872 var tab = $(this).closest(".tab-pane").attr("id"); 1873 $("li[role='" + tab + "']").addClass("has-error"); 1874 $(this).closest(".form-group").addClass("has-error"); 1875 noErrors = false; 1876 } 1877 } 1878 }); 1879 1880 if(!checkHasCurrencyLitigation()) noErrors = false; 1881 if(!checkHasCurrencyGoodsPrice()) noErrors = false; 1882 // if(!checkHasCurrencyClaim()) noErrors = false; 1883 // if(!checkHasCurrencyCounterClaim()) noErrors = false; 1884 if(!checkHasCurrencyCosts()) noErrors = false; 1885 if(!checkHasCurrencyClaimGranted()) noErrors = false; 1886 if(!checkHasCurrencyCounterClaimGranted()) noErrors = false; 1887 1888 if(noErrors){ 1889 // make all empty array inputs have at least an empty string
1890 $("[id^='issue'], [id^='special1'], [id^='special2'], [id^='pincite_start_'], [id^='pincite_end_'], [id^='start_no_'], [id^='end_no_'], [id='year'], [id='volume'], [id^='claimSum'], [id^='relatedCaseDescription'], [id^='costOfLitigation'], [id^='counterClaimSum'], [id='startPageNumber'], [id='author'], [id='title'], [id='goodsPrice'], [id='endPageNumber'], [id^='claimantName'], [id^='claimantRoleContractDefinition'], [id^='respondantName'], [id^='respondantRoleContractDefinition'], [id^='buyerSellerName'], [id^='buyerSellerRoleContractDefinition'], [id^='claimBasis'], [id^='counterClaimBasis'], [id^='abstractsCreator'], [id^='fullTextCreator'], [id^='translationCreator'], [id^='fileName']").each(function(){ 1891 if($(this).val() == "") $(this).val("-"); 1892 }); 1893 1894 console.log("NO ERRORS -> SEND FORM"); 1895 1896 // sanitize inputs for commas 1897 $("[id^='relatedCaseDescription'], [id^='claimantName'], [name='commentTitle[]'], [id^='respondantName'], [id^='buyerSellerName']").each(function(){ 1898 $(this).val($(this).val().replace(/,/g, "*")); 1899 }); 1900 1901 // create form obj with all form input fields 1902 var form = $('#caseForm')[0]; 1903 var data = new FormData(form); 1904 1905 // add files to form 1906 var abstractAmount = 0; 1907 $("[id^='abstractPart']").each(function(){ 1908 var fileField = $(this).find("#abstractsFile"), 1909 creatorVal = $(this).find("#abstractsCreator").val().replace(/,/g , "*"), 1910 langVal = $(this).find("#select").val(), 1911 fileID = $(this).find("#fileId").val(), 1912 fileName = $(this).find("#fileName").val(), 1913 isClout = $(this).find("#abstractsCaseFilesIsClout").is(":checked") ? 1 : 0; 1914 if(fileField.get(0).files.length === 0 && fileID == 0){ 1915 console.log("Abstract: NO FILE"); 1916 } else { 1917 abstractAmount++; 1918 if(fileField.get(0).files.length){ 1919 data.append("abstractsCaseFiles_" + abstractAmount, fileField[0].files[0], fileField[0].files[0].name); 1920 } else { 1921 data.append("abstractsCaseFiles_" + abstractAmount, 1234); 1922 } 1923 data.append("abstractsCaseFilesCreator[]", creatorVal); 1924 data.append("abstractsCaseFilesLang[]", langVal); 1925 data.append("abstractsCaseFilesType[]", 1); 1926 data.append("abstractsCaseFilesId[]", fileID); 1927 data.append("abstractsCaseFilesName[]", fileName); 1928 data.append("abstractsCaseFilesIsClout[]", isClout); 1929 } 1930 }); 1931 data.append("abstractsCaseFilesAmount", abstractAmount); 1932 var fullTextAmount = 0; 1933 $("[id^='fullTextPart']").each(function(){ 1934 var fileField = $(this).find("#fullTextFile"), 1935 creatorVal = $(this).find("#fullTextCreator").val().replace(/,/g , "*"), 1936 langVal = $(this).find("#select").val(), 1937 fileID = $(this).find("#fileId").val(), 1938 fileName = $(this).find("#fileName").val(); 1939 1940 if(fileField.get(0).files.length === 0 && fileID == 0){ 1941 console.log("NO FILE"); 1942 } else { 1943 fullTextAmount++; 1944 if(fileField.get(0).files.length){ 1945 data.append("fullTextCaseFiles_" + fullTextAmount, fileField[0].files[0], fileField[0].files[0].name); 1946 } else { 1947 data.append("fullTextCaseFiles_" + fullTextAmount, 1234); 1948 } 1949 data.append("fullTextCaseFilesCreator[]", creatorVal); 1950 data.append("fullTextCaseFilesLang[]", langVal); 1951 data.append("fullTextCaseFilesType[]", 2); 1952 data.append("fullTextCaseFilesId[]", fileID); 1953 data.append("fullTextCaseFilesName[]", fileName); 1954 } 1955 }); 1956 data.append("fullTextCaseFilesAmount", fullTextAmount); 1957 var translationAmount = 0; 1958 $("[id^='translationPart']").each(function(){ 1959 var fileField = $(this).find("#translationFile"), 1960 creatorVal = $(this).find("#translationCreator").val().replace(/,/g , "*"), 1961 langVal = $(this).find("#select").val(), 1962 fileID = $(this).find("#fileId").val(), 1963 fileName = $(this).find("#fileName").val(); 1964 1965 if(fileField.get(0).files.length === 0 && fileID == 0){ 1966 console.log("NO FILE"); 1967 } else { 1968 translationAmount++; 1969 if(fileField.get(0).files.length){ 1970 data.append("translationCaseFiles_" + translationAmount, fileField[0].files[0], fileField[0].files[0].name); 1971 } else { 1972 data.append("translationCaseFiles_" + translationAmount, 1234); 1973 } 1974 data.append("translationCaseFilesCreator[]", creatorVal); 1975 data.append("translationCaseFilesLang[]", langVal); 1976 data.append("translationCaseFilesType[]", 3); 1977 data.append("translationCaseFilesId[]", fileID); 1978 data.append("translationCaseFilesName[]", fileName); 1979 } 1980 }); 1981 data.append("translationCaseFilesAmount", translationAmount); 1982 var remarkAmount = 0; 1983 $("[id^='remarkPart']").each(function(){ 1984 var fileField = $(this).find("#remarkFile"), 1985 fileID = $(this).find("#fileId").val(), 1986 fileName = $(this).find("#fileName").val(); 1987 1988 if(fileField.get(0).files.length === 0 && fileID == 0){ 1989 console.log("NO FILE"); 1990 } else { 1991 remarkAmount++; 1992 if(fileField.get(0).files.length){ 1993 data.append("remarkCaseFiles_" + remarkAmount, fileField[0].files[0], fileField[0].files[0].name); 1994 } else { 1995 data.append("remarkCaseFiles_" + remarkAmount, 1234); 1996 } 1997 data.append("remarkCaseFilesType[]", 4); 1998 data.append("remarkCaseFilesId[]", fileID); 1999 data.append("remarkCaseFilesName[]", fileName); 2000 } 2001 }); 2002 data.append("remarkCaseFilesAmount", remarkAmount); 2003 2004 $("[id^='commentPart']").each(function(){ 2005 var fileField = $(this).find("#commentFile"), 2006 partId = $(this).find("#partId").val(); 2007 if(fileField.get(0).files.length === 0){ 2008 data.append("commentCaseHasFile[]", 0); 2009 } else { 2010 data.append("commentCaseFiles_" + partId, fileField[0].files[0], fileField[0].files[0].name); 2011 data.append("commentCaseHasFile[]", 1); 2012 } 2013 }); 2014 2015 $("[id^='commentBookPart']").each(function(){ 2016 var fileField = $(this).find("#commentBookFile"), 2017 partId = $(this).find("#partid"); 2018 if(fileField.get(0).files.length === 0){ 2019 console.log("NO FILE"); 2020 data.append("commentBookCaseHasFile[]", 0); 2021 } else { 2022 data.append("commentBookCaseFiles_" + partId, fileField[0].files[0], fileField[0].files[0].name); 2023 data.append("commentBookCaseHasFile[]", 1); 2024 } 2025 }); 2026 2027 var xhr = new XMLHttpRequest(); 2028 2029 xhr.onload = function(e){
2030 if (xhr.status === 200){ 2031 var res = JSON.parse(this.responseText); 2032 $("#caseUploadInfoDialog").html(res.MODAL); 2033 $("#caseUploadInfo").modal("show"); 2034 } 2035 }; 2036 xhr.onprogress = function(e){ 2037 // console.log("Progress: " + e.loaded); 2038 // console.log("Total: " + e.total); 2039 }; 2040 2041 console.log(JSON.stringify(data)); 2042 2043 xhr.open("POST", "/cfc/Case.cfc?method=editCase"); 2044 2045 xhr.send(data); 2046 } else { 2047 $('html,body').animate({ scrollTop: 0 }); 2048 } 2049 2050 }); 2051 2052 $(".nav-tabs li").click(function(){ 2053 $(this).removeClass("has-error"); 2054 }) 2055 2056 $("#deleteCaseBtn").click(function(){ 2057 $.getJSON("/cfc/Case.cfc?method=deleteCase&caseId=" + $("#caseEditId").val(), function(data){ 2058 $("[class*='modal']").modal("hide"); 2059 $("#showCaseInfoModalDialog").html(data.MODAL); 2060 $("#showCaseInfoModal").modal("show"); 2061 }); 2062 }); 2063 2064 2065 /* search for case */ 2066 function sortNumbering(){ 2067 var c = 1; 2068 $("[id='sortPill']").each(function(e){ 2069 $(this).find("#orderNumber").remove(); 2070 if($(this).hasClass("active")){ 2071 $(this).prepend("<span id='orderNumber' class='order-number'>"+c+"</span>"); 2072 c++; 2073 } 2074 }); 2075 } 2076 if(localStorage.showAdmin){ 2077 if(localStorage.showAdmin == "hide"){ 2078 $("#adminPanel").addClass("hide"); 2079 } 2080 } 2081 $("[data-has-content='adminPanel']").click(function(){ 2082 if($("#adminPanel").hasClass("hide")){ 2083 localStorage.showAdmin = ""; 2084 } else { 2085 localStorage.showAdmin = "hide"; 2086 } 2087 }) 2088 $("#searchLast5").click(function(){ 2089 var orderBy = ""; 2090 $("#sortPill").each(function(){ 2091 console.log("each pill"); 2092 if($(this).hasClass("active")){ 2093 console.log("add to sort"); 2094 orderBy += $(this).attr("order-by")+"-"+$(this).attr("order-direction")+","; 2095 } 2096 }); 2097 getSearchResults({ 2098 orderBy: orderBy, 2099 searchLastFive: $(this).attr("number"), 2100 rotator: "searchRotator5", 2101 isAdmin: $(this).attr("is-admin") 2102 }); 2103 }); 2104 $("#searchHighRelevance").click(function(){ 2105 var orderBy = ""; 2106 $("#sortPill").each(function(){ 2107 console.log("each pill"); 2108 if($(this).hasClass("active")){ 2109 console.log("add to sort"); 2110 orderBy += $(this).attr("order-by")+"-"+$(this).attr("order-direction")+","; 2111 } 2112 }); 2113 getSearchResults({ 2114 orderBy: orderBy, 2115 searchHighRelevance: 1, 2116 rotator: "searchRotatorHighRelevance", 2117 isAdmin: $(this).attr("is-admin") 2118 }); 2119 }); 2120 $("#searchHighDifficulty").click(function(){ 2121 var orderBy = ""; 2122 $("#sortPill").each(function(){ 2123 console.log("each pill"); 2124 if($(this).hasClass("active")){ 2125 console.log("add to sort"); 2126 orderBy += $(this).attr("order-by")+"-"+$(this).attr("order-direction")+","; 2127 } 2128 }); 2129 getSearchResults({ 2130 orderBy: orderBy, 2131 searchHighDifficulty: 1, 2132 rotator: "searchRotatorHighDifficulty", 2133 isAdmin: $(this).attr("is-admin") 2134 }); 2135 }); 2136 $("#logoutAdmin").click(function(){ 2137 $.getJSON("/cfc/Case.cfc?method=adminLogout", { 2138 isAdmin: $(this).attr("is-admin"), 2139 userId: $(this).attr("user-id") 2140 }, 2141 function(data){ 2142 if(data.SUCCESS){ 2143 location.reload(false); 2144 } 2145 }); 2146 }); 2147 $(document).on("click touchend", "[id^='searchCaseRow_']", function(e){ 2148 var sel = getSelection().toString(); 2149 if(!dragging && !sel){ 2150 console.log(e.target.id) 2151 if (e.target.id !== 'searchOpenBlank') { 2152 location.href = "/search-for-cases?caseId=" + $(this).attr("id").split("_")[1]; 2153 } 2154 } 2155 }); 2156 $(document).on("click touchend", "[id^='searchCaseRowAdmin_']", function(){ 2157 var sel = getSelection().toString(); 2158 if(!dragging && !sel){ 2159 location.href = "case-admin?command=edit&caseId=" + $(this).attr("id").split("_")[1]; 2160 } 2161 }); 2162 $("#searchForm").keypress(function(e){ 2163 if(e.which == 13){ 2164 var data = "", 2165 orderBy = ""; 2166 $("#sortPill").each(function(){ 2167 console.log("each pill"); 2168 if($(this).hasClass("active")){ 2169 console.log("add to sort"); 2170 orderBy += $(this).attr("order-by")+"-"+$(this).attr("order-direction")+","; 2171 } 2172 }); 2173 $("#searchForm input, #searchForm select").each(function(){ 2174 if($(this).attr("name") != undefined){ 2175 if ($(this).attr('type') == 'checkbox') { 2176 if ($(this).is(':checked')) { 2177 data += "&"+$(this).attr("name")+"="+encodeURIComponent($(this).val()); 2178 } 2179 } else { 2180 data += "&"+$(this).attr("name")+"="+encodeURIComponent($(this).val()); 2181 } 2182 } 2183 }); 2184 getSearchResults({ 2185 orderBy: orderBy, 2186 searchForm: data, 2187 rotator: "searchRotator", 2188 isAdmin: $("#isAdmin").val() 2189 }); 2190 } 2191 }); 2192 $("#searchFormBtn").click(function(){ 2193 var data = "", 2194 orderBy = ""; 2195 $("[id='sortPill']").each(function(){ 2196 if($(this).hasClass("active")){ 2197 orderBy += $(this).attr("order-by")+"-"+$(this).attr("order-direction")+","; 2198 } 2199 }); 2200 $("#searchForm input, #searchForm select, #searchForm textarea").each(function(){ 2201 if($(this).attr("name") != undefined){ 2202 if ($(this).attr("type") != "checkbox") { 2203 data += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val()); 2204 } else { 2205 if ($(this).is(":checked")) { 2206 data += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val()); 2207 } 2208 } 2209 } 2210 });
2211 getSearchResults({ 2212 orderBy: orderBy, 2213 searchForm: data, 2214 rotator: "searchRotator", 2215 isAdmin: $("#isAdmin").val() 2216 }); 2217 }); 2218 $("#clearSearchForm").click(function () { 2219 $("#searchForm select").each(function () { 2220 $(this).selectpicker("val", 0) 2221 }); 2222 $("#dateOfDecision_Full").html(""); 2223 $("#searchForm").trigger("reset"); 2224 $("#cisgProvisionsCitedType").selectpicker("val", "keyCisgProvisionsIA,keyCisgProvisionsInterpreted,keyCisgProvisionsApplied,cisgProvisionsNotCited") 2225 $("#limitationProvisionsCitedType").selectpicker("val", "keyLimitationProvisionsIA,keyLimitationProvisionsInterpreted,keyLimitationProvisionsApplied,limitationProvisionsNotCited") 2226 $("#languageType").selectpicker("val", "1,2,3") 2227 pageUp() 2228 }); 2229 2230 $("#sortList").sortable({ 2231 start: function(e, ui){ 2232 $(ui.item).addClass("sorting"); 2233 $(ui.placeholder).addClass("sorted"); 2234 sorting = true; 2235 }, 2236 stop: function(e, ui){ 2237 $(ui.item).removeClass("sorting"); 2238 $(ui.placeholder).removeClass("sorted"); 2239 sorting = false; 2240 sortNumbering(); 2241 } 2242 }); 2243 2244 $("body").on("touchmove", function(){ 2245 dragging = true; 2246 }); 2247 $("body").on("touchstart", function(){ 2248 dragging = false; 2249 }); 2250 2251 $("[id='sortPill']").on("mouseup", function(e){ 2252 if(!sorting){ 2253 if(!$(e.target).hasClass("sort-pill")){ 2254 $(this).find(".fa").toggleClass("fa-rotate-180"); 2255 $(this).attr("order-direction", $(this).attr("order-direction") == "ASC" ? "DESC" : "ASC"); 2256 } else { 2257 if($(this).hasClass("active")){ 2258 $(this).removeClass("active"); 2259 } else { 2260 $(this).addClass("active"); 2261 } 2262 sortNumbering(); 2263 } 2264 } 2265 }); 2266 2267 /* display case */ 2268 $(document).on('click', '[data-has-content]', function (e) { 2269 if (!$(e.target).hasClass("is-link")) { 2270 $(this).toggleClass("active"); 2271 $(this).find("i.fa-arrow-down").toggleClass("fa-rotate-180"); 2272 $("[data-is-content='" + $(this).attr("data-has-content") + "']").toggleClass("hide"); 2273 } 2274 }) 2275 $(document).on("click", "#pageUp", function(){ 2276 pageUp() 2277 }); 2278 2279 $("#btnArbitral").click(function(){ 2280 $("[id='arbitral']").each(function(){ 2281 console.log("BSA") 2282 $(this).toggleClass("hidden"); 2283 }); 2284 }) 2285 2286}); 2287
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.