import { logger } from './logger.js'; import { getNextName, createTimer } from './timer.repository.js'; const templatePath = `modules/yet-another-timer/templates/add-timer.hbs`; export class AddTimerScreen extends FormApplication { static get defaultOptions() { const defaults = super.defaultOptions; const overrides = { height: "auto", id: "yet-another-timer-add-timer", template: templatePath, title: game.i18n?.localize("YAT.status.add-timer") || "Add Timer", closeOnSubmit: false, submitOnChange: false, }; return Object.assign({}, defaults, overrides); } getData() { return { nextName: getNextName() }; } activateListeners(html) { logger.debug('Activating listeners...'); html.on('click', "[data-action]", this.#handleClick.bind(this)); logger.debug('Activated.'); } _updateObject(event, formData) { logger.debug("Adding a timer", formData, event); createTimer(formData.duration, formData.name, formData.startNow); this.close(); // also ping to update? } #handleClick(event) { logger.debug('**click**', event); const el = $(event.currentTarget); const action = el.data().action; logger.debug('handle debug on ', action); const data = $(el).parents('form'); logger.debug('Data:', data); } } export const showAddTimer = () => new AddTimerScreen().render(true);