|
@@ -370,7 +370,17 @@ async function getEvent(id) {
|
|
|
}
|
|
|
|
|
|
let enrolledLoading = ref(false);
|
|
|
-let registrations = reactive({
|
|
|
+
|
|
|
+// 審核狀態
|
|
|
+let registrationState = ref(false);
|
|
|
+
|
|
|
+// 待審核報名清單
|
|
|
+let pendingRegistration = reactive({
|
|
|
+ list: [],
|
|
|
+});
|
|
|
+
|
|
|
+// 已審核報名清單
|
|
|
+let approvedRegistration = reactive({
|
|
|
list: [],
|
|
|
});
|
|
|
|
|
@@ -378,15 +388,37 @@ let registrations = reactive({
|
|
|
async function getEnrolledData(eventId) {
|
|
|
enrolledLoading.value = true;
|
|
|
console.log("getEnrolledData eventId", eventId);
|
|
|
+
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append("class_id", eventId);
|
|
|
+
|
|
|
try {
|
|
|
const response = await axios.get(
|
|
|
`https://cmm.ai:8088/api/get_registration_class?event_id=${eventId}&access_token=${token}`
|
|
|
);
|
|
|
+ const recordResponse = await axios.post(
|
|
|
+ `https://cmm.ai:8088/api/add_attend_record_by_event`,
|
|
|
+ formData
|
|
|
+ );
|
|
|
console.log("取得報名", response);
|
|
|
- registrations.list = response.data.registrations;
|
|
|
- console.log("報名清單", registrations.list);
|
|
|
+ console.log("新增課堂報名資料", recordResponse);
|
|
|
+
|
|
|
+ pendingRegistration.list = response.data.registrations.filter(
|
|
|
+ (item) => item.reg_confirm === 0
|
|
|
+ );
|
|
|
+
|
|
|
+ if (pendingRegistration.list.length) {
|
|
|
+ registrationState.value = true;
|
|
|
+ } else {
|
|
|
+ registrationState.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ approvedRegistration.list = response.data.registrations.filter(
|
|
|
+ (item) => item.reg_confirm === 1
|
|
|
+ );
|
|
|
+ console.log("已審核", approvedRegistration.list);
|
|
|
|
|
|
- registrations.list.map((item) => {
|
|
|
+ approvedRegistration.list.map((item) => {
|
|
|
if (item.payment_status) {
|
|
|
item.payment_status = true;
|
|
|
} else {
|
|
@@ -419,7 +451,7 @@ async function updateEnrolledData(item, index) {
|
|
|
// 若取消付款狀態則清空末五碼欄位
|
|
|
if (!data.payment_status) {
|
|
|
data.five_digits = "00000";
|
|
|
- registrations.list[index].five_digits = "";
|
|
|
+ approvedRegistration.list[index].five_digits = "";
|
|
|
}
|
|
|
|
|
|
console.log("data >", data);
|
|
@@ -484,41 +516,8 @@ let date = reactive({
|
|
|
registration_end_time: "", // 報名截止時間
|
|
|
});
|
|
|
|
|
|
-let itemsPerPage = ref(10); // 每頁顯示筆數(查看出缺席)
|
|
|
-let headers = reactive([
|
|
|
- {
|
|
|
- title: "姓名",
|
|
|
- key: "real_name",
|
|
|
- },
|
|
|
- { title: "電話", key: "phone" },
|
|
|
- { title: "信箱", key: "email" },
|
|
|
- { title: "付款狀態", key: "payment" },
|
|
|
- { title: "末五碼", key: "five_digits" },
|
|
|
-]);
|
|
|
-
|
|
|
-let studentHeaders = reactive([
|
|
|
- {
|
|
|
- title: "姓名",
|
|
|
- align: "start",
|
|
|
- key: "real_name",
|
|
|
- },
|
|
|
- { title: "電話", key: "phone" },
|
|
|
- { title: "信箱", key: "email" },
|
|
|
- { title: "出席", key: "is_attend" },
|
|
|
-]);
|
|
|
-
|
|
|
-let sessionHeaders = reactive([
|
|
|
- {
|
|
|
- title: "課堂編號",
|
|
|
- align: "center",
|
|
|
- key: "sessions",
|
|
|
- },
|
|
|
- { title: "開始時間", align: "center", key: "start_time" },
|
|
|
- { title: "結束時間", align: "center", key: "end_time" },
|
|
|
- { title: "學員名單", align: "center", key: "student" },
|
|
|
-]);
|
|
|
-
|
|
|
let studentDialog = ref(false);
|
|
|
+
|
|
|
let record = reactive({
|
|
|
list: [],
|
|
|
});
|
|
@@ -550,6 +549,7 @@ async function getAttendRecord(id) {
|
|
|
// 更新課堂出席名單
|
|
|
async function saveAttendRecord(item) {
|
|
|
const data = {
|
|
|
+ id: item.raw.id,
|
|
|
class_detail_id: item.raw.class_detail_id,
|
|
|
user_id: item.raw.user_id,
|
|
|
is_attend: item.raw.is_attend ? 1 : 0,
|
|
@@ -562,17 +562,92 @@ async function saveAttendRecord(item) {
|
|
|
|
|
|
console.log("data", data);
|
|
|
|
|
|
+ try {
|
|
|
+ const response = await axios.get(
|
|
|
+ `https://cmm.ai:8088/api/update_attend_record?id=${data.id}&class_detail_id=${data.class_detail_id}&user_id=${data.user_id}&is_attend=${data.is_attend}`
|
|
|
+ );
|
|
|
+
|
|
|
+ console.log("更新報名清單", response);
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+let tab = ref(2);
|
|
|
+
|
|
|
+async function updateRegConfirm(item) {
|
|
|
+ console.log("updateRegConfirm", item);
|
|
|
+
|
|
|
+ const data = {
|
|
|
+ is_attend: item.is_attend,
|
|
|
+ payment_status: 0,
|
|
|
+ reg_confirm: 1, // 審核確認
|
|
|
+ five_digits: "00000",
|
|
|
+ };
|
|
|
+
|
|
|
+ const formData = new FormData();
|
|
|
+ for (const key in data) {
|
|
|
+ formData.append(key, data[key]);
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
const response = await axios.post(
|
|
|
- "https://cmm.ai:8088/api/add_attend_record",
|
|
|
+ `https://cmm.ai:8088/api/update_registration_class?event_id=${item.event_id}&user_id=${item.user_id}&access_token=${token}`,
|
|
|
formData
|
|
|
);
|
|
|
|
|
|
- console.log("更新報名清單", response);
|
|
|
+ console.log("更新審核", response);
|
|
|
+
|
|
|
+ getEnrolledData(item.event_id);
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+let itemsPerPage = ref(10); // 每頁顯示筆數(查看出缺席)
|
|
|
+
|
|
|
+let pendingHeaders = reactive([
|
|
|
+ {
|
|
|
+ title: "姓名",
|
|
|
+ key: "real_name",
|
|
|
+ },
|
|
|
+ { title: "電話", key: "phone" },
|
|
|
+ { title: "信箱", key: "email" },
|
|
|
+ { title: "審核", key: "reg_confirm" },
|
|
|
+]);
|
|
|
+
|
|
|
+let approvedHeaders = reactive([
|
|
|
+ {
|
|
|
+ title: "姓名",
|
|
|
+ key: "real_name",
|
|
|
+ },
|
|
|
+ { title: "電話", key: "phone" },
|
|
|
+ { title: "信箱", key: "email" },
|
|
|
+ { title: "付款狀態", key: "payment" },
|
|
|
+ { title: "末五碼", key: "five_digits" },
|
|
|
+]);
|
|
|
+
|
|
|
+let studentHeaders = reactive([
|
|
|
+ {
|
|
|
+ title: "姓名",
|
|
|
+ align: "start",
|
|
|
+ key: "real_name",
|
|
|
+ },
|
|
|
+ { title: "電話", key: "phone" },
|
|
|
+ { title: "信箱", key: "email" },
|
|
|
+ { title: "出席", key: "is_attend" },
|
|
|
+]);
|
|
|
+
|
|
|
+let sessionHeaders = reactive([
|
|
|
+ {
|
|
|
+ title: "課堂編號",
|
|
|
+ align: "center",
|
|
|
+ key: "sessions",
|
|
|
+ },
|
|
|
+ { title: "開始時間", align: "center", key: "start_time" },
|
|
|
+ { title: "結束時間", align: "center", key: "end_time" },
|
|
|
+ { title: "學員名單", align: "center", key: "student" },
|
|
|
+]);
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -672,27 +747,62 @@ async function saveAttendRecord(item) {
|
|
|
></v-progress-circular>
|
|
|
</div>
|
|
|
|
|
|
- <v-data-table
|
|
|
- v-else
|
|
|
- v-model:items-per-page="itemsPerPage"
|
|
|
- :headers="headers"
|
|
|
- :items="registrations.list"
|
|
|
- item-value="name"
|
|
|
- class="courses-table"
|
|
|
- >
|
|
|
- <!-- <template v-slot:item.enrolled="{ item }">
|
|
|
+ <div v-else>
|
|
|
+ <v-tabs
|
|
|
+ v-model="tab"
|
|
|
+ color="purple"
|
|
|
+ align-tabs="center"
|
|
|
+ class="mb-5 courses-tab"
|
|
|
+ >
|
|
|
+ <v-tab :value="1" class="me-5">
|
|
|
+ 未審核
|
|
|
+ <span v-show="registrationState" class="badge"></span
|
|
|
+ ></v-tab>
|
|
|
+ <v-tab :value="2">已審核</v-tab>
|
|
|
+ </v-tabs>
|
|
|
+ <v-window v-model="tab">
|
|
|
+ <v-window-item :value="1">
|
|
|
+ <v-data-table
|
|
|
+ v-model:items-per-page="itemsPerPage"
|
|
|
+ :headers="pendingHeaders"
|
|
|
+ :items="pendingRegistration.list"
|
|
|
+ item-value="name"
|
|
|
+ class="courses-table"
|
|
|
+ >
|
|
|
+ <template v-slot:item.reg_confirm="{ item }">
|
|
|
+ <v-btn
|
|
|
+ class="my-3 me-4"
|
|
|
+ color="purple"
|
|
|
+ icon="mdi-check"
|
|
|
+ @click="updateRegConfirm(item.raw)"
|
|
|
+ >
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ </v-data-table>
|
|
|
+ </v-window-item>
|
|
|
+ <v-window-item :value="2">
|
|
|
+ <v-data-table
|
|
|
+ v-model:items-per-page="itemsPerPage"
|
|
|
+ :headers="approvedHeaders"
|
|
|
+ :items="approvedRegistration.list"
|
|
|
+ item-value="name"
|
|
|
+ class="courses-table"
|
|
|
+ >
|
|
|
+ <!-- <template v-slot:item.enrolled="{ item }">
|
|
|
<v-checkbox hide-details></v-checkbox>
|
|
|
</template> -->
|
|
|
- <template v-slot:item.payment="{ item }">
|
|
|
- <div class="d-flex align-center my-2">
|
|
|
- <v-checkbox
|
|
|
- v-model="item.selectable.payment_status"
|
|
|
- color="purple"
|
|
|
- hide-details
|
|
|
- label="已付款"
|
|
|
- @change="updateEnrolledData(item.raw, item.index)"
|
|
|
- ></v-checkbox>
|
|
|
- <!-- <v-text-field
|
|
|
+ <template v-slot:item.payment="{ item }">
|
|
|
+ <div class="d-flex align-center my-2">
|
|
|
+ <v-checkbox
|
|
|
+ v-model="item.selectable.payment_status"
|
|
|
+ color="purple"
|
|
|
+ hide-details
|
|
|
+ label="已付款"
|
|
|
+ @change="
|
|
|
+ updateEnrolledData(item.raw, item.index)
|
|
|
+ "
|
|
|
+ ></v-checkbox>
|
|
|
+ <!-- <v-text-field
|
|
|
v-model="item.selectable.five_digits"
|
|
|
density="compact"
|
|
|
variant="outlined"
|
|
@@ -741,69 +851,78 @@ async function saveAttendRecord(item) {
|
|
|
</v-chip>
|
|
|
</Transition>
|
|
|
</div> -->
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-slot:item.five_digits="{ item }">
|
|
|
- <div class="d-flex align-center my-2">
|
|
|
- <!-- <v-checkbox
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:item.five_digits="{ item }">
|
|
|
+ <div class="d-flex align-center my-2">
|
|
|
+ <!-- <v-checkbox
|
|
|
v-model="item.selectable.payment_status"
|
|
|
color="purple"
|
|
|
hide-details
|
|
|
label="已付款"
|
|
|
@change="updateEnrolledData(item.raw, item.index)"
|
|
|
></v-checkbox> -->
|
|
|
- <v-text-field
|
|
|
- v-model="item.selectable.five_digits"
|
|
|
- density="compact"
|
|
|
- variant="outlined"
|
|
|
- hide-details
|
|
|
- label="帳號末五碼"
|
|
|
- class="account-item"
|
|
|
- :disabled="!item.selectable.payment_status"
|
|
|
- @input="fiveDigitsInput[item.index] = true"
|
|
|
- ></v-text-field>
|
|
|
+ <v-text-field
|
|
|
+ v-model="item.selectable.five_digits"
|
|
|
+ density="compact"
|
|
|
+ variant="outlined"
|
|
|
+ hide-details
|
|
|
+ label="帳號末五碼"
|
|
|
+ class="account-item"
|
|
|
+ :disabled="!item.selectable.payment_status"
|
|
|
+ @input="fiveDigitsInput[item.index] = true"
|
|
|
+ ></v-text-field>
|
|
|
|
|
|
- <div style="width: 95px">
|
|
|
- <div v-if="fiveDigitsInput[item.index]">
|
|
|
- <v-btn
|
|
|
- @click="
|
|
|
- updateEnrolledData(item.raw, item.index)
|
|
|
- "
|
|
|
- variant="outlined"
|
|
|
- rounded
|
|
|
- color="success"
|
|
|
- size="xs-small"
|
|
|
- class="mx-3"
|
|
|
- >
|
|
|
- <v-icon icon="mdi-check" class="pa-4"></v-icon>
|
|
|
- </v-btn>
|
|
|
- <v-btn
|
|
|
- @click="
|
|
|
- fiveDigitsInput[item.index] = false;
|
|
|
- item.selectable.five_digits = '';
|
|
|
- "
|
|
|
- variant="outlined"
|
|
|
- rounded
|
|
|
- color="gray"
|
|
|
- size="xs-small"
|
|
|
- >
|
|
|
- <v-icon icon="mdi-close" class="pa-4"></v-icon>
|
|
|
- </v-btn>
|
|
|
- </div>
|
|
|
- <Transition>
|
|
|
- <v-chip
|
|
|
- v-if="showChip[item.index]"
|
|
|
- class="ms-3"
|
|
|
- color="success"
|
|
|
- variant="outlined"
|
|
|
- >
|
|
|
- 儲存成功
|
|
|
- </v-chip>
|
|
|
- </Transition>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </v-data-table>
|
|
|
+ <div style="width: 95px">
|
|
|
+ <div v-if="fiveDigitsInput[item.index]">
|
|
|
+ <v-btn
|
|
|
+ @click="
|
|
|
+ updateEnrolledData(item.raw, item.index)
|
|
|
+ "
|
|
|
+ variant="outlined"
|
|
|
+ rounded
|
|
|
+ color="success"
|
|
|
+ size="xs-small"
|
|
|
+ class="mx-3"
|
|
|
+ >
|
|
|
+ <v-icon
|
|
|
+ icon="mdi-check"
|
|
|
+ class="pa-4"
|
|
|
+ ></v-icon>
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ @click="
|
|
|
+ fiveDigitsInput[item.index] = false;
|
|
|
+ item.selectable.five_digits = '';
|
|
|
+ "
|
|
|
+ variant="outlined"
|
|
|
+ rounded
|
|
|
+ color="gray"
|
|
|
+ size="xs-small"
|
|
|
+ >
|
|
|
+ <v-icon
|
|
|
+ icon="mdi-close"
|
|
|
+ class="pa-4"
|
|
|
+ ></v-icon>
|
|
|
+ </v-btn>
|
|
|
+ </div>
|
|
|
+ <Transition>
|
|
|
+ <v-chip
|
|
|
+ v-if="showChip[item.index]"
|
|
|
+ class="ms-3"
|
|
|
+ color="success"
|
|
|
+ variant="outlined"
|
|
|
+ >
|
|
|
+ 儲存成功
|
|
|
+ </v-chip>
|
|
|
+ </Transition>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </v-data-table>
|
|
|
+ </v-window-item>
|
|
|
+ </v-window>
|
|
|
+ </div>
|
|
|
|
|
|
<!-- <v-data-table
|
|
|
v-else
|
|
@@ -1621,13 +1740,16 @@ async function saveAttendRecord(item) {
|
|
|
.v-data-table-footer {
|
|
|
padding: 20px 0;
|
|
|
}
|
|
|
+
|
|
|
.v-selection-control {
|
|
|
justify-content: center;
|
|
|
}
|
|
|
+
|
|
|
.account-item {
|
|
|
.v-field__input {
|
|
|
padding: 0 20px;
|
|
|
}
|
|
|
+
|
|
|
.v-label {
|
|
|
color: var(--gray);
|
|
|
}
|
|
@@ -1637,4 +1759,20 @@ async function saveAttendRecord(item) {
|
|
|
.v-data-table-header__content {
|
|
|
justify-content: center;
|
|
|
}
|
|
|
+
|
|
|
+.courses-tab {
|
|
|
+ .v-tab {
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+ .badge {
|
|
|
+ display: block;
|
|
|
+ height: 10px;
|
|
|
+ width: 10px;
|
|
|
+ background-color: red;
|
|
|
+ border-radius: 100px;
|
|
|
+ position: absolute;
|
|
|
+ right: 0px;
|
|
|
+ top: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|