diff --git a/assets/app.js b/assets/app.js index f7aa10d7..ad7e8f4c 100644 --- a/assets/app.js +++ b/assets/app.js @@ -93,6 +93,7 @@ require('./js/KimaiWebLoader.js'); global.KimaiPaginatedBoxWidget = require('./js/widgets/KimaiPaginatedBoxWidget').default; global.KimaiReloadPageWidget = require('./js/widgets/KimaiReloadPageWidget').default; global.KimaiCookies = require('./js/widgets/KimaiCookies').default; +global.KimaiStorage = require('./js/widgets/KimaiStorage').default; // ------ Autocomplete for tags only ------ require('jquery-ui/ui/widgets/autocomplete'); diff --git a/assets/js/widgets/KimaiStorage.js b/assets/js/widgets/KimaiStorage.js new file mode 100644 index 00000000..5927aa52 --- /dev/null +++ b/assets/js/widgets/KimaiStorage.js @@ -0,0 +1,30 @@ +/* + * This file is part of the Kimai time-tracking app. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/*! + * [KIMAI] KimaiStorage: simple wrapper to handle localStorage access + */ + +export default class KimaiStorage { + + static set(name, values) { + window.localStorage.setItem(name, JSON.stringify(values)); + } + + static get(name) { + let value = window.localStorage.getItem(name); + if (value === undefined || value === null) { + return null; + } + return JSON.parse(value); + } + + static remove(name) { + window.localStorage.removeItem(name); + } + +} diff --git a/public/build/app.07c264a7.js b/public/build/app.07c264a7.js new file mode 100644 index 00000000..18dcb6f7 --- /dev/null +++ b/public/build/app.07c264a7.js @@ -0,0 +1,2 @@ +/*! For license information please see app.07c264a7.js.LICENSE.txt */ +(self.webpackChunkkimai2=self.webpackChunkkimai2||[]).push([[143],{3752:function(e,t,n){var r=n(9755);if(void 0===r)throw new Error("AdminLTE requires jQuery");!function(e){"use strict";function t(t,n){if(this.element=t,this.options=n,this.$overlay=e(n.overlayTemplate),""===n.source)throw new Error("Source url was not defined. Please specify a url in your BoxRefresh source option.");this._setUpListeners(),this.load()}var n="lte.boxrefresh",r={source:"",params:{},trigger:".refresh-btn",content:".box-body",loadInContent:!0,responseType:"",overlayTemplate:'
',onLoadStart:function(){},onLoadDone:function(e){return e}};function i(i){return this.each((function(){var a=e(this),o=a.data(n);if(!o){var s=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,o=new t(a,s))}if("string"==typeof o){if(void 0===o[i])throw new Error("No method named "+i);o[i]()}}))}t.prototype.load=function(){this._addOverlay(),this.options.onLoadStart.call(e(this)),e.get(this.options.source,this.options.params,function(t){this.options.loadInContent&&e(this.element).find(this.options.content).html(t),this.options.onLoadDone.call(e(this),t),this._removeOverlay()}.bind(this),""!==this.options.responseType&&this.options.responseType)},t.prototype._setUpListeners=function(){e(this.element).on("click",this.options.trigger,function(e){e&&e.preventDefault(),this.load()}.bind(this))},t.prototype._addOverlay=function(){e(this.element).append(this.$overlay)},t.prototype._removeOverlay=function(){e(this.$overlay).remove()};var a=e.fn.boxRefresh;e.fn.boxRefresh=i,e.fn.boxRefresh.Constructor=t,e.fn.boxRefresh.noConflict=function(){return e.fn.boxRefresh=a,this},e(window).on("load",(function(){e('[data-widget="box-refresh"]').each((function(){i.call(e(this))}))}))}(r),function(e){"use strict";function t(e,t){this.element=e,this.options=t,this._setUpListeners()}var n="lte.boxwidget",r={animationSpeed:500,collapseTrigger:'[data-widget="collapse"]',removeTrigger:'[data-widget="remove"]',collapseIcon:"fa-minus",expandIcon:"fa-plus",removeIcon:"fa-times"},i=".box-header",a=".box-body",o=".box-footer",s=".box-tools",l="collapsed-box";function u(i){return this.each((function(){var a=e(this),o=a.data(n);if(!o){var s=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,o=new t(a,s))}if("string"==typeof i){if(void 0===o[i])throw new Error("No method named "+i);o[i]()}}))}t.prototype.toggle=function(){e(this.element).is(".collapsed-box")?this.expand():this.collapse()},t.prototype.expand=function(){var t=e.Event("expanded.boxwidget"),n=e.Event("expanding.boxwidget"),r=this.options.collapseIcon,u=this.options.expandIcon;e(this.element).removeClass(l),e(this.element).children(i+", "+a+", "+o).children(s).find("."+u).removeClass(u).addClass(r),e(this.element).children(a+", "+o).slideDown(this.options.animationSpeed,function(){e(this.element).trigger(t)}.bind(this)).trigger(n)},t.prototype.collapse=function(){var t=e.Event("collapsed.boxwidget"),n=e.Event("collapsing.boxwidget"),r=this.options.collapseIcon,u=this.options.expandIcon;e(this.element).children(i+", "+a+", "+o).children(s).find("."+r).removeClass(r).addClass(u),e(this.element).children(a+", "+o).slideUp(this.options.animationSpeed,function(){e(this.element).addClass(l),e(this.element).trigger(t)}.bind(this)).trigger(n)},t.prototype.remove=function(){var t=e.Event("removed.boxwidget"),n=e.Event("removing.boxwidget");e(this.element).slideUp(this.options.animationSpeed,function(){e(this.element).trigger(t),e(this.element).remove()}.bind(this)).trigger(n)},t.prototype._setUpListeners=function(){var t=this;e(this.element).on("click",this.options.collapseTrigger,(function(n){return n&&n.preventDefault(),t.toggle(e(this)),!1})),e(this.element).on("click",this.options.removeTrigger,(function(n){return n&&n.preventDefault(),t.remove(e(this)),!1}))};var c=e.fn.boxWidget;e.fn.boxWidget=u,e.fn.boxWidget.Constructor=t,e.fn.boxWidget.noConflict=function(){return e.fn.boxWidget=c,this},e(window).on("load",(function(){e(".box").each((function(){u.call(e(this))}))}))}(r),function(e){"use strict";function t(e,t){this.element=e,this.options=t,this.hasBindedResize=!1,this.init()}var n="lte.controlsidebar",r={controlsidebarSlide:!0},i=".control-sidebar",a='[data-toggle="control-sidebar"]',o=".control-sidebar-open",s="control-sidebar-open",l="control-sidebar-hold-transition";function u(i){return this.each((function(){var a=e(this),o=a.data(n);if(!o){var s=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,o=new t(a,s))}"string"==typeof i&&o.toggle()}))}t.prototype.init=function(){e(this.element).is(a)||e(this).on("click",this.toggle),this.fix(),e(window).resize(function(){this.fix()}.bind(this))},t.prototype.toggle=function(t){t&&t.preventDefault(),this.fix(),e(i).is(o)||e("body").is(o)?this.collapse():this.expand()},t.prototype.expand=function(){e(i).show(),this.options.controlsidebarSlide?e(i).addClass(s):e("body").addClass(l).addClass(s).delay(50).queue((function(){e("body").removeClass(l),e(this).dequeue()})),e(this.element).trigger(e.Event("expanded.controlsidebar"))},t.prototype.collapse=function(){this.options.controlsidebarSlide?e(i).removeClass(s):e("body").addClass(l).removeClass(s).delay(50).queue((function(){e("body").removeClass(l),e(this).dequeue()})),e(i).fadeOut(),e(this.element).trigger(e.Event("collapsed.controlsidebar"))},t.prototype.fix=function(){e("body").is(".layout-boxed")&&this._fixForBoxed(e(".control-sidebar-bg"))},t.prototype._fixForBoxed=function(t){t.css({position:"absolute",height:e(".wrapper").height()})};var c=e.fn.controlSidebar;e.fn.controlSidebar=u,e.fn.controlSidebar.Constructor=t,e.fn.controlSidebar.noConflict=function(){return e.fn.controlSidebar=c,this},e(document).on("click",a,(function(t){t&&t.preventDefault(),u.call(e(this),"toggle")}))}(r),function(e){"use strict";function t(e){this.element=e}var n="lte.directchat";function r(r){return this.each((function(){var i=e(this),a=i.data(n);a||i.data(n,a=new t(i)),"string"==typeof r&&a.toggle(i)}))}t.prototype.toggle=function(e){e.parents(".direct-chat").first().toggleClass("direct-chat-contacts-open")};var i=e.fn.directChat;e.fn.directChat=r,e.fn.directChat.Constructor=t,e.fn.directChat.noConflict=function(){return e.fn.directChat=i,this},e(document).on("click",'[data-widget="chat-pane-toggle"]',(function(t){t&&t.preventDefault(),r.call(e(this),"toggle")}))}(r),function(e){"use strict";function t(e){this.options=e,this.init()}var n="lte.pushmenu",r={collapseScreenSize:767,expandOnHover:!1,expandTransitionDelay:200},i='[data-toggle="push-menu"]',a=".sidebar-mini",o="sidebar-collapse",s="sidebar-open",l="sidebar-expanded-on-hover",u="expanded.pushMenu",c="collapsed.pushMenu";function d(i){return this.each((function(){var a=e(this),o=a.data(n);if(!o){var s=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,o=new t(s))}"toggle"===i&&o.toggle()}))}t.prototype.init=function(){(this.options.expandOnHover||e("body").is(a+".fixed"))&&(this.expandOnHover(),e("body").addClass("sidebar-mini-expand-feature")),e(".content-wrapper").click(function(){e(window).width()<=this.options.collapseScreenSize&&e("body").hasClass(s)&&this.close()}.bind(this)),e(".sidebar-form .form-control").click((function(e){e.stopPropagation()}))},t.prototype.toggle=function(){var t=e(window).width(),n=!e("body").hasClass(o);t<=this.options.collapseScreenSize&&(n=e("body").hasClass(s)),n?this.close():this.open()},t.prototype.open=function(){e(window).width()>this.options.collapseScreenSize?e("body").removeClass(o).trigger(e.Event(u)):e("body").addClass(s).trigger(e.Event(u))},t.prototype.close=function(){e(window).width()>this.options.collapseScreenSize?e("body").addClass(o).trigger(e.Event(c)):e("body").removeClass(s+" "+o).trigger(e.Event(c))},t.prototype.expandOnHover=function(){e(".main-sidebar").hover(function(){e("body").is(a+".sidebar-collapse")&&e(window).width()>this.options.collapseScreenSize&&this.expand()}.bind(this),function(){e("body").is(".sidebar-expanded-on-hover")&&this.collapse()}.bind(this))},t.prototype.expand=function(){setTimeout((function(){e("body").removeClass(o).addClass(l)}),this.options.expandTransitionDelay)},t.prototype.collapse=function(){setTimeout((function(){e("body").removeClass(l).addClass(o)}),this.options.expandTransitionDelay)};var f=e.fn.pushMenu;e.fn.pushMenu=d,e.fn.pushMenu.Constructor=t,e.fn.pushMenu.noConflict=function(){return e.fn.pushMenu=f,this},e(document).on("click",i,(function(t){t.preventDefault(),d.call(e(this),"toggle")})),e(window).on("load",(function(){d.call(e(i))}))}(r),function(e){"use strict";function t(e,t){this.element=e,this.options=t,this._setUpListeners()}var n="lte.todolist",r={onCheck:function(e){return e},onUnCheck:function(e){return e}},i={data:'[data-widget="todo-list"]'};function a(i){return this.each((function(){var a=e(this),o=a.data(n);if(!o){var s=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,o=new t(a,s))}if("string"==typeof o){if(void 0===o[i])throw new Error("No method named "+i);o[i]()}}))}t.prototype.toggle=function(e){e.parents(i.li).first().toggleClass("done"),e.prop("checked")?this.check(e):this.unCheck(e)},t.prototype.check=function(e){this.options.onCheck.call(e)},t.prototype.unCheck=function(e){this.options.onUnCheck.call(e)},t.prototype._setUpListeners=function(){var t=this;e(this.element).on("change ifChanged","input:checkbox",(function(){t.toggle(e(this))}))};var o=e.fn.todoList;e.fn.todoList=a,e.fn.todoList.Constructor=t,e.fn.todoList.noConflict=function(){return e.fn.todoList=o,this},e(window).on("load",(function(){e(i.data).each((function(){a.call(e(this))}))}))}(r),function(e){"use strict";function t(t,n){this.element=t,this.options=n,e(this.element).addClass(l),e(i+o,this.element).addClass(s),this._setUpListeners()}var n="lte.tree",r={animationSpeed:500,accordion:!0,followLink:!1,trigger:".treeview a"},i=".treeview",a=".treeview-menu",o=".active",s="menu-open",l="tree";function u(i){return this.each((function(){var a=e(this);if(!a.data(n)){var o=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,new t(a,o))}}))}t.prototype.toggle=function(e,t){var n=e.next(a),r=e.parent(),o=r.hasClass(s);r.is(i)&&(this.options.followLink&&"#"!==e.attr("href")||t.preventDefault(),o?this.collapse(n,r):this.expand(n,r))},t.prototype.expand=function(t,n){var r=e.Event("expanded.tree");if(this.options.accordion){var i=n.siblings(".menu-open, .active"),o=i.children(a);this.collapse(o,i)}n.addClass(s),t.stop().slideDown(this.options.animationSpeed,function(){e(this.element).trigger(r),n.height("auto")}.bind(this))},t.prototype.collapse=function(t,n){var r=e.Event("collapsed.tree");n.removeClass(s),t.stop().slideUp(this.options.animationSpeed,function(){e(this.element).trigger(r),n.find(i).removeClass(s).find(a).hide()}.bind(this))},t.prototype._setUpListeners=function(){var t=this;e(this.element).on("click",this.options.trigger,(function(n){t.toggle(e(this),n)}))};var c=e.fn.tree;e.fn.tree=u,e.fn.tree.Constructor=t,e.fn.tree.noConflict=function(){return e.fn.tree=c,this},e(window).on("load",(function(){e('[data-widget="tree"]').each((function(){u.call(e(this))}))}))}(r),function(e){"use strict";function t(e){this.options=e,this.bindedResize=!1,this.activate()}var n="lte.layout",r={slimscroll:!0,resetHeight:!0},i=".wrapper",a=".content-wrapper",o=".main-header",s=".sidebar",l=".sidebar-menu",u="fixed";function c(i){return this.each((function(){var a=e(this),o=a.data(n);if(!o){var s=e.extend({},r,a.data(),"object"==typeof i&&i);a.data(n,o=new t(s))}if("string"==typeof i){if(void 0===o[i])throw new Error("No method named "+i);o[i]()}}))}t.prototype.activate=function(){this.fix(),this.fixSidebar(),e("body").removeClass("hold-transition"),this.options.resetHeight&&e("body, html, "+i).css({height:"auto","min-height":"100%"}),this.bindedResize||(e(window).resize(function(){this.fix(),this.fixSidebar(),e(".main-header .logo, "+s).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){this.fix(),this.fixSidebar()}.bind(this))}.bind(this)),this.bindedResize=!0),e(l).on("expanded.tree",function(){this.fix(),this.fixSidebar()}.bind(this)),e(l).on("collapsed.tree",function(){this.fix(),this.fixSidebar()}.bind(this))},t.prototype.fix=function(){e(".layout-boxed > "+i).css("overflow","hidden");var t=e(".main-footer").outerHeight()||0,n=e(o).outerHeight()||0,r=n+t,l=e(window).height(),c=e(s).outerHeight()||0;if(e("body").hasClass(u))e(a).css("min-height",l-t);else{var d;d=c+n<=l?(e(a).css("min-height",l-r),l-r):(e(a).css("min-height",c),c);var f=e(".control-sidebar");void 0!==f&&f.height()>d&&e(a).css("min-height",f.height())}},t.prototype.fixSidebar=function(){e("body").hasClass(u)?this.options.slimscroll&&void 0!==e.fn.slimScroll&&0===e(".main-sidebar").find("slimScrollDiv").length&&e(s).slimScroll({height:e(window).height()-e(o).height()+"px"}):void 0!==e.fn.slimScroll&&e(s).slimScroll({destroy:!0}).height("auto")};var d=e.fn.layout;e.fn.layout=c,e.fn.layout.Constuctor=t,e.fn.layout.noConflict=function(){return e.fn.layout=d,this},e(window).on("load",(function(){c.call(e("body"))}))}(r)},8144:function(e,t,n){var r=n(9755);n.g.$=n.g.jQuery=r,n(3002),n(1402),n(686),n(5405),n(4037),n(2322),n(6823),n(4159),n(4752),n(2876),n(143),n(9850),n(2285),n(7665),n(1808),n(1311),n(3256),n(3912),n(6757),n(6806),n(818),n(6453),n(1339),n(7120),n(2985),n(7049),n(2984),n(4525);var i=n(381);n.g.moment=i,n(867),n(5822),n(4780),n(9740),n(217),n(894),n(837),n(2915),n(5655),n(7763),n(1897),n(4694),n(4470),n(4206),n(2138),n(626),n(9183),n(3730),n(3901),n(4495),n(9520),n(7971),n(6459),n(1793),n(4249),n(8760),n(2397),n(5666),n(3839),n(932),n(8749),n(2945),n(958),n(157),n(2404),n.g.$.AdminLTE={},n.g.$.AdminLTE.options={},n(3752),n(1639),n(5290),n.g.KimaiPaginatedBoxWidget=n(985).Z,n.g.KimaiReloadPageWidget=n(8227).Z,n.g.KimaiCookies=n(3954).Z,n.g.KimaiStorage=n(6654).Z,n(2993)},5290:function(e,t,n){"use strict";n.r(t);n(2526),n(1817),n(1539),n(2165),n(6992),n(8783),n(3948),n(489),n(2419),n(4916),n(5306),n(1249);var r=n(381),i=n.n(r);function a(e,t){for(var n=0;n".concat(a.project.name," (").concat(a.project.customer.name,")
")+"