WIP
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import {onMounted, reactive, ref, toRaw} from "vue";
|
||||
import {onMounted, reactive, ref, toRaw, computed} from "vue";
|
||||
import TablePlan from "@/components/TablePlan.vue";
|
||||
import {API} from "@/views/api";
|
||||
import type {Mark, PlanModel} from "@/models/models";
|
||||
import type {Gottesdienst, Mark, PlanModel, SimplifiedMinistrant} from "@/models/models";
|
||||
import MobilePlan from "@/components/MobilePlan.vue";
|
||||
import PlanActionBar from "@/components/PlanActionBar.vue";
|
||||
|
||||
import {computed, onMounted, reactive, ref} from "vue";
|
||||
import Plan from "@/components/Plan.vue";
|
||||
import {API} from "@/views/api";
|
||||
import type {PlanModel} from "@/models/models";
|
||||
|
||||
const plan = reactive<PlanModel>({
|
||||
const plan = reactive<{
|
||||
gottesdienste: Gottesdienst[],
|
||||
ministranten: SimplifiedMinistrant[],
|
||||
marks: Mark[],
|
||||
editable: number[]
|
||||
}>({
|
||||
gottesdienste: [],
|
||||
ministranten: [],
|
||||
marks: []
|
||||
marks: [],
|
||||
editable: []
|
||||
})
|
||||
const mobile = ref(false)
|
||||
const editedMarks = reactive<Mark[]>([]);
|
||||
const editPlanAdmin = ref(false)
|
||||
|
||||
const sortedGottesdienste = computed(() => {
|
||||
return plan.gottesdienste.sort((a, b) => {
|
||||
@@ -27,7 +29,8 @@ const sortedGottesdienste = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
async function addGodi(data) {
|
||||
async function addGodi(data, validate) {
|
||||
console.log("Test")
|
||||
console.log(data)
|
||||
let date = Date.parse(data.date + "T" + data.time);
|
||||
let attendance = data.attendance && data.attendance != ""
|
||||
@@ -41,7 +44,8 @@ async function addGodi(data) {
|
||||
0
|
||||
)
|
||||
console.log(newGodi)
|
||||
plan.gottesdienste.push(newGodi)
|
||||
plan.gottesdienste.push(newGodi);
|
||||
validate()
|
||||
}
|
||||
|
||||
async function deleteGottedienst(id) {
|
||||
@@ -53,13 +57,6 @@ async function deleteGottedienst(id) {
|
||||
}
|
||||
|
||||
|
||||
async function addGodi() {
|
||||
let time = 1692104646066 + ((1000 * 60 * 60 * 24) * Math.random() * 6)
|
||||
let newGodi = await API.addGottesdienst("Godi", new Date(time), new Date(time - 1000 * 60 * 30), 0)
|
||||
plan.gottesdienste.push(newGodi)
|
||||
}
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
let fetchedPlan = await API.getPlan(0)
|
||||
plan.gottesdienste = fetchedPlan.gottesdienste
|
||||
@@ -111,9 +108,11 @@ function toggleMark(gid, mid) {
|
||||
:ministranten="plan.ministranten"
|
||||
:marks="getMarks()"
|
||||
:editable="plan.editable"
|
||||
:edit="editPlanAdmin"
|
||||
@added="addGodi"
|
||||
@delete="deleteGottesdienst"
|
||||
@delete="deleteGottedienst"
|
||||
@toggle-mark="toggleMark"
|
||||
@end-edit="editPlanAdmin = false"
|
||||
class="plan table"
|
||||
v-if="!mobile">
|
||||
|
||||
@@ -134,7 +133,7 @@ function toggleMark(gid, mid) {
|
||||
class="action-bar"
|
||||
:save="getDif().length > 0"
|
||||
:plan="false"
|
||||
:godi="false"
|
||||
:godi="true"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user