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"), $doc_id = $modal.find("#document_id") document_id = this.element.dataset["documentId"] document_ref_no = this.element.dataset["documentReferenceNumber"] console.log($doc_id.val()) console.log($doc_title.val()) } }