diff --git a/app/dist/js/index.js b/app/dist/js/index.js index ee67800..b8f61d2 100644 --- a/app/dist/js/index.js +++ b/app/dist/js/index.js @@ -455,7 +455,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var cor /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.json.stringify.js */ \"./node_modules/core-js/modules/es.json.stringify.js\");\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ \"./node_modules/core-js/modules/esnext.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/esnext.iterator.filter.js */ \"./node_modules/core-js/modules/esnext.iterator.filter.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ \"./node_modules/core-js/modules/esnext.iterator.find.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ \"./node_modules/core-js/modules/esnext.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/esnext.iterator.map.js */ \"./node_modules/core-js/modules/esnext.iterator.map.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/plugins/tm@_utils/tm.utils */ \"./src/plugins/tm@_utils/tm.utils.ts\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/plugins/tm@modal/_mixins/modal.mixin */ \"./src/plugins/tm@modal/_mixins/modal.mixin.ts\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm-bundler.js\");\n/* harmony import */ var _employees_a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../employees/a-employee-timeblock.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-timeblock.vue\");\n/* harmony import */ var _employees_a_employee_timeblock_timeline_vue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../employees/a-employee-timeblock-timeline.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-timeblock-timeline.vue\");\n/* harmony import */ var _plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/plugins/tm@_utils/timeblock.utils */ \"./src/plugins/tm@_utils/timeblock.utils.ts\");\n/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ \"./node_modules/console-browserify/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n AEmployeeTimeblock: _employees_a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n AEmployeeTimeblockTimeline: _employees_a_employee_timeblock_timeline_vue__WEBPACK_IMPORTED_MODULE_12__[\"default\"]\n },\n mixins: [_plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_9__[\"default\"]],\n props: {\n timeblocks: {\n type: Array,\n required: true\n },\n subtask: {\n type: Object,\n required: true\n }\n },\n emits: ['update-subtask'],\n data() {\n return {\n tmUtils: _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n showModal: false,\n visible: false,\n // New timeblock for modal (used by a-employee-timeblock component)\n newTimeblock: {\n id: null,\n date: new Date(),\n starts_at_time: null,\n ends_at_time: null,\n employee_id: null\n },\n // Timeline constants\n START_HOUR: 0,\n END_HOUR: 24,\n HOUR_WIDTH: 60,\n HOUR_WIDTH_MOBILE: 50,\n // Existing timeblocks timeline data\n existingTimeblocksData: {} // { [index]: { tasks: [], loading: false } }\n };\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapGetters)('tm', ['mastertasks', 'enrichedEmployees']),\n isOffice365Task() {\n return this.subtask.type == 'office365';\n },\n // Get employee data from subtask\n employee() {\n if (!this.subtask?.employee_id) return null;\n return this.subtask._employee || this.enrichedEmployees.find(emp => emp.id === this.subtask.employee_id);\n },\n // Hour width based on screen size\n hourWidth() {\n return window.innerWidth <= 768 ? this.HOUR_WIDTH_MOBILE : this.HOUR_WIDTH;\n },\n // All timeblocks for modal (includes existing timeblocks from this subtask)\n allTimeblocksForModal() {\n return this.timeblocks || [];\n },\n // Computed property to trigger reactivity when existingTimeblocksData changes\n existingTimeblocksDataReactive() {\n // This forces Vue to track changes to existingTimeblocksData\n return {\n ...this.existingTimeblocksData\n };\n }\n },\n watch: {\n // Watch for timeblocks changes\n timeblocks: {\n handler() {\n // Refetch timeline data for all timeblocks when they change\n this.$nextTick(() => {\n this.fetchAllTimelinesData();\n });\n },\n deep: true\n },\n // Watch for employee changes\n 'employee.id': {\n handler(newId) {\n if (newId) {\n this.fetchAllTimelinesData();\n }\n }\n },\n // Watch for modal opening - set employee_id and reset to today\n showModal: {\n handler(isOpen) {\n if (isOpen) {\n this.newTimeblock = {\n id: null,\n date: new Date(),\n starts_at_time: null,\n ends_at_time: null,\n employee_id: this.employee?.id || null\n };\n }\n }\n }\n },\n mounted() {\n // Fetch timeline data on mount\n if (this.employee?.id) {\n this.fetchAllTimelinesData();\n }\n },\n methods: {\n // Submit timeblock from employee timeblock component\n async submitFromEmployeeTimeblock() {\n // Validate using the employee timeblock component's validation\n const isValid = await this.$refs.employeeTimeblockRef?.validate();\n if (!isValid) {\n return;\n }\n\n // The newTimeblock data is already reactive and updated by the component\n await this.submit();\n },\n // Methods for existing timeblocks timeline\n getTimelineLoadingState(index) {\n const reactiveData = this.existingTimeblocksDataReactive;\n return reactiveData[index]?.loading || false;\n },\n getScheduledBlocksForTimeblock(index) {\n // Use the reactive computed property to ensure Vue tracks changes\n const reactiveData = this.existingTimeblocksDataReactive;\n const tasks = reactiveData[index]?.tasks || [];\n const currentTimeblock = this.timeblocks[index];\n\n // Filter out the current timeblock from scheduled blocks\n return tasks.filter(task => !task._timeblock_id || !currentTimeblock.id || task._timeblock_id !== currentTimeblock.id);\n },\n getOtherTimeblocksForTimeblock(timeblock, currentIndex) {\n if (!timeblock.date) return [];\n const selectedDate = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n return this.timeblocks.filter((tb, idx) => {\n // Skip current timeblock\n if (idx === currentIndex) return false;\n if (!tb.date || !tb.starts_at_time || !tb.ends_at_time) return false;\n const tbDate = moment__WEBPACK_IMPORTED_MODULE_8___default()(tb.date).format('YYYY-MM-DD');\n return tbDate === selectedDate;\n });\n },\n getTimeblockRange(timeblock) {\n const {\n start,\n end\n } = (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.timeblockToDateRange)(timeblock);\n return {\n start,\n end\n };\n },\n getCollisionForTimeblock(timeblock, index) {\n const scheduledBlocks = this.getScheduledBlocksForTimeblock(index);\n return (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.detectCollision)(timeblock, scheduledBlocks);\n },\n getCollisionSegmentsForTimeblock(timeblock, index) {\n const scheduledBlocks = this.getScheduledBlocksForTimeblock(index);\n return (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.getCollisionSegments)(timeblock, scheduledBlocks);\n },\n calculateDuration(timeblock) {\n return (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.calculateTimeblockDuration)(timeblock);\n },\n async fetchTimelineDataForTimeblock(index) {\n const timeblock = this.timeblocks[index];\n if (!this.employee?.id || !timeblock.date) {\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks: [],\n loading: false\n }\n };\n return;\n }\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks: this.existingTimeblocksData[index]?.tasks || [],\n loading: true\n }\n };\n try {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n const queryParams = new URLSearchParams({\n start: dateStr,\n end: dateStr,\n employee_id: this.employee.id.toString()\n }).toString();\n const response = await this.$axios.get_auth(`v1/subtasks?${queryParams}`);\n const subtasks = [...(response.subtasks || []), ...(response.blockers || [])];\n const tasks = [];\n subtasks.forEach(subtask => {\n // Check if this is a blocker/adhoc/etc with direct start/end fields (no timeblocks array)\n if (!subtask.timeblocks && subtask.start && subtask.end && ['blocker', 'adhoc', 'home_office', 'vacation', 'free_day', 'office365_blocker'].includes(subtask.type)) {\n const blockerDateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(subtask.start).format('YYYY-MM-DD');\n if (blockerDateStr === dateStr) {\n const type = subtask.type;\n tasks.push({\n id: subtask.id,\n start: new Date(subtask.start),\n end: new Date(subtask.end),\n master_task: null,\n date: new Date(subtask.start),\n project_code: null,\n subtask: subtask,\n blocker: subtask,\n type,\n _timeblock_id: null,\n _timeblock_is_finished: subtask.is_finished || false,\n _real_start: new Date(subtask.start),\n _real_end: new Date(subtask.end)\n });\n }\n } else {\n // Process regular subtasks with timeblocks array\n subtask.timeblocks?.forEach(tb => {\n const timeblockDateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(tb.start).format('YYYY-MM-DD');\n if (timeblockDateStr === dateStr) {\n let type = 'subtask';\n if (subtask.type === 'office365') type = 'office365';\n tasks.push({\n id: subtask.id,\n start: new Date(tb.start),\n end: new Date(tb.end),\n master_task: subtask.master_task,\n date: new Date(tb.start),\n project_code: subtask.project_code,\n subtask: subtask,\n blocker: undefined,\n type,\n _timeblock_id: tb.id,\n _timeblock_is_finished: tb.is_finished,\n _real_start: new Date(tb.start),\n _real_end: new Date(tb.end)\n });\n }\n });\n }\n });\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks,\n loading: false\n }\n };\n } catch (error) {\n console.error('Error fetching timeline data for timeblock:', error);\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks: [],\n loading: false\n }\n };\n }\n },\n // Fetch timeline data for all existing timeblocks\n async fetchAllTimelinesData() {\n if (!this.employee?.id) return;\n const promises = this.timeblocks.map((_, index) => this.fetchTimelineDataForTimeblock(index));\n await Promise.all(promises);\n },\n formatTimeblockStart(timeblock) {\n // Handle internal format with date and time fields\n if (timeblock.date && timeblock.starts_at_time) {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('DD.MM.yyyy');\n return `${dateStr}, ${timeblock.starts_at_time}`;\n }\n // Fallback to backend format\n if (timeblock.start) {\n return _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTime(timeblock.start);\n }\n return '';\n },\n formatTimeblockEnd(timeblock) {\n // Handle internal format with date and time fields\n if (timeblock.date && timeblock.ends_at_time) {\n return timeblock.ends_at_time;\n }\n // Fallback to backend format\n if (timeblock.end) {\n return _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTime(timeblock.end);\n }\n return '';\n },\n async submit() {\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n if (!subtask?.timeblocks) {\n subtask.timeblocks = [];\n }\n if (!subtask?.timesheets) {\n subtask.timesheets = [];\n }\n if (!subtask?.is_finished) {\n subtask.is_finished = 0;\n }\n\n // Add timeblock in internal format from newTimeblock\n subtask.timeblocks.push({\n id: null,\n date: this.newTimeblock.date,\n starts_at_time: this.newTimeblock.starts_at_time,\n ends_at_time: this.newTimeblock.ends_at_time,\n is_finished: 0\n });\n if (subtask.deadline) subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTimeForBackend(this._mergeDeadlineTimeDate());\n const isAfterDeadline = this.isAfterDeadline();\n if (isAfterDeadline) {\n this.visible = true;\n } else {\n if (!subtask.id) {\n this.$emit('update-unfinished-subtask', subtask);\n this.closeModal();\n } else {\n this._update(subtask);\n }\n }\n },\n async confirmSubmit() {\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n if (!subtask?.timeblocks) {\n subtask.timeblocks = [];\n }\n if (!subtask?.timesheets) {\n subtask.timesheets = [];\n }\n if (!subtask?.is_finished) {\n subtask.is_finished = 0;\n }\n\n // Add timeblock in internal format from newTimeblock\n subtask.timeblocks.push({\n id: null,\n date: this.newTimeblock.date,\n starts_at_time: this.newTimeblock.starts_at_time,\n ends_at_time: this.newTimeblock.ends_at_time,\n is_finished: 0\n });\n if (subtask.deadline) subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTimeForBackend(this._mergeDeadlineTimeDate());\n if (!subtask.id) {\n this.$emit('update-unfinished-subtask', subtask);\n this.closeModal();\n return;\n }\n this.visible = false;\n this._update(subtask);\n },\n async toggleTimeblockIsFinished(originalTimeblock) {\n // TODO: Pridat odpracovany cas modal?\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n const timeblock = JSON.parse(JSON.stringify(originalTimeblock));\n timeblock.is_finished = timeblock.is_finished == 1 ? 0 : 1;\n try {\n // Convert timeblock to backend format before sending\n const timeblockForBackend = {\n id: timeblock.id,\n is_finished: timeblock.is_finished\n };\n\n // If timeblock is in internal format, convert it\n if (timeblock.date) {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n timeblockForBackend.start = `${dateStr} ${timeblock.starts_at_time}:00`;\n timeblockForBackend.end = `${dateStr} ${timeblock.ends_at_time}:00`;\n } else {\n // Already in backend format\n timeblockForBackend.start = timeblock.start;\n timeblockForBackend.end = timeblock.end;\n }\n const {\n data: newTimeblock\n } = await this.$axios.put_auth(`v1/timeblocks/${timeblock.id}`, timeblockForBackend);\n\n // Convert returned timeblock from backend format to internal format\n const startMoment = moment__WEBPACK_IMPORTED_MODULE_8___default()(newTimeblock.start, 'YYYY-MM-DD HH:mm:ss');\n const endMoment = moment__WEBPACK_IMPORTED_MODULE_8___default()(newTimeblock.end, 'YYYY-MM-DD HH:mm:ss');\n const convertedTimeblock = {\n id: newTimeblock.id,\n date: startMoment.toDate(),\n starts_at_time: startMoment.format('HH:mm'),\n ends_at_time: endMoment.format('HH:mm'),\n is_finished: newTimeblock.is_finished\n };\n subtask.timeblocks = subtask.timeblocks.map(originalTimeblock => {\n if (originalTimeblock.id == convertedTimeblock.id) return convertedTimeblock;\n return originalTimeblock;\n });\n this.$events.emit('on-subtask-edited', subtask);\n this.$emit('update-subtask', subtask);\n if (timeblock.is_finished) this.$events.emit('show-task-add-time-modal', {\n subtask\n });\n } catch (error) {\n this.$toast.error(error.message || error);\n }\n },\n async deleteTimeblock({\n id\n }) {\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n subtask.timeblocks = subtask.timeblocks.filter(timeblock => timeblock.id != id);\n if (subtask.deadline) subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTimeForBackend(this._mergeDeadlineTimeDate());\n this._update(subtask);\n },\n deleteTimeblockWithoutId(_index) {\n this.$emit('delete-timeblock');\n },\n async _update(data) {\n try {\n const timesheets = data.timesheets.map(timesheet => {\n delete timesheet.employee_name;\n return timesheet;\n });\n\n // Convert timeblocks from internal format to BE format\n const timeblocks = (data.timeblocks || []).filter(timeblock => {\n // Filter timeblocks that have either old format (date) or new format (start)\n return timeblock.date || timeblock.start;\n }).map(timeblock => {\n // If already in BE format (has start field), return as is\n if (timeblock.start && !timeblock.date) {\n return {\n id: timeblock.id || null,\n start: timeblock.start,\n end: timeblock.end,\n is_finished: timeblock.is_finished || 0\n };\n }\n\n // Convert from internal format to BE format\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n return {\n id: timeblock.id || null,\n start: `${dateStr} ${timeblock.starts_at_time}:00`,\n end: `${dateStr} ${timeblock.ends_at_time}:00`,\n is_finished: timeblock.is_finished || 0\n };\n });\n const {\n subtask\n } = await this.$axios.put_auth(`v1/subtasks/${data.id}`, {\n ...data,\n timesheets,\n timeblocks\n });\n this.closeModal();\n this.$events.emit('on-subtask-edited', subtask);\n } catch (error) {\n this.$toast.error(error.message || error);\n }\n },\n isAfterDeadline() {\n const deadline = this.getDeadline(this.subtask);\n if (!deadline) return;\n const mDate = moment__WEBPACK_IMPORTED_MODULE_8___default()(this.newTimeblock.date);\n const mDeadline = moment__WEBPACK_IMPORTED_MODULE_8___default()(deadline);\n const [hours, minutes] = this.newTimeblock.ends_at_time.split(':').map(Number);\n mDate.hours(hours);\n mDate.minutes(minutes);\n return mDate.isAfter(mDeadline);\n },\n getDeadline(subtask) {\n if (subtask?.deadline) return subtask.deadline;\n return subtask.master_task_deadline;\n },\n _mergeDeadlineTimeDate() {\n const date = new Date(this.subtask.deadline);\n const timeParts = this.subtask._deadline_time.split(':');\n date.setHours(parseInt(timeParts[0]));\n date.setMinutes(parseInt(timeParts[1]));\n return date;\n },\n closeModal() {\n // Reset newTimeblock\n this.newTimeblock = {\n id: null,\n date: new Date(),\n starts_at_time: null,\n ends_at_time: null,\n employee_id: this.employee?.id || null\n };\n this.showModal = false;\n }\n }\n});\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); +eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.json.stringify.js */ \"./node_modules/core-js/modules/es.json.stringify.js\");\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ \"./node_modules/core-js/modules/esnext.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/esnext.iterator.filter.js */ \"./node_modules/core-js/modules/esnext.iterator.filter.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ \"./node_modules/core-js/modules/esnext.iterator.find.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ \"./node_modules/core-js/modules/esnext.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/esnext.iterator.map.js */ \"./node_modules/core-js/modules/esnext.iterator.map.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/plugins/tm@_utils/tm.utils */ \"./src/plugins/tm@_utils/tm.utils.ts\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/plugins/tm@modal/_mixins/modal.mixin */ \"./src/plugins/tm@modal/_mixins/modal.mixin.ts\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm-bundler.js\");\n/* harmony import */ var _employees_a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../employees/a-employee-timeblock.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-timeblock.vue\");\n/* harmony import */ var _employees_a_employee_timeblock_timeline_vue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../employees/a-employee-timeblock-timeline.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-timeblock-timeline.vue\");\n/* harmony import */ var _plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/plugins/tm@_utils/timeblock.utils */ \"./src/plugins/tm@_utils/timeblock.utils.ts\");\n/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ \"./node_modules/console-browserify/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n AEmployeeTimeblock: _employees_a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n AEmployeeTimeblockTimeline: _employees_a_employee_timeblock_timeline_vue__WEBPACK_IMPORTED_MODULE_12__[\"default\"]\n },\n mixins: [_plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_9__[\"default\"]],\n props: {\n timeblocks: {\n type: Array,\n required: true\n },\n subtask: {\n type: Object,\n required: true\n }\n },\n emits: ['update-subtask'],\n data() {\n return {\n tmUtils: _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n showModal: false,\n visible: false,\n // New timeblock for modal (used by a-employee-timeblock component)\n newTimeblock: {\n id: null,\n date: new Date(),\n starts_at_time: null,\n ends_at_time: null,\n employee_id: null\n },\n // Timeline constants\n START_HOUR: 0,\n END_HOUR: 24,\n HOUR_WIDTH: 60,\n HOUR_WIDTH_MOBILE: 50,\n // Existing timeblocks timeline data\n existingTimeblocksData: {} // { [index]: { tasks: [], loading: false } }\n };\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapGetters)('tm', ['mastertasks', 'enrichedEmployees']),\n isOffice365Task() {\n return this.subtask.type == 'office365';\n },\n // Get employee data from subtask\n employee() {\n if (!this.subtask?.employee_id) return null;\n return this.subtask._employee || this.enrichedEmployees.find(emp => emp.id === this.subtask.employee_id);\n },\n // Hour width based on screen size\n hourWidth() {\n return window.innerWidth <= 768 ? this.HOUR_WIDTH_MOBILE : this.HOUR_WIDTH;\n },\n // Computed property to trigger reactivity when existingTimeblocksData changes\n existingTimeblocksDataReactive() {\n // This forces Vue to track changes to existingTimeblocksData\n return {\n ...this.existingTimeblocksData\n };\n }\n },\n watch: {\n // Watch for timeblocks changes\n timeblocks: {\n handler() {\n // Refetch timeline data for all timeblocks when they change\n this.$nextTick(() => {\n this.fetchAllTimelinesData();\n });\n },\n deep: true\n },\n // Watch for employee changes\n 'employee.id': {\n handler(newId) {\n if (newId) {\n this.fetchAllTimelinesData();\n }\n }\n },\n // Watch for modal opening - set employee_id and reset to today\n showModal: {\n handler(isOpen) {\n if (isOpen) {\n this.newTimeblock = {\n id: null,\n date: new Date(),\n starts_at_time: null,\n ends_at_time: null,\n employee_id: this.employee?.id || null\n };\n }\n }\n }\n },\n mounted() {\n // Fetch timeline data on mount\n if (this.employee?.id) {\n this.fetchAllTimelinesData();\n }\n },\n methods: {\n // Submit timeblock from employee timeblock component\n async submitFromEmployeeTimeblock() {\n // Validate using the employee timeblock component's validation\n const isValid = await this.$refs.employeeTimeblockRef?.validate();\n if (!isValid) {\n return;\n }\n\n // The newTimeblock data is already reactive and updated by the component\n await this.submit();\n },\n // Methods for existing timeblocks timeline\n getTimelineLoadingState(index) {\n const reactiveData = this.existingTimeblocksDataReactive;\n return reactiveData[index]?.loading || false;\n },\n getScheduledBlocksForTimeblock(index) {\n // Use the reactive computed property to ensure Vue tracks changes\n const reactiveData = this.existingTimeblocksDataReactive;\n const tasks = reactiveData[index]?.tasks || [];\n const currentTimeblock = this.timeblocks[index];\n\n // Filter out the current timeblock from scheduled blocks\n return tasks.filter(task => !task._timeblock_id || !currentTimeblock.id || task._timeblock_id !== currentTimeblock.id);\n },\n getOtherTimeblocksForTimeblock(timeblock, currentIndex) {\n if (!timeblock.date) return [];\n const selectedDate = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n return this.timeblocks.filter((tb, idx) => {\n // Skip current timeblock\n if (idx === currentIndex) return false;\n if (!tb.date || !tb.starts_at_time || !tb.ends_at_time) return false;\n const tbDate = moment__WEBPACK_IMPORTED_MODULE_8___default()(tb.date).format('YYYY-MM-DD');\n return tbDate === selectedDate;\n });\n },\n getTimeblockRange(timeblock) {\n const {\n start,\n end\n } = (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.timeblockToDateRange)(timeblock);\n return {\n start,\n end\n };\n },\n getCollisionForTimeblock(timeblock, index) {\n const scheduledBlocks = this.getScheduledBlocksForTimeblock(index);\n return (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.detectCollision)(timeblock, scheduledBlocks);\n },\n getCollisionSegmentsForTimeblock(timeblock, index) {\n const scheduledBlocks = this.getScheduledBlocksForTimeblock(index);\n return (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.getCollisionSegments)(timeblock, scheduledBlocks);\n },\n calculateDuration(timeblock) {\n return (0,_plugins_tm_utils_timeblock_utils__WEBPACK_IMPORTED_MODULE_13__.calculateTimeblockDuration)(timeblock);\n },\n async fetchTimelineDataForTimeblock(index) {\n const timeblock = this.timeblocks[index];\n if (!this.employee?.id || !timeblock.date) {\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks: [],\n loading: false\n }\n };\n return;\n }\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks: this.existingTimeblocksData[index]?.tasks || [],\n loading: true\n }\n };\n try {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n const queryParams = new URLSearchParams({\n start: dateStr,\n end: dateStr,\n employee_id: this.employee.id.toString()\n }).toString();\n const response = await this.$axios.get_auth(`v1/subtasks?${queryParams}`);\n const subtasks = [...(response.subtasks || []), ...(response.blockers || [])];\n const tasks = [];\n subtasks.forEach(subtask => {\n // Check if this is a blocker/adhoc/etc with direct start/end fields (no timeblocks array)\n if (!subtask.timeblocks && subtask.start && subtask.end && ['blocker', 'adhoc', 'home_office', 'vacation', 'free_day', 'office365_blocker'].includes(subtask.type)) {\n const blockerDateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(subtask.start).format('YYYY-MM-DD');\n if (blockerDateStr === dateStr) {\n const type = subtask.type;\n tasks.push({\n id: subtask.id,\n start: new Date(subtask.start),\n end: new Date(subtask.end),\n master_task: null,\n date: new Date(subtask.start),\n project_code: null,\n subtask: subtask,\n blocker: subtask,\n type,\n _timeblock_id: null,\n _timeblock_is_finished: subtask.is_finished || false,\n _real_start: new Date(subtask.start),\n _real_end: new Date(subtask.end)\n });\n }\n } else {\n // Process regular subtasks with timeblocks array\n subtask.timeblocks?.forEach(tb => {\n const timeblockDateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(tb.start).format('YYYY-MM-DD');\n if (timeblockDateStr === dateStr) {\n let type = 'subtask';\n if (subtask.type === 'office365') type = 'office365';\n tasks.push({\n id: subtask.id,\n start: new Date(tb.start),\n end: new Date(tb.end),\n master_task: subtask.master_task,\n date: new Date(tb.start),\n project_code: subtask.project_code,\n subtask: subtask,\n blocker: undefined,\n type,\n _timeblock_id: tb.id,\n _timeblock_is_finished: tb.is_finished,\n _real_start: new Date(tb.start),\n _real_end: new Date(tb.end)\n });\n }\n });\n }\n });\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks,\n loading: false\n }\n };\n } catch (error) {\n console.error('Error fetching timeline data for timeblock:', error);\n this.existingTimeblocksData = {\n ...this.existingTimeblocksData,\n [index]: {\n tasks: [],\n loading: false\n }\n };\n }\n },\n // Fetch timeline data for all existing timeblocks\n async fetchAllTimelinesData() {\n if (!this.employee?.id) return;\n const promises = this.timeblocks.map((_, index) => this.fetchTimelineDataForTimeblock(index));\n await Promise.all(promises);\n },\n formatTimeblockStart(timeblock) {\n // Handle internal format with date and time fields\n if (timeblock.date && timeblock.starts_at_time) {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('DD.MM.yyyy');\n return `${dateStr}, ${timeblock.starts_at_time}`;\n }\n // Fallback to backend format\n if (timeblock.start) {\n return _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTime(timeblock.start);\n }\n return '';\n },\n formatTimeblockEnd(timeblock) {\n // Handle internal format with date and time fields\n if (timeblock.date && timeblock.ends_at_time) {\n return timeblock.ends_at_time;\n }\n // Fallback to backend format\n if (timeblock.end) {\n return _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTime(timeblock.end);\n }\n return '';\n },\n async submit() {\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n if (!subtask?.timeblocks) {\n subtask.timeblocks = [];\n }\n if (!subtask?.timesheets) {\n subtask.timesheets = [];\n }\n if (!subtask?.is_finished) {\n subtask.is_finished = 0;\n }\n\n // Add timeblock in internal format from newTimeblock\n subtask.timeblocks.push({\n id: null,\n date: this.newTimeblock.date,\n starts_at_time: this.newTimeblock.starts_at_time,\n ends_at_time: this.newTimeblock.ends_at_time,\n is_finished: 0\n });\n if (subtask.deadline) subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTimeForBackend(this._mergeDeadlineTimeDate());\n const isAfterDeadline = this.isAfterDeadline();\n if (isAfterDeadline) {\n this.visible = true;\n } else {\n if (!subtask.id) {\n this.$emit('update-unfinished-subtask', subtask);\n this.closeModal();\n } else {\n this._update(subtask);\n }\n }\n },\n async confirmSubmit() {\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n if (!subtask?.timeblocks) {\n subtask.timeblocks = [];\n }\n if (!subtask?.timesheets) {\n subtask.timesheets = [];\n }\n if (!subtask?.is_finished) {\n subtask.is_finished = 0;\n }\n\n // Add timeblock in internal format from newTimeblock\n subtask.timeblocks.push({\n id: null,\n date: this.newTimeblock.date,\n starts_at_time: this.newTimeblock.starts_at_time,\n ends_at_time: this.newTimeblock.ends_at_time,\n is_finished: 0\n });\n if (subtask.deadline) subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTimeForBackend(this._mergeDeadlineTimeDate());\n if (!subtask.id) {\n this.$emit('update-unfinished-subtask', subtask);\n this.closeModal();\n return;\n }\n this.visible = false;\n this._update(subtask);\n },\n async toggleTimeblockIsFinished(originalTimeblock) {\n // TODO: Pridat odpracovany cas modal?\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n const timeblock = JSON.parse(JSON.stringify(originalTimeblock));\n timeblock.is_finished = timeblock.is_finished == 1 ? 0 : 1;\n try {\n // Convert timeblock to backend format before sending\n const timeblockForBackend = {\n id: timeblock.id,\n is_finished: timeblock.is_finished\n };\n\n // If timeblock is in internal format, convert it\n if (timeblock.date) {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n timeblockForBackend.start = `${dateStr} ${timeblock.starts_at_time}:00`;\n timeblockForBackend.end = `${dateStr} ${timeblock.ends_at_time}:00`;\n } else {\n // Already in backend format\n timeblockForBackend.start = timeblock.start;\n timeblockForBackend.end = timeblock.end;\n }\n const {\n data: newTimeblock\n } = await this.$axios.put_auth(`v1/timeblocks/${timeblock.id}`, timeblockForBackend);\n\n // Convert returned timeblock from backend format to internal format\n const startMoment = moment__WEBPACK_IMPORTED_MODULE_8___default()(newTimeblock.start, 'YYYY-MM-DD HH:mm:ss');\n const endMoment = moment__WEBPACK_IMPORTED_MODULE_8___default()(newTimeblock.end, 'YYYY-MM-DD HH:mm:ss');\n const convertedTimeblock = {\n id: newTimeblock.id,\n date: startMoment.toDate(),\n starts_at_time: startMoment.format('HH:mm'),\n ends_at_time: endMoment.format('HH:mm'),\n is_finished: newTimeblock.is_finished\n };\n subtask.timeblocks = subtask.timeblocks.map(originalTimeblock => {\n if (originalTimeblock.id == convertedTimeblock.id) return convertedTimeblock;\n return originalTimeblock;\n });\n this.$events.emit('on-subtask-edited', subtask);\n this.$emit('update-subtask', subtask);\n if (timeblock.is_finished) this.$events.emit('show-task-add-time-modal', {\n subtask\n });\n } catch (error) {\n this.$toast.error(error.message || error);\n }\n },\n async deleteTimeblock({\n id\n }) {\n const subtask = JSON.parse(JSON.stringify(this.subtask));\n subtask.timeblocks = subtask.timeblocks.filter(timeblock => timeblock.id != id);\n if (subtask.deadline) subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_7__[\"default\"].formatDateTimeForBackend(this._mergeDeadlineTimeDate());\n this._update(subtask);\n },\n deleteTimeblockWithoutId(_index) {\n this.$emit('delete-timeblock');\n },\n async _update(data) {\n try {\n const timesheets = data.timesheets.map(timesheet => {\n delete timesheet.employee_name;\n return timesheet;\n });\n\n // Convert timeblocks from internal format to BE format\n const timeblocks = (data.timeblocks || []).filter(timeblock => {\n // Filter timeblocks that have either old format (date) or new format (start)\n return timeblock.date || timeblock.start;\n }).map(timeblock => {\n // If already in BE format (has start field), return as is\n if (timeblock.start && !timeblock.date) {\n return {\n id: timeblock.id || null,\n start: timeblock.start,\n end: timeblock.end,\n is_finished: timeblock.is_finished || 0\n };\n }\n\n // Convert from internal format to BE format\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_8___default()(timeblock.date).format('YYYY-MM-DD');\n return {\n id: timeblock.id || null,\n start: `${dateStr} ${timeblock.starts_at_time}:00`,\n end: `${dateStr} ${timeblock.ends_at_time}:00`,\n is_finished: timeblock.is_finished || 0\n };\n });\n const {\n subtask\n } = await this.$axios.put_auth(`v1/subtasks/${data.id}`, {\n ...data,\n timesheets,\n timeblocks\n });\n this.closeModal();\n this.$events.emit('on-subtask-edited', subtask);\n } catch (error) {\n this.$toast.error(error.message || error);\n }\n },\n isAfterDeadline() {\n const deadline = this.getDeadline(this.subtask);\n if (!deadline) return;\n const mDate = moment__WEBPACK_IMPORTED_MODULE_8___default()(this.newTimeblock.date);\n const mDeadline = moment__WEBPACK_IMPORTED_MODULE_8___default()(deadline);\n const [hours, minutes] = this.newTimeblock.ends_at_time.split(':').map(Number);\n mDate.hours(hours);\n mDate.minutes(minutes);\n return mDate.isAfter(mDeadline);\n },\n getDeadline(subtask) {\n if (subtask?.deadline) return subtask.deadline;\n return subtask.master_task_deadline;\n },\n _mergeDeadlineTimeDate() {\n const date = new Date(this.subtask.deadline);\n const timeParts = this.subtask._deadline_time.split(':');\n date.setHours(parseInt(timeParts[0]));\n date.setMinutes(parseInt(timeParts[1]));\n return date;\n },\n closeModal() {\n // Reset newTimeblock\n this.newTimeblock = {\n id: null,\n date: new Date(),\n starts_at_time: null,\n ends_at_time: null,\n employee_id: this.employee?.id || null\n };\n this.showModal = false;\n }\n }\n});\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); /***/ }), @@ -543,7 +543,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var cor /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.json.stringify.js */ \"./node_modules/core-js/modules/es.json.stringify.js\");\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ \"./node_modules/core-js/modules/esnext.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/esnext.iterator.filter.js */ \"./node_modules/core-js/modules/esnext.iterator.filter.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ \"./node_modules/core-js/modules/esnext.iterator.find.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ \"./node_modules/core-js/modules/esnext.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/esnext.iterator.map.js */ \"./node_modules/core-js/modules/esnext.iterator.map.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _plugins_tm_components_z_datepicker_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/plugins/tm@_components/z-datepicker.vue */ \"./src/plugins/tm@_components/z-datepicker.vue\");\n/* harmony import */ var _plugins_tm_components_z_files_upload_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/plugins/tm@_components/z-files-upload.vue */ \"./src/plugins/tm@_components/z-files-upload.vue\");\n/* harmony import */ var _vuelidate_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @vuelidate/core */ \"./node_modules/@vuelidate/core/dist/index.esm.js\");\n/* harmony import */ var _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @vuelidate/validators */ \"./node_modules/@vuelidate/validators/dist/index.esm.js\");\n/* harmony import */ var _plugins_lib_auth_utils_error_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/plugins/lib@auth/_utils/error.utils */ \"./src/plugins/lib@auth/_utils/error.utils.ts\");\n/* harmony import */ var _vueup_vue_quill__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @vueup/vue-quill */ \"./node_modules/@vueup/vue-quill/dist/vue-quill.esm-bundler.js\");\n/* harmony import */ var _master_task_mixins_selects_mixin__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../master-task/_mixins/selects.mixin */ \"./src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts\");\n/* harmony import */ var _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/plugins/tm@_utils/tm.utils */ \"./src/plugins/tm@_utils/tm.utils.ts\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_15__);\n/* harmony import */ var _vueup_vue_quill_dist_vue_quill_snow_css__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @vueup/vue-quill/dist/vue-quill.snow.css */ \"./node_modules/@vueup/vue-quill/dist/vue-quill.snow.css\");\n/* harmony import */ var _vueup_vue_quill_dist_vue_quill_snow_css__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_vueup_vue_quill_dist_vue_quill_snow_css__WEBPACK_IMPORTED_MODULE_16__);\n/* harmony import */ var _plugins_tm_mixins_autocomplete_mixin__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @/plugins/tm@_mixins/autocomplete.mixin */ \"./src/plugins/tm@_mixins/autocomplete.mixin.ts\");\n/* harmony import */ var _components_z_task_readonly_info_vue__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./_components/z-task-readonly-info.vue */ \"./src/plugins/tm@modal/task/_components/z-task-readonly-info.vue\");\n/* harmony import */ var _components_employees_a_employee_vue__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./_components/employees/a-employee.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee.vue\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm-bundler.js\");\n/* harmony import */ var _plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @/plugins/tm@modal/_mixins/modal.mixin */ \"./src/plugins/tm@modal/_mixins/modal.mixin.ts\");\n/* harmony import */ var _plugins_tm_modal_components_a_resize_handle_vue__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @/plugins/tm@modal/_components/a-resize-handle.vue */ \"./src/plugins/tm@modal/_components/a-resize-handle.vue\");\n/* harmony import */ var _plugins_tm_modal_components_a_reset_size_button_vue__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @/plugins/tm@modal/_components/a-reset-size-button.vue */ \"./src/plugins/tm@modal/_components/a-reset-size-button.vue\");\n/* harmony import */ var _plugins_tm_modal_components_a_close_button_vue__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! @/plugins/tm@modal/_components/a-close-button.vue */ \"./src/plugins/tm@modal/_components/a-close-button.vue\");\n/* harmony import */ var _z_remove_employee_modal_vue__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./z-remove-employee-modal.vue */ \"./src/plugins/tm@modal/task/z-remove-employee-modal.vue\");\n/* harmony import */ var _z_remove_timeblock_modal_vue__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./z-remove-timeblock-modal.vue */ \"./src/plugins/tm@modal/task/z-remove-timeblock-modal.vue\");\n/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ \"./node_modules/console-browserify/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n ZTaskReadonlyInfo: _components_z_task_readonly_info_vue__WEBPACK_IMPORTED_MODULE_18__[\"default\"],\n AEmployee: _components_employees_a_employee_vue__WEBPACK_IMPORTED_MODULE_19__[\"default\"],\n ZFilesUpload: _plugins_tm_components_z_files_upload_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n ZDatepicker: _plugins_tm_components_z_datepicker_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n // ATaskTimeblocks,\n QuillEditor: _vueup_vue_quill__WEBPACK_IMPORTED_MODULE_12__.QuillEditor,\n AResizeHandle: _plugins_tm_modal_components_a_resize_handle_vue__WEBPACK_IMPORTED_MODULE_22__[\"default\"],\n AResetSizeButton: _plugins_tm_modal_components_a_reset_size_button_vue__WEBPACK_IMPORTED_MODULE_23__[\"default\"],\n ACloseButton: _plugins_tm_modal_components_a_close_button_vue__WEBPACK_IMPORTED_MODULE_24__[\"default\"],\n ZRemoveEmployeeModal: _z_remove_employee_modal_vue__WEBPACK_IMPORTED_MODULE_25__[\"default\"],\n ZRemoveTimeblockModal: _z_remove_timeblock_modal_vue__WEBPACK_IMPORTED_MODULE_26__[\"default\"]\n },\n mixins: [_master_task_mixins_selects_mixin__WEBPACK_IMPORTED_MODULE_13__[\"default\"], _plugins_tm_mixins_autocomplete_mixin__WEBPACK_IMPORTED_MODULE_17__[\"default\"], _plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_21__[\"default\"]],\n emits: ['close', 'refresh'],\n data() {\n return {\n tmUtils: _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_14__[\"default\"],\n editMode: false,\n visible: false,\n subtask: null,\n isSaving: false,\n errorUtils: _plugins_lib_auth_utils_error_utils__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n v$: (0,_vuelidate_core__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(),\n showDatePicker: false,\n selectedNewDate: [],\n timeblocks: [],\n deletedTimeblockIds: [],\n // Track IDs of saved timeblocks that have been deleted\n wasFormValidationTriggered: false,\n modalName: 'z-task-modal',\n employeeRefs: [],\n pendingRemoveEmployeeId: undefined,\n pendingRemoveEmployeeIndex: undefined\n };\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_20__.mapGetters)('tm', ['mastertasks', 'enrichedEmployees']),\n enrichedMastertasks() {\n return this.mastertasks.map(mastertask => ({\n ...mastertask,\n _fullName: `${mastertask.name} [${mastertask.project_code}]`\n }));\n },\n editModeEmployee: {\n get() {\n return {\n id: this.subtask?.employee_id || null,\n duration: this.subtask?.duration || null\n };\n },\n set(value) {\n if (this.subtask) {\n this.subtask.employee_id = value.id;\n this.subtask.duration = value.duration;\n }\n }\n }\n },\n validations() {\n return {\n subtask: {\n master_task_id: {\n required: _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__.required\n },\n deadline: {\n required: _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__.required\n },\n _deadline_time: {\n required: _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__.required\n }\n }\n };\n },\n watch: {\n 'subtask.employee_id'(value, oldValue) {\n if (!value || !oldValue) return;\n this.subtask.timeblocks = [];\n this.subtask._employee = this.enrichedEmployees.find(employee => employee.id == this.subtask.employee_id);\n },\n 'subtask.employees': {\n handler() {\n if (!this.subtask?.employees) return;\n const lastEmployee = this.subtask.employees[this.subtask.employees.length - 1];\n if (lastEmployee?.id || lastEmployee?.duration) this.subtask.employees.push({});\n },\n deep: true\n },\n 'subtask.master_task_id'(value) {\n if (!value) return;\n this.subtask._master_task = this.mastertasks.find(mastertask => mastertask.id == this.subtask.master_task_id);\n this.subtask.project_code = this.subtask._master_task?.project_code || null;\n },\n editMode() {\n this.$nextTick(() => {\n this.$refs['description']?.setHTML(this.subtask.description || '');\n });\n },\n subtask: {\n handler(val) {\n if (this.editMode && !this.subtask?.id) {\n const employees = val?.employees?.filter(employee => employee?.id || employee?.duration) || [{}];\n const subtaskData = {\n ...val,\n employees: employees && employees.length > 0 ? employees : [{}]\n };\n localStorage.setItem('subtaskData', JSON.stringify(subtaskData));\n }\n },\n deep: true\n },\n timeblocks: {\n handler(val) {\n if (this.editMode && !this.subtask?.id) {\n // Save timeblocks to localStorage for new tasks\n localStorage.setItem('subtaskTimeblocks', JSON.stringify(val));\n }\n },\n deep: true\n }\n },\n mounted() {\n // Handle remove timeblock modal\n this.$events.on('show-remove-timeblock-modal', ({\n onConfirm\n }) => {\n this.$refs.removeTimeblockModal.showModal({\n onConfirm\n });\n });\n this.$events.on('add-timeblock', timeblock => {\n if (!this.subtask?.timeblocks) {\n this.subtask.timeblocks = [];\n }\n if (!this.subtask?.timesheets) {\n this.subtask.timesheets = [];\n }\n if (!this.subtask?.is_finished) {\n this.subtask.is_finished = 0;\n }\n this.subtask.timeblocks.push(timeblock);\n });\n this.$events.on('on-subtask-edited', subtask => {\n if (subtask?.id !== this.subtask?.id) return;\n const data = JSON.parse(JSON.stringify(subtask));\n const splittedDeadline = data.deadline?.split(' ') || [];\n data.deadline = splittedDeadline[0];\n data._deadline_time = splittedDeadline[1];\n\n // Convert BE format timeblocks to internal format\n const convertedTimeblocks = [];\n if (data.timeblocks && data.timeblocks.length > 0) {\n data.timeblocks.forEach(timeblock => {\n // If already in internal format, keep as is\n if (timeblock.date) {\n convertedTimeblocks.push({\n ...timeblock,\n employee_id: data.employee_id // Add employee_id\n });\n return;\n }\n\n // Convert from BE format to internal format\n if (timeblock.start && timeblock.end) {\n const startMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.start, 'YYYY-MM-DD HH:mm:ss');\n const endMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.end, 'YYYY-MM-DD HH:mm:ss');\n convertedTimeblocks.push({\n id: timeblock.id || null,\n date: startMoment.toDate(),\n starts_at_time: startMoment.format('HH:mm'),\n ends_at_time: endMoment.format('HH:mm'),\n is_finished: timeblock.is_finished || 0,\n employee_id: data.employee_id // Add employee_id\n });\n }\n });\n }\n // Store in component's timeblocks array\n this.timeblocks = convertedTimeblocks;\n this.subtask = this._enrichTask(data);\n\n // TODO: Remove? riesil som neodstranovanie jedineho zanamu v trvani a odpracovanom case\n this.$forceUpdate();\n });\n this.$events.on('on-subtask-deleted', subtask => {\n if (subtask?.id == this.subtask?.id) this.closeModal();\n });\n },\n methods: {\n toggleEditMode() {\n if (this.subtask.type == 'office365') return this.$events.emit('show-unable-to-edit-office-task-modal', {\n mode: 'edit'\n });\n this.editMode = !this.editMode;\n },\n // Set refs for employee components in create mode\n setEmployeeRef(el, index) {\n if (el) {\n this.employeeRefs[index] = el;\n }\n },\n openDatepicker(ref) {\n this.$refs[ref].openMenu();\n },\n // Helper: Get employee by ID\n getEmployeeById(employeeId) {\n return this.enrichedEmployees.find(emp => emp.id === employeeId);\n },\n // Helper: Get employee full name\n getEmployeeFullName(employeeId) {\n const employee = this.getEmployeeById(employeeId);\n return employee ? `${employee.name} ${employee.surname}` : '';\n },\n // Helper: Get valid employees (with id and duration) in create mode\n getValidEmployees() {\n if (!this.subtask?.employees) return [];\n return this.subtask.employees.filter(emp => emp.id && emp.duration);\n },\n // Helper: Get timeblocks for specific employee\n getEmployeeTimeblocks(employeeId) {\n if (!this.timeblocks) return [];\n return this.timeblocks.filter(tb => tb.employee_id === employeeId);\n },\n updateEmployeeTimeblocks(updatedTimeblocks, employeeId) {\n // Track deleted timeblocks (saved timeblocks that are no longer in the updated list)\n const updatedIds = new Set(updatedTimeblocks.filter(tb => tb.id).map(tb => tb.id));\n const deletedIds = this.timeblocks.filter(tb => tb.employee_id === employeeId && tb.id && !updatedIds.has(tb.id)).map(tb => tb.id).filter(id => !this.deletedTimeblockIds.includes(id));\n this.deletedTimeblockIds.push(...deletedIds);\n\n // Replace timeblocks for this employee\n const otherEmployeeTimeblocks = this.timeblocks.filter(tb => tb.employee_id !== employeeId);\n const updatedWithEmployeeId = updatedTimeblocks.map(tb => ({\n ...tb,\n employee_id: employeeId\n }));\n this.timeblocks = [...otherEmployeeTimeblocks, ...updatedWithEmployeeId];\n },\n updateTimeblock(val, index, employeeId) {\n const employeeTimeblocks = this.getEmployeeTimeblocks(employeeId);\n const timeblock = employeeTimeblocks[index];\n if (!timeblock) return;\n\n // Find the actual index in the full timeblocks array\n const actualIndex = this.timeblocks.indexOf(timeblock);\n if (actualIndex !== -1) {\n this.timeblocks[actualIndex] = {\n ...val,\n employee_id: employeeId\n };\n }\n },\n addTimeblock(employeeId, afterIndex = -1) {\n const newTimeblock = {\n date: new Date(),\n // Preset to current day\n starts_at_time: null,\n ends_at_time: null,\n employee_id: employeeId\n };\n\n // Get timeblocks for this employee\n const employeeTimeblocks = this.timeblocks.filter(tb => tb.employee_id === employeeId);\n if (afterIndex === -1 || afterIndex >= employeeTimeblocks.length - 1) {\n // Add at the end\n this.timeblocks.push(newTimeblock);\n } else {\n // Find the position in the full timeblocks array\n const timeblockToInsertAfter = employeeTimeblocks[afterIndex];\n const insertPosition = this.timeblocks.indexOf(timeblockToInsertAfter) + 1;\n this.timeblocks.splice(insertPosition, 0, newTimeblock);\n }\n },\n removeTimeblock(index, employeeId) {\n const employeeTimeblocks = this.getEmployeeTimeblocks(employeeId);\n const timeblock = employeeTimeblocks[index];\n if (!timeblock) return;\n\n // Find the actual index in the full timeblocks array\n const actualIndex = this.timeblocks.indexOf(timeblock);\n if (actualIndex !== -1) {\n this.timeblocks.splice(actualIndex, 1);\n }\n },\n // Handle remove employee - also removes their timeblocks\n handleRemoveEmployee() {\n this.pendingRemoveEmployeeId = this.subtask.employee_id;\n this.$refs.removeEmployeeModal.showModal();\n },\n removeEmployeeAtIndex(index) {\n this.pendingRemoveEmployeeIndex = index;\n this.$refs.removeEmployeeModal.showModal();\n },\n confirmRemoveEmployee() {\n // Handle edit mode (single employee removal)\n if (this.pendingRemoveEmployeeId !== undefined) {\n if (this.subtask.employee_id) {\n // Remove all timeblocks for this employee\n this.timeblocks = this.timeblocks.filter(tb => tb.employee_id !== this.subtask.employee_id);\n }\n\n // Clear employee data in edit mode\n this.subtask.employee_id = null;\n this.subtask.duration = null;\n this.pendingRemoveEmployeeId = undefined;\n }\n // Handle create mode (multiple employees removal)\n else if (this.pendingRemoveEmployeeIndex !== undefined) {\n const employee = this.subtask.employees[this.pendingRemoveEmployeeIndex];\n if (employee?.id) {\n // Remove all timeblocks for this employee\n this.timeblocks = this.timeblocks.filter(tb => tb.employee_id !== employee.id);\n }\n\n // Remove employee from array\n this.subtask.employees.splice(this.pendingRemoveEmployeeIndex, 1);\n this.pendingRemoveEmployeeIndex = undefined;\n }\n },\n async showModal({\n subtask,\n editMode = false,\n mastertask = {}\n }) {\n this.isSaving = false;\n this.subtask = null;\n this.wasFormValidationTriggered = false; // Reset validation trigger\n\n // CRITICAL: Prevent v-dialog autofocus BEFORE modal opens\n this.preventInputFocus = true;\n this.visible = true;\n this.timeblocks = [];\n this.deletedTimeblockIds = []; // Reset deleted timeblock IDs\n this.employeeRefs = [];\n this.$nextTick(() => {\n this.v$.$reset();\n\n // Reset after modal is fully rendered and v-dialog autofocus has been blocked\n setTimeout(() => {\n this.preventInputFocus = false;\n }, 300);\n });\n try {\n if (subtask?.id) {\n const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`);\n\n // Convert BE format timeblocks to internal format\n const convertedTimeblocks = [];\n if (data.timeblocks && data.timeblocks.length > 0) {\n data.timeblocks.forEach(timeblock => {\n // If already in internal format, keep as is\n if (timeblock.date) {\n convertedTimeblocks.push({\n ...timeblock,\n employee_id: data.employee_id // Add employee_id for edit mode\n });\n return;\n }\n\n // Convert from BE format to internal format\n if (timeblock.start && timeblock.end) {\n const startMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.start, 'YYYY-MM-DD HH:mm:ss');\n const endMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.end, 'YYYY-MM-DD HH:mm:ss');\n convertedTimeblocks.push({\n id: timeblock.id || null,\n date: startMoment.toDate(),\n starts_at_time: startMoment.format('HH:mm'),\n ends_at_time: endMoment.format('HH:mm'),\n is_finished: timeblock.is_finished || 0,\n employee_id: data.employee_id // Add employee_id for edit mode\n });\n }\n });\n }\n // Store timeblocks in the component's timeblocks array\n this.timeblocks = convertedTimeblocks;\n\n // Ensure at least one timeblock exists for edit mode\n if (data.employee_id && this.timeblocks.length === 0) {\n this.addTimeblock(data.employee_id);\n }\n if (!data.deadline) {\n this.editMode = editMode || !data.id;\n return this.subtask = this._enrichTask(data);\n }\n const splittedDeadline = data.deadline.split(' ');\n data.deadline = splittedDeadline[0];\n data._deadline_time = splittedDeadline[1];\n this.subtask = this._enrichTask(data);\n } else {\n const savedSubtask = localStorage.getItem('subtaskData');\n const savedTimeblocks = localStorage.getItem('subtaskTimeblocks');\n try {\n if (savedSubtask) {\n const parsedSubtask = JSON.parse(savedSubtask);\n this.subtask = parsedSubtask;\n // If the parsed result is not an object, reset to default\n if (typeof this.subtask !== 'object' || this.subtask === null) {\n throw new Error('Parsed subtask is not an object');\n }\n\n // Load timeblocks from localStorage if they exist\n if (savedTimeblocks) {\n try {\n const parsedTimeblocks = JSON.parse(savedTimeblocks);\n if (Array.isArray(parsedTimeblocks)) {\n this.timeblocks = parsedTimeblocks.map(tb => ({\n ...tb,\n date: tb.date ? new Date(tb.date) : null\n }));\n }\n } catch (e) {\n console.error('Error parsing saved timeblocks:', e);\n this.timeblocks = [];\n }\n }\n this.$nextTick(() => {\n this.$refs['description']?.setHTML(this.subtask.description || '');\n });\n } else {\n throw new Error('subtaskData is null or undefined');\n }\n } catch (error) {\n this.subtask = {\n master_task: mastertask,\n employees: [{}],\n _deadline_time: '17:00'\n };\n }\n if (subtask?.deadline && subtask._deadline_time && subtask.employee_id) {\n const employee = this.enrichedEmployees.find(employee => employee.id == subtask.employee_id);\n this.subtask.employees = [employee];\n this.subtask.deadline = subtask.deadline;\n this.subtask._deadline_time = subtask._deadline_time;\n }\n if (subtask?.master_task_id && subtask?.project_code) {\n this.subtask.master_task_id = subtask.master_task_id;\n this.subtask.project_code = subtask.project_code;\n }\n }\n this.editMode = editMode || !this.subtask.id;\n } catch (error) {\n this.$toast.error(this.$parseError(error));\n }\n },\n deleteTimeblock(i) {\n this.subtask.timeblocks.splice(i, 1);\n },\n closeModal() {\n this.visible = false;\n this.$router.replace({\n name: this.$route.name\n });\n },\n async validate(concept = false) {\n if (concept === false) {\n const employeesValid = await this._validateEmployees();\n const timeblocksValid = await this._validateTimeblocks();\n if (!(await this.v$.$validate())) return;\n if (!employeesValid || !timeblocksValid) return;\n return true;\n } else {\n this.v$.subtask.master_task_id.$touch();\n return this.v$.subtask.master_task_id.$errors.length === 0;\n }\n },\n async save(concept = false) {\n this.v$.$reset();\n this.wasFormValidationTriggered = true;\n if (!(await this.validate(concept))) return;\n this.subtask.description = this.$refs['description'].getHTML();\n this._mergeDeadlineTimeDate();\n try {\n this.isSaving = true;\n\n // Concept tasks may not have a deadline time set\n this.subtask.deadline = this.subtask.deadline ? moment__WEBPACK_IMPORTED_MODULE_15___default()(this.subtask.deadline).format('YYYY-MM-DD HH:mm:SS') : null;\n if (this.subtask?.id) {\n const timesheets = this.subtask.timesheets.map(timesheet => {\n delete timesheet.employee_name;\n return timesheet;\n });\n\n // Convert timeblocks from internal format to BE format for update\n // Filter out completely empty timeblocks AND timeblocks without all required fields\n const timeblocks = this.timeblocks.filter(timeblock => timeblock.date && timeblock.starts_at_time && timeblock.ends_at_time && timeblock.employee_id === this.subtask.employee_id) // Only send complete timeblocks for this employee\n .map(timeblock => {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD');\n return {\n id: timeblock.id || null,\n start: `${dateStr} ${timeblock.starts_at_time}:00`,\n end: `${dateStr} ${timeblock.ends_at_time}:00`,\n is_finished: timeblock.is_finished || 0\n };\n });\n const payload = {\n ...this.subtask,\n timesheets,\n timeblocks\n };\n if (concept) {\n payload.is_draft = 1;\n } else {\n payload.is_draft = 0;\n }\n const {\n subtask\n } = await this.$axios.patch_auth_form(`v1/subtasks/${this.subtask.id}`, payload);\n localStorage.removeItem('subtaskData');\n localStorage.removeItem('subtaskTimeblocks');\n this.$store.commit('tm/update_subtask', subtask);\n this.$events.emit('on-subtask-edited', this.subtask);\n } else {\n // Filter out employees that don't have both id and duration\n const validEmployees = this.subtask.employees.filter(employee => employee.id && employee.duration);\n\n // Assign timeblocks to each employee based on employee_id\n // Filter out empty/incomplete timeblocks - only send fully filled timeblocks\n validEmployees.forEach(employee => {\n employee.timeblocks = this.timeblocks.filter(timeblock => timeblock.date && timeblock.starts_at_time && timeblock.ends_at_time && timeblock.employee_id === employee.id).map(timeblock => {\n return {\n start: `${moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD')} ${timeblock.starts_at_time}:00`,\n end: `${moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD')} ${timeblock.ends_at_time}:00`,\n id: null\n };\n });\n });\n const subtaskCopy = {\n ...this.subtask,\n employees: validEmployees\n };\n if (concept) {\n subtaskCopy.is_draft = true;\n subtaskCopy.employees = subtaskCopy.employees?.length > 0 ? subtaskCopy.employees : [{\n id: this.$store.getters['auth/user']?.id,\n duration: 0\n }];\n }\n delete subtaskCopy._master_task;\n const {\n subtasks\n } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, subtaskCopy);\n localStorage.removeItem('subtaskData');\n localStorage.removeItem('subtaskTimeblocks');\n this.subtask.id = subtasks[0].id;\n subtasks.forEach(subtask => {\n this.$store.commit('tm/update_subtask', subtask);\n this.$events.emit('on-subtask-edited', this.subtask);\n });\n this.$events.emit('task-created');\n this.$events.emit('close-both-modals');\n }\n this.closeModal();\n } catch (error) {\n this.$toast.error(this.$parseError(error));\n } finally {\n this.isSaving = false;\n }\n },\n openDeleteTaskModal(subtask) {\n if (subtask.type == 'office365') return this.$events.emit('show-unable-to-edit-office-task-modal', {\n mode: 'delete'\n });\n this.$events.emit('show-delete-task-modal', {\n subtask\n });\n },\n showCompleteTaskModal() {\n this.$events.emit('show-complete-task-modal', {\n subtask: this.subtask\n });\n if (this.subtask.deadline) this.subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_14__[\"default\"].formatDateTimeForBackend(this.subtask.deadline);\n },\n filesUploaded(files) {\n this.subtask.files = files;\n },\n updateSubtask(subtask) {\n this.subtask = subtask;\n },\n _mergeDeadlineTimeDate() {\n // Override for concept tasks which may not have a deadline time set (check for invalid date)\n if (isNaN(new Date(this.subtask.deadline).getTime())) {\n this.subtask.deadline = null;\n } else {\n const date = new Date(this.subtask.deadline);\n const timeParts = this.subtask._deadline_time.split(':');\n date.setHours(parseInt(timeParts[0]));\n date.setMinutes(parseInt(timeParts[1]));\n this.subtask.deadline = date;\n }\n },\n async _validateEmployees() {\n if (this.subtask.id) {\n // For existing subtasks, at least one employee is required\n const hasEmployee = !!(this.subtask.employee_id && this.subtask.duration);\n return hasEmployee;\n } else {\n let valid = true;\n\n // Validate ALL employee component refs (this will show errors on inputs)\n for (let i = 0; i < this.employeeRefs.length; i++) {\n const employeeRef = this.employeeRefs[i];\n\n // Validate employees that have any data (partial or complete)\n if (employeeRef && typeof employeeRef.validate === 'function') {\n if (!(await employeeRef.validate())) {\n valid = false;\n }\n }\n }\n return valid;\n }\n },\n async _validateTimeblocks() {\n // Date alone is valid. Validation only applies if start OR end time is filled.\n // If start OR end is filled, then ALL fields (date, start, end) are required.\n let valid = true;\n for (const timeblock of this.timeblocks) {\n const hasStart = !!timeblock.starts_at_time;\n const hasEnd = !!timeblock.ends_at_time;\n const hasAnyTime = hasStart || hasEnd;\n\n // If no time data (start/end), timeblock is valid (date alone is OK)\n if (!hasAnyTime) {\n continue;\n }\n\n // If start OR end is filled, ALL fields are required\n const hasDate = !!timeblock.date;\n if (!hasDate || !hasStart || !hasEnd) {\n valid = false;\n break;\n }\n\n // Validate that end time is after start time\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD');\n const start = moment__WEBPACK_IMPORTED_MODULE_15___default()(`${dateStr} ${timeblock.starts_at_time}`, 'YYYY-MM-DD HH:mm');\n const end = moment__WEBPACK_IMPORTED_MODULE_15___default()(`${dateStr} ${timeblock.ends_at_time}`, 'YYYY-MM-DD HH:mm');\n if (end.isSameOrBefore(start)) {\n valid = false;\n break;\n }\n }\n return valid;\n },\n _enrichTask(subtask) {\n return {\n ...subtask,\n _created_by: this.enrichedEmployees.find(employee => employee.id == subtask.created_by),\n _employee: this.enrichedEmployees.find(employee => employee.id == subtask.employee_id),\n _master_task: this.mastertasks.find(mastertask => mastertask.id == subtask.master_task_id)\n };\n }\n }\n});\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/z-task-modal.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); +eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.json.stringify.js */ \"./node_modules/core-js/modules/es.json.stringify.js\");\n/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ \"./node_modules/core-js/modules/esnext.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/esnext.iterator.filter.js */ \"./node_modules/core-js/modules/esnext.iterator.filter.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ \"./node_modules/core-js/modules/esnext.iterator.find.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ \"./node_modules/core-js/modules/esnext.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/esnext.iterator.map.js */ \"./node_modules/core-js/modules/esnext.iterator.map.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _plugins_tm_components_z_datepicker_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/plugins/tm@_components/z-datepicker.vue */ \"./src/plugins/tm@_components/z-datepicker.vue\");\n/* harmony import */ var _plugins_tm_components_z_files_upload_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/plugins/tm@_components/z-files-upload.vue */ \"./src/plugins/tm@_components/z-files-upload.vue\");\n/* harmony import */ var _vuelidate_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @vuelidate/core */ \"./node_modules/@vuelidate/core/dist/index.esm.js\");\n/* harmony import */ var _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @vuelidate/validators */ \"./node_modules/@vuelidate/validators/dist/index.esm.js\");\n/* harmony import */ var _plugins_lib_auth_utils_error_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/plugins/lib@auth/_utils/error.utils */ \"./src/plugins/lib@auth/_utils/error.utils.ts\");\n/* harmony import */ var _vueup_vue_quill__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @vueup/vue-quill */ \"./node_modules/@vueup/vue-quill/dist/vue-quill.esm-bundler.js\");\n/* harmony import */ var _master_task_mixins_selects_mixin__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../master-task/_mixins/selects.mixin */ \"./src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts\");\n/* harmony import */ var _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/plugins/tm@_utils/tm.utils */ \"./src/plugins/tm@_utils/tm.utils.ts\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_15__);\n/* harmony import */ var _vueup_vue_quill_dist_vue_quill_snow_css__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @vueup/vue-quill/dist/vue-quill.snow.css */ \"./node_modules/@vueup/vue-quill/dist/vue-quill.snow.css\");\n/* harmony import */ var _vueup_vue_quill_dist_vue_quill_snow_css__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_vueup_vue_quill_dist_vue_quill_snow_css__WEBPACK_IMPORTED_MODULE_16__);\n/* harmony import */ var _plugins_tm_mixins_autocomplete_mixin__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @/plugins/tm@_mixins/autocomplete.mixin */ \"./src/plugins/tm@_mixins/autocomplete.mixin.ts\");\n/* harmony import */ var _components_z_task_readonly_info_vue__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./_components/z-task-readonly-info.vue */ \"./src/plugins/tm@modal/task/_components/z-task-readonly-info.vue\");\n/* harmony import */ var _components_employees_a_employee_vue__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./_components/employees/a-employee.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee.vue\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm-bundler.js\");\n/* harmony import */ var _plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @/plugins/tm@modal/_mixins/modal.mixin */ \"./src/plugins/tm@modal/_mixins/modal.mixin.ts\");\n/* harmony import */ var _plugins_tm_modal_components_a_resize_handle_vue__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @/plugins/tm@modal/_components/a-resize-handle.vue */ \"./src/plugins/tm@modal/_components/a-resize-handle.vue\");\n/* harmony import */ var _plugins_tm_modal_components_a_reset_size_button_vue__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @/plugins/tm@modal/_components/a-reset-size-button.vue */ \"./src/plugins/tm@modal/_components/a-reset-size-button.vue\");\n/* harmony import */ var _plugins_tm_modal_components_a_close_button_vue__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! @/plugins/tm@modal/_components/a-close-button.vue */ \"./src/plugins/tm@modal/_components/a-close-button.vue\");\n/* harmony import */ var _z_remove_employee_modal_vue__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./z-remove-employee-modal.vue */ \"./src/plugins/tm@modal/task/z-remove-employee-modal.vue\");\n/* harmony import */ var _z_remove_timeblock_modal_vue__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./z-remove-timeblock-modal.vue */ \"./src/plugins/tm@modal/task/z-remove-timeblock-modal.vue\");\n/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ \"./node_modules/console-browserify/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n ZTaskReadonlyInfo: _components_z_task_readonly_info_vue__WEBPACK_IMPORTED_MODULE_18__[\"default\"],\n AEmployee: _components_employees_a_employee_vue__WEBPACK_IMPORTED_MODULE_19__[\"default\"],\n ZFilesUpload: _plugins_tm_components_z_files_upload_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n ZDatepicker: _plugins_tm_components_z_datepicker_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n // ATaskTimeblocks,\n QuillEditor: _vueup_vue_quill__WEBPACK_IMPORTED_MODULE_12__.QuillEditor,\n AResizeHandle: _plugins_tm_modal_components_a_resize_handle_vue__WEBPACK_IMPORTED_MODULE_22__[\"default\"],\n AResetSizeButton: _plugins_tm_modal_components_a_reset_size_button_vue__WEBPACK_IMPORTED_MODULE_23__[\"default\"],\n ACloseButton: _plugins_tm_modal_components_a_close_button_vue__WEBPACK_IMPORTED_MODULE_24__[\"default\"],\n ZRemoveEmployeeModal: _z_remove_employee_modal_vue__WEBPACK_IMPORTED_MODULE_25__[\"default\"],\n ZRemoveTimeblockModal: _z_remove_timeblock_modal_vue__WEBPACK_IMPORTED_MODULE_26__[\"default\"]\n },\n mixins: [_master_task_mixins_selects_mixin__WEBPACK_IMPORTED_MODULE_13__[\"default\"], _plugins_tm_mixins_autocomplete_mixin__WEBPACK_IMPORTED_MODULE_17__[\"default\"], _plugins_tm_modal_mixins_modal_mixin__WEBPACK_IMPORTED_MODULE_21__[\"default\"]],\n emits: ['close', 'refresh'],\n data() {\n return {\n tmUtils: _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_14__[\"default\"],\n editMode: false,\n visible: false,\n subtask: null,\n isSaving: false,\n errorUtils: _plugins_lib_auth_utils_error_utils__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n v$: (0,_vuelidate_core__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(),\n showDatePicker: false,\n selectedNewDate: [],\n timeblocks: [],\n deletedTimeblockIds: [],\n // Track IDs of saved timeblocks that have been deleted\n wasFormValidationTriggered: false,\n modalName: 'z-task-modal',\n employeeRefs: [],\n pendingRemoveEmployeeId: undefined,\n pendingRemoveEmployeeIndex: undefined\n };\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_20__.mapGetters)('tm', ['mastertasks', 'enrichedEmployees']),\n enrichedMastertasks() {\n return this.mastertasks.map(mastertask => ({\n ...mastertask,\n _fullName: `${mastertask.name} [${mastertask.project_code}]`\n }));\n },\n editModeEmployee: {\n get() {\n return {\n id: this.subtask?.employee_id || null,\n duration: this.subtask?.duration || null\n };\n },\n set(value) {\n if (this.subtask) {\n this.subtask.employee_id = value.id;\n this.subtask.duration = value.duration;\n }\n }\n }\n },\n validations() {\n return {\n subtask: {\n master_task_id: {\n required: _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__.required\n },\n deadline: {\n required: _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__.required\n },\n _deadline_time: {\n required: _vuelidate_validators__WEBPACK_IMPORTED_MODULE_10__.required\n }\n }\n };\n },\n watch: {\n 'subtask.employee_id'(value, oldValue) {\n if (!value || !oldValue) return;\n\n // In edit mode: reassign timeblocks to new employee\n if (this.subtask.id) {\n this.timeblocks = this.timeblocks.map(tb => {\n if (tb.employee_id === oldValue) {\n return {\n ...tb,\n employee_id: value\n };\n }\n return tb;\n });\n } else {\n // In create mode: remove old employee's timeblocks\n this.timeblocks = this.timeblocks.filter(tb => tb.employee_id !== oldValue);\n }\n this.subtask._employee = this.enrichedEmployees.find(employee => employee.id == this.subtask.employee_id);\n },\n 'subtask.employees': {\n handler() {\n if (!this.subtask?.employees) return;\n const lastEmployee = this.subtask.employees[this.subtask.employees.length - 1];\n if (lastEmployee?.id || lastEmployee?.duration) this.subtask.employees.push({});\n },\n deep: true\n },\n 'subtask.master_task_id'(value) {\n if (!value) return;\n this.subtask._master_task = this.mastertasks.find(mastertask => mastertask.id == this.subtask.master_task_id);\n this.subtask.project_code = this.subtask._master_task?.project_code || null;\n },\n editMode() {\n this.$nextTick(() => {\n this.$refs['description']?.setHTML(this.subtask.description || '');\n });\n },\n subtask: {\n handler(val) {\n if (this.editMode && !this.subtask?.id) {\n const employees = val?.employees?.filter(employee => employee?.id || employee?.duration) || [{}];\n const subtaskData = {\n ...val,\n employees: employees && employees.length > 0 ? employees : [{}]\n };\n localStorage.setItem('subtaskData', JSON.stringify(subtaskData));\n }\n },\n deep: true\n },\n timeblocks: {\n handler(val) {\n if (this.editMode && !this.subtask?.id) {\n // Save timeblocks to localStorage for new tasks\n localStorage.setItem('subtaskTimeblocks', JSON.stringify(val));\n }\n },\n deep: true\n }\n },\n mounted() {\n // Handle remove timeblock modal\n this.$events.on('show-remove-timeblock-modal', ({\n onConfirm\n }) => {\n this.$refs.removeTimeblockModal.showModal({\n onConfirm\n });\n });\n this.$events.on('add-timeblock', timeblock => {\n if (!this.subtask) return;\n if (!this.subtask.timeblocks) {\n this.subtask.timeblocks = [];\n }\n if (!this.subtask.timesheets) {\n this.subtask.timesheets = [];\n }\n if (!this.subtask.is_finished) {\n this.subtask.is_finished = 0;\n }\n this.subtask.timeblocks.push(timeblock);\n });\n this.$events.on('on-subtask-edited', subtask => {\n if (subtask?.id !== this.subtask?.id) return;\n const data = JSON.parse(JSON.stringify(subtask));\n const splittedDeadline = data.deadline?.split(' ') || [];\n data.deadline = splittedDeadline[0];\n data._deadline_time = splittedDeadline[1];\n\n // Convert BE format timeblocks to internal format\n const convertedTimeblocks = [];\n if (data.timeblocks && data.timeblocks.length > 0) {\n data.timeblocks.forEach(timeblock => {\n // If already in internal format, keep as is\n if (timeblock.date) {\n convertedTimeblocks.push({\n ...timeblock,\n employee_id: data.employee_id // Add employee_id\n });\n return;\n }\n\n // Convert from BE format to internal format\n if (timeblock.start && timeblock.end) {\n const startMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.start, 'YYYY-MM-DD HH:mm:ss');\n const endMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.end, 'YYYY-MM-DD HH:mm:ss');\n convertedTimeblocks.push({\n id: timeblock.id || null,\n date: startMoment.toDate(),\n starts_at_time: startMoment.format('HH:mm'),\n ends_at_time: endMoment.format('HH:mm'),\n is_finished: timeblock.is_finished || 0,\n employee_id: data.employee_id // Add employee_id\n });\n }\n });\n }\n // Store in component's timeblocks array\n this.timeblocks = convertedTimeblocks;\n this.subtask = this._enrichTask(data);\n\n // TODO: Remove? riesil som neodstranovanie jedineho zanamu v trvani a odpracovanom case\n this.$forceUpdate();\n });\n this.$events.on('on-subtask-deleted', subtask => {\n if (subtask?.id == this.subtask?.id) this.closeModal();\n });\n },\n methods: {\n toggleEditMode() {\n if (this.subtask.type == 'office365') return this.$events.emit('show-unable-to-edit-office-task-modal', {\n mode: 'edit'\n });\n this.editMode = !this.editMode;\n },\n // Set refs for employee components in create mode\n setEmployeeRef(el, index) {\n if (el) {\n this.employeeRefs[index] = el;\n }\n },\n openDatepicker(ref) {\n this.$refs[ref].openMenu();\n },\n // Helper: Get employee by ID\n getEmployeeById(employeeId) {\n return this.enrichedEmployees.find(emp => emp.id === employeeId);\n },\n // Helper: Get employee full name\n getEmployeeFullName(employeeId) {\n const employee = this.getEmployeeById(employeeId);\n return employee ? `${employee.name} ${employee.surname}` : '';\n },\n // Helper: Get valid employees (with id and duration) in create mode\n getValidEmployees() {\n if (!this.subtask?.employees) return [];\n return this.subtask.employees.filter(emp => emp.id && emp.duration);\n },\n // Helper: Get timeblocks for specific employee\n getEmployeeTimeblocks(employeeId) {\n if (!this.timeblocks) return [];\n return this.timeblocks.filter(tb => tb.employee_id === employeeId);\n },\n updateEmployeeTimeblocks(updatedTimeblocks, employeeId) {\n // Track deleted timeblocks (saved timeblocks that are no longer in the updated list)\n const updatedIds = new Set(updatedTimeblocks.filter(tb => tb.id).map(tb => tb.id));\n const deletedIds = this.timeblocks.filter(tb => tb.employee_id === employeeId && tb.id && !updatedIds.has(tb.id)).map(tb => tb.id).filter(id => !this.deletedTimeblockIds.includes(id));\n this.deletedTimeblockIds.push(...deletedIds);\n\n // Replace timeblocks for this employee\n const otherEmployeeTimeblocks = this.timeblocks.filter(tb => tb.employee_id !== employeeId);\n const updatedWithEmployeeId = updatedTimeblocks.map(tb => ({\n ...tb,\n employee_id: employeeId\n }));\n this.timeblocks = [...otherEmployeeTimeblocks, ...updatedWithEmployeeId];\n },\n updateTimeblock(val, index, employeeId) {\n const employeeTimeblocks = this.getEmployeeTimeblocks(employeeId);\n const timeblock = employeeTimeblocks[index];\n if (!timeblock) return;\n\n // Find the actual index in the full timeblocks array\n const actualIndex = this.timeblocks.indexOf(timeblock);\n if (actualIndex !== -1) {\n this.timeblocks[actualIndex] = {\n ...val,\n employee_id: employeeId\n };\n }\n },\n addTimeblock(employeeId, afterIndex = -1) {\n const newTimeblock = {\n date: new Date(),\n // Preset to current day\n starts_at_time: null,\n ends_at_time: null,\n employee_id: employeeId\n };\n\n // Get timeblocks for this employee\n const employeeTimeblocks = this.timeblocks.filter(tb => tb.employee_id === employeeId);\n if (afterIndex === -1 || afterIndex >= employeeTimeblocks.length - 1) {\n // Add at the end\n this.timeblocks.push(newTimeblock);\n } else {\n // Find the position in the full timeblocks array\n const timeblockToInsertAfter = employeeTimeblocks[afterIndex];\n const insertPosition = this.timeblocks.indexOf(timeblockToInsertAfter) + 1;\n this.timeblocks.splice(insertPosition, 0, newTimeblock);\n }\n },\n removeTimeblock(index, employeeId) {\n const employeeTimeblocks = this.getEmployeeTimeblocks(employeeId);\n const timeblock = employeeTimeblocks[index];\n if (!timeblock) return;\n\n // Find the actual index in the full timeblocks array\n const actualIndex = this.timeblocks.indexOf(timeblock);\n if (actualIndex !== -1) {\n this.timeblocks.splice(actualIndex, 1);\n }\n },\n // Handle remove employee - also removes their timeblocks\n handleRemoveEmployee() {\n this.pendingRemoveEmployeeId = this.subtask.employee_id;\n this.$refs.removeEmployeeModal.showModal();\n },\n removeEmployeeAtIndex(index) {\n this.pendingRemoveEmployeeIndex = index;\n this.$refs.removeEmployeeModal.showModal();\n },\n confirmRemoveEmployee() {\n // Handle edit mode (single employee removal)\n if (this.pendingRemoveEmployeeId !== undefined) {\n if (this.subtask.employee_id) {\n // Remove all timeblocks for this employee\n this.timeblocks = this.timeblocks.filter(tb => tb.employee_id !== this.subtask.employee_id);\n }\n\n // Clear employee data in edit mode\n this.subtask.employee_id = null;\n this.subtask.duration = null;\n this.pendingRemoveEmployeeId = undefined;\n }\n // Handle create mode (multiple employees removal)\n else if (this.pendingRemoveEmployeeIndex !== undefined) {\n const employee = this.subtask.employees[this.pendingRemoveEmployeeIndex];\n if (employee?.id) {\n // Remove all timeblocks for this employee\n this.timeblocks = this.timeblocks.filter(tb => tb.employee_id !== employee.id);\n }\n\n // Remove employee from array\n this.subtask.employees.splice(this.pendingRemoveEmployeeIndex, 1);\n this.pendingRemoveEmployeeIndex = undefined;\n }\n },\n async showModal({\n subtask,\n editMode = false,\n mastertask = {}\n }) {\n this.isSaving = false;\n this.subtask = null;\n this.wasFormValidationTriggered = false; // Reset validation trigger\n\n // CRITICAL: Prevent v-dialog autofocus BEFORE modal opens\n this.preventInputFocus = true;\n this.visible = true;\n this.timeblocks = [];\n this.deletedTimeblockIds = []; // Reset deleted timeblock IDs\n this.employeeRefs = [];\n this.$nextTick(() => {\n this.v$.$reset();\n\n // Reset after modal is fully rendered and v-dialog autofocus has been blocked\n setTimeout(() => {\n this.preventInputFocus = false;\n }, 300);\n });\n try {\n if (subtask?.id) {\n const data = await this.$axios.get_auth_data(`v1/subtasks/${subtask.id}`);\n\n // Convert BE format timeblocks to internal format\n const convertedTimeblocks = [];\n if (data.timeblocks && data.timeblocks.length > 0) {\n data.timeblocks.forEach(timeblock => {\n // If already in internal format, keep as is\n if (timeblock.date) {\n convertedTimeblocks.push({\n ...timeblock,\n employee_id: data.employee_id // Add employee_id for edit mode\n });\n return;\n }\n\n // Convert from BE format to internal format\n if (timeblock.start && timeblock.end) {\n const startMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.start, 'YYYY-MM-DD HH:mm:ss');\n const endMoment = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.end, 'YYYY-MM-DD HH:mm:ss');\n convertedTimeblocks.push({\n id: timeblock.id || null,\n date: startMoment.toDate(),\n starts_at_time: startMoment.format('HH:mm'),\n ends_at_time: endMoment.format('HH:mm'),\n is_finished: timeblock.is_finished || 0,\n employee_id: data.employee_id // Add employee_id for edit mode\n });\n }\n });\n }\n // Store timeblocks in the component's timeblocks array\n this.timeblocks = convertedTimeblocks;\n\n // Ensure at least one timeblock exists for edit mode\n if (data.employee_id && this.timeblocks.length === 0) {\n this.addTimeblock(data.employee_id);\n }\n if (!data.deadline) {\n this.editMode = editMode || !data.id;\n return this.subtask = this._enrichTask(data);\n }\n const splittedDeadline = data.deadline.split(' ');\n data.deadline = splittedDeadline[0];\n data._deadline_time = splittedDeadline[1];\n this.subtask = this._enrichTask(data);\n } else {\n const savedSubtask = localStorage.getItem('subtaskData');\n const savedTimeblocks = localStorage.getItem('subtaskTimeblocks');\n try {\n if (savedSubtask) {\n const parsedSubtask = JSON.parse(savedSubtask);\n this.subtask = parsedSubtask;\n // If the parsed result is not an object, reset to default\n if (typeof this.subtask !== 'object' || this.subtask === null) {\n throw new Error('Parsed subtask is not an object');\n }\n\n // Load timeblocks from localStorage if they exist\n if (savedTimeblocks) {\n try {\n const parsedTimeblocks = JSON.parse(savedTimeblocks);\n if (Array.isArray(parsedTimeblocks)) {\n this.timeblocks = parsedTimeblocks.map(tb => ({\n ...tb,\n date: tb.date ? new Date(tb.date) : null\n }));\n }\n } catch (e) {\n console.error('Error parsing saved timeblocks:', e);\n this.timeblocks = [];\n }\n }\n this.$nextTick(() => {\n this.$refs['description']?.setHTML(this.subtask.description || '');\n });\n } else {\n throw new Error('subtaskData is null or undefined');\n }\n } catch (error) {\n this.subtask = {\n master_task: mastertask,\n employees: [{}],\n _deadline_time: '17:00'\n };\n }\n if (subtask?.deadline && subtask._deadline_time && subtask.employee_id) {\n const employee = this.enrichedEmployees.find(employee => employee.id == subtask.employee_id);\n this.subtask.employees = [employee];\n this.subtask.deadline = subtask.deadline;\n this.subtask._deadline_time = subtask._deadline_time;\n }\n if (subtask?.master_task_id && subtask?.project_code) {\n this.subtask.master_task_id = subtask.master_task_id;\n this.subtask.project_code = subtask.project_code;\n }\n }\n this.editMode = editMode || !this.subtask.id;\n } catch (error) {\n this.$toast.error(this.$parseError(error));\n }\n },\n deleteTimeblock(i) {\n this.subtask.timeblocks.splice(i, 1);\n },\n closeModal() {\n this.visible = false;\n this.$router.replace({\n name: this.$route.name\n });\n },\n async validate(concept = false) {\n if (concept === false) {\n const employeesValid = await this._validateEmployees();\n const timeblocksValid = await this._validateTimeblocks();\n if (!(await this.v$.$validate())) return;\n if (!employeesValid || !timeblocksValid) return;\n return true;\n } else {\n this.v$.subtask.master_task_id.$touch();\n return this.v$.subtask.master_task_id.$errors.length === 0;\n }\n },\n async save(concept = false) {\n this.v$.$reset();\n this.wasFormValidationTriggered = true;\n if (!(await this.validate(concept))) return;\n this.subtask.description = this.$refs['description'].getHTML();\n this._mergeDeadlineTimeDate();\n try {\n this.isSaving = true;\n\n // Concept tasks may not have a deadline time set\n this.subtask.deadline = this.subtask.deadline ? moment__WEBPACK_IMPORTED_MODULE_15___default()(this.subtask.deadline).format('YYYY-MM-DD HH:mm:SS') : null;\n if (this.subtask?.id) {\n const timesheets = this.subtask.timesheets.map(timesheet => {\n delete timesheet.employee_name;\n return timesheet;\n });\n\n // Convert timeblocks from internal format to BE format for update\n // Filter out completely empty timeblocks AND timeblocks without all required fields\n const timeblocks = this.timeblocks.filter(timeblock => timeblock.date && timeblock.starts_at_time && timeblock.ends_at_time && timeblock.employee_id === this.subtask.employee_id) // Only send complete timeblocks for this employee\n .map(timeblock => {\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD');\n return {\n id: timeblock.id || null,\n start: `${dateStr} ${timeblock.starts_at_time}:00`,\n end: `${dateStr} ${timeblock.ends_at_time}:00`,\n is_finished: timeblock.is_finished || 0\n };\n });\n const payload = {\n ...this.subtask,\n timesheets,\n timeblocks\n };\n if (concept) {\n payload.is_draft = 1;\n } else {\n payload.is_draft = 0;\n }\n const {\n subtask\n } = await this.$axios.patch_auth_form(`v1/subtasks/${this.subtask.id}`, payload);\n localStorage.removeItem('subtaskData');\n localStorage.removeItem('subtaskTimeblocks');\n this.$store.commit('tm/update_subtask', subtask);\n this.$events.emit('on-subtask-edited', this.subtask);\n } else {\n // Filter out employees that don't have both id and duration\n const validEmployees = this.subtask.employees.filter(employee => employee.id && employee.duration);\n\n // Assign timeblocks to each employee based on employee_id\n // Filter out empty/incomplete timeblocks - only send fully filled timeblocks\n validEmployees.forEach(employee => {\n employee.timeblocks = this.timeblocks.filter(timeblock => timeblock.date && timeblock.starts_at_time && timeblock.ends_at_time && timeblock.employee_id === employee.id).map(timeblock => {\n return {\n start: `${moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD')} ${timeblock.starts_at_time}:00`,\n end: `${moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD')} ${timeblock.ends_at_time}:00`,\n id: null\n };\n });\n });\n const subtaskCopy = {\n ...this.subtask,\n employees: validEmployees\n };\n if (concept) {\n subtaskCopy.is_draft = true;\n subtaskCopy.employees = subtaskCopy.employees?.length > 0 ? subtaskCopy.employees : [{\n id: this.$store.getters['auth/user']?.id,\n duration: 0\n }];\n }\n delete subtaskCopy._master_task;\n const {\n subtasks\n } = await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`, subtaskCopy);\n localStorage.removeItem('subtaskData');\n localStorage.removeItem('subtaskTimeblocks');\n this.subtask.id = subtasks[0].id;\n subtasks.forEach(subtask => {\n this.$store.commit('tm/update_subtask', subtask);\n this.$events.emit('on-subtask-edited', this.subtask);\n });\n this.$events.emit('task-created');\n this.$events.emit('close-both-modals');\n }\n this.closeModal();\n } catch (error) {\n this.$toast.error(this.$parseError(error));\n } finally {\n this.isSaving = false;\n }\n },\n openDeleteTaskModal(subtask) {\n if (subtask.type == 'office365') return this.$events.emit('show-unable-to-edit-office-task-modal', {\n mode: 'delete'\n });\n this.$events.emit('show-delete-task-modal', {\n subtask\n });\n },\n showCompleteTaskModal() {\n this.$events.emit('show-complete-task-modal', {\n subtask: this.subtask\n });\n if (this.subtask.deadline) this.subtask.deadline = _plugins_tm_utils_tm_utils__WEBPACK_IMPORTED_MODULE_14__[\"default\"].formatDateTimeForBackend(this.subtask.deadline);\n },\n filesUploaded(files) {\n this.subtask.files = files;\n },\n updateSubtask(subtask) {\n this.subtask = subtask;\n },\n _mergeDeadlineTimeDate() {\n // Override for concept tasks which may not have a deadline time set (check for invalid date)\n if (isNaN(new Date(this.subtask.deadline).getTime())) {\n this.subtask.deadline = null;\n } else {\n const date = new Date(this.subtask.deadline);\n const timeParts = this.subtask._deadline_time.split(':');\n date.setHours(parseInt(timeParts[0]));\n date.setMinutes(parseInt(timeParts[1]));\n this.subtask.deadline = date;\n }\n },\n async _validateEmployees() {\n if (this.subtask.id) {\n // For existing subtasks, at least one employee is required\n const hasEmployee = !!(this.subtask.employee_id && this.subtask.duration);\n return hasEmployee;\n } else {\n let valid = true;\n\n // Validate ALL employee component refs (this will show errors on inputs)\n for (let i = 0; i < this.employeeRefs.length; i++) {\n const employeeRef = this.employeeRefs[i];\n\n // Validate employees that have any data (partial or complete)\n if (employeeRef && typeof employeeRef.validate === 'function') {\n if (!(await employeeRef.validate())) {\n valid = false;\n }\n }\n }\n return valid;\n }\n },\n async _validateTimeblocks() {\n // Date alone is valid. Validation only applies if start OR end time is filled.\n // If start OR end is filled, then ALL fields (date, start, end) are required.\n let valid = true;\n for (const timeblock of this.timeblocks) {\n const hasStart = !!timeblock.starts_at_time;\n const hasEnd = !!timeblock.ends_at_time;\n const hasAnyTime = hasStart || hasEnd;\n\n // If no time data (start/end), timeblock is valid (date alone is OK)\n if (!hasAnyTime) {\n continue;\n }\n\n // If start OR end is filled, ALL fields are required\n const hasDate = !!timeblock.date;\n if (!hasDate || !hasStart || !hasEnd) {\n valid = false;\n break;\n }\n\n // Validate that end time is after start time\n const dateStr = moment__WEBPACK_IMPORTED_MODULE_15___default()(timeblock.date).format('YYYY-MM-DD');\n const start = moment__WEBPACK_IMPORTED_MODULE_15___default()(`${dateStr} ${timeblock.starts_at_time}`, 'YYYY-MM-DD HH:mm');\n const end = moment__WEBPACK_IMPORTED_MODULE_15___default()(`${dateStr} ${timeblock.ends_at_time}`, 'YYYY-MM-DD HH:mm');\n if (end.isSameOrBefore(start)) {\n valid = false;\n break;\n }\n }\n return valid;\n },\n _enrichTask(subtask) {\n return {\n ...subtask,\n _created_by: this.enrichedEmployees.find(employee => employee.id == subtask.created_by),\n _employee: this.enrichedEmployees.find(employee => employee.id == subtask.employee_id),\n _master_task: this.mastertasks.find(mastertask => mastertask.id == subtask.master_task_id)\n };\n }\n }\n});\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/z-task-modal.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); /***/ }), @@ -1243,7 +1243,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var cor /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ \"./node_modules/core-js/modules/esnext.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ \"./node_modules/core-js/modules/esnext.iterator.find.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm-bundler.js\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm-bundler.js\");\n/* harmony import */ var _a_employee_select_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./a-employee-select.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-select.vue\");\n/* harmony import */ var _a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./a-employee-timeblock.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-timeblock.vue\");\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (/*@__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_2__.defineComponent)({\n __name: 'a-employee',\n props: {\n employeeData: {\n type: Object,\n required: true\n },\n timeblocks: {\n type: Array,\n required: false,\n default: () => []\n },\n allTimeblocks: {\n type: Array,\n required: false,\n default: () => []\n },\n deletedTimeblockIds: {\n type: Array,\n required: false,\n default: () => []\n },\n customFilter: {\n type: Function,\n required: false,\n default: undefined\n },\n hasBackground: {\n type: Boolean,\n required: false,\n default: true\n },\n required: {\n type: Boolean,\n required: false,\n default: false\n }\n },\n emits: [\"update:employeeData\", \"update:timeblocks\", \"clearEmployee\", \"addTimeblock\"],\n setup(__props, {\n expose: __expose,\n emit: __emit\n }) {\n const props = __props;\n const emit = __emit;\n const store = (0,vuex__WEBPACK_IMPORTED_MODULE_3__.useStore)();\n // Local models with v-model sync\n const employeeDataLocal = (0,vue__WEBPACK_IMPORTED_MODULE_2__.computed)({\n get: () => props.employeeData,\n set: value => emit('update:employeeData', value)\n });\n // Refs for validation\n const employeeSelectRef = (0,vue__WEBPACK_IMPORTED_MODULE_2__.ref)(null);\n const timeblockRefs = (0,vue__WEBPACK_IMPORTED_MODULE_2__.ref)([]);\n const setTimeblockRef = (el, index) => {\n if (el) {\n timeblockRefs.value[index] = el;\n }\n };\n // Get the full employee object from store\n const selectedEmployee = (0,vue__WEBPACK_IMPORTED_MODULE_2__.computed)(() => {\n if (!props.employeeData.id) return null;\n const employees = store.getters['tm/enrichedEmployees'];\n return employees.find(emp => emp.id === props.employeeData.id) || null;\n });\n // Watch for when employee is selected and ensure at least one timeblock exists\n (0,vue__WEBPACK_IMPORTED_MODULE_2__.watch)(() => props.employeeData.id, (newId, oldId) => {\n // If employee just got selected (id changed from null/undefined to a value)\n // and there are no timeblocks for this employee, request one to be added\n if (newId && !oldId && props.timeblocks.length === 0) {\n (0,vue__WEBPACK_IMPORTED_MODULE_2__.nextTick)(() => {\n emit('addTimeblock', -1);\n });\n }\n }, {\n flush: 'post'\n });\n // On mount, check if employee has ID but no timeblocks\n (0,vue__WEBPACK_IMPORTED_MODULE_2__.onMounted)(() => {\n if (props.employeeData.id && props.timeblocks.length === 0) {\n (0,vue__WEBPACK_IMPORTED_MODULE_2__.nextTick)(() => {\n emit('addTimeblock', -1);\n });\n }\n });\n const handleClearEmployee = () => {\n emit('clearEmployee');\n };\n const handleUpdateTimeblock = (index, value) => {\n const updatedTimeblocks = [...props.timeblocks];\n updatedTimeblocks[index] = value;\n emit('update:timeblocks', updatedTimeblocks);\n };\n const handleRemoveTimeblock = index => {\n const updatedTimeblocks = [...props.timeblocks];\n updatedTimeblocks.splice(index, 1);\n emit('update:timeblocks', updatedTimeblocks);\n };\n const handleAddTimeblock = afterIndex => {\n emit('addTimeblock', afterIndex);\n };\n // Expose validate method that validates all child components\n const validate = async () => {\n let isValid = true;\n // Validate employee select\n if (employeeSelectRef.value) {\n const selectValid = await employeeSelectRef.value.validate();\n isValid = isValid && selectValid;\n }\n // Validate all timeblocks\n for (const timeblockRef of timeblockRefs.value) {\n if (timeblockRef) {\n const timeblockValid = await timeblockRef.validate();\n isValid = isValid && timeblockValid;\n }\n }\n return isValid;\n };\n __expose({\n validate\n });\n const __returned__ = {\n props,\n emit,\n store,\n employeeDataLocal,\n employeeSelectRef,\n timeblockRefs,\n setTimeblockRef,\n selectedEmployee,\n handleClearEmployee,\n handleUpdateTimeblock,\n handleRemoveTimeblock,\n handleAddTimeblock,\n validate,\n AEmployeeSelect: _a_employee_select_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n AEmployeeTimeblock: _a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n };\n Object.defineProperty(__returned__, '__isScriptSetup', {\n enumerable: false,\n value: true\n });\n return __returned__;\n }\n}));\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/employees/a-employee.vue?./node_modules/webpack-plugin-vuetify/dist/scriptLoader.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use%5B1%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); +eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ \"./node_modules/core-js/modules/esnext.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/esnext.iterator.filter.js */ \"./node_modules/core-js/modules/esnext.iterator.filter.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_filter_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ \"./node_modules/core-js/modules/esnext.iterator.find.js\");\n/* harmony import */ var core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_find_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm-bundler.js\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm-bundler.js\");\n/* harmony import */ var _a_employee_select_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./a-employee-select.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-select.vue\");\n/* harmony import */ var _a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./a-employee-timeblock.vue */ \"./src/plugins/tm@modal/task/_components/employees/a-employee-timeblock.vue\");\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (/*@__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_3__.defineComponent)({\n __name: 'a-employee',\n props: {\n employeeData: {\n type: Object,\n required: true\n },\n timeblocks: {\n type: Array,\n required: false,\n default: () => []\n },\n allTimeblocks: {\n type: Array,\n required: false,\n default: () => []\n },\n deletedTimeblockIds: {\n type: Array,\n required: false,\n default: () => []\n },\n customFilter: {\n type: Function,\n required: false,\n default: undefined\n },\n hasBackground: {\n type: Boolean,\n required: false,\n default: true\n },\n required: {\n type: Boolean,\n required: false,\n default: false\n }\n },\n emits: [\"update:employeeData\", \"update:timeblocks\", \"clearEmployee\", \"addTimeblock\"],\n setup(__props, {\n expose: __expose,\n emit: __emit\n }) {\n const props = __props;\n const emit = __emit;\n const store = (0,vuex__WEBPACK_IMPORTED_MODULE_4__.useStore)();\n // Local models with v-model sync\n const employeeDataLocal = (0,vue__WEBPACK_IMPORTED_MODULE_3__.computed)({\n get: () => props.employeeData,\n set: value => emit('update:employeeData', value)\n });\n // Refs for validation\n const employeeSelectRef = (0,vue__WEBPACK_IMPORTED_MODULE_3__.ref)(null);\n const timeblockRefs = (0,vue__WEBPACK_IMPORTED_MODULE_3__.ref)([]);\n const setTimeblockRef = (el, index) => {\n if (el) {\n timeblockRefs.value[index] = el;\n }\n };\n // Get the full employee object from store\n const selectedEmployee = (0,vue__WEBPACK_IMPORTED_MODULE_3__.computed)(() => {\n if (!props.employeeData.id) return null;\n const employees = store.getters['tm/enrichedEmployees'];\n return employees.find(emp => emp.id === props.employeeData.id) || null;\n });\n // Filter allTimeblocks to only include timeblocks for current employee\n const allTimeblocksForCurrentEmployee = (0,vue__WEBPACK_IMPORTED_MODULE_3__.computed)(() => {\n if (!props.employeeData.id) return [];\n return props.allTimeblocks.filter(tb => tb.employee_id === props.employeeData.id);\n });\n // Watch for when employee is selected and ensure at least one timeblock exists\n (0,vue__WEBPACK_IMPORTED_MODULE_3__.watch)(() => props.employeeData.id, (newId, oldId) => {\n // If employee just got selected (id changed from null/undefined to a value)\n // and there are no timeblocks for this employee, request one to be added\n if (newId && !oldId && props.timeblocks.length === 0) {\n (0,vue__WEBPACK_IMPORTED_MODULE_3__.nextTick)(() => {\n emit('addTimeblock', -1);\n });\n }\n }, {\n flush: 'post'\n });\n // On mount, check if employee has ID but no timeblocks\n (0,vue__WEBPACK_IMPORTED_MODULE_3__.onMounted)(() => {\n if (props.employeeData.id && props.timeblocks.length === 0) {\n (0,vue__WEBPACK_IMPORTED_MODULE_3__.nextTick)(() => {\n emit('addTimeblock', -1);\n });\n }\n });\n const handleClearEmployee = () => {\n emit('clearEmployee');\n };\n const handleUpdateTimeblock = (index, value) => {\n const updatedTimeblocks = [...props.timeblocks];\n updatedTimeblocks[index] = value;\n emit('update:timeblocks', updatedTimeblocks);\n };\n const handleRemoveTimeblock = index => {\n const updatedTimeblocks = [...props.timeblocks];\n updatedTimeblocks.splice(index, 1);\n emit('update:timeblocks', updatedTimeblocks);\n };\n const handleAddTimeblock = afterIndex => {\n emit('addTimeblock', afterIndex);\n };\n // Expose validate method that validates all child components\n const validate = async () => {\n let isValid = true;\n // Validate employee select\n if (employeeSelectRef.value) {\n const selectValid = await employeeSelectRef.value.validate();\n isValid = isValid && selectValid;\n }\n // Validate all timeblocks\n for (const timeblockRef of timeblockRefs.value) {\n if (timeblockRef) {\n const timeblockValid = await timeblockRef.validate();\n isValid = isValid && timeblockValid;\n }\n }\n return isValid;\n };\n __expose({\n validate\n });\n const __returned__ = {\n props,\n emit,\n store,\n employeeDataLocal,\n employeeSelectRef,\n timeblockRefs,\n setTimeblockRef,\n selectedEmployee,\n allTimeblocksForCurrentEmployee,\n handleClearEmployee,\n handleUpdateTimeblock,\n handleRemoveTimeblock,\n handleAddTimeblock,\n validate,\n AEmployeeSelect: _a_employee_select_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n AEmployeeTimeblock: _a_employee_timeblock_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"]\n };\n Object.defineProperty(__returned__, '__isScriptSetup', {\n enumerable: false,\n value: true\n });\n return __returned__;\n }\n}));\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/employees/a-employee.vue?./node_modules/webpack-plugin-vuetify/dist/scriptLoader.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use%5B1%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); /***/ }), @@ -1320,7 +1320,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm-bundler.js\");\n\nconst _hoisted_1 = {\n key: 0,\n class: \"employee__timeblocks\"\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([\"employee\", {\n 'employee--has-background': $props.hasBackground\n }])\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup[\"AEmployeeSelect\"], {\n ref: \"employeeSelectRef\",\n modelValue: $setup.employeeDataLocal,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = $event => $setup.employeeDataLocal = $event),\n \"custom-filter\": $props.customFilter,\n required: $props.required,\n onClearEmployee: $setup.handleClearEmployee\n }, null, 8 /* PROPS */, [\"modelValue\", \"custom-filter\", \"required\"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\" Timeblocks Timeline \"), $setup.selectedEmployee ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", _hoisted_1, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.timeblocks, (timeblock, index) => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup[\"AEmployeeTimeblock\"], {\n key: `timeblock-${index}`,\n ref_for: true,\n ref: el => $setup.setTimeblockRef(el, index),\n \"model-value\": timeblock,\n employee: $setup.selectedEmployee,\n \"all-employee-timeblocks\": $props.timeblocks,\n \"all-timeblocks\": $props.allTimeblocks,\n \"deleted-timeblock-ids\": $props.deletedTimeblockIds,\n \"current-index\": index,\n deletable: $props.timeblocks.length > 1,\n index: index,\n \"onUpdate:modelValue\": val => $setup.handleUpdateTimeblock(index, val),\n onAddTimeblock: $event => $setup.handleAddTimeblock(index),\n onRemoveTimeblock: $event => $setup.handleRemoveTimeblock(index)\n }, null, 8 /* PROPS */, [\"model-value\", \"employee\", \"all-employee-timeblocks\", \"all-timeblocks\", \"deleted-timeblock-ids\", \"current-index\", \"deletable\", \"index\", \"onUpdate:modelValue\", \"onAddTimeblock\", \"onRemoveTimeblock\"]);\n }), 128 /* KEYED_FRAGMENT */))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true)], 2 /* CLASS */);\n}\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/employees/a-employee.vue?./node_modules/webpack-plugin-vuetify/dist/scriptLoader.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use%5B1%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B5%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); +eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm-bundler.js\");\n\nconst _hoisted_1 = {\n key: 0,\n class: \"employee__timeblocks\"\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([\"employee\", {\n 'employee--has-background': $props.hasBackground\n }])\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup[\"AEmployeeSelect\"], {\n ref: \"employeeSelectRef\",\n modelValue: $setup.employeeDataLocal,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = $event => $setup.employeeDataLocal = $event),\n \"custom-filter\": $props.customFilter,\n required: $props.required,\n onClearEmployee: $setup.handleClearEmployee\n }, null, 8 /* PROPS */, [\"modelValue\", \"custom-filter\", \"required\"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\" Timeblocks Timeline \"), $setup.selectedEmployee ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", _hoisted_1, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.timeblocks, (timeblock, index) => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup[\"AEmployeeTimeblock\"], {\n key: `timeblock-${index}`,\n ref_for: true,\n ref: el => $setup.setTimeblockRef(el, index),\n \"model-value\": timeblock,\n employee: $setup.selectedEmployee,\n \"all-employee-timeblocks\": $props.timeblocks,\n \"all-timeblocks\": $setup.allTimeblocksForCurrentEmployee,\n \"deleted-timeblock-ids\": $props.deletedTimeblockIds,\n \"current-index\": index,\n deletable: $props.timeblocks.length > 1,\n index: index,\n \"onUpdate:modelValue\": val => $setup.handleUpdateTimeblock(index, val),\n onAddTimeblock: $event => $setup.handleAddTimeblock(index),\n onRemoveTimeblock: $event => $setup.handleRemoveTimeblock(index)\n }, null, 8 /* PROPS */, [\"model-value\", \"employee\", \"all-employee-timeblocks\", \"all-timeblocks\", \"deleted-timeblock-ids\", \"current-index\", \"deletable\", \"index\", \"onUpdate:modelValue\", \"onAddTimeblock\", \"onRemoveTimeblock\"]);\n }), 128 /* KEYED_FRAGMENT */))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true)], 2 /* CLASS */);\n}\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/employees/a-employee.vue?./node_modules/webpack-plugin-vuetify/dist/scriptLoader.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use%5B1%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B5%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); /***/ }), @@ -1760,7 +1760,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm-bundler.js\");\n/* harmony import */ var vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vuetify/lib/components/VBtn/index.mjs */ \"./node_modules/vuetify/lib/components/VBtn/VBtn.mjs\");\n/* harmony import */ var vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vuetify/lib/components/VCard/index.mjs */ \"./node_modules/vuetify/lib/components/VCard/VCard.mjs\");\n/* harmony import */ var vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vuetify/lib/components/VCard/index.mjs */ \"./node_modules/vuetify/lib/components/VCard/VCardActions.mjs\");\n/* harmony import */ var vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vuetify/lib/components/VCard/index.mjs */ \"./node_modules/vuetify/lib/components/VCard/VCardText.mjs\");\n/* harmony import */ var vuetify_lib_components_VDialog_index_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! vuetify/lib/components/VDialog/index.mjs */ \"./node_modules/vuetify/lib/components/VDialog/VDialog.mjs\");\n/* harmony import */ var vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vuetify/lib/components/VGrid/index.mjs */ \"./node_modules/vuetify/lib/components/VGrid/VCol.mjs\");\n/* harmony import */ var vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuetify/lib/components/VGrid/index.mjs */ \"./node_modules/vuetify/lib/components/VGrid/VRow.mjs\");\n/* harmony import */ var vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vuetify/lib/components/VIcon/index.mjs */ \"./node_modules/vuetify/lib/components/VIcon/VIcon.mjs\");\n/* harmony import */ var vuetify_lib_components_VSheet_index_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vuetify/lib/components/VSheet/index.mjs */ \"./node_modules/vuetify/lib/components/VSheet/VSheet.mjs\");\n\nconst _hoisted_1 = {\n class: \"d-flex align-center\"\n};\nconst _hoisted_2 = {\n key: 0,\n class: \"d-flex align-center mb-3\"\n};\nconst _hoisted_3 = {\n class: \"d-flex align-center mb-2\"\n};\nconst _hoisted_4 = {\n key: 0,\n class: \"existing-timeblock-timeline ml-8\"\n};\nconst _hoisted_5 = {\n class: \"d-flex justify-space-between align-center pa-4\"\n};\nconst _hoisted_6 = {\n class: \"d-flex justify-space-between align-center\"\n};\nconst _hoisted_7 = {\n class: \"text-red\"\n};\nconst _hoisted_8 = {\n class: \"text-black\"\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n \n \n \n const _component_a_employee_timeblock_timeline = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"a-employee-timeblock-timeline\");\n \n const _component_a_employee_timeblock = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"a-employee-timeblock\");\n \n \n \n \n \n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_7__.VRow, {\n \"no-gutters\": \"\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_6__.VCol, {\n cols: \"5\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VSheet_index_mjs__WEBPACK_IMPORTED_MODULE_9__.VSheet, {\n class: \"py-3\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n icon: \"mdi-calendar-week\",\n size: \"large\"\n }), _cache[9] || (_cache[9] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"p\", {\n class: \"mx-3\"\n }, \"Trvanie\", -1 /* CACHED */))])]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_6__.VCol, {\n cols: \"7\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VSheet_index_mjs__WEBPACK_IMPORTED_MODULE_9__.VSheet, {\n class: \"py-3\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [!$options.isOffice365Task ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n class: \"add-date cursor-pointer mr-2\",\n icon: \"mdi-plus\",\n size: \"medium\",\n onClick: _cache[0] || (_cache[0] = $event => $data.showModal = true)\n }), _cache[10] || (_cache[10] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"p\", {\n class: \"task-badge rounded-pill\"\n }, \"Pridať záznam\", -1 /* CACHED */))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.timeblocks, (timeblock, index) => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", {\n key: timeblock.id || `timeblock-${index}`,\n class: \"timeblock-item mb-3\"\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_3, [!$options.isOffice365Task ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n key: 0,\n class: \"circle-border cursor-pointer mr-2\",\n icon: \"mdi-minus\",\n size: \"medium\",\n onClick: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $props.subtask.id ? $options.deleteTimeblock(timeblock) : $options.deleteTimeblockWithoutId(index), [\"stop\"])\n }, null, 8 /* PROPS */, [\"onClick\"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"p\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([\"task-badge rounded-pill\", {\n 'strike-through': timeblock.is_finished\n }])\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.formatTimeblockStart(timeblock)) + \" - \" + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.formatTimeblockEnd(timeblock)), 3 /* TEXT, CLASS */), !$options.isOffice365Task ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n key: 1,\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([\"circle-border cursor-pointer ml-2\", {\n completed: timeblock.is_finished\n }]),\n icon: \"mdi-check\",\n size: \"medium\",\n onClick: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $options.toggleTimeblockIsFinished(timeblock), [\"stop\"])\n }, null, 8 /* PROPS */, [\"class\", \"onClick\"])), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $props.subtask.id]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\" Timeline Visualization for existing timeblock \"), $options.employee && timeblock.date ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", _hoisted_4, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_a_employee_timeblock_timeline, {\n \"is-loading\": $options.getTimelineLoadingState(index),\n employee: $options.employee,\n \"scheduled-blocks\": $options.getScheduledBlocksForTimeblock(index),\n \"other-timeblocks\": $options.getOtherTimeblocksForTimeblock(timeblock, index),\n \"current-timeblock-range\": $options.getTimeblockRange(timeblock),\n collision: $options.getCollisionForTimeblock(timeblock, index),\n \"collision-segments\": $options.getCollisionSegmentsForTimeblock(timeblock, index),\n \"timeblock-duration\": $options.calculateDuration(timeblock),\n \"start-hour\": $data.START_HOUR,\n \"end-hour\": $data.END_HOUR,\n \"hour-width\": $options.hourWidth\n }, null, 8 /* PROPS */, [\"is-loading\", \"employee\", \"scheduled-blocks\", \"other-timeblocks\", \"current-timeblock-range\", \"collision\", \"collision-segments\", \"timeblock-duration\", \"start-hour\", \"end-hour\", \"hour-width\"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true)]);\n }), 128 /* KEYED_FRAGMENT */))]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VDialog_index_mjs__WEBPACK_IMPORTED_MODULE_5__.VDialog, {\n modelValue: $data.showModal,\n \"onUpdate:modelValue\": _cache[4] || (_cache[4] = $event => $data.showModal = $event),\n \"max-width\": \"900\",\n persistent: \"\",\n \"retain-focus\": false\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_2__.VCard, {\n class: \"add-timeblock-modal\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_5, [_cache[11] || (_cache[11] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"h1\", null, \"Pridať dátum\", -1 /* CACHED */)), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n icon: \"mdi-close\",\n size: \"large\",\n onClick: _cache[1] || (_cache[1] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $options.closeModal(), [\"stop\"]))\n })]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_4__.VCardText, {\n class: \"pa-4\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\" Reuse the a-employee-timeblock component \"), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_a_employee_timeblock, {\n ref: \"employeeTimeblockRef\",\n modelValue: $data.newTimeblock,\n \"onUpdate:modelValue\": _cache[2] || (_cache[2] = $event => $data.newTimeblock = $event),\n employee: $options.employee,\n \"all-timeblocks\": $options.allTimeblocksForModal,\n deletable: false,\n index: 0\n }, null, 8 /* PROPS */, [\"modelValue\", \"employee\", \"all-timeblocks\"])]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_3__.VCardActions, {\n class: \"pa-4\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__.VBtn, {\n class: \"button primary\",\n onClick: _cache[3] || (_cache[3] = $event => $options.submitFromEmployeeTimeblock())\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [...(_cache[12] || (_cache[12] = [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\" Potvrdiť \", -1 /* CACHED */)]))]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"modelValue\"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VDialog_index_mjs__WEBPACK_IMPORTED_MODULE_5__.VDialog, {\n modelValue: $data.visible,\n \"onUpdate:modelValue\": _cache[8] || (_cache[8] = $event => $data.visible = $event),\n \"max-width\": \"750\",\n persistent: \"\",\n \"retain-focus\": false\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_2__.VCard, null, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"h1\", _hoisted_7, [_cache[13] || (_cache[13] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\" Ste si istý, že chcete pridať timeblock po deadline \", -1 /* CACHED */)), _cache[14] || (_cache[14] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"br\", null, null, -1 /* CACHED */)), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"b\", _hoisted_8, \"z mastertasku \" + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.subtask?.project_code) + \" ?\", 1 /* TEXT */)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n icon: \"mdi-close\",\n size: \"large\",\n class: \"mb-15\",\n onClick: _cache[5] || (_cache[5] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $data.visible = false, [\"stop\"]))\n })]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_3__.VCardActions, {\n class: \"mt-10 d-flex justify-start align-center mobile-view\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__.VBtn, {\n class: \"button primary half\",\n variant: \"flat\",\n onClick: _cache[6] || (_cache[6] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $options.confirmSubmit(), [\"stop\"]))\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [...(_cache[15] || (_cache[15] = [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\"ÁNO\", -1 /* CACHED */)]))]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__.VBtn, {\n class: \"button primary half outline\",\n onClick: _cache[7] || (_cache[7] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $data.visible = false, [\"stop\"]))\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [...(_cache[16] || (_cache[16] = [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\"ZRUŠIŤ\", -1 /* CACHED */)]))]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"modelValue\"])], 64 /* STABLE_FRAGMENT */);\n}\n\n/* Vuetify */\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue?./node_modules/webpack-plugin-vuetify/dist/scriptLoader.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B5%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); +eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm-bundler.js\");\n/* harmony import */ var vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vuetify/lib/components/VBtn/index.mjs */ \"./node_modules/vuetify/lib/components/VBtn/VBtn.mjs\");\n/* harmony import */ var vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vuetify/lib/components/VCard/index.mjs */ \"./node_modules/vuetify/lib/components/VCard/VCard.mjs\");\n/* harmony import */ var vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vuetify/lib/components/VCard/index.mjs */ \"./node_modules/vuetify/lib/components/VCard/VCardActions.mjs\");\n/* harmony import */ var vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vuetify/lib/components/VCard/index.mjs */ \"./node_modules/vuetify/lib/components/VCard/VCardText.mjs\");\n/* harmony import */ var vuetify_lib_components_VDialog_index_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! vuetify/lib/components/VDialog/index.mjs */ \"./node_modules/vuetify/lib/components/VDialog/VDialog.mjs\");\n/* harmony import */ var vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vuetify/lib/components/VGrid/index.mjs */ \"./node_modules/vuetify/lib/components/VGrid/VCol.mjs\");\n/* harmony import */ var vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuetify/lib/components/VGrid/index.mjs */ \"./node_modules/vuetify/lib/components/VGrid/VRow.mjs\");\n/* harmony import */ var vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vuetify/lib/components/VIcon/index.mjs */ \"./node_modules/vuetify/lib/components/VIcon/VIcon.mjs\");\n/* harmony import */ var vuetify_lib_components_VSheet_index_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vuetify/lib/components/VSheet/index.mjs */ \"./node_modules/vuetify/lib/components/VSheet/VSheet.mjs\");\n\nconst _hoisted_1 = {\n class: \"d-flex align-center\"\n};\nconst _hoisted_2 = {\n key: 0,\n class: \"d-flex align-center mb-3\"\n};\nconst _hoisted_3 = {\n class: \"d-flex align-center mb-2\"\n};\nconst _hoisted_4 = {\n key: 0,\n class: \"existing-timeblock-timeline ml-8\"\n};\nconst _hoisted_5 = {\n class: \"d-flex justify-space-between align-center pa-4\"\n};\nconst _hoisted_6 = {\n class: \"d-flex justify-space-between align-center\"\n};\nconst _hoisted_7 = {\n class: \"text-red\"\n};\nconst _hoisted_8 = {\n class: \"text-black\"\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n \n \n \n const _component_a_employee_timeblock_timeline = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"a-employee-timeblock-timeline\");\n \n const _component_a_employee_timeblock = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"a-employee-timeblock\");\n \n \n \n \n \n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_7__.VRow, {\n \"no-gutters\": \"\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_6__.VCol, {\n cols: \"5\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VSheet_index_mjs__WEBPACK_IMPORTED_MODULE_9__.VSheet, {\n class: \"py-3\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n icon: \"mdi-calendar-week\",\n size: \"large\"\n }), _cache[9] || (_cache[9] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"p\", {\n class: \"mx-3\"\n }, \"Trvanie\", -1 /* CACHED */))])]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VGrid_index_mjs__WEBPACK_IMPORTED_MODULE_6__.VCol, {\n cols: \"7\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VSheet_index_mjs__WEBPACK_IMPORTED_MODULE_9__.VSheet, {\n class: \"py-3\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [!$options.isOffice365Task ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n class: \"add-date cursor-pointer mr-2\",\n icon: \"mdi-plus\",\n size: \"medium\",\n onClick: _cache[0] || (_cache[0] = $event => $data.showModal = true)\n }), _cache[10] || (_cache[10] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"p\", {\n class: \"task-badge rounded-pill\"\n }, \"Pridať záznam\", -1 /* CACHED */))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.timeblocks, (timeblock, index) => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", {\n key: timeblock.id || `timeblock-${index}`,\n class: \"timeblock-item mb-3\"\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_3, [!$options.isOffice365Task ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n key: 0,\n class: \"circle-border cursor-pointer mr-2\",\n icon: \"mdi-minus\",\n size: \"medium\",\n onClick: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $props.subtask.id ? $options.deleteTimeblock(timeblock) : $options.deleteTimeblockWithoutId(index), [\"stop\"])\n }, null, 8 /* PROPS */, [\"onClick\"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"p\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([\"task-badge rounded-pill\", {\n 'strike-through': timeblock.is_finished\n }])\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.formatTimeblockStart(timeblock)) + \" - \" + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.formatTimeblockEnd(timeblock)), 3 /* TEXT, CLASS */), !$options.isOffice365Task ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n key: 1,\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([\"circle-border cursor-pointer ml-2\", {\n completed: timeblock.is_finished\n }]),\n icon: \"mdi-check\",\n size: \"medium\",\n onClick: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $options.toggleTimeblockIsFinished(timeblock), [\"stop\"])\n }, null, 8 /* PROPS */, [\"class\", \"onClick\"])), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $props.subtask.id]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\" Timeline Visualization for existing timeblock \"), $options.employee && timeblock.date ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", _hoisted_4, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_a_employee_timeblock_timeline, {\n \"is-loading\": $options.getTimelineLoadingState(index),\n employee: $options.employee,\n \"scheduled-blocks\": $options.getScheduledBlocksForTimeblock(index),\n \"other-timeblocks\": $options.getOtherTimeblocksForTimeblock(timeblock, index),\n \"current-timeblock-range\": $options.getTimeblockRange(timeblock),\n collision: $options.getCollisionForTimeblock(timeblock, index),\n \"collision-segments\": $options.getCollisionSegmentsForTimeblock(timeblock, index),\n \"timeblock-duration\": $options.calculateDuration(timeblock),\n \"start-hour\": $data.START_HOUR,\n \"end-hour\": $data.END_HOUR,\n \"hour-width\": $options.hourWidth\n }, null, 8 /* PROPS */, [\"is-loading\", \"employee\", \"scheduled-blocks\", \"other-timeblocks\", \"current-timeblock-range\", \"collision\", \"collision-segments\", \"timeblock-duration\", \"start-hour\", \"end-hour\", \"hour-width\"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true)]);\n }), 128 /* KEYED_FRAGMENT */))]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VDialog_index_mjs__WEBPACK_IMPORTED_MODULE_5__.VDialog, {\n modelValue: $data.showModal,\n \"onUpdate:modelValue\": _cache[4] || (_cache[4] = $event => $data.showModal = $event),\n \"max-width\": \"900\",\n persistent: \"\",\n \"retain-focus\": false\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_2__.VCard, {\n class: \"add-timeblock-modal\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_5, [_cache[11] || (_cache[11] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"h1\", null, \"Pridať dátum\", -1 /* CACHED */)), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n icon: \"mdi-close\",\n size: \"large\",\n onClick: _cache[1] || (_cache[1] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $options.closeModal(), [\"stop\"]))\n })]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_4__.VCardText, {\n class: \"pa-4\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\" Reuse the a-employee-timeblock component \"), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_a_employee_timeblock, {\n ref: \"employeeTimeblockRef\",\n modelValue: $data.newTimeblock,\n \"onUpdate:modelValue\": _cache[2] || (_cache[2] = $event => $data.newTimeblock = $event),\n employee: $options.employee,\n deletable: false,\n index: 0\n }, null, 8 /* PROPS */, [\"modelValue\", \"employee\"])]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_3__.VCardActions, {\n class: \"pa-4\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__.VBtn, {\n class: \"button primary\",\n onClick: _cache[3] || (_cache[3] = $event => $options.submitFromEmployeeTimeblock())\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [...(_cache[12] || (_cache[12] = [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\" Potvrdiť \", -1 /* CACHED */)]))]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"modelValue\"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VDialog_index_mjs__WEBPACK_IMPORTED_MODULE_5__.VDialog, {\n modelValue: $data.visible,\n \"onUpdate:modelValue\": _cache[8] || (_cache[8] = $event => $data.visible = $event),\n \"max-width\": \"750\",\n persistent: \"\",\n \"retain-focus\": false\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_2__.VCard, null, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"div\", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"h1\", _hoisted_7, [_cache[13] || (_cache[13] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\" Ste si istý, že chcete pridať timeblock po deadline \", -1 /* CACHED */)), _cache[14] || (_cache[14] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"br\", null, null, -1 /* CACHED */)), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"b\", _hoisted_8, \"z mastertasku \" + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.subtask?.project_code) + \" ?\", 1 /* TEXT */)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VIcon_index_mjs__WEBPACK_IMPORTED_MODULE_8__.VIcon, {\n icon: \"mdi-close\",\n size: \"large\",\n class: \"mb-15\",\n onClick: _cache[5] || (_cache[5] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $data.visible = false, [\"stop\"]))\n })]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VCard_index_mjs__WEBPACK_IMPORTED_MODULE_3__.VCardActions, {\n class: \"mt-10 d-flex justify-start align-center mobile-view\"\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__.VBtn, {\n class: \"button primary half\",\n variant: \"flat\",\n onClick: _cache[6] || (_cache[6] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $options.confirmSubmit(), [\"stop\"]))\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [...(_cache[15] || (_cache[15] = [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\"ÁNO\", -1 /* CACHED */)]))]),\n _: 1 /* STABLE */\n }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vuetify_lib_components_VBtn_index_mjs__WEBPACK_IMPORTED_MODULE_1__.VBtn, {\n class: \"button primary half outline\",\n onClick: _cache[7] || (_cache[7] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.withModifiers)($event => $data.visible = false, [\"stop\"]))\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [...(_cache[16] || (_cache[16] = [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(\"ZRUŠIŤ\", -1 /* CACHED */)]))]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"modelValue\"])], 64 /* STABLE_FRAGMENT */);\n}\n\n/* Vuetify */\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://jandl/./src/plugins/tm@modal/task/_components/_components/a-task-timeblocks.vue?./node_modules/webpack-plugin-vuetify/dist/scriptLoader.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B5%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D\n}"); /***/ }),