Skip to content

Commit

Permalink
Merge pull request #1219 from NicoPennec/fix/production-schedule
Browse files Browse the repository at this point in the history
Improve production schedule
  • Loading branch information
NicoPennec authored Oct 16, 2023
2 parents 74a5305 + fbdb5d7 commit 619760b
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 139 deletions.
12 changes: 5 additions & 7 deletions src/components/modals/EditMilestoneModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
<text-field
ref="nameField"
:label="$t('schedule.milestone.name')"
v-model="form.name"
:maxlength="40"
v-model.trim="form.name"
@enter="confirm"
v-focus
/>
<button-simple
class="button is-link error"
text="Delete milestone"
:text="$t('schedule.milestone.delete_milestone')"
@click="$emit('remove-milestone', milestoneToEdit)"
v-if="isEdit"
/>

<modal-footer
:error-text="$t('schedule.milestone.error')"
:is-error="isError"
Expand All @@ -48,7 +48,7 @@
/*
* Modal used to edit and create milestones.
*/
import { mapGetters, mapActions } from 'vuex'
import { mapActions } from 'vuex'
import { modalMixin } from '@/components/modals/base_modal'
import ButtonSimple from '@/components/widgets/ButtonSimple'
Expand Down Expand Up @@ -97,8 +97,6 @@ export default {
},
computed: {
...mapGetters([]),
isEdit() {
return this.milestoneToEdit.id !== undefined
},
Expand All @@ -118,7 +116,7 @@ export default {
reset() {
this.form = {
id: this.milestoneToEdit.id || undefined,
name: `${this.milestoneToEdit.name || ''}`,
name: this.milestoneToEdit.name || '',
date: this.milestoneToEdit.date
}
}
Expand Down
53 changes: 32 additions & 21 deletions src/components/pages/ProductionSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</label>
<datepicker
wrapper-class="datepicker"
input-class="date-input input"
input-class="date-input input short"
:language="locale"
:disabled-dates="{ days: [6, 0] }"
:monday-first="true"
Expand All @@ -22,22 +22,23 @@
</label>
<datepicker
wrapper-class="datepicker"
input-class="date-input input"
input-class="date-input input short"
:language="locale"
:disabled-dates="{ days: [6, 0] }"
:monday-first="true"
format="yyyy-MM-dd"
v-model="selectedEndDate"
/>
</div>
<!--
<text-field
class="flexrow-item overall-man-days"
type="number"
v-model="overallManDays"
:label="$t('schedule.overall_man_days')"
:disabled="!isCurrentUserAdmin"
v-show="false"
/>
-->
<combobox-number
class="flexrow-item zoom-level"
:label="$t('schedule.zoom_level')"
Expand Down Expand Up @@ -85,7 +86,6 @@ import { daysToMinutes, parseDate } from '@/lib/time'
import ComboboxNumber from '@/components/widgets/ComboboxNumber'
import TaskInfo from '@/components/sides/TaskInfo'
import TextField from '@/components/widgets/TextField'
import Schedule from '@/components/pages/schedule/Schedule'
export default {
Expand All @@ -94,14 +94,13 @@ export default {
ComboboxNumber,
Datepicker,
Schedule,
TaskInfo,
TextField
TaskInfo
},
data() {
return {
currentTask: null,
overallManDays: 0,
// overallManDays: 0,
endDate: moment().add(6, 'months').endOf('day'),
scheduleItems: [],
startDate: moment().startOf('day'),
Expand Down Expand Up @@ -236,7 +235,7 @@ export default {
if (this.currentProduction.end_date) {
this.endDate = parseDate(this.currentProduction.end_date)
}
this.overallManDays = this.currentProduction.man_days
// this.overallManDays = this.currentProduction.man_days
this.selectedStartDate = this.startDate.toDate()
this.selectedEndDate = this.endDate.toDate()
this.loadData()
Expand Down Expand Up @@ -383,29 +382,41 @@ export default {
watch: {
selectedStartDate() {
this.startDate = parseDate(this.selectedStartDate)
this.editProduction({
...this.currentProduction,
start_date: this.startDate.format('YYYY-MM-DD')
})
const start_date = this.startDate.format('YYYY-MM-DD')
if (
this.currentProduction.start_date &&
this.currentProduction.start_date !== start_date
) {
this.editProduction({
...this.currentProduction,
start_date
})
}
},
selectedEndDate() {
this.endDate = parseDate(this.selectedEndDate)
this.editProduction({
...this.currentProduction,
end_date: this.endDate.format('YYYY-MM-DD')
})
},
overallManDays() {
if (this.overallManDays !== this.currentProduction.man_days) {
const end_date = this.endDate.format('YYYY-MM-DD')
if (
this.currentProduction.end_date &&
this.currentProduction.end_date !== end_date
) {
this.editProduction({
...this.currentProduction,
man_days: this.overallManDays
end_date
})
}
},
// overallManDays() {
// if (this.overallManDays !== this.currentProduction.man_days) {
// this.editProduction({
// ...this.currentProduction,
// man_days: this.overallManDays
// })
// }
// },
currentProduction() {
this.reset()
}
Expand Down
Loading

0 comments on commit 619760b

Please sign in to comment.