Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions src/components/pages/ProductionSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
v-model="zoomLevel"
@update:model-value="onZoomLevelChanged"
/>
<combobox
class="flexrow-item"
:label="$t('main.entities')"
v-model="entityType"
:options="entityTypeOptions"
@update:model-value="onEntityTypeChanged"
v-if="availableEntityTypes.length > 1"
/>
<combobox
class="flexrow-item ml1"
:label="$t('schedule.mode')"
Expand Down Expand Up @@ -105,7 +113,7 @@
ref="schedule"
:start-date="startDate"
:end-date="endDate"
:hierarchy="scheduleItems"
:hierarchy="filteredScheduleItems"
:zoom-level="zoomLevel"
:is-loading="loading.schedule"
:is-error="errors.schedule"
Expand Down Expand Up @@ -580,6 +588,7 @@ export default {
daysOffByPerson: {},
draggedEntities: [],
endDate: moment().add(6, 'months').endOf('day'),
entityType: null,
isSidePanelOpen: false,
scheduleItems: [],
startDate: moment().startOf('day'),
Expand Down Expand Up @@ -740,6 +749,35 @@ export default {
}

return [referenceVersion, ...options]
},

availableEntityTypes() {
const types = new Set()
this.scheduleItems.forEach(item => {
const taskType = this.taskTypeMap.get(item.task_type_id)
if (taskType?.for_entity) {
types.add(taskType.for_entity)
}
})
return Array.from(types).sort()
},

entityTypeOptions() {
const options = [{ label: this.$t('main.all'), value: null }]
this.availableEntityTypes.forEach(type => {
options.push({ label: type, value: type })
})
return options
},

filteredScheduleItems() {
if (!this.entityType) {
return this.scheduleItems
}
return this.scheduleItems.filter(item => {
const taskType = this.taskTypeMap.get(item.task_type_id)
return taskType && taskType.for_entity === this.entityType
})
}
},

Expand Down Expand Up @@ -769,12 +807,15 @@ export default {
'updateTask'
]),

updateRoute({ mode, version, zoom }) {
updateRoute({ mode, type, version, zoom }) {
const query = { ...this.$route.query }

if (mode !== undefined) {
query.mode = mode || undefined
}
if (type !== undefined) {
query.type = type || undefined
}
if (version !== undefined) {
query.version = version || undefined
}
Expand Down Expand Up @@ -876,12 +917,16 @@ export default {
await this.loadData()

const mode = this.$route.query.mode
const type = this.$route.query.type
const version = this.$route.query.version
const zoom = Number(this.$route.query.zoom)

this.mode = this.modeOptions.map(o => o.value).includes(mode)
? mode
: DEFAULT_MODE
this.entityType = this.entityTypeOptions.map(o => o.value).includes(type)
? type
: null
this.version = this.versionOptions.map(o => o.value).includes(version)
? version
: DEFAULT_VERSION
Expand Down Expand Up @@ -965,7 +1010,9 @@ export default {
: this.loadSequenceScheduleItems
: taskTypeElement.for_entity === 'Shot'
? this.loadSequenceScheduleItems
: this.loadAssetTypeScheduleItems
: taskTypeElement.for_entity === 'Sequence'
? this.loadSequenceScheduleItems
: this.loadAssetTypeScheduleItems
const parameters = {
production: this.currentProduction,
taskType: this.taskTypeMap.get(taskTypeElement.task_type_id)
Expand Down Expand Up @@ -1839,6 +1886,10 @@ export default {
this.updateRoute({ zoom })
},

onEntityTypeChanged(type) {
this.updateRoute({ type })
},

onModeChanged(mode) {
this.updateRoute({ mode })
this.closeSidePanel()
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ export default {
empty_comment: 'Empty comment',
empty_schedule: 'There are no tasks or they don\'t have start dates.',
end_date: 'End date',
entities: 'Entities',
estimation: 'Estimation',
estimation_short: 'Est.',
expand_all: 'Expand all',
Expand Down