You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

73 lines
2.3 KiB

import { end } from '@popperjs/core'
import ApplicationController from './application_controller'
export default class extends ApplicationController {
static targets = ["input"]
connect () {
super.connect()
}
search () {
var $this = this
$.get("/api/jurisprudences.json", { q: $this.inputTarget.value }, function (data, status) {
if (status === "success") {
$this.stimulate("DocumentReflex#render_index_table", data, $this.element.dataset["documentId"], $this.element.dataset["doctrineId"])
}
});
}
modalDocumentSearch () {
var $this = this
$.get("/api/jurisprudences.json", { q: $this.inputTarget.value }, function (data, status) {
if (status === "success") {
$this.stimulate("DocumentReflex#render_modal_document_search_table", data)
}
});
}
loadYears () {
var $this = this
$.get("/api/jurisprudences/years.json", {}, function (data, status) {
if (status === "success") {
$this.stimulate("DocumentReflex#render_years", data)
}
});
}
loadFormDocumentDetais () {
var document_id = "", document_title = "", document_ref_no = "", document_date_or_year = "", $modal = $("#newAnnotationModal")
document_id = this.element.dataset["documentId"]
document_title = this.element.dataset["documentTitle"]
document_ref_no = this.element.dataset["documentReferenceNumber"]
document_date_or_year = this.element.dataset["documentDateOrYear"]
$modal.find("#document_title").val([document_title, document_ref_no, document_date_or_year].join(", "))
$modal.find("#document_id").val(document_id)
}
addCitingDocument () {
var document_id = "", document_ref_no = "", $modal = $("#newAnnotationModal"), $doc_title = $modal.find("#document_title")
document_id = this.element.dataset["documentId"]
document_ref_no = this.element.dataset["documentReferenceNumber"]
var document_ids = []
console.log($("#document_ids").val() === "")
if ($("#document_ids").val() === "") {
document_ids.push(document_id)
} else {
document_ids = $("#document_ids").val().split(",")
document_ids.push(document_id)
}
$("#document_ids").val(document_ids.join(","))
var doc_title = $doc_title.val()
$doc_title.val(doc_title + " citing " + document_ref_no)
}
}