trigger form change upon copy-data event
This commit is contained in:
@@ -48,10 +48,10 @@ export default class KimaiCopyDataForm extends KimaiFormPlugin {
|
||||
if (element.dataset.event !== undefined) {
|
||||
for (const event of element.dataset.event.split(' ')) {
|
||||
target.dispatchEvent(new Event(event));
|
||||
}
|
||||
} else if (element.dataset.eventBubbles !== undefined) {
|
||||
for (const event of element.dataset.eventBubbles.split(' ')) {
|
||||
target.dispatchEvent(new Event(event, {bubbles: true}));
|
||||
const form = target.closest('form');
|
||||
if (form !== null) {
|
||||
form.dispatchEvent(new Event(event));
|
||||
}
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
public/build/app.dd395c1d.js
Normal file
2
public/build/app.dd395c1d.js
Normal file
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@
|
||||
"app": {
|
||||
"js": [
|
||||
"/build/runtime.74179306.js",
|
||||
"/build/app.06423747.js"
|
||||
"/build/app.dd395c1d.js"
|
||||
],
|
||||
"css": [
|
||||
"/build/app.6bd98062.css"
|
||||
@@ -72,7 +72,7 @@
|
||||
},
|
||||
"integrity": {
|
||||
"/build/runtime.74179306.js": "sha384-OC1hTNUXUalKJcvmzrZ0TMCOIwnhxCxgG9dQkbcwR7WcBBCkl2H8bs3giiT2pAwG",
|
||||
"/build/app.06423747.js": "sha384-9bVxz1eOxdhs+XNwJ6Ug4/crO0CrQlWs1FDYQ1xF14LpFIZjuVO65YohHT3KWreU",
|
||||
"/build/app.dd395c1d.js": "sha384-OMqLzNbXe5Dx/gPoy67bNHWTehw5vz1UYQ0GsfRwpaokM+MwBRymwkC4MT28rkjz",
|
||||
"/build/app.6bd98062.css": "sha384-BB9TrvQK/jlfhbdISEdBH5ZaZvbrPnZ+AcocXs1uQNh2yIQFboslUY9Up3iqnY4h",
|
||||
"/build/app-rtl.97153087.js": "sha384-jX7jRUAa8rH29Eg8jLIUKGfGcOT6RBz/P90plXmZPadf2CXKUBdcNGrspaejCHkr",
|
||||
"/build/app-rtl.6a14a027.css": "sha384-ZmUAtO0Z/WfjYxJNleP3rBJpDmAnbaTlFMtejV/YpsshxkqmyNUneCIos9uMX7kH",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"build/app.css": "/build/app.6bd98062.css",
|
||||
"build/app.js": "/build/app.06423747.js",
|
||||
"build/app.js": "/build/app.dd395c1d.js",
|
||||
"build/app-rtl.css": "/build/app-rtl.6a14a027.css",
|
||||
"build/app-rtl.js": "/build/app-rtl.97153087.js",
|
||||
"build/export-pdf.css": "/build/export-pdf.d8a6c23b.css",
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
{% set yearInt = year|date_format('Y') %}
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-left btn-icon" href="#" data-toggle="tooltip" data-placement="top" title="{{ previousYear|date_short }}"
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ previousYear|report_date }}" data-event-bubbles="change">
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ previousYear|report_date }}" data-event="change">
|
||||
{{ icon('left') }}
|
||||
</a>
|
||||
{% if show_range %}
|
||||
@@ -298,12 +298,12 @@
|
||||
<ul class="dropdown-menu dropdown-menu-start pre-scrollable">
|
||||
{% for i in (yearInt - 5)..(yearInt + 5) %}
|
||||
{% set tmpYear = report_date(i) %}
|
||||
<li><a href="#" data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ tmpYear|report_date }}" data-event-bubbles="change" class="dropdown-item">{{ tmpYear|date_format('Y') }}</a></li>
|
||||
<li><a href="#" data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ tmpYear|report_date }}" data-event="change" class="dropdown-item">{{ tmpYear|date_format('Y') }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<a class="btn btn-right btn-icon" href="#" data-toggle="tooltip" data-placement="top" title="{{ nextYear|date_short }}"
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ nextYear|report_date }}" data-event-bubbles="change">
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ nextYear|report_date }}" data-event="change">
|
||||
{{ icon('right') }}
|
||||
</a>
|
||||
</div>
|
||||
@@ -314,14 +314,14 @@
|
||||
{% block monthpicker_widget -%}
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-left btn-icon" href="#" data-toggle="tooltip" data-placement="top" title="{{ previousMonth|month_name(true) }}"
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ previousMonth|report_date }}" data-event-bubbles="change">
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ previousMonth|report_date }}" data-event="change">
|
||||
{{ icon('left') }}
|
||||
</a>
|
||||
<a class="btn" href="#" onclick="return false;">
|
||||
<span id="{{ form.vars.id }}_month_name">{{ month|month_name(true) }}</span>
|
||||
</a>
|
||||
<a class="btn btn-right btn-icon" href="#" data-toggle="tooltip" data-placement="top" title="{{ nextMonth|month_name(true) }}"
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ nextMonth|report_date }}" data-event-bubbles="change">
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ nextMonth|report_date }}" data-event="change">
|
||||
{{ icon('right') }}
|
||||
</a>
|
||||
</div>
|
||||
@@ -332,7 +332,7 @@
|
||||
{% block weekpicker_widget -%}
|
||||
<div class="btn-group week-picker-btn-group {{ attr.class ?? '' }}">
|
||||
<a class="btn btn-left btn-icon" href="#" data-toggle="tooltip" data-placement="top" title="{{ 'stats.workingTimeWeek'|trans({'%week%': previousWeek|date_format('W')}) }}"
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ previousWeek|report_date }}" data-event-bubbles="change">
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ previousWeek|report_date }}" data-event="change">
|
||||
{{ icon('left') }}
|
||||
</a>
|
||||
<a class="btn btn-default" href="#" onclick="return false;">
|
||||
@@ -343,7 +343,7 @@
|
||||
</span>
|
||||
</a>
|
||||
<a class="btn btn-right btn-icon" href="#" data-toggle="tooltip" data-placement="top" title="{{ 'stats.workingTimeWeek'|trans({'%week%': nextWeek|date_format('W')}) }}"
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ nextWeek|report_date }}" data-event-bubbles="change">
|
||||
data-form-widget="copy-data" data-target="#{{ form.vars.id }}" data-value="{{ nextWeek|report_date }}" data-event="change">
|
||||
{{ icon('right') }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user