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
11 changes: 11 additions & 0 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ const endpoints = [
icon: 'groups',
role: Role.Secretary,
},
/*{
name: '提案管理',
url: '/manage_proposals',
icon: 'description',
role: Role.Secretary,
},*/
{
name: '主持會議',
url: '/meeting_host',
Expand All @@ -126,6 +132,11 @@ const endpoints = [
icon: 'construction',
role: Role.Secretary,
},
/*{
name: '提案',
url: '/proposal',
icon: 'book',
},*/
{
name: '關於',
url: '/about',
Expand Down
13 changes: 10 additions & 3 deletions src/pages/mgmt/ManageMeetingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@
<q-checkbox v-model="targetMeeting.exemptFromAttendance" label="不記入出缺席 (委員會會議用)" />
<div class="row">
<q-checkbox :model-value="!!targetMeeting.customAttendanceBar" @update:model-value="editCustomAttendanceBar" label="自訂開會門檻" />
<q-input class="q-ml-sm" v-if="targetMeeting.customAttendanceBar" v-model.number="targetMeeting.customAttendanceBar" type="number" dense label="開會門檻" />
<q-input
class="q-ml-sm"
v-if="targetMeeting.customAttendanceBar"
v-model.number="targetMeeting.customAttendanceBar"
type="number"
dense
label="開會門檻"
/>
</div>
<p class="q-mb-none">開會日期:</p>
<div class="row q-gutter-md q-ml-none">
Expand Down Expand Up @@ -229,7 +236,7 @@ async function submit() {
reign: targetMeeting.reign,
registration: targetMeeting.registration,
exemptFromAttendance: targetMeeting.exemptFromAttendance,
customAttendanceBar: (targetMeeting.customAttendanceBar) ? targetMeeting.customAttendanceBar : null,
customAttendanceBar: targetMeeting.customAttendanceBar ? targetMeeting.customAttendanceBar : null,
punchInPasscode: targetMeeting.punchInPasscode,
});
} else if (action.value === 'add') {
Expand All @@ -247,7 +254,7 @@ async function submit() {
reign: targetMeeting.reign,
registration: targetMeeting.registration,
exemptFromAttendance: targetMeeting.exemptFromAttendance,
customAttendanceBar: (targetMeeting.customAttendanceBar) ? targetMeeting.customAttendanceBar : null,
customAttendanceBar: targetMeeting.customAttendanceBar ? targetMeeting.customAttendanceBar : null,
} as unknown as Meeting);
}
} catch (e) {
Expand Down
35 changes: 19 additions & 16 deletions src/pages/mgmt/attendance/AttendancePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<q-tabs>
<q-route-tab label="檢視班代出席時數" to="/attendance" />
<q-route-tab label="列出連續未出席者" to="/attendance/serial_absence" />
<q-route-tab label="生成職務訴訟文書" to="/attendance/export_indictment" />
<q-route-tab label="列出請假情況" to="/attendance/scheduled_absence" />
<q-route-tab label="匯出期末時數與記功嘉獎表" to="/attendance/export" />
</q-tabs>
Expand All @@ -26,7 +27,7 @@ import type { User } from 'src/ts/models.ts';
import { meetingCollectionOfCurrentReign } from 'src/ts/models.ts';
import { ref, watch } from 'vue';
import type { QTableColumn } from 'quasar';
import {currentReign, notifyError} from 'src/ts/utils.ts';
import { currentReign, notifyError } from 'src/ts/utils.ts';

const accounts = ref(null as User[] | null);
const meetings = meetingCollectionOfCurrentReign();
Expand Down Expand Up @@ -99,7 +100,7 @@ function updateAttendance() {
}
let meetingsCount = 0;
for (const meeting of meetings.value) {
if (!meeting||meeting.exemptFromAttendance) continue;
if (!meeting || meeting.exemptFromAttendance) continue;
for (const clazz of meeting.participants) {
if (!tempAttendance[clazz]) continue;
tempAttendance[clazz].attendedMeetings++;
Expand All @@ -121,20 +122,22 @@ function updateAttendance() {
attendance.value = Object.values(tempAttendance);
}

getAllUsers().then((users) => {
accounts.value = users;
watch(
meetings,
() => {
updateAttendance();
},
{ deep: true },
);
updateAttendance();
}).catch(e => notifyError('載入資料失敗', e))
.finally(()=> {
loading.value = false;
});
getAllUsers()
.then((users) => {
accounts.value = users;
watch(
meetings,
() => {
updateAttendance();
},
{ deep: true },
);
updateAttendance();
})
.catch((e) => notifyError('載入資料失敗', e))
.finally(() => {
loading.value = false;
});
</script>

<style scoped></style>
7 changes: 4 additions & 3 deletions src/pages/mgmt/attendance/ExportAttendancePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<q-tabs>
<q-route-tab label="檢視班代出席時數" to="/attendance" />
<q-route-tab label="列出連續未出席者" to="/attendance/serial_absence" />
<q-route-tab label="生成職務訴訟文書" to="/attendance/export_indictment" />
<q-route-tab label="列出請假情況" to="/attendance/scheduled_absence" />
<q-route-tab label="匯出期末時數與記功嘉獎表" to="/attendance/export" />
</q-tabs>
Expand All @@ -16,7 +17,7 @@ import { rawMeetingsOfCurrentReignQuery } from 'src/ts/models.ts';
import ExcelJS from 'exceljs';
import { exportFile, Loading } from 'quasar';
import { getDocs } from 'firebase/firestore';
import {cleanseName, notifyError} from 'src/ts/utils.ts';
import { cleanseName, notifyError } from 'src/ts/utils.ts';

async function exp() {
Loading.show();
Expand All @@ -38,12 +39,12 @@ async function exp() {
if (!account.clazz) continue;
let serviceHours = 0;
for (const meeting of meetings) {
if (!meeting||meeting.data()?.exemptFromAttendance) continue;
if (!meeting || meeting.data()?.exemptFromAttendance) continue;
if (meeting.data()?.participants.includes(account.clazz)) {
serviceHours++;
}
}
const attRate = serviceHours / meetings.filter(f => f.data() && !f.data()!.exemptFromAttendance).length;
const attRate = serviceHours / meetings.filter((f) => f.data() && !f.data()!.exemptFromAttendance).length;
let awardType;
if (attRate == 1) {
awardType = '小功乙支';
Expand Down
Loading