import { Controller } from 'stimulus';

/*
 * This is an example Stimulus controller!
 *
 * Any element with a data-controller="calendar" attribute will cause
 * this controller to be executed. The name "hello" comes from the filename:
 * calendar_controller.js -> "calendar"
 *
 * Delete this file or adapt it for your use!
 */
export default class extends Controller {
    connect() {
        var modal = document.getElementById('detail-specialist');
        
        this.element.addEventListener('click', function (evn) {
            modal.dataset.specialistid = evn.target.dataset.specialistid;
            modal.dataset.filialid = evn.target.dataset.filialid;
            modal.dataset.onlinemode = evn.target.dataset.onlinemode;
            modal.dataset.docname = (evn.target.dataset.docName ?? evn.target.dataset.docname ?? '').toString();
            modal.dataset.address = (evn.target.dataset.address ?? '').toString();
            modal.dataset.comment = (evn.target.dataset.comment ?? '').toString();
            
            $(modal).modal('show');
        })
        // this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
    }
}
