diff --git a/assets/js/plugins/KimaiAjaxModalForm.js b/assets/js/plugins/KimaiAjaxModalForm.js index 5533f882..d4ce8037 100644 --- a/assets/js/plugins/KimaiAjaxModalForm.js +++ b/assets/js/plugins/KimaiAjaxModalForm.js @@ -89,9 +89,6 @@ export default class KimaiAjaxModalForm extends KimaiClickHandlerReducedInTableR jQuery(html).find('#form_modal .modal-content') ); - // TODO these should be handled with Events, probably using Custom Events - // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events - // activate new loaded widgets self.getContainer().getPlugin('date-time-picker').activateDateTimePicker(formIdentifier); self.getContainer().getPlugin('autocomplete').activateAutocomplete(formIdentifier + " .js-autocomplete"); diff --git a/assets/js/plugins/KimaiDatatable.js b/assets/js/plugins/KimaiDatatable.js index 2668c9a4..6f9a523e 100644 --- a/assets/js/plugins/KimaiDatatable.js +++ b/assets/js/plugins/KimaiDatatable.js @@ -47,7 +47,6 @@ export default class KimaiDatatable extends KimaiPlugin { } reloadDatatable() { - // FIXME remove query const durations = this.getContainer().getPlugin('timesheet-duration'); const form = jQuery('.toolbar form'); let loading = '
'; diff --git a/assets/js/plugins/KimaiSelectDataAPI.js b/assets/js/plugins/KimaiSelectDataAPI.js index a0ccaa0a..06e8fd40 100644 --- a/assets/js/plugins/KimaiSelectDataAPI.js +++ b/assets/js/plugins/KimaiSelectDataAPI.js @@ -67,10 +67,44 @@ export default class KimaiSelectDataAPI extends KimaiPlugin { select.append(''); } - jQuery.each(data, function(i, obj) { - select.append(''); + const options = {}; + for (const apiData of data) { + let title = apiData.parentTitle; + if (title === null) { + title = '__empty__'; + } + if (!options.hasOwnProperty(title)) { + options[title] = []; + } + options[title].push(apiData); + } + + const ordered = {}; + Object.keys(options).sort().forEach(function(key) { + ordered[key] = options[key]; }); + let htmlOptions = ''; + let emptyOptions = ''; + + for (const [key, value] of Object.entries(ordered)) { + if (key === '__empty__') { + for (const entity of value) { + emptyOptions += ''; + } + continue; + } + + htmlOptions += ''; + for (const entity of value) { + htmlOptions += ''; + } + htmlOptions += ''; + } + + select.append(htmlOptions); + select.append(emptyOptions); + // if we don't trigger the change, the other selects won't be resetted select.trigger('change'); diff --git a/config/serializer/App/Entity.Activity.yml b/config/serializer/App/Entity.Activity.yml index 445f7ce6..3e688996 100644 --- a/config/serializer/App/Entity.Activity.yml +++ b/config/serializer/App/Entity.Activity.yml @@ -35,6 +35,11 @@ App\Entity\Activity: metaFields: exclude: true virtual_properties: + parentTitle: + serialized_name: parentTitle + include: true + exp: "object.getProject() === null ? null : object.getProject().getName()" + groups: [Default] getProject: serialized_name: project exp: "object.getProject() === null ? null : object.getProject().getId()" diff --git a/config/serializer/App/Entity.Project.yml b/config/serializer/App/Entity.Project.yml index 25a17e30..d997ec7c 100644 --- a/config/serializer/App/Entity.Project.yml +++ b/config/serializer/App/Entity.Project.yml @@ -33,6 +33,11 @@ App\Entity\Project: metaFields: exclude: true virtual_properties: + parentTitle: + serialized_name: parentTitle + include: true + exp: "object.getCustomer() === null ? null : object.getCustomer().getName()" + groups: [Default] getCustomer: serialized_name: customer exp: "object.getCustomer() === null ? null : object.getCustomer().getId()" diff --git a/public/build/app.0ac6f178.js b/public/build/app.0ac6f178.js deleted file mode 100644 index d5d2b798..00000000 --- a/public/build/app.0ac6f178.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["app"],{"+2oP":function(t,e,n){"use strict";var i=n("I+eb"),o=n("hh1v"),s=n("6LWA"),r=n("I8vh"),a=n("UMSQ"),l=n("/GqU"),c=n("hBjN"),u=n("Hd5f"),d=n("tiKp")("species"),h=[].slice,f=Math.max;i({target:"Array",proto:!0,forced:!u("slice")},{slice:function(t,e){var n,i,u,p=l(this),m=a(p.length),g=r(t,m),v=r(void 0===e?m:e,m);if(s(p)&&("function"!=typeof(n=p.constructor)||n!==Array&&!s(n.prototype)?o(n)&&null===(n=n[d])&&(n=void 0):n=void 0,n===Array||void 0===n))return h.call(p,g,v);for(i=new(void 0===n?Array:n)(f(v-g,0)),u=0;g")}),u=!s(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]});t.exports=function(t,e,n,d){var h=r(t),f=!s(function(){var e={};return e[h]=function(){return 7},7!=""[t](e)}),p=f&&!s(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[l]=function(){return n}),n[h](""),!e});if(!f||!p||"replace"===t&&!c||"split"===t&&!u){var m=/./[h],g=n(h,""[t],function(t,e,n,i,o){return e.exec===a?f&&!o?{done:!0,value:m.call(e,n,i)}:{done:!0,value:t.call(n,e,i)}:{done:!1}}),v=g[0],b=g[1];o(String.prototype,t,v),o(RegExp.prototype,h,2==e?function(t,e){return b.call(t,this,e)}:function(t){return b.call(t,this)}),d&&i(RegExp.prototype[h],"sham",!0)}}},"1E5z":function(t,e,n){var i=n("m/L8").f,o=n("UTVS"),s=n("tiKp")("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,s)&&i(t,s,{configurable:!0,value:e})}},"1Wo5":function(t,e,n){(function(t){var e=n("EVdn");t.$=t.jQuery=e,n("VSY+"),n("Onkx"),n("DPhY");var i=n("wd/R");t.moment=i,n("tGlX"),n("bpih"),n("nyYc"),n("iYuL"),n("lXzo"),n("jnO4"),n("WxRl"),n("0tRk"),n("X709"),n("B55N"),n("eHjp"),n("+jAj"),n("Qiut"),n("vh7O"),n("WySY"),t.$.AdminLTE={},t.$.AdminLTE.options={},n("qG+3"),n("NlKh"),n("zcCC"),n("9/yf")}).call(this,n("yLpj"))},"2B1R":function(t,e,n){"use strict";var i=n("I+eb"),o=n("P0SU"),s=n("Hd5f"),r=o(1);i({target:"Array",proto:!0,forced:!s("map")},{map:function(t){return r(this,t,arguments[1])}})},"2oRo":function(t,e,n){(function(e){var n="object",i=function(t){return t&&t.Math==Math&&t};t.exports=i(typeof globalThis==n&&globalThis)||i(typeof window==n&&window)||i(typeof self==n&&self)||i(typeof e==n&&e)||Function("return this")()}).call(this,n("yLpj"))},"33Wh":function(t,e,n){var i=n("yoRg"),o=n("eDl+");t.exports=Object.keys||function(t){return i(t,o)}},"3UD+":function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},"3bBZ":function(t,e,n){var i=n("2oRo"),o=n("/byt"),s=n("4mDm"),r=n("X2U+"),a=n("tiKp"),l=a("iterator"),c=a("toStringTag"),u=s.values;for(var d in o){var h=i[d],f=h&&h.prototype;if(f){if(f[l]!==u)try{r(f,l,u)}catch(t){f[l]=u}if(f[c]||r(f,c,d),o[d])for(var p in s)if(f[p]!==s[p])try{r(f,p,s[p])}catch(t){f[p]=s[p]}}}},"4Brf":function(t,e,n){"use strict";var i=n("I+eb"),o=n("g6v/"),s=n("2oRo"),r=n("UTVS"),a=n("hh1v"),l=n("m/L8").f,c=n("6JNq"),u=s.Symbol;if(o&&"function"==typeof u&&(!("description"in u.prototype)||void 0!==u().description)){var d={},h=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof h?new u(t):void 0===t?u():u(t);return""===t&&(d[e]=!0),e};c(h,u);var f=h.prototype=u.prototype;f.constructor=h;var p=f.toString,m="Symbol(test)"==String(u("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var t=a(this)?this.valueOf():this,e=p.call(t);if(r(d,t))return"";var n=m?e.slice(7,-1):e.replace(g,"$1");return""===n?void 0:n}}),i({global:!0,forced:!0},{Symbol:h})}},"4WOD":function(t,e,n){var i=n("UTVS"),o=n("ewvW"),s=n("93I0"),r=n("4Xet"),a=s("IE_PROTO"),l=Object.prototype;t.exports=r?Object.getPrototypeOf:function(t){return t=o(t),i(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?l:null}},"4Xet":function(t,e,n){var i=n("0Dky");t.exports=!i(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},"4l63":function(t,e,n){var i=n("I+eb"),o=n("5YOQ");i({global:!0,forced:parseInt!=o},{parseInt:o})},"4mDm":function(t,e,n){"use strict";var i=n("/GqU"),o=n("RNIs"),s=n("P4y1"),r=n("afO8"),a=n("fdAy"),l=r.set,c=r.getterFor("Array Iterator");t.exports=a(Array,"Array",function(t,e){l(this,{type:"Array Iterator",target:i(t),index:0,kind:e})},function(){var t=c(this),e=t.target,n=t.kind,i=t.index++;return!e||i>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:i,done:!1}:"values"==n?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},"5YOQ":function(t,e,n){var i=n("2oRo"),o=n("WKiH"),s=n("WJkJ"),r=i.parseInt,a=/^[+-]?0[Xx]/,l=8!==r(s+"08")||22!==r(s+"0x16");t.exports=l?function(t,e){var n=o(String(t),3);return r(n,e>>>0||(a.test(n)?16:10))}:r},"5dW1":function(t,e,n){var i=n("ppGB"),o=n("HYAF");t.exports=function(t,e,n){var s,r,a=String(o(t)),l=i(e),c=a.length;return l<0||l>=c?n?"":void 0:(s=a.charCodeAt(l))<55296||s>56319||l+1===c||(r=a.charCodeAt(l+1))<56320||r>57343?n?a.charAt(l):s:n?a.slice(l,l+2):r-56320+(s-55296<<10)+65536}},"6JNq":function(t,e,n){var i=n("UTVS"),o=n("Vu81"),s=n("Bs8V"),r=n("m/L8");t.exports=function(t,e){for(var n=o(e),a=r.f,l=s.f,c=0;c",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,n,i,o=this.element[0].nodeName.toLowerCase(),s="textarea"===o,r="input"===o;this.isMultiLine=s||!r&&this._isContentEditable(this.element),this.valueMethod=this.element[s||r?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(o){if(this.element.prop("readOnly"))return e=!0,i=!0,void(n=!0);e=!1,i=!1,n=!1;var s=t.ui.keyCode;switch(o.keyCode){case s.PAGE_UP:e=!0,this._move("previousPage",o);break;case s.PAGE_DOWN:e=!0,this._move("nextPage",o);break;case s.UP:e=!0,this._keyEvent("previous",o);break;case s.DOWN:e=!0,this._keyEvent("next",o);break;case s.ENTER:this.menu.active&&(e=!0,o.preventDefault(),this.menu.select(o));break;case s.TAB:this.menu.active&&this.menu.select(o);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(o),o.preventDefault());break;default:n=!0,this._searchTimeout(o)}},keypress:function(i){if(e)return e=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||i.preventDefault());if(!n){var o=t.ui.keyCode;switch(i.keyCode){case o.PAGE_UP:this._move("previousPage",i);break;case o.PAGE_DOWN:this._move("nextPage",i);break;case o.UP:this._keyEvent("previous",i);break;case o.DOWN:this._keyEvent("next",i)}}},input:function(t){if(i)return i=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(clearTimeout(this.searching),this.close(t),this._change(t))}}),this._initSource(),this.menu=t("