diff --git a/app/public/mock/v1/tasks/(id).GET.json b/app/public/mock/v1/tasks/(id).GET.json index 320d663..5dd1e78 100644 --- a/app/public/mock/v1/tasks/(id).GET.json +++ b/app/public/mock/v1/tasks/(id).GET.json @@ -7,7 +7,18 @@ "duration": 5400000, "spent_time": 3000000, "is_finished": false, - "dates": [], + "timeblocks": [ + { + "id": 43, + "start": "2023-01-31 04:02:17", + "end": "2023-01-31 08:23:05" + }, + { + "id": 52, + "start": "2023-09-26 01:01:17", + "end": "2024-02-11 08:23:05" + } + ], "master_task": { "id": 1, "name": "Master task 1", diff --git a/app/src/plugins/app/_config/App.vue b/app/src/plugins/app/_config/App.vue index 19efa9f..6de527d 100644 --- a/app/src/plugins/app/_config/App.vue +++ b/app/src/plugins/app/_config/App.vue @@ -5,16 +5,17 @@ - - + + - - - - - + + + + + + - + diff --git a/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue b/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue index 7805a7b..68b9f88 100644 --- a/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue +++ b/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue @@ -167,9 +167,6 @@ export default { await this.$axios.post_auth('v1/blockers', this.blocker) this.closeModal() - - // Kravarik: Toto tu ma byt? - this.$router.push({ name: 'Dashboard - Tasks' }) } catch (error) { this.$toast(error) } diff --git a/app/src/plugins/tm@modal/master-task/z-delete-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-delete-master-task-modal.vue new file mode 100644 index 0000000..14fbffb --- /dev/null +++ b/app/src/plugins/tm@modal/master-task/z-delete-master-task-modal.vue @@ -0,0 +1,54 @@ + + + \ No newline at end of file diff --git a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue index 056c8b6..be661e1 100644 --- a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue +++ b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue @@ -12,19 +12,22 @@ - + >

{{ masterTask.name }}

- pencil-icon - trash-icon + pencil-icon + trash-icon
@@ -177,9 +180,9 @@ - + - +
- -

{{ masterTask.team }}

-
+ +

{{ masterTask.team.name }}

+

{{ employee.name.charAt(0) + employee.surname.charAt(0) }}

@@ -233,7 +236,7 @@ -

{{ (masterTask.worked_time)?.toFixed(2) }} h

+

{{ (masterTask.time_worked)?.toFixed(2) }} h

@@ -251,7 +254,7 @@ -

{{ (masterTask.duration - masterTask.worked_time)?.toFixed(2) }} h

+

{{ (masterTask.duration - masterTask.time_worked)?.toFixed(2) }} h

@@ -273,27 +276,26 @@
- - - {{ masterTask.name }} + + {{ task.project_code }}

- {{ employee.name.charAt(0) + employee.surname.charAt(0) }} + {{ getFullNameByEmployeeId(task.employee_id).initials }}

-

+

{{ getFullNameByEmployeeId(task.employee_id).fullName }}

checkmark-icon pencil-icon - trash-icon + trash-icon
- Pridať Subtask + Pridať Subtask
@@ -337,6 +339,7 @@ export default { errorUtils, v$: useVuelidate(), teams: null, + projects: null, employees: null, employeeSelect: null, teamSelect: '', @@ -349,20 +352,41 @@ export default { validations() { return { masterTask: { - project_code: { required }, + project_id: { required }, name: { required }, team: { required }, + // duration: { required }, + // description: { required }, deadline: { required }, employees: { atLeastOne } }, } }, + mounted() { + this.$events.on('on-master-task-deleted', (masterTask) => { + if (masterTask?.id == this.masterTask?.id) this.closeModal() + }) + }, + methods: { - itemSelected(x) { - console.log(x) + getFullNameByEmployeeId(employee_id) { + let fullName = '' + let initials = '' + this.employees.forEach(employee => { + if (employee.id === employee_id) { + fullName = `${employee.name} ${employee.surname}` + initials = employee.name.charAt(0) + employee.surname.charAt(0) + } + }) + return { + fullName, + initials + } + }, + async showModal(masterTask, editMode = false) { this.visible = true this.masterTask = null @@ -372,6 +396,7 @@ export default { try { this.teams = await this.$axios.get_auth_data('v1/teams') const employees = await this.$axios.get_auth_data('v1/employees') + this.projects = await this.$axios.get_auth_data('v1/projects') this.employees = tmUtils.enrichEmployeesByFullName(employees) if (masterTask?.id) { @@ -392,16 +417,23 @@ export default { return try { + this.masterTask.duration = 5 + this.masterTask.description = 'popis' + this.masterTask.employees = this.masterTask.employees.map(employee => { + employee.duration = 5 + return employee + }) + this.masterTask.deadline = moment(this.masterTask.deadline).format("YYYY-MM-DD HH:MM:SS") + if (this.masterTask.id) await this.$axios.put_auth(`v1/mastertasks/${this.masterTask.id}`, this.masterTask) else - await this.$axios.post_auth('v1/mastertasks', this.masterTask) + await this.$axios.post_auth_data('v1/mastertasks', this.masterTask) this.closeModal() - // this.$router.push({ name: 'Dashboard - Tasks' }) } catch (error) { - this.$toast(error) + this.$toast.error(error) } }, @@ -410,17 +442,14 @@ export default { this.$emit('close', this.masterTask) }, - async _delete() { - // Kravarik: Tu sa ma volat delete-master-task-modal, ak taka funkcionalita vlastne je - - // try { - // await this.$axios.delete(`v1/master-tasks/${this.masterTask.id}`) - // this.closeModal() - // } catch (error) { - // this.$toast.error(error) - // } + openDeleteMasterTaskModal(masterTask) { + this.$events.emit('show-delete-master-task-modal', { masterTask }) }, + openDeleteTaskModal(task) { + this.$events.emit('show-delete-task-modal', { task }) + }, + employeeSelected(selectedOption) { const employee = this.employees.find((empl) => empl.id == selectedOption.key) this.masterTask.employees.push(employee) @@ -429,7 +458,11 @@ export default { filesUploaded(files) { this.masterTask.files = files - } + }, + + addTask() { + this.$events.emit('show-task-modal', {}) + }, }, computed: { @@ -502,9 +535,6 @@ export default { .scrolling overflow: hidden !important -.scroll-employees - overflow-x: scroll - .border-bottom border-bottom: 1px solid rgba(0,0,0,.1) diff --git a/app/src/plugins/tm@modal/task/z-delete-task-modal.vue b/app/src/plugins/tm@modal/task/z-delete-task-modal.vue index 56c1962..dff68a2 100644 --- a/app/src/plugins/tm@modal/task/z-delete-task-modal.vue +++ b/app/src/plugins/tm@modal/task/z-delete-task-modal.vue @@ -2,12 +2,13 @@
-

Ste si istý, že chcete zmazať {{ task.title }}?

+

Ste si istý, že chcete zmazať task z masterTasku {{ task.project_code }}?

@@ -20,7 +21,7 @@