feat(classes): add class days and meeting times to class forms
Let admins set the weekly schedule on the class and show it in lists, details, and session generation.
This commit is contained in:
@@ -55,6 +55,28 @@
|
||||
<label class="font-semibold text-sm">کلاس فعال است</label>
|
||||
</div>
|
||||
|
||||
<div class="col-12 flex flex-column gap-2">
|
||||
<label class="font-semibold text-sm">روزهای برگزاری</label>
|
||||
<SelectButton
|
||||
v-model="form.days"
|
||||
:options="weekdays"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
multiple
|
||||
class="text-sm"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 md:col-6 flex flex-column gap-2">
|
||||
<label class="font-semibold text-sm">ساعت شروع کلاس</label>
|
||||
<InputText v-model.trim="form.startTime" class="w-full text-sm" dir="ltr" placeholder="19:00" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 md:col-6 flex flex-column gap-2">
|
||||
<label class="font-semibold text-sm">ساعت پایان کلاس</label>
|
||||
<InputText v-model.trim="form.endTime" class="w-full text-sm" dir="ltr" placeholder="21:00" />
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<AdminNotesField v-model="form.adminNotes" />
|
||||
</div>
|
||||
@@ -137,6 +159,9 @@
|
||||
:course-id="form.course ? String(form.course) : ''"
|
||||
:professor-id="form.professor ? String(form.professor) : null"
|
||||
:default-session-count="defaultSessionCount"
|
||||
:days="form.days"
|
||||
:start-time="form.startTime"
|
||||
:end-time="form.endTime"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -177,6 +202,8 @@ import Tag from 'primevue/tag';
|
||||
import DataTable from 'primevue/datatable';
|
||||
import Column from 'primevue/column';
|
||||
import DatePicker from 'vue3-persian-datetime-picker';
|
||||
import SelectButton from 'primevue/selectbutton';
|
||||
import { WEEKDAYS } from '@/utils/classSchedule';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -210,9 +237,13 @@ const form = reactive({
|
||||
tuitionFee: 0,
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
days: [],
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
isActive: true,
|
||||
adminNotes: []
|
||||
});
|
||||
const weekdays = WEEKDAYS;
|
||||
|
||||
const removeDialogMessage = computed(() => {
|
||||
const name = studentToRemove.value?.name;
|
||||
@@ -293,6 +324,9 @@ const fetchData = async () => {
|
||||
tuitionFee: data.tuitionFee || 0,
|
||||
startDate: toJalaliDisplay(data.startDate),
|
||||
endDate: toJalaliDisplay(data.endDate),
|
||||
days: Array.isArray(data.days) ? [...data.days] : [],
|
||||
startTime: data.startTime || '',
|
||||
endTime: data.endTime || '',
|
||||
isActive: data.isActive !== false,
|
||||
adminNotes: Array.isArray(data.adminNotes) ? [...data.adminNotes] : []
|
||||
});
|
||||
@@ -329,6 +363,9 @@ const handleSubmit = async () => {
|
||||
tuitionFee: form.tuitionFee,
|
||||
startDate: toGregorianIso(form.startDate),
|
||||
endDate: toGregorianIso(form.endDate),
|
||||
days: form.days || [],
|
||||
startTime: form.startTime || '',
|
||||
endTime: form.endTime || '',
|
||||
isActive: form.isActive,
|
||||
adminNotes: (form.adminNotes || []).map((n) => String(n).trim()).filter(Boolean)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user