import { Controller } from '@hotwired/stimulus'; /* * This is an example Stimulus controller! * * Any element with a data-controller="hello" attribute will cause * this controller to be executed. The name "hello" comes from the filename: * hello_controller.js -> "hello" * * Delete this file or adapt it for your use! */ export default class extends Controller { allCardsDiv; connect() { this.allCardsDiv = $('#allCardsReport .report-one'); } showModal(){ const reportId = event.params.reportid, date = event.params.date; $("#showReportModal").find('.modal-body').html( this.findReport(reportId) ); $("#showReportModal").find('.modal-title').html(date) $("#showReportModal").modal('show'); } findReport(id) { for (const allCardsDivKey of this.allCardsDiv) { const tmp = $(allCardsDivKey); if (tmp.data('report_id') === id) { return tmp; } } } }