mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
adapted other/stgorg lvplans to mobile view changes
This commit is contained in:
@@ -6,199 +6,212 @@ import ApiLvPlan from "../.././../api/factory/lvPlan.js";
|
|||||||
import ApiOtherLvPlan from "../.././../api/factory/otherLvPlan.js";
|
import ApiOtherLvPlan from "../.././../api/factory/otherLvPlan.js";
|
||||||
import ApiAuthinfo from "../../../api/factory/authinfo.js";
|
import ApiAuthinfo from "../../../api/factory/authinfo.js";
|
||||||
|
|
||||||
export const DEFAULT_MODE_LVPLAN = "Week";
|
export const DEFAULT_MODE_LVPLAN_DESKTOP = "Week";
|
||||||
|
export const DEFAULT_MODE_LVPLAN_MOBILE = "List";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OtherLvPlan",
|
name: "OtherLvPlan",
|
||||||
components: {
|
components: {
|
||||||
FormForm,
|
FormForm,
|
||||||
FormInput,
|
FormInput,
|
||||||
FhcCalendar,
|
FhcCalendar,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewData: Object,
|
viewData: Object,
|
||||||
propsViewData: Object,
|
propsViewData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
localProps: {},
|
localProps: {},
|
||||||
studiensemester_kurzbz: null,
|
studiensemester_kurzbz: null,
|
||||||
studiensemester_start: null,
|
studiensemester_start: null,
|
||||||
studiensemester_ende: null,
|
studiensemester_ende: null,
|
||||||
isOtherPersonMitarbeiter: false,
|
isOtherPersonMitarbeiter: false,
|
||||||
isOtherPersonStudent: false,
|
isOtherPersonStudent: false,
|
||||||
currentStgBezeichnung: null,
|
currentStgBezeichnung: null,
|
||||||
listVerband: [],
|
listVerband: [],
|
||||||
listGroup: [],
|
listGroup: [],
|
||||||
rangeIntervalFirst: null,
|
rangeIntervalFirst: null,
|
||||||
otherPersonData: {
|
otherPersonData: {
|
||||||
fullName: "",
|
fullName: "",
|
||||||
photo: "",
|
photo: "",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
inject: ["isMobile"],
|
||||||
currentDay() {
|
computed: {
|
||||||
if (
|
currentDay() {
|
||||||
!this.propsViewData?.focus_date ||
|
if (
|
||||||
isNaN(new Date(this.propsViewData?.focus_date))
|
!this.propsViewData?.focus_date ||
|
||||||
)
|
isNaN(new Date(this.propsViewData?.focus_date))
|
||||||
return luxon.DateTime.now().setZone(this.viewData.timezone).toISODate();
|
)
|
||||||
return this.propsViewData?.focus_date;
|
return luxon.DateTime.now()
|
||||||
},
|
.setZone(this.viewData.timezone)
|
||||||
currentMode() {
|
.toISODate();
|
||||||
if (
|
return this.propsViewData?.focus_date;
|
||||||
!this.propsViewData?.mode ||
|
},
|
||||||
!["day", "week", "month"].includes(
|
currentMode() {
|
||||||
this.propsViewData?.mode.toLowerCase(),
|
let validModes = ["day", "month"];
|
||||||
)
|
validModes.push(this.isMobile ? "list" : "week");
|
||||||
)
|
|
||||||
return DEFAULT_MODE_LVPLAN;
|
|
||||||
return this.propsViewData?.mode;
|
|
||||||
},
|
|
||||||
downloadLinks() {
|
|
||||||
if (
|
|
||||||
!this.studiensemester_start ||
|
|
||||||
!this.studiensemester_ende ||
|
|
||||||
!this.propsViewData.otherUid
|
|
||||||
)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const type = this.isOtherPersonStudent
|
const defaultMode = this.isMobile
|
||||||
? "student"
|
? DEFAULT_MODE_LVPLAN_MOBILE
|
||||||
: this.isOtherPersonMitarbeiter
|
: DEFAULT_MODE_LVPLAN_DESKTOP;
|
||||||
? "lektor"
|
|
||||||
: null;
|
|
||||||
|
|
||||||
if (!type) return;
|
if (
|
||||||
|
!this.propsViewData?.mode ||
|
||||||
|
!validModes.includes(this.propsViewData?.mode.toLowerCase())
|
||||||
|
)
|
||||||
|
return defaultMode;
|
||||||
|
return this.propsViewData?.mode;
|
||||||
|
},
|
||||||
|
downloadLinks() {
|
||||||
|
if (
|
||||||
|
!this.studiensemester_start ||
|
||||||
|
!this.studiensemester_ende ||
|
||||||
|
!this.propsViewData.otherUid
|
||||||
|
)
|
||||||
|
return false;
|
||||||
|
|
||||||
const opts = { zone: this.viewData.timezone };
|
const type = this.isOtherPersonStudent
|
||||||
const start = luxon.DateTime.fromISO(
|
? "student"
|
||||||
this.studiensemester_start,
|
: this.isOtherPersonMitarbeiter
|
||||||
opts,
|
? "lektor"
|
||||||
).toUnixInteger();
|
: null;
|
||||||
const ende = luxon.DateTime.fromISO(
|
|
||||||
this.studiensemester_ende,
|
|
||||||
opts,
|
|
||||||
).toUnixInteger();
|
|
||||||
|
|
||||||
const download_link =
|
if (!type) return;
|
||||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
|
||||||
"cis/private/lvplan/stpl_kalender.php" +
|
|
||||||
"?type=" +
|
|
||||||
type +
|
|
||||||
"&pers_uid=" +
|
|
||||||
this.propsViewData.otherUid +
|
|
||||||
"&begin=" +
|
|
||||||
start +
|
|
||||||
"&ende=" +
|
|
||||||
ende;
|
|
||||||
|
|
||||||
return [
|
const opts = { zone: this.viewData.timezone };
|
||||||
{
|
const start = luxon.DateTime.fromISO(
|
||||||
title: "excel",
|
this.studiensemester_start,
|
||||||
icon: "fa-solid fa-file-excel",
|
opts,
|
||||||
link: download_link + "&format=excel",
|
).toUnixInteger();
|
||||||
},
|
const ende = luxon.DateTime.fromISO(
|
||||||
{
|
this.studiensemester_ende,
|
||||||
title: "csv",
|
opts,
|
||||||
icon: "fa-solid fa-file-csv",
|
).toUnixInteger();
|
||||||
link: download_link + "&format=csv",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "ical1",
|
|
||||||
icon: "fa-regular fa-calendar",
|
|
||||||
link: download_link + "&format=ical&version=1&target=ical",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "ical2",
|
|
||||||
icon: "fa-regular fa-calendar",
|
|
||||||
link: download_link + "&format=ical&version=2&target=ical",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
},
|
|
||||||
get_image_base64_src: function () {
|
|
||||||
if (!this.otherPersonData.photo?.length) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return "data:image/jpeg;base64," + this.otherPersonData.photo;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
"propsViewData.otherUid": {
|
|
||||||
handler() {
|
|
||||||
this.$router.go();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleChangeDate(day, newMode) {
|
|
||||||
return this.handleChangeMode(newMode, day);
|
|
||||||
},
|
|
||||||
handleChangeMode(newMode, day) {
|
|
||||||
const mode = newMode[0].toUpperCase() + newMode.slice(1);
|
|
||||||
const focus_date = day.toISODate();
|
|
||||||
|
|
||||||
this.$router.push({
|
const download_link =
|
||||||
name: "OtherLvPlan",
|
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||||
params: {
|
"cis/private/lvplan/stpl_kalender.php" +
|
||||||
mode,
|
"?type=" +
|
||||||
focus_date,
|
type +
|
||||||
},
|
"&pers_uid=" +
|
||||||
});
|
this.propsViewData.otherUid +
|
||||||
},
|
"&begin=" +
|
||||||
updateRange(rangeInterval) {
|
start +
|
||||||
this.$api
|
"&ende=" +
|
||||||
.call(
|
ende;
|
||||||
ApiLvPlan.studiensemesterDateInterval(
|
|
||||||
rangeInterval.end.startOf("week").toISODate(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
this.studiensemester_kurzbz = res.data.studiensemester_kurzbz;
|
|
||||||
this.studiensemester_start = res.data.start;
|
|
||||||
this.studiensemester_ende = res.data.ende;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getPromiseFunc(start, end) {
|
|
||||||
return [
|
|
||||||
this.$api.call(
|
|
||||||
ApiLvPlan.eventsPersonal(
|
|
||||||
start.toISODate(),
|
|
||||||
end.toISODate(),
|
|
||||||
this.propsViewData.otherUid,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
this.$api.call(
|
|
||||||
ApiLvPlan.getLvPlanReservierungen(
|
|
||||||
start.toISODate(),
|
|
||||||
end.toISODate(),
|
|
||||||
this.propsViewData.otherUid,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
async created() {
|
|
||||||
const authInfoResponse = await this.$api.call(ApiAuthinfo.getAuthInfo());
|
|
||||||
const authId = authInfoResponse.data.uid;
|
|
||||||
if (authId === this.propsViewData.otherUid) {
|
|
||||||
this.$router.push({ name: "MyLvPlan" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const userDataResponse = await this.$api.call(
|
return [
|
||||||
ApiOtherLvPlan.getBasicUserAttributesForLvPlanDisplay(
|
{
|
||||||
this.propsViewData.otherUid,
|
title: "excel",
|
||||||
),
|
icon: "fa-solid fa-file-excel",
|
||||||
);
|
link: download_link + "&format=excel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "csv",
|
||||||
|
icon: "fa-solid fa-file-csv",
|
||||||
|
link: download_link + "&format=csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ical1",
|
||||||
|
icon: "fa-regular fa-calendar",
|
||||||
|
link: download_link + "&format=ical&version=1&target=ical",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ical2",
|
||||||
|
icon: "fa-regular fa-calendar",
|
||||||
|
link: download_link + "&format=ical&version=2&target=ical",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
get_image_base64_src: function () {
|
||||||
|
if (!this.otherPersonData.photo?.length) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "data:image/jpeg;base64," + this.otherPersonData.photo;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"propsViewData.otherUid": {
|
||||||
|
handler() {
|
||||||
|
this.$router.go();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleChangeDate(day, newMode) {
|
||||||
|
return this.handleChangeMode(newMode, day);
|
||||||
|
},
|
||||||
|
handleChangeMode(newMode, day) {
|
||||||
|
const mode = newMode[0].toUpperCase() + newMode.slice(1);
|
||||||
|
const focus_date = day.toISODate();
|
||||||
|
|
||||||
const userData = userDataResponse.data;
|
this.$router.push({
|
||||||
this.isOtherPersonMitarbeiter = !!userData.is_mitarbeiter;
|
name: "OtherLvPlan",
|
||||||
this.isOtherPersonStudent = !!userData.is_student;
|
params: {
|
||||||
this.otherPersonData.fullName = userData.vorname + " " + userData.nachname;
|
mode,
|
||||||
this.otherPersonData.photo = userData.foto;
|
focus_date,
|
||||||
},
|
},
|
||||||
template: `
|
});
|
||||||
|
},
|
||||||
|
updateRange(rangeInterval) {
|
||||||
|
this.$api
|
||||||
|
.call(
|
||||||
|
ApiLvPlan.studiensemesterDateInterval(
|
||||||
|
rangeInterval.end.startOf("week").toISODate(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
this.studiensemester_kurzbz =
|
||||||
|
res.data.studiensemester_kurzbz;
|
||||||
|
this.studiensemester_start = res.data.start;
|
||||||
|
this.studiensemester_ende = res.data.ende;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getPromiseFunc(start, end) {
|
||||||
|
return [
|
||||||
|
this.$api.call(
|
||||||
|
ApiLvPlan.eventsPersonal(
|
||||||
|
start.toISODate(),
|
||||||
|
end.toISODate(),
|
||||||
|
this.propsViewData.otherUid,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
this.$api.call(
|
||||||
|
ApiLvPlan.getLvPlanReservierungen(
|
||||||
|
start.toISODate(),
|
||||||
|
end.toISODate(),
|
||||||
|
this.propsViewData.otherUid,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
const authInfoResponse = await this.$api.call(
|
||||||
|
ApiAuthinfo.getAuthInfo(),
|
||||||
|
);
|
||||||
|
const authId = authInfoResponse.data.uid;
|
||||||
|
if (authId === this.propsViewData.otherUid) {
|
||||||
|
this.$router.push({ name: "MyLvPlan" });
|
||||||
|
}
|
||||||
|
|
||||||
|
const userDataResponse = await this.$api.call(
|
||||||
|
ApiOtherLvPlan.getBasicUserAttributesForLvPlanDisplay(
|
||||||
|
this.propsViewData.otherUid,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const userData = userDataResponse.data;
|
||||||
|
this.isOtherPersonMitarbeiter = !!userData.is_mitarbeiter;
|
||||||
|
this.isOtherPersonStudent = !!userData.is_student;
|
||||||
|
this.otherPersonData.fullName =
|
||||||
|
userData.vorname + " " + userData.nachname;
|
||||||
|
this.otherPersonData.photo = userData.foto;
|
||||||
|
},
|
||||||
|
template: `
|
||||||
<div class="d-flex flex-column h-100">
|
<div class="d-flex flex-column h-100">
|
||||||
<h2>
|
<h2>
|
||||||
<div class="d-flex flex-row justify-content-between align-items-center">
|
<div class="d-flex flex-row justify-content-between align-items-center">
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import FhcCalendar from "../../Calendar/LvPlan.js";
|
import FhcCalendar from "../../Calendar/LvPlan.js";
|
||||||
|
|
||||||
import ApiLvPlan from '../../../api/factory/lvPlan.js';
|
import ApiLvPlan from "../../../api/factory/lvPlan.js";
|
||||||
import ApiAuthinfo from '../../../api/factory/authinfo.js';
|
import ApiAuthinfo from "../../../api/factory/authinfo.js";
|
||||||
|
|
||||||
export const DEFAULT_MODE_LVPLAN_DESKTOP = 'Week';
|
export const DEFAULT_MODE_LVPLAN_DESKTOP = "Week";
|
||||||
export const DEFAULT_MODE_LVPLAN_MOBILE = 'List';
|
export const DEFAULT_MODE_LVPLAN_MOBILE = "List";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LvPlanPersonal',
|
name: "LvPlanPersonal",
|
||||||
components: {
|
components: {
|
||||||
FhcCalendar
|
FhcCalendar,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewData: Object, // NOTE(chris): this is inherited from router-view
|
viewData: Object, // NOTE(chris): this is inherited from router-view
|
||||||
propsViewData: Object
|
propsViewData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -22,105 +22,152 @@ export default {
|
|||||||
studiensemester_ende: null,
|
studiensemester_ende: null,
|
||||||
uid: null,
|
uid: null,
|
||||||
isMitarbeiter: false,
|
isMitarbeiter: false,
|
||||||
isStudent: false
|
isStudent: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
inject: ["isMobile"],
|
inject: ["isMobile"],
|
||||||
computed:{
|
computed: {
|
||||||
currentDay() {
|
currentDay() {
|
||||||
if (!this.propsViewData?.focus_date || isNaN(new Date(this.propsViewData?.focus_date)))
|
if (
|
||||||
return luxon.DateTime.now().setZone(this.viewData.timezone).toISODate();
|
!this.propsViewData?.focus_date ||
|
||||||
|
isNaN(new Date(this.propsViewData?.focus_date))
|
||||||
|
)
|
||||||
|
return luxon.DateTime.now()
|
||||||
|
.setZone(this.viewData.timezone)
|
||||||
|
.toISODate();
|
||||||
return this.propsViewData?.focus_date;
|
return this.propsViewData?.focus_date;
|
||||||
},
|
},
|
||||||
currentMode() {
|
currentMode() {
|
||||||
let validModes = ['day', 'month'];
|
let validModes = ["day", "month"];
|
||||||
validModes.push(this.isMobile ? 'list' : 'week');
|
validModes.push(this.isMobile ? "list" : "week");
|
||||||
|
|
||||||
const defaultMode = this.isMobile ? DEFAULT_MODE_LVPLAN_MOBILE : DEFAULT_MODE_LVPLAN_DESKTOP;
|
const defaultMode = this.isMobile
|
||||||
|
? DEFAULT_MODE_LVPLAN_MOBILE
|
||||||
|
: DEFAULT_MODE_LVPLAN_DESKTOP;
|
||||||
|
|
||||||
if (!this.propsViewData?.mode || !validModes.includes(this.propsViewData?.mode.toLowerCase()))
|
if (
|
||||||
|
!this.propsViewData?.mode ||
|
||||||
|
!validModes.includes(this.propsViewData?.mode.toLowerCase())
|
||||||
|
)
|
||||||
return defaultMode;
|
return defaultMode;
|
||||||
return this.propsViewData?.mode;
|
return this.propsViewData?.mode;
|
||||||
},
|
},
|
||||||
downloadLinks() {
|
downloadLinks() {
|
||||||
if (!this.studiensemester_start || !this.studiensemester_ende || !this.uid)
|
if (
|
||||||
|
!this.studiensemester_start ||
|
||||||
|
!this.studiensemester_ende ||
|
||||||
|
!this.uid
|
||||||
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let type = false;
|
let type = false;
|
||||||
type = this.isStudent ? 'student' : type;
|
type = this.isStudent ? "student" : type;
|
||||||
type = this.isMitarbeiter ? 'lektor' : type;
|
type = this.isMitarbeiter ? "lektor" : type;
|
||||||
if (false === type)
|
if (false === type) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const opts = { zone: this.viewData.timezone };
|
const opts = { zone: this.viewData.timezone };
|
||||||
const start = luxon.DateTime
|
const start = luxon.DateTime.fromISO(
|
||||||
.fromISO(this.studiensemester_start, opts)
|
this.studiensemester_start,
|
||||||
.toUnixInteger();
|
opts,
|
||||||
const ende = luxon.DateTime
|
).toUnixInteger();
|
||||||
.fromISO(this.studiensemester_ende, opts)
|
const ende = luxon.DateTime.fromISO(
|
||||||
.toUnixInteger();
|
this.studiensemester_ende,
|
||||||
|
opts,
|
||||||
|
).toUnixInteger();
|
||||||
|
|
||||||
const download_link = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
const download_link =
|
||||||
+ 'cis/private/lvplan/stpl_kalender.php'
|
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||||
+ '?type=' + type
|
"cis/private/lvplan/stpl_kalender.php" +
|
||||||
+ '&pers_uid=' + this.uid
|
"?type=" +
|
||||||
+ '&begin=' + start
|
type +
|
||||||
+ '&ende=' + ende;
|
"&pers_uid=" +
|
||||||
|
this.uid +
|
||||||
|
"&begin=" +
|
||||||
|
start +
|
||||||
|
"&ende=" +
|
||||||
|
ende;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ title: "excel", icon: 'fa-solid fa-file-excel', link: download_link + '&format=excel' },
|
{
|
||||||
{ title: "csv", icon: 'fa-solid fa-file-csv', link: download_link + '&format=csv' },
|
title: "excel",
|
||||||
{ title: "ical1", icon: 'fa-regular fa-calendar', link: download_link + '&format=ical&version=1&target=ical' },
|
icon: "fa-solid fa-file-excel",
|
||||||
{ title: "ical2", icon: 'fa-regular fa-calendar', link: download_link + '&format=ical&version=2&target=ical' }
|
link: download_link + "&format=excel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "csv",
|
||||||
|
icon: "fa-solid fa-file-csv",
|
||||||
|
link: download_link + "&format=csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ical1",
|
||||||
|
icon: "fa-regular fa-calendar",
|
||||||
|
link: download_link + "&format=ical&version=1&target=ical",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ical2",
|
||||||
|
icon: "fa-regular fa-calendar",
|
||||||
|
link: download_link + "&format=ical&version=2&target=ical",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleChangeDate(day, newMode) {
|
handleChangeDate(day, newMode) {
|
||||||
return this.handleChangeMode(newMode, day);
|
return this.handleChangeMode(newMode, day);
|
||||||
},
|
},
|
||||||
handleChangeMode(newMode, day) {
|
handleChangeMode(newMode, day) {
|
||||||
const mode = newMode[0].toUpperCase() + newMode.slice(1)
|
const mode = newMode[0].toUpperCase() + newMode.slice(1);
|
||||||
const focus_date = day.toISODate();
|
const focus_date = day.toISODate();
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: "MyLvPlan",
|
name: "MyLvPlan",
|
||||||
params: {
|
params: {
|
||||||
mode,
|
mode,
|
||||||
focus_date
|
focus_date,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateRange(rangeInterval) {
|
updateRange(rangeInterval) {
|
||||||
this.$api
|
this.$api
|
||||||
.call(ApiLvPlan.studiensemesterDateInterval(
|
.call(
|
||||||
rangeInterval.end.startOf('week').toISODate()
|
ApiLvPlan.studiensemesterDateInterval(
|
||||||
))
|
rangeInterval.end.startOf("week").toISODate(),
|
||||||
.then(res => {
|
),
|
||||||
this.studiensemester_kurzbz = res.data.studiensemester_kurzbz;
|
)
|
||||||
|
.then((res) => {
|
||||||
|
this.studiensemester_kurzbz =
|
||||||
|
res.data.studiensemester_kurzbz;
|
||||||
this.studiensemester_start = res.data.start;
|
this.studiensemester_start = res.data.start;
|
||||||
this.studiensemester_ende = res.data.ende;
|
this.studiensemester_ende = res.data.ende;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getPromiseFunc(start, end) {
|
getPromiseFunc(start, end) {
|
||||||
return [
|
return [
|
||||||
this.$api.call(ApiLvPlan.eventsPersonal(start.toISODate(), end.toISODate())),
|
this.$api.call(
|
||||||
this.$api.call(ApiLvPlan.getLvPlanReservierungen(start.toISODate(), end.toISODate()))
|
ApiLvPlan.eventsPersonal(
|
||||||
|
start.toISODate(),
|
||||||
|
end.toISODate(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
this.$api.call(
|
||||||
|
ApiLvPlan.getLvPlanReservierungen(
|
||||||
|
start.toISODate(),
|
||||||
|
end.toISODate(),
|
||||||
|
),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$api
|
this.$api.call(ApiAuthinfo.getAuthInfo()).then((res) => {
|
||||||
.call(ApiAuthinfo.getAuthInfo())
|
this.uid = res.data.uid;
|
||||||
.then(res => {
|
this.isMitarbeiter = res.data.isMitarbeiter;
|
||||||
this.uid = res.data.uid;
|
this.isStudent = res.data.isStudent;
|
||||||
this.isMitarbeiter = res.data.isMitarbeiter;
|
});
|
||||||
this.isStudent = res.data.isStudent;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
template: /*html*/`
|
template: /*html*/ `
|
||||||
<div class="cis-lvplan-personal d-flex flex-column h-100">
|
<div class="cis-lvplan-personal d-flex flex-column h-100">
|
||||||
<h2>
|
<h2>
|
||||||
{{ $p.t('lehre/stundenplan') }}
|
{{ $p.t('lehre/stundenplan') }}
|
||||||
@@ -158,5 +205,5 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fhc-calendar>
|
</fhc-calendar>
|
||||||
</div>`
|
</div>`,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import FormForm from '../../Form/Form.js';
|
import FormForm from "../../Form/Form.js";
|
||||||
import FormInput from '../../Form/Input.js';
|
import FormInput from "../../Form/Input.js";
|
||||||
import FhcCalendar from "../../Calendar/LvPlan.js";
|
import FhcCalendar from "../../Calendar/LvPlan.js";
|
||||||
|
|
||||||
import ApiLvPlan from '../.././../api/factory/lvPlan.js';
|
import ApiLvPlan from "../.././../api/factory/lvPlan.js";
|
||||||
import ApiAuthinfo from '../../../api/factory/authinfo.js';
|
import ApiAuthinfo from "../../../api/factory/authinfo.js";
|
||||||
|
|
||||||
export const DEFAULT_MODE_LVPLAN = 'Week';
|
export const DEFAULT_MODE_LVPLAN_DESKTOP = "Week";
|
||||||
|
export const DEFAULT_MODE_LVPLAN_MOBILE = "List";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LvPlanStgOrg',
|
name: "LvPlanStgOrg",
|
||||||
components: {
|
components: {
|
||||||
FormForm,
|
FormForm,
|
||||||
FormInput,
|
FormInput,
|
||||||
@@ -16,7 +17,7 @@ export default {
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewData: Object,
|
viewData: Object,
|
||||||
propsViewData: Object
|
propsViewData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -28,85 +29,134 @@ export default {
|
|||||||
isMitarbeiter: false,
|
isMitarbeiter: false,
|
||||||
isStudent: false,
|
isStudent: false,
|
||||||
currentStgBezeichnung: null,
|
currentStgBezeichnung: null,
|
||||||
formData: {
|
formData: {
|
||||||
stgkz: null,
|
stgkz: null,
|
||||||
sem: null,
|
sem: null,
|
||||||
verband: null,
|
verband: null,
|
||||||
gruppe: null,
|
gruppe: null,
|
||||||
},
|
},
|
||||||
listStg: [],
|
listStg: [],
|
||||||
listSem: [1,2,3,4,5,6,7,8,9,10],
|
listSem: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
listVerband: [],
|
listVerband: [],
|
||||||
listGroup: [],
|
listGroup: [],
|
||||||
rangeIntervalFirst: null
|
rangeIntervalFirst: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
inject: ["isMobile"],
|
||||||
computed: {
|
computed: {
|
||||||
maxSemester(){
|
maxSemester() {
|
||||||
const currentStg = this.listStg.find(
|
const currentStg = this.listStg.find(
|
||||||
item => item.studiengang_kz === this.formData.stgkz
|
(item) => item.studiengang_kz === this.formData.stgkz,
|
||||||
);
|
);
|
||||||
return currentStg?.max_semester;
|
return currentStg?.max_semester;
|
||||||
},
|
},
|
||||||
currentDay() {
|
currentDay() {
|
||||||
if (!this.propsViewData?.focus_date || isNaN(new Date(this.propsViewData?.focus_date)))
|
if (
|
||||||
return luxon.DateTime.now().setZone(this.viewData.timezone).toISODate();
|
!this.propsViewData?.focus_date ||
|
||||||
|
isNaN(new Date(this.propsViewData?.focus_date))
|
||||||
|
)
|
||||||
|
return luxon.DateTime.now()
|
||||||
|
.setZone(this.viewData.timezone)
|
||||||
|
.toISODate();
|
||||||
return this.propsViewData?.focus_date;
|
return this.propsViewData?.focus_date;
|
||||||
},
|
},
|
||||||
currentMode() {
|
currentMode() {
|
||||||
if (!this.propsViewData?.mode || !['day', 'week', 'month'].includes(this.propsViewData?.mode.toLowerCase()))
|
let validModes = ["day", "month"];
|
||||||
return DEFAULT_MODE_LVPLAN;
|
validModes.push(this.isMobile ? "list" : "week");
|
||||||
|
|
||||||
|
const defaultMode = this.isMobile
|
||||||
|
? DEFAULT_MODE_LVPLAN_MOBILE
|
||||||
|
: DEFAULT_MODE_LVPLAN_DESKTOP;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!this.propsViewData?.mode ||
|
||||||
|
!validModes.includes(this.propsViewData?.mode.toLowerCase())
|
||||||
|
)
|
||||||
|
return defaultMode;
|
||||||
return this.propsViewData?.mode;
|
return this.propsViewData?.mode;
|
||||||
},
|
},
|
||||||
downloadLinks() {
|
downloadLinks() {
|
||||||
if (!this.studiensemester_start || !this.studiensemester_ende || !this.uid)
|
if (
|
||||||
|
!this.studiensemester_start ||
|
||||||
|
!this.studiensemester_ende ||
|
||||||
|
!this.uid
|
||||||
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let type = false;
|
let type = false;
|
||||||
type = this.isStudent ? 'student' : type;
|
type = this.isStudent ? "student" : type;
|
||||||
type = this.isMitarbeiter ? 'lektor' : type;
|
type = this.isMitarbeiter ? "lektor" : type;
|
||||||
if (false === type)
|
if (false === type) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const opts = { zone: this.viewData.timezone };
|
const opts = { zone: this.viewData.timezone };
|
||||||
const start = luxon.DateTime
|
const start = luxon.DateTime.fromISO(
|
||||||
.fromISO(this.studiensemester_start, opts)
|
this.studiensemester_start,
|
||||||
.toUnixInteger();
|
opts,
|
||||||
const ende = luxon.DateTime
|
).toUnixInteger();
|
||||||
.fromISO(this.studiensemester_ende, opts)
|
const ende = luxon.DateTime.fromISO(
|
||||||
.toUnixInteger();
|
this.studiensemester_ende,
|
||||||
|
opts,
|
||||||
|
).toUnixInteger();
|
||||||
|
|
||||||
const download_link = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
const download_link =
|
||||||
+ 'cis/private/lvplan/stpl_kalender.php'
|
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||||
+ '?type=' + type
|
"cis/private/lvplan/stpl_kalender.php" +
|
||||||
+ '&pers_uid=' + this.uid
|
"?type=" +
|
||||||
+ '&begin=' + start
|
type +
|
||||||
+ '&ende=' + ende;
|
"&pers_uid=" +
|
||||||
|
this.uid +
|
||||||
|
"&begin=" +
|
||||||
|
start +
|
||||||
|
"&ende=" +
|
||||||
|
ende;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ title: "excel", icon: 'fa-solid fa-file-excel', link: download_link + '&format=excel' },
|
{
|
||||||
{ title: "csv", icon: 'fa-solid fa-file-csv', link: download_link + '&format=csv' },
|
title: "excel",
|
||||||
{ title: "ical1", icon: 'fa-regular fa-calendar', link: download_link + '&format=ical&version=1&target=ical' },
|
icon: "fa-solid fa-file-excel",
|
||||||
{ title: "ical2", icon: 'fa-regular fa-calendar', link: download_link + '&format=ical&version=2&target=ical' }
|
link: download_link + "&format=excel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "csv",
|
||||||
|
icon: "fa-solid fa-file-csv",
|
||||||
|
link: download_link + "&format=csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ical1",
|
||||||
|
icon: "fa-regular fa-calendar",
|
||||||
|
link: download_link + "&format=ical&version=1&target=ical",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ical2",
|
||||||
|
icon: "fa-regular fa-calendar",
|
||||||
|
link: download_link + "&format=ical&version=2&target=ical",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadLvPlan(){
|
loadLvPlan() {
|
||||||
if(!this.formData.stgkz){
|
if (!this.formData.stgkz) {
|
||||||
this.$fhcAlert.alertError(this.$p.t('LvPlan', 'chooseStg'));
|
this.$fhcAlert.alertError(this.$p.t("LvPlan", "chooseStg"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.formData.sem && (this.formData.verband || this.formData.gruppe)){
|
if (
|
||||||
this.$fhcAlert.alertError(this.$p.t('LvPlan', 'error_SemMissing'));
|
!this.formData.sem &&
|
||||||
|
(this.formData.verband || this.formData.gruppe)
|
||||||
|
) {
|
||||||
|
this.$fhcAlert.alertError(
|
||||||
|
this.$p.t("LvPlan", "error_SemMissing"),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.formData.verband && this.formData.gruppe){
|
if (!this.formData.verband && this.formData.gruppe) {
|
||||||
this.$fhcAlert.alertError(this.$p.t('LvPlan', 'error_VerbandMissing'));
|
this.$fhcAlert.alertError(
|
||||||
|
this.$p.t("LvPlan", "error_VerbandMissing"),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,18 +170,17 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//ensure logic: no value after a null value in route
|
//ensure logic: no value after a null value in route
|
||||||
if(params.sem == null)
|
if (params.sem == null) {
|
||||||
{
|
|
||||||
params.verband = null;
|
params.verband = null;
|
||||||
params.gruppe = null;
|
params.gruppe = null;
|
||||||
}
|
}
|
||||||
if(params.verband == null) {
|
if (params.verband == null) {
|
||||||
params.gruppe = null;
|
params.gruppe = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete all null values to avoid null in router
|
//delete all null values to avoid null in router
|
||||||
Object.keys(params).forEach(
|
Object.keys(params).forEach(
|
||||||
key => params[key] == null && delete params[key]
|
(key) => params[key] == null && delete params[key],
|
||||||
);
|
);
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
@@ -139,37 +188,60 @@ export default {
|
|||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$refs['calendar'].resetEventLoader();
|
this.$refs["calendar"].resetEventLoader();
|
||||||
},
|
},
|
||||||
loadListSem(){
|
loadListSem() {
|
||||||
this.listSem = [...Array(this.maxSemester).keys()].map(i => i + 1);
|
this.listSem = [...Array(this.maxSemester).keys()].map(
|
||||||
|
(i) => i + 1,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
loadListVerband(){
|
loadListVerband() {
|
||||||
this.$api
|
this.$api
|
||||||
.call(ApiLvPlan.getLehrverband(this.formData.stgkz, this.formData.semester, this.formData.verband))
|
.call(
|
||||||
.then(result => {
|
ApiLvPlan.getLehrverband(
|
||||||
|
this.formData.stgkz,
|
||||||
|
this.formData.semester,
|
||||||
|
this.formData.verband,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.then((result) => {
|
||||||
const data = result.data;
|
const data = result.data;
|
||||||
const mappedData = data.map(item => item.verband);
|
const mappedData = data.map((item) => item.verband);
|
||||||
this.listVerband = [...new Set(mappedData.filter(v =>
|
this.listVerband = [
|
||||||
v !== null &&
|
...new Set(
|
||||||
v !== undefined &&
|
mappedData.filter(
|
||||||
String(v).trim() !== ""
|
(v) =>
|
||||||
))]
|
v !== null &&
|
||||||
.sort();
|
v !== undefined &&
|
||||||
|
String(v).trim() !== "",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
].sort();
|
||||||
})
|
})
|
||||||
.catch(this.$fhcAlert.handleSystemError);
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
},
|
},
|
||||||
loadListGroup(){
|
loadListGroup() {
|
||||||
this.$api
|
this.$api
|
||||||
.call(ApiLvPlan.getGruppe(this.formData.stgkz, this.formData.semester, this.formData.verband))
|
.call(
|
||||||
.then(result => {
|
ApiLvPlan.getGruppe(
|
||||||
|
this.formData.stgkz,
|
||||||
|
this.formData.semester,
|
||||||
|
this.formData.verband,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.then((result) => {
|
||||||
const data = result.data;
|
const data = result.data;
|
||||||
const mappedData = data.map(item => item.gruppe);
|
const mappedData = data.map((item) => item.gruppe);
|
||||||
this.listGroup = [...new Set(mappedData.filter(v =>
|
this.listGroup = [
|
||||||
v !== null &&
|
...new Set(
|
||||||
v !== undefined &&
|
mappedData.filter(
|
||||||
String(v).trim() !== ""))]
|
(v) =>
|
||||||
.sort();
|
v !== null &&
|
||||||
|
v !== undefined &&
|
||||||
|
String(v).trim() !== "",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
].sort();
|
||||||
})
|
})
|
||||||
.catch(this.$fhcAlert.handleSystemError);
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
},
|
},
|
||||||
@@ -194,42 +266,60 @@ export default {
|
|||||||
},
|
},
|
||||||
updateRange(rangeInterval) {
|
updateRange(rangeInterval) {
|
||||||
this.$api
|
this.$api
|
||||||
.call(ApiLvPlan.studiensemesterDateInterval(
|
.call(
|
||||||
rangeInterval.end.startOf('week').toISODate()
|
ApiLvPlan.studiensemesterDateInterval(
|
||||||
))
|
rangeInterval.end.startOf("week").toISODate(),
|
||||||
.then(res => {
|
),
|
||||||
this.studiensemester_kurzbz = res.data.studiensemester_kurzbz;
|
)
|
||||||
|
.then((res) => {
|
||||||
|
this.studiensemester_kurzbz =
|
||||||
|
res.data.studiensemester_kurzbz;
|
||||||
this.studiensemester_start = res.data.start;
|
this.studiensemester_start = res.data.start;
|
||||||
this.studiensemester_ende = res.data.ende;
|
this.studiensemester_ende = res.data.ende;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getPromiseFunc(start, end) {
|
getPromiseFunc(start, end) {
|
||||||
return [
|
return [
|
||||||
this.$api.call(ApiLvPlan.eventsStgOrg(start, end, this.formData.stgkz, this.formData.sem, this.formData.verband, this.formData.gruppe))
|
this.$api.call(
|
||||||
|
ApiLvPlan.eventsStgOrg(
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
this.formData.stgkz,
|
||||||
|
this.formData.sem,
|
||||||
|
this.formData.verband,
|
||||||
|
this.formData.gruppe,
|
||||||
|
),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created(){
|
created() {
|
||||||
this.$api
|
this.$api.call(ApiAuthinfo.getAuthInfo()).then((res) => {
|
||||||
.call(ApiAuthinfo.getAuthInfo())
|
this.uid = res.data.uid;
|
||||||
.then(res => {
|
this.isMitarbeiter = res.data.isMitarbeiter;
|
||||||
this.uid = res.data.uid;
|
this.isStudent = res.data.isStudent;
|
||||||
this.isMitarbeiter = res.data.isMitarbeiter;
|
});
|
||||||
this.isStudent = res.data.isStudent;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$api
|
this.$api
|
||||||
.call(ApiLvPlan.getStudiengaenge())
|
.call(ApiLvPlan.getStudiengaenge())
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
this. listStg = result.data;
|
this.listStg = result.data;
|
||||||
})
|
})
|
||||||
.catch(this.$fhcAlert.handleSystemError);
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
|
||||||
if(this.propsViewData) {
|
if (this.propsViewData) {
|
||||||
this.formData.stgkz = this.propsViewData.stgkz ? this.propsViewData.stgkz: null;
|
this.formData.stgkz = this.propsViewData.stgkz
|
||||||
this.formData.sem = this.propsViewData.sem ? this.propsViewData.sem: null;
|
? this.propsViewData.stgkz
|
||||||
this.formData.verband = this.propsViewData.verband ? this.propsViewData.verband: null;
|
: null;
|
||||||
this.formData.gruppe = this.propsViewData.gruppe ? this.propsViewData.gruppe: null;
|
this.formData.sem = this.propsViewData.sem
|
||||||
|
? this.propsViewData.sem
|
||||||
|
: null;
|
||||||
|
this.formData.verband = this.propsViewData.verband
|
||||||
|
? this.propsViewData.verband
|
||||||
|
: null;
|
||||||
|
this.formData.gruppe = this.propsViewData.gruppe
|
||||||
|
? this.propsViewData.gruppe
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
@@ -331,6 +421,4 @@ export default {
|
|||||||
</fhc-calendar>
|
</fhc-calendar>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
|
};
|
||||||
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user