Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app

This commit is contained in:
Matej Glasnák committed 2023-02-09 00:49:39 +01:00
commit 4429e3e566
32 files changed
+1229 -150

No files matched your search

+12 -1
View File
@@ -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",
+29 -11
View File
@@ -5,16 +5,17 @@
</v-main>
</v-app>
<Z-team-modal ref="z-team-modal" @update="onTeamUpdate" />
<Z-delete-team-modal ref="z-delete-team-modal" @update="onTeamUpdate" />
<Z-team-modal ref="z-team-modal" @update="onTeamUpdate" />
<Z-delete-team-modal ref="z-delete-team-modal" @update="onTeamUpdate" />
<Z-task-modal ref="z-task-modal" />
<Z-delete-task-modal ref="z-delete-task-modal" @update="onTaskDeleted" />
<Z-complete-task-modal ref="z-complete-task-modal" />
<Z-task-add-time-modal ref="z-task-add-time-modal" />
<Z-blocker-modal ref="z-blocker-modal" />
<Z-task-modal ref="z-task-modal" @on-task-edited="onTaskEdited" />
<Z-delete-task-modal ref="z-delete-task-modal" @on-task-deleted="onTaskDeleted" />
<Z-delete-master-task-modal ref="z-delete-master-task-modal" />
<Z-complete-task-modal ref="z-complete-task-modal" @task-completed="onTaskCompleted" />
<Z-task-add-time-modal ref="z-task-add-time-modal" />
<Z-blocker-modal ref="z-blocker-modal" />
<Z-master-task-modal ref="z-master-task-modal" />
<Z-master-task-modal ref="z-master-task-modal" />
</template>
<script>
@@ -25,7 +26,7 @@ import ZTaskModal from '@/plugins/tm@modal/task/z-task-modal.vue'
import ZCompleteTaskModal from '@/plugins/tm@modal/task/z-complete-task-modal.vue'
import ZTaskAddTimeModal from '@/plugins/tm@modal/task/z-task-add-time-modal.vue'
import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue'
// import ZDeleteMasterTaskModal from '@/plugins/tm@modal/master-task/z-delete-task-modal.vue'
import ZDeleteMasterTaskModal from '@/plugins/tm@modal/master-task/z-delete-master-task-modal.vue'
import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
export default {
@@ -37,7 +38,8 @@ export default {
ZMasterTaskModal,
ZCompleteTaskModal,
ZTaskAddTimeModal,
ZBlockerModal
ZBlockerModal,
ZDeleteMasterTaskModal
},
mounted() {
@@ -53,6 +55,10 @@ export default {
this.$refs['z-delete-task-modal'].showModal(task)
})
this.$events.on('show-delete-master-task-modal', ({masterTask}) => {
this.$refs['z-delete-master-task-modal'].showModal(masterTask)
})
this.$events.on('show-task-modal', ({task, editMode}) => {
this.$refs['z-task-modal'].showModal(task, editMode)
})
@@ -77,11 +83,23 @@ export default {
methods: {
onTeamUpdate(team) {
this.$events.emit('on-team-deleted', team)
this.$events.emit('on-team-update', team)
},
onTaskDeleted(task) {
this.$events.emit('on-task-deleted', task)
},
onTaskCompleted(task) {
this.$events.emit('on-task-completed', task)
},
onTaskEdited(task) {
this.$events.emit('on-task-edited', task)
},
onMasterTaskDeleted(masterTask){
this.$events.emit('on-master-task-deleted', masterTask)
}
}
}
+4 -4
View File
@@ -54,17 +54,17 @@ const options: Options = {
// 'GET v1/master-tasks/(id)': true,
// 'GET v1/master-tasks': true,
'POST v1/master-tasks/(id)': true,
'DELETE v1/master-tasks/(id)': true,
'POST v1/master-tasks': true,
// 'DELETE v1/master-tasks/(id)': true,
// 'POST v1/master-tasks': true,
'GET v1/overview/projects': true,
// 'GET v1/overview/projects': true,
'GET v1/overview/tasks': true,
'GET v1/overview/teams': true,
'GET v1/overview/ongoing-tasks': true,
'GET v1/overview/unscheduled-tasks': true,
'GET v1/tasks/(id)': true,
'POST v1/tasks/(id)': true,
// 'POST v1/tasks/(id)': true,
'DELETE v1/tasks/(id)': true,
// 'GET v1/teams/(id)': true,
@@ -49,29 +49,14 @@
</v-menu>
</div>
</div>
<!-- <Z-master-task-modal ref="z-master-task-modal" />
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-blocker-modal ref="z-blocker-modal" />
<Z-team-modal ref="z-team-modal" /> -->
</v-app-bar>
</template>
<script>
import { mapGetters } from 'vuex'
// import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue'
// import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue'
// import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
// import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
export default {
// components: {
// ZTeamModal,
// ZBlockerModal,
// ZMasterTaskModal,
// ZSubTaskModal
// },
data() {
return {
search: ''
@@ -109,6 +109,7 @@ ion-item
@media (min-width: 992px)
ion-menu
width: 300px
--width: 300px
width: 257px
min-width: 257px
--width: 257px
</style>
@@ -44,6 +44,6 @@ export default {
@media (min-width: 992px)
.split-pane-right-side
width: calc(100vw - 300px) !important
max-width: calc(100vw - 300px) !important
width: calc(100vw - 257px) !important
max-width: calc(100vw - 257px) !important
</style>
@@ -1,19 +1,16 @@
.modal-header
flex: 0 0 auto
.trash-icon
padding: 10px
background: rgba(0, 0, 0, 0.04)
margin-left: 12px
border-radius: 50%
cursor: pointer
.pencil-icon
.icon
padding: 10px
background: rgba(0, 0, 0, 0.04)
border-radius: 50%
cursor: pointer
&:hover
cursor: pointer
&.trash
margin-left: 12px
.modal-input
width: 100% !important
+15
View File
@@ -34,6 +34,21 @@
height: 24px
width: 24px
.remove-date
border: 1px solid rgba(0, 0, 0, 0.2)
border-radius: 50%
padding: 13px
height: 24px
width: 24px
.add-date
color: white
border-radius: 50%
background: #6200EE
padding: 13px
height: 24px
width: 24px
th
font-size: 16px !important
@@ -42,7 +42,7 @@ export default {
try {
await this.$store.dispatch('auth/login', this.form)
this.$router.push({ name: 'Overview - Ongoing tasks'})
this.$router.push({ name: 'Dashboard - Tasks'})
} catch (error) {
this.$toast.error(error)
}
@@ -17,7 +17,7 @@
:scroll-to-hour="calConfig.scrollHour"
:split-days="splits"
:sticky-split-labels="true"
:min-split-width="300"
:min-split-width="270"
@ready="onReady()"
@view-change="weekChanged"
@event-drop="eventMoved"
@@ -71,7 +71,7 @@
</div>
<div class="event-footer d-flex">
<v-btn rounded class="event-footer-button me-2" :class="{'completed': event.completed}" @click.stop="completeTask(event)"><img :src="require('./_img/checkmark.svg')" alt=""></v-btn>
<v-btn rounded class="event-footer-button me-2" :class="{'completed': event.completed}" @click.stop="clickCompleteTask(event)"><img :src="require('./_img/checkmark.svg')" alt=""></v-btn>
<v-btn rounded class="event-footer-button me-2" @click.stop="editTask(event, true)"><img :src="require('./_img/pencil.svg')" alt=""></v-btn>
<v-btn rounded class="event-footer-button me-2" @click.stop="deleteTask(event)"><img :src="require('./_img/bin.svg')" alt=""></v-btn>
</div>
@@ -190,8 +190,18 @@ export default {
// console.log(`Focused: ${event.task_id}`)
},
clickCompleteTask(event) {
if (event.completed) this.completeTask(event)
async clickCompleteTask(event) {
if (!event.completed) {
this.completeTask(event)
} else {
event.completed = !event.completed
try {
await this.$axios.patch_auth(`v1/tasks/${event.id}`, event)
this.$emit('reopenTask', event)
} catch (error) {
this.$toast.error(error)
}
}
},
completeTask(task) {
+29 -8
View File
@@ -3,7 +3,7 @@
<A-task-filter :unscheduledTime="unscheduledTime" @dataChanged="getTimelineData" />
<W-loadable :content="timelineData" class="w-loadable" empty-message="Nepodarilo sa nacitat data!">
<Z-timeline :calData="timelineData" :calConfig="config" :splits="splitDays" />
<Z-timeline :calData="timelineData" :calConfig="config" :splits="splitDays" @reopenTask="toggleCompleteTask" />
</W-loadable>
</div>
</template>
@@ -31,6 +31,20 @@ export default {
}
},
mounted() {
this.$events.on('on-task-deleted', (task) => {
this.deleteTask(task)
})
this.$events.on('on-task-completed', (task) => {
this.toggleCompleteTask(task)
})
this.$events.on('on-task-edited', (task) => {
this.editTask(task)
})
},
methods: {
async getTimelineData(data) {
this.config.date = data.firstDay
@@ -82,7 +96,7 @@ export default {
event.split = diffInDays * (-1) + 1
})
console.log(this.timelineData.tasks)
// console.log(this.timelineData.tasks)
this.unscheduledTime = 0
@@ -147,13 +161,20 @@ export default {
}
},
// deleteTask(id) {
// const task = this.timelineData.find(task => task.id == id)
// this.$refs['z-delete-task-modal'].delete(task)
deleteTask(task) {
const id = task.id
this.timelineData.tasks.splice(this.timelineData.tasks.findIndex(item => item.id === id), 1)
},
// // TODO: Remove after BE integration
// this.timelineData.tasks.splice(this.timelineData.tasks.findIndex(item => item.id === id), 1)
// }
toggleCompleteTask(task) {
const taskInTasks = this.timelineData.tasks.find(e => e.id == task.id)
taskInTasks.completed = !taskInTasks.completed
},
editTask(task) {
const taskIndex = this.timelineData.tasks.findIndex(item => item.id === task.id)
this.timelineData.tasks[taskIndex] = task
},
}
}
</script>
@@ -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)
}
@@ -0,0 +1,54 @@
<template>
<v-dialog v-model="visible" max-width="650">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete zmazať <b>{{ masterTask.name }}</b>?</h1>
<v-icon
@click.stop="closeModal()"
icon="mdi-close"
size="large"
class="mb-15"
></v-icon>
</div>
<v-card-actions class="mt-10 d-flex justify-start align-center">
<v-btn class="button primary half" variant="flat" @click="deleteMasterTask()">ÁNO</v-btn>
<v-btn class="button primary half outline" @click.stop="closeModal()">ZRUŠIŤ</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
export default {
emits: ['on-master-task-deleted'],
data() {
return {
visible: false,
masterTask: null
}
},
methods: {
async showModal(masterTask) {
this.masterTask = masterTask
this.visible = true
},
closeModal() {
this.visible = false
},
async deleteMasterTask() {
try {
await this.$axios.delete(`v1/mastertasks/${this.masterTask.id}`)
this.$emit('on-master-task-deleted', this.masterTask)
this.closeModal()
} catch (error) {
this.$toast.error(error)
}
}
}
}
</script>
@@ -12,19 +12,22 @@
</div>
<v-card-actions class="d-flex flex-column modal-content">
<v-text-field
v-model="masterTask.project_code"
<v-select
v-model="masterTask.project_id"
@focus="onInputFocus"
class="modal-input"
class="modal-input border-select"
label="Kód projektu"
variant="solo"
:class="{ error: v$.masterTask.project_code.$errors.length }"
:items="projects"
item-value="id"
item-title="code"
:class="{ error: v$.masterTask.project_id.$errors.length }"
:hint="
v$.masterTask.project_code.$errors
? errorUtils.parseErrors(v$.masterTask.project_code.$errors)
v$.masterTask.project_id.$errors
? errorUtils.parseErrors(v$.masterTask.project_id.$errors)
: null
"
></v-text-field>
></v-select>
<v-text-field
v-model="masterTask.name"
@@ -133,8 +136,8 @@
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
<h1>{{ masterTask.name }}</h1>
<div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="_delete()"/>
<img class="icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
<img class="icon trash" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteMasterTaskModal(masterTask)" />
</div>
</div>
@@ -177,9 +180,9 @@
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center">
<v-row no-gutters>
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<v-sheet class="pa-2 ma-2 pt-0">
<div class="d-flex align-center">
<v-icon
icon="mdi-account-multiple-outline"
@@ -190,9 +193,9 @@
</v-sheet>
</v-col>
<v-col cols="7">
<v-sheet class="ma-2 d-flex scroll-employees">
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team }}</p>
<div class="d-flex align-center flex-shrink-0 mx-3" v-for="(employee, index) in masterTask.employees" :key="employee.id">
<v-sheet class="d-flex flex-wrap flex-column">
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team.name }}</p>
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" v-for="(employee, index) in masterTask.employees" :key="employee.id">
<p class="employee-selected-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
</p>
@@ -233,7 +236,7 @@
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p :class="masterTask.worked_time > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.worked_time)?.toFixed(2) }} h</p>
<p :class="masterTask.time_worked > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.time_worked)?.toFixed(2) }} h</p>
</v-sheet>
</v-col>
</v-row>
@@ -251,7 +254,7 @@
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p :class="masterTask.worked_time > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.duration - masterTask.worked_time)?.toFixed(2) }} h</p>
<p :class="masterTask.time_worked > masterTask.duration ? 'text-red-darken-4': 'text-black'">{{ (masterTask.duration - masterTask.time_worked)?.toFixed(2) }} h</p>
</v-sheet>
</v-col>
</v-row>
@@ -273,27 +276,26 @@
</div>
<v-table class="mt-7 mb-5">
<tbody class="px-5 py-5">
<!-- Kravarik: natiahnut toto z masterTask.tasks -->
<tr v-for="(employee, index) in masterTask.employees" :key="employee.id">
<td class="w-25">{{ masterTask.name }}</td>
<tr v-for="task in masterTask.subtasks" :key="task.id">
<td class="w-25">{{ task.project_code }}</td>
<td class="d-flex align-center">
<p class="employee-selected-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
{{ getFullNameByEmployeeId(task.employee_id).initials }}
</p>
<p class="ml-2" v-html="`${masterTask.employees[index].name} ${masterTask.employees[index].surname}`" />
<p class="ml-2">{{ getFullNameByEmployeeId(task.employee_id).fullName }}</p>
</td>
<td class="task-action">
<div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/tm@dashboard/_components/_img/checkmark.svg')" alt="checkmark-icon" :style="{opacity: 0.3}">
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" :style="{opacity: 0.3}">
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)">
</div>
</td>
</tr>
</tbody>
</v-table>
<div class="d-flex align-center ">
<v-btn class="subtask-btn w-100"><v-icon class="mx-1" icon="mdi-plus" />Pridať Subtask</v-btn>
<v-btn class="subtask-btn w-100" @click="addTask()" ><v-icon class="mx-1" icon="mdi-plus" />Pridať Subtask</v-btn>
</div>
</div>
</v-card-actions>
@@ -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)
@@ -2,12 +2,13 @@
<v-dialog v-model="visible" max-width="650">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete zmazať <b>{{ task.title }}</b>?</h1>
<h1>Ste si istý, že chcete zmazať task z masterTasku <b>{{ task.project_code }}</b>?</h1>
<v-icon
@click.stop="closeModal()"
icon="mdi-close"
size="large"
class="mb-15"
></v-icon>
</div>
<v-card-actions class="mt-10 d-flex justify-start align-center">
@@ -20,7 +21,7 @@
<script>
export default {
emits: ['deleted'],
emits: ['on-task-deleted'],
data() {
return {
@@ -41,8 +42,8 @@ export default {
async deleteTask() {
try {
await this.$axios.delete(`v1/tasks/${this.task.id}`)
this.$emit('deleted', this.task)
await this.$axios.delete(`v1/subtasks/${this.task.id}`)
this.$emit('on-task-deleted', this.task)
this.closeModal()
} catch (error) {
this.$toast.error(error)
+78 -20
View File
@@ -103,13 +103,13 @@
<h1>{{ task.title }}</h1>
<div class="d-flex justify-start">
<img
class="pencil-icon"
class="icon"
:src="require('@/plugins/tm@overview/_img/pencil-icon.svg')"
alt="pencil-icon"
@click.stop="editMode = !editMode"
/>
<img
class="trash-icon"
class="icon trash"
:src="require('@/plugins/tm@overview/_img/trash-icon.svg')"
alt="trash-icon"
@click.stop="openDeleteTaskModal(task)"
@@ -165,9 +165,9 @@
</v-sheet>
</v-col>
</v-row>
<v-row no-gutters class="align-center">
<v-row no-gutters>
<v-col cols="5">
<v-sheet class="pa-2 ma-2">
<v-sheet class="pa-2 ma-2 pt-5">
<div class="d-flex align-center">
<v-icon
icon="mdi-calendar-week"
@@ -179,11 +179,50 @@
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p
v-html="
`${tmUtils.formatDateTime(task.starts_at)} - ${tmUtils.formatDateTime(task.ends_at)}`
"
<div v-for="(date, index) in task.timeblocks" :key="date.id">
<div class="d-flex align-center m-5">
<v-icon
@click.stop="removeDate(index)"
class="remove-date cursor-pointer mr-2" icon="mdi-minus" size="medium"
/>
<p
class="task-badge px-4 py-2 rounded-pill mt-2"
v-html="
`${tmUtils.formatDateTime(date.start)} - ${tmUtils.formatDateTime(date.end)}`
"
/>
</div>
</div>
<v-icon
@click="showDatePicker = true"
class="add-date cursor-pointer mt-5" icon="mdi-plus" size="medium"
/>
<v-dialog max-width="650" v-model="showDatePicker">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Pridať dátum</h1>
<v-icon
@click.stop="showDatePicker = false"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-card-actions class="mt-10 d-flex justify-start align-center">
<Datepicker
v-model="selectedNewDate"
class="modal-input"
format="dd.MM.yyyy, HH:mm"
locale="sk"
select-text="Vybrať"
cancel-text="Zrušiť"
placeholder="Trvanie od - do"
range
/>
</v-card-actions>
<v-btn @click="addNewDate()" class="button primary mt-5">Potvrdiť</v-btn>
</v-card>
</v-dialog>
</v-sheet>
</v-col>
</v-row>
@@ -232,7 +271,7 @@
</v-col>
<v-col cols="7">
<v-sheet class="ma-2">
<p>{{ task.duration / 3600 }} h</p>
<p>{{ (task.duration / 3600000).toFixed(2) }} h</p>
</v-sheet>
</v-col>
</v-row>
@@ -275,7 +314,7 @@
<v-col cols="7">
<v-sheet class="ma-2">
<p>
{{ (task.duration - task.spent_time) / 3600 }} h
{{ ((task.duration / 3600000) - (task.spent_time)).toFixed(2) }} h
</p>
</v-sheet>
</v-col>
@@ -355,7 +394,9 @@ export default {
preventInputFocus: false,
masterTasks: [],
masterTaskIdSelect: null,
employeeIdSelect: null
employeeIdSelect: null,
showDatePicker: false,
selectedNewDate: []
}
},
@@ -371,12 +412,11 @@ export default {
validations() {
return {
task: {
// project_code: { required },
date: { required },
// team: { required },
duration: { required },
employee: { required },
},
}
}
},
@@ -394,11 +434,12 @@ export default {
try {
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
if (task?.id) {
const t = await this.$axios.get_auth_data(`v1/tasks/${task.id}`)
const t = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
this.employeeIdSelect = t.employee.id
this.employeeIdSelect = t.employee.id
this.masterTaskIdSelect = t.master_task.id
this.task = t
this.task.spent_time = ((t.spent_time) / 3600000).toFixed(2)
} else {
this.task = {master_task: {}}
}
@@ -414,24 +455,37 @@ export default {
},
async save() {
if (!(await this.v$.$validate())) return
if (!(await this.v$.$validate())) return console.log(this.v$)
try {
if (this.task.id) {
await this.$axios.put_auth(`v1/mastertasks/${this.task.id}`, this.task)
this.$events.emit('on-task-edited', this.task)
} else {
await this.$axios.post_auth('v1/mastertasks', this.task)
await this.$axios.post_auth('v1/subtasks', this.task)
}
this.closeModal()
// Kravarik: Toto tu ma byt?
this.$router.push({ name: 'Dashboard - Tasks' })
} catch (error) {
this.$toast.error(error)
}
},
async addNewDate() {
if (this.selectedNewDate) {
this.task.timeblocks.push({
start: this.selectedNewDate[0],
end: this.selectedNewDate[1]
})
this.showDatePicker = false
this.selectedNewDate = []
}
},
removeDate(index) {
this.task.timeblocks.splice(index, 1)
},
openDeleteTaskModal(task) {
this.$events.emit('show-delete-task-modal', { task })
},
@@ -446,6 +500,10 @@ export default {
if (!value || !this.task) return
this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value)
const selectedMasterTask = this.masterTasks.find(masterTask => masterTask.id === value)
if (selectedMasterTask) {
this.task.project_code = selectedMasterTask.project_code
}
},
employeeIdSelect(value) {
+1 -1
View File
@@ -23,7 +23,7 @@ export default {
},
mounted() {
this.$events.on('on-team-deleted', () => this._loadData())
this.$events.on('on-team-update', () => this._loadData())
},
methods: {
@@ -26,13 +26,12 @@ export default {
}
},
async created() {
async mounted() {
await this._startLoading()
},
methods: {
async _startLoading() {
// Kravarik: toto hadze tie warny v konzole. Fixnut
this.loader = await this.$loading.show()
},
@@ -56,4 +55,4 @@ export default {
<style lang="sass" scoped>
div
height: calc( 100vh - 329px )
</style>
</style>
@@ -2,27 +2,24 @@
namespace App\Http\Controllers;
use App\Models\Attachment;
use App\Models\MasterTask;
use App\Models\Team;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
class MasterTaskController extends Controller
{
public function store(Request $request)
{
$image = base64_encode(file_get_contents($request->all()['data']['files'][0]));
echo $image;
dd('done');
$validator = Validator::make($request->all(), [
'data.name' => 'required',
'data.description' => 'required',
'data.duration' => 'required',
'data.deadline' => 'required',
'data.project_id' => 'required',
'data.employees' => 'required',
]);
if($validator->fails()){
@@ -34,25 +31,79 @@ class MasterTaskController extends Controller
$data['data']['title'] = $request->all()['data']['name'];
$data['data']['estimated_time'] = $request->all()['data']['duration'];
foreach ( $data['data']['employees'] as $key => $employee ) {
$data['data']['employees'][$key]['user_id'] = $employee['id'];
$data['data']['employees'][$key]['estimated_time'] = $employee['duration'];
}
$request->merge($data);
$mastertask = MasterTask::create($request->all()['data']);
$mastertask->subtasks()->createMany($request->all()['data']['employees']);
// upload attachmentu
if ($request->file('data')) {
$attachments = Attachment::uploadAttachmentsToS3($request->file('data')['files'], $mastertask);
$mastertask->attachments()->createMany($attachments);
}
return response()->json([
'message' => 'Master Task created successfully',
'mastertask' => $mastertask
], 201);
}
public function update($id, Request $request)
{
$validator = Validator::make($request->all(), [
'data.name' => 'required',
'data.description' => 'required',
'data.duration' => 'required',
'data.deadline' => 'required',
'data.project_id' => 'required',
]);
if ($validator->fails()){
return response()->json($validator->errors(), 400);
}
// upratanie requestu, pretoze frontend pouziva inu nomenklaturu fieldov ako appka
$data['data'] = $request->all()['data'];
$data['data']['title'] = $request->all()['data']['name'];
$data['data']['estimated_time'] = $request->all()['data']['duration'];
$request->merge($data);
$mastertask = MasterTask::find($id);
// ak je Master task v stave ukončený, nedovolime update
if ($mastertask->is_finished == 1) {
return response()->json([
'message' => 'Cannot update mastertask with is_finished 1.',
], 400);
}
$mastertask->update($request->all()['data']);
// upload attachmentu
// TODO prerobit na upsert
if ($request->file('data')) {
$attachments = Attachment::uploadAttachmentsToS3($request->file('data')['files'], $mastertask);
$mastertask->attachments()->createMany($attachments);
}
return response()->json([
'message' => 'Master Task updated successfully',
'mastertask' => $mastertask
]);
// TODO V prípade, že sa menil zodpovedný team - Pre prebiehajúce sub tasky - Ukončia sa sub tasky pôvodného teamu a tie sa následne zarátajú do ERP Karat
// TODO V prípade, že sa menil zodpovedný team - Pre nové sub tasky (s nenatrackovaným časom) budú tieto tasky zmazané
}
public function delete($id)
{
$mastertask = MasterTask::find($id);
@@ -61,7 +112,7 @@ class MasterTaskController extends Controller
foreach ($mastertask->subtasks as $subtask) {
if ($subtask->timesheets()->exists()) {
return response()->json([
'message' => 'Cannot delete subtask with submitted timesheets.',
'message' => 'Cannot delete mastertask containing subtasks submitted timesheets.',
], 400);
}
}
+97 -1
View File
@@ -2,14 +2,60 @@
namespace App\Http\Controllers;
use App\Models\Attachment;
use App\Models\MasterTask;
use App\Models\SubTask;
use App\Models\Team;
use App\Models\Timesheet;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class SubTaskController extends Controller
{
public function index(Request $request)
{
// get query parameter from request
$parameters = $request->query();
$parameters['user_id'] = ( $parameters['employee_id'] ?? null );
$validator = Validator::make($request->all(), [
'start' => 'required',
'end' => 'required',
]);
$validator->after(function ($validator) use ($parameters) {
if ( !isset($parameters['employee_id']) && !isset($parameters['team_id'])) {
$validator->errors()->add(
'error', 'You must provide either employee_id or team_id.'
);
}
});
if ($validator->fails()){
return response()->json($validator->errors(), 400);
}
if (isset($parameters['team_id'])) {
$subtasks = SubTask::whereHas('mastertask', function ($query) use ($parameters) {
$query->where('team_id', $parameters['team_id']);
})->whereHas('timeblocks', function ($query) use ($parameters) {
$query->where('start', '>=', $parameters['start']);
$query->where('end', '<=', $parameters['end']);
})->get();
} else if (isset($parameters['user_id'])) {
$subtasks = SubTask::where('user_id', $parameters['user_id'])->whereHas('timeblocks', function ($query) use ($parameters) {
$query->where('start', '>=', $parameters['start']);
$query->where('end', '<=', $parameters['end']);
})->get();
}
return response()->json([
'subtasks' => $subtasks
], 200);
}
public function store($mastertask_id, Request $request)
{
$validator = Validator::make($request->all(), [
@@ -26,7 +72,7 @@ class SubTaskController extends Controller
}
});
if($validator->fails()){
if ($validator->fails()){
return response()->json($validator->errors(), 400);
}
@@ -40,12 +86,62 @@ class SubTaskController extends Controller
$mastertask = MasterTask::find($mastertask_id);
$subtask = $mastertask->subtasks()->create($request->all()['data']);
// syncnutie timeblocks
if (!empty($data['data']['timeblocks'])) {
$subtask->syncTimeblocks($data['data']['timeblocks']);
}
// upload attachmentu
if ($request->file('data')) {
$attachments = Attachment::uploadAttachmentsToS3($request->file('data')['files'], $mastertask);
$subtask->attachments()->createMany($attachments);
}
return response()->json([
'message' => 'Sub Task created successfully',
'subtask' => $subtask
], 201);
}
// TODO zabezpecit, ze ked sa meni user, tak nech sa dvojmu nevlozia jeho vykazy
public function update($id, Request $request)
{
$subtask = SubTask::find($id);
$validator = Validator::make($request->all(), [
'data.employee_id' => 'required',
'data.duration' => 'required',
]);
if ($validator->fails()){
return response()->json($validator->errors(), 400);
}
// upratanie requestu, pretoze frontend pouziva inu nomenklaturu fieldov ako appka
$data['data'] = $request->all()['data'];
$data['data']['user_id'] = $request->all()['data']['employee_id'];
$data['data']['estimated_time'] = $request->all()['data']['duration'];
$request->merge($data);
$subtask->update($request->all()['data']);
// syncnutie vykazu
if (!empty($data['data']['timesheets'])) {
$subtask->syncTimesheets($data['data']['timesheets']);
}
// syncnutie timeblocks
if (!empty($data['data']['timeblocks'])) {
$subtask->syncTimeblocks($data['data']['timeblocks']);
}
return response()->json([
'message' => 'Subtask updated successfully',
'subtask' => $subtask
]);
}
public function delete($id)
{
$subtask = SubTask::find($id);
+1 -2
View File
@@ -18,11 +18,10 @@ class AttachmentResource extends JsonResource
'id' => $this->id,
'content_type' => $this->content_type,
'disk_name' => $this->disk_name,
'extension' => $this->estimated_time,
'extension' => $this->extension,
'name' => $this->original_name,
'file_size' => $this->file_size,
'path' => $this->path,
];
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ class MasterTaskResource extends JsonResource
'starts_at' => $this->created_at,
'deadline' => $this->deadline,
'project_code' => $this->project->code,
'team_id' => ($this->team) ? $this->team->id : null,
'team' => ($this->team) ?: null,
'employees' => UserResource::collection($this->usersOutsideTeam),
'subtasks' => SubTaskResource::collection($this->subtasks),
'files' => AttachmentResource::collection($this->attachments),
+2 -1
View File
@@ -20,7 +20,7 @@ class SubTaskResource extends JsonResource
'project_code' => $this->mastertask->project->code,
'master_task_id' => $this->mastertask->id,
'master_task' => $this->mastertask->title,
'team_id' => $this->mastertask->team->id,
'team_id' => ($this->mastertask->team) ? $this->mastertask->team->id : null,
'team' => $this->mastertask->team,
'employee_id' => $this->user->id,
'duration' => $this->estimated_time,
@@ -28,6 +28,7 @@ class SubTaskResource extends JsonResource
'is_finished' => $this->is_finished,
'timeblocks' => TimeblockResource::collection($this->timeblocks),
'timesheets' => TimesheetResource::collection($this->timesheets),
'files' => AttachmentResource::collection($this->attachments),
];
}
+32
View File
@@ -4,15 +4,47 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
class Attachment extends Model
{
use HasFactory;
public $timestamps = true;
public $guarded = ['id'];
public function mastertask()
{
return $this->belongsTo(MasterTask::class, 'master_task_id');
}
public function subtask()
{
return $this->belongsTo(SubTask::class, 'sub_task_id');
}
public static function uploadAttachmentsToS3($request, $mastertask)
{
$attachmentDataArray = [];
foreach ( $request as $file ) {
$extension = $file->getClientOriginalExtension();
$disk_name = uniqid() . '.' . $extension;
$path = 'jandl_taskmanager/attachments/' . $mastertask->id . '/' . $disk_name;
Storage::disk('s3')->put($path, $file->getContent(), 'public');
$attachmentDataArray[] = [
'original_name' => $file->getClientOriginalName(),
'disk_name' => $disk_name,
'path' => Storage::disk('s3')->url($path),
'extension' => $extension,
'content_type' => $file->getMimeType(),
'file_size' => $file->getSize(),
];
}
return $attachmentDataArray;
}
}
+5
View File
@@ -37,6 +37,11 @@ class MasterTask extends Model
{
$users = $this->subtasks->pluck('user')->unique();
// ak nie je uvedeny ziaden team, tak sa vratia vsetci useri
if (!$this->team){
return $users;
}
return $users->filter(function ($user) {
return !in_array($this->team->id, $user->teams->pluck('id')->unique()->toArray());
});
+36
View File
@@ -31,6 +31,42 @@ class SubTask extends Model
{
return $this->hasMany(Timesheet::class);
}
public function attachments()
{
return $this->hasMany(Attachment::class);
}
// syncnutie vykazu. ak array obsahuje NULL id, tak ho vytvori, ak obsahuje ID, tak ho upravi. ak sa v array nenachadza, tak ho zmaze z DB
public function syncTimesheets(Array $timesheets)
{
// pripravenie array na upsert
$timesheets = array_map(function($item) {
$item['user_id'] = $item['employee_id'];
unset($item['employee_id']);
$item['sub_task_id'] = $this->id;
return $item;
}, $timesheets);
$this->timesheets()->upsert($timesheets, ['id']);
// zmazanie vykazov, ktore boli poslane z frontendu
$this->timesheets()->whereNotIn('id', collect($timesheets)->pluck('id'))->delete();
}
public function syncTimeblocks(Array $timeblocks)
{
// pripravenie array na upsert
$timeblocks = array_map(function($item) {
$item['sub_task_id'] = $this->id;
return $item;
}, $timeblocks);
$this->timeblocks()->upsert($timeblocks, ['id']);
// zmazanie vykazov, ktore boli poslane z frontendu
$this->timeblocks()->whereNotIn('id', collect($timeblocks)->pluck('id'))->delete();
}
}
+1
View File
@@ -10,6 +10,7 @@ class Timeblock extends Model
use HasFactory;
public $timestamps = true;
public $guarded = ['id'];
public function subtask()
{
+1
View File
@@ -10,6 +10,7 @@ class Timesheet extends Model
use HasFactory;
public $timestamps = true;
public $guarded = ['id'];
public function subtask()
{
+3 -1
View File
@@ -6,10 +6,12 @@
"license": "MIT",
"require": {
"php": "^8.0.2",
"doctrine/dbal": "^3.5",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7"
"laravel/tinker": "^2.7",
"league/flysystem-aws-s3-v3": "^3.12"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
+620 -1
View File
@@ -4,8 +4,152 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ccbd816a07b206f971042295b899d1ba",
"content-hash": "a4780cc777f18d3de8e76af29ee7bfeb",
"packages": [
{
"name": "aws/aws-crt-php",
"version": "v1.0.4",
"source": {
"type": "git",
"url": "https://github.com/awslabs/aws-crt-php.git",
"reference": "f5c64ee7c5fce196e2519b3d9b7138649efe032d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/f5c64ee7c5fce196e2519b3d9b7138649efe032d",
"reference": "f5c64ee7c5fce196e2519b3d9b7138649efe032d",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35|^5.6.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "AWS SDK Common Runtime Team",
"email": "aws-sdk-common-runtime@amazon.com"
}
],
"description": "AWS Common Runtime for PHP",
"homepage": "http://aws.amazon.com/sdkforphp",
"keywords": [
"amazon",
"aws",
"crt",
"sdk"
],
"support": {
"issues": "https://github.com/awslabs/aws-crt-php/issues",
"source": "https://github.com/awslabs/aws-crt-php/tree/v1.0.4"
},
"time": "2023-01-31T23:08:25+00:00"
},
{
"name": "aws/aws-sdk-php",
"version": "3.258.4",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "c20d674f502ed96ed0de63e9da087eb5f0e95590"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c20d674f502ed96ed0de63e9da087eb5f0e95590",
"reference": "c20d674f502ed96ed0de63e9da087eb5f0e95590",
"shasum": ""
},
"require": {
"aws/aws-crt-php": "^1.0.4",
"ext-json": "*",
"ext-pcre": "*",
"ext-simplexml": "*",
"guzzlehttp/guzzle": "^6.5.8 || ^7.4.5",
"guzzlehttp/promises": "^1.4.0",
"guzzlehttp/psr7": "^1.8.5 || ^2.3",
"mtdowling/jmespath.php": "^2.6",
"php": ">=5.5"
},
"require-dev": {
"andrewsville/php-token-reflection": "^1.4",
"aws/aws-php-sns-message-validator": "~1.0",
"behat/behat": "~3.0",
"composer/composer": "^1.10.22",
"dms/phpunit-arraysubset-asserts": "^0.4.0",
"doctrine/cache": "~1.4",
"ext-dom": "*",
"ext-openssl": "*",
"ext-pcntl": "*",
"ext-sockets": "*",
"nette/neon": "^2.3",
"paragonie/random_compat": ">= 2",
"phpunit/phpunit": "^4.8.35 || ^5.6.3 || ^9.5",
"psr/cache": "^1.0",
"psr/simple-cache": "^1.0",
"sebastian/comparator": "^1.2.3 || ^4.0",
"yoast/phpunit-polyfills": "^1.0"
},
"suggest": {
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
"doctrine/cache": "To use the DoctrineCacheAdapter",
"ext-curl": "To send requests using cURL",
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
"ext-sockets": "To use client-side monitoring"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Aws\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Amazon Web Services",
"homepage": "http://aws.amazon.com"
}
],
"description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
"homepage": "http://aws.amazon.com/sdkforphp",
"keywords": [
"amazon",
"aws",
"cloud",
"dynamodb",
"ec2",
"glacier",
"s3",
"sdk"
],
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.258.4"
},
"time": "2023-02-06T19:28:40+00:00"
},
{
"name": "brick/math",
"version": "0.10.2",
@@ -137,6 +281,210 @@
},
"time": "2022-10-27T11:44:00+00:00"
},
{
"name": "doctrine/cache",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "1ca8f21980e770095a31456042471a57bc4c68fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb",
"reference": "1ca8f21980e770095a31456042471a57bc4c68fb",
"shasum": ""
},
"require": {
"php": "~7.1 || ^8.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/coding-standard": "^9",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/cache": "^4.4 || ^5.4 || ^6",
"symfony/var-exporter": "^4.4 || ^5.4 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
"homepage": "https://www.doctrine-project.org/projects/cache.html",
"keywords": [
"abstraction",
"apcu",
"cache",
"caching",
"couchdb",
"memcached",
"php",
"redis",
"xcache"
],
"support": {
"issues": "https://github.com/doctrine/cache/issues",
"source": "https://github.com/doctrine/cache/tree/2.2.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache",
"type": "tidelift"
}
],
"time": "2022-05-20T20:07:39+00:00"
},
{
"name": "doctrine/dbal",
"version": "3.5.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "88fa7e5189fd5ec6682477044264dc0ed4e3aa1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/88fa7e5189fd5ec6682477044264dc0ed4e3aa1e",
"reference": "88fa7e5189fd5ec6682477044264dc0ed4e3aa1e",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2",
"doctrine/cache": "^1.11|^2.0",
"doctrine/deprecations": "^0.5.3|^1",
"doctrine/event-manager": "^1|^2",
"php": "^7.4 || ^8.0",
"psr/cache": "^1|^2|^3",
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "11.0.0",
"jetbrains/phpstorm-stubs": "2022.3",
"phpstan/phpstan": "1.9.4",
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "9.5.27",
"psalm/plugin-phpunit": "0.18.4",
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^5.4|^6.0",
"symfony/console": "^4.4|^5.4|^6.0",
"vimeo/psalm": "4.30.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlite",
"sqlserver",
"sqlsrv"
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.5.3"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2023-01-12T10:21:44+00:00"
},
{
"name": "doctrine/deprecations",
"version": "v1.0.0",
@@ -180,6 +528,97 @@
},
"time": "2022-05-02T15:47:09+00:00"
},
{
"name": "doctrine/event-manager",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32",
"reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"conflict": {
"doctrine/common": "<2.9"
},
"require-dev": {
"doctrine/coding-standard": "^10",
"phpstan/phpstan": "^1.8.8",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.28"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"keywords": [
"event",
"event dispatcher",
"event manager",
"event system",
"events"
],
"support": {
"issues": "https://github.com/doctrine/event-manager/issues",
"source": "https://github.com/doctrine/event-manager/tree/2.0.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager",
"type": "tidelift"
}
],
"time": "2022-10-12T20:59:15+00:00"
},
{
"name": "doctrine/inflector",
"version": "2.0.6",
@@ -1600,6 +2039,76 @@
],
"time": "2023-01-06T16:34:48+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
"version": "3.12.2",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
"reference": "645e14e4a80bd2da8b01e57388e7296a695a80c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/645e14e4a80bd2da8b01e57388e7296a695a80c2",
"reference": "645e14e4a80bd2da8b01e57388e7296a695a80c2",
"shasum": ""
},
"require": {
"aws/aws-sdk-php": "^3.220.0",
"league/flysystem": "^3.10.0",
"league/mime-type-detection": "^1.0.0",
"php": "^8.0.2"
},
"conflict": {
"guzzlehttp/guzzle": "<7.0",
"guzzlehttp/ringphp": "<1.1.1"
},
"type": "library",
"autoload": {
"psr-4": {
"League\\Flysystem\\AwsS3V3\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frankdejonge.nl"
}
],
"description": "AWS S3 filesystem adapter for Flysystem.",
"keywords": [
"Flysystem",
"aws",
"file",
"files",
"filesystem",
"s3",
"storage"
],
"support": {
"issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues",
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.12.2"
},
"funding": [
{
"url": "https://ecologi.com/frankdejonge",
"type": "custom"
},
{
"url": "https://github.com/frankdejonge",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/league/flysystem",
"type": "tidelift"
}
],
"time": "2023-01-17T14:15:08+00:00"
},
{
"name": "league/mime-type-detection",
"version": "1.11.0",
@@ -1758,6 +2267,67 @@
],
"time": "2022-07-24T11:55:47+00:00"
},
{
"name": "mtdowling/jmespath.php",
"version": "2.6.1",
"source": {
"type": "git",
"url": "https://github.com/jmespath/jmespath.php.git",
"reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/9b87907a81b87bc76d19a7fb2d61e61486ee9edb",
"reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0 || ^8.0",
"symfony/polyfill-mbstring": "^1.17"
},
"require-dev": {
"composer/xdebug-handler": "^1.4 || ^2.0",
"phpunit/phpunit": "^4.8.36 || ^7.5.15"
},
"bin": [
"bin/jp.php"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"files": [
"src/JmesPath.php"
],
"psr-4": {
"JmesPath\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Declaratively specify how to extract elements from a JSON document",
"keywords": [
"json",
"jsonpath"
],
"support": {
"issues": "https://github.com/jmespath/jmespath.php/issues",
"source": "https://github.com/jmespath/jmespath.php/tree/2.6.1"
},
"time": "2021-06-14T00:11:39+00:00"
},
{
"name": "nesbot/carbon",
"version": "2.65.0",
@@ -2224,6 +2794,55 @@
],
"time": "2022-07-30T15:51:26+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('attachments', function (Blueprint $table) {
$table->foreignIdFor( \App\Models\SubTask::class)->nullable()->after('master_task_id');
$table->bigInteger( 'master_task_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('master_tasks', function (Blueprint $table) {
//
});
}
};
+8 -2
View File
@@ -66,6 +66,7 @@ Route::get('/v1/mastertasks/{id}', function ($id) {
Route::post('/v1/mastertasks', MasterTaskController::class . '@store');
Route::put('/v1/mastertasks/{id}', MasterTaskController::class . '@update');
Route::delete('/v1/mastertasks/{id}', MasterTaskController::class . '@delete');
Route::get('/v1/mastertasks/{id}/subtasks', function ($id) {
@@ -75,12 +76,17 @@ Route::get('/v1/mastertasks/{id}/subtasks', function ($id) {
});
Route::post('/v1/mastertasks/{id}/subtasks', SubTaskController::class . '@store');
Route::put('/v1/subtasks/{id}', SubTaskController::class . '@update');
Route::get('/v1/subtasks/{id}', function ($id) {
return new SubTaskResource( SubTask::find($id));
});
Route::get('/v1/subtasks/{id}', function ($id) {
return new SubTaskResource( SubTask::find($id));
});
Route::get('/v1/subtasks',SubTaskController::class . '@index');
Route::delete('/v1/subtasks/{id}', SubTaskController::class . '@delete');