Skip to content
Snippets Groups Projects
Commit 3054c85c authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Merge branch 'master' into 225-introduce-substitution-to-do-list-generated-from-teachers-absences

parents f23575ad cfcfa211
No related branches found
No related tags found
1 merge request!329Introduce substitution to do list
Pipeline #192998 failed
<script setup> <script setup>
import TimetableWrapper from "./TimetableWrapper.vue"; import TimetableWrapper from "./TimetableWrapper.vue";
</script> </script>
<script> <script>
import { DateTime } from "luxon";
export default { export default {
name: "Timetable", name: "Timetable",
data() {
return {
calendarFocus: "",
calendarType: "week",
initialRouteFocusSet: false,
};
},
methods: {
setCalendarFocus(val) {
this.calendarFocus = val;
},
setCalendarType(val) {
this.calendarType = val;
},
setInnerFocusAndType() {
if (this.$route.name === "chronos.timetableWithId") {
this.$refs.calendarWithControls.setCalendarFocus(
DateTime.now().toISODate(),
);
this.$refs.calendarWithControls.setCalendarType(
this.$vuetify.breakpoint.mdAndDown ? "day" : "week",
);
} else {
this.initialRouteFocusSet = true;
this.$refs.calendarWithControls.setCalendarFocus(
[
this.$route.params.year,
this.$route.params.month,
this.$route.params.day,
].join("-"),
);
this.$refs.calendarWithControls.setCalendarType(
this.$route.params.view,
);
}
},
},
watch: {
calendarFocus(newValue, oldValue) {
// Do not redirect on first page load
if (oldValue === "") return;
// Do not redirect when calendar focus was just set with route param values
if (this.initialRouteFocusSet) {
this.initialRouteFocusSet = false;
return;
}
const [year, month, day] = newValue.split("-");
this.$router.push({
name: "chronos.timetableWithIdAndParams",
params: {
view: this.calendarType,
year,
month,
day,
},
});
},
calendarType(newValue) {
const [year, month, day] = this.calendarFocus.split("-");
this.$router.push({
name: "chronos.timetableWithIdAndParams",
params: {
view: newValue,
year,
month,
day,
},
});
},
},
}; };
</script> </script>
...@@ -17,6 +92,10 @@ export default { ...@@ -17,6 +92,10 @@ export default {
{ name: 'holidays' }, { name: 'holidays' },
]" ]"
:params="{ type: selected.type, id: selected.objId }" :params="{ type: selected.type, id: selected.objId }"
ref="calendarWithControls"
@changeCalendarFocus="setCalendarFocus"
@changeCalendarType="setCalendarType"
@calendarReady="setInnerFocusAndType"
/> />
</template> </template>
</timetable-wrapper> </timetable-wrapper>
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
titleKey: "chronos.menu_title", titleKey: "chronos.menu_title",
icon: "mdi-school-outline", icon: "mdi-school-outline",
iconActive: "mdi-school", iconActive: "mdi-school",
validators: [hasPersonValidator], permission: "chronos.view_menu_rule",
}, },
children: [ children: [
{ {
...@@ -32,6 +32,17 @@ export default { ...@@ -32,6 +32,17 @@ export default {
permission: "chronos.view_timetable_overview_rule", permission: "chronos.view_timetable_overview_rule",
fullWidth: true, fullWidth: true,
}, },
children: [
{
path: ":view(month|week|day)/:year(\\d\\d\\d\\d)/:month(\\d\\d)/:day(\\d\\d)/",
component: () => import("./components/Timetable.vue"),
name: "chronos.timetableWithIdAndParams",
meta: {
permission: "chronos.view_timetable_overview_rule",
fullWidth: true,
},
},
],
}, },
{ {
path: "substitution_overview/", path: "substitution_overview/",
......
...@@ -102,3 +102,7 @@ add_perm("chronos.delete_supervision_substitution_rule", delete_supervision_subs ...@@ -102,3 +102,7 @@ add_perm("chronos.delete_supervision_substitution_rule", delete_supervision_subs
# View room (timetable) # View room (timetable)
view_room_predicate = has_person & has_room_timetable_perm view_room_predicate = has_person & has_room_timetable_perm
add_perm("chronos.view_room_rule", view_room_predicate) add_perm("chronos.view_room_rule", view_room_predicate)
# View parent menu entry
view_menu_predicate = has_person & (view_timetable_overview_predicate)
add_perm("chronos.view_menu_rule", view_menu_predicate)
[tool.poetry] [tool.poetry]
name = "AlekSIS-App-Chronos" name = "AlekSIS-App-Chronos"
version = "4.0.0.dev6" version = "4.0.0.dev7"
packages = [ packages = [
{ include = "aleksis" } { include = "aleksis" }
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment