Skip to content

Commit

Permalink
Merge pull request #31 from maikusobu/feat/student-department
Browse files Browse the repository at this point in the history
fix: update student-department
  • Loading branch information
loingtan authored Apr 28, 2024
2 parents ed637c0 + 0b41523 commit d724976
Show file tree
Hide file tree
Showing 13 changed files with 762 additions and 25 deletions.
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"jwt-decode": "^4.0.0",
"pinia": "^2.1.7",
"update-electron-app": "^3.0.0",
"vee-validate": "^4.12.6",
"vue": "^3.4.20",
"vue-router": "^4.3.0",
"vue-toastification": "^2.0.0-rc.5"
Expand Down
37 changes: 20 additions & 17 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@
@tailwind utilities;

@layer utilities {
/* font */
* {
font-family: 'Inter', sans-serif;
}
/* font */
* {
font-family: 'Inter', sans-serif;
}

/* background */
body {
@apply bg-[#fcfafa];
}
/* background */
body {
@apply bg-[#fcfafa];
}

/* form elements */
input {
@apply placeholder:text-[#8a8a8a] placeholder:text-[14px] placeholder:font-medium !rounded-[4px];
}
button,
select,
input {
@apply !outline-none !ring-0;
}
/* form elements */
input {
@apply placeholder:text-[#8a8a8a] placeholder:text-[14px] placeholder:font-medium !rounded-[4px];
}

button,
select,
input {
@apply !outline-none !ring-0;
}


}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const createWindow = () => {
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
autoHideMenuBar: process.env.NODE_ENV === 'development' ? false : true,
autoHideMenuBar: process.env.NODE_ENV !== 'development',
});

// and load the index.html of the app.
Expand Down
9 changes: 8 additions & 1 deletion src/renderer/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import TrainingDepartment from '../views/training-department/TrainingDepartment.
import FinanceDepartment from '../views/finance-department/FinanceDepartment.vue';
import Course from '../views/training-department/course/Course.vue';
import StudentDepartment from '../views/student-department/StudentDepartment.vue';
import Student from '../views/student-department/student/Student.vue';
import resolveDepartmentRoute from '../../utils/resolveDepartmentRoute';
import getSession from '../../utils/getSession';

Expand Down Expand Up @@ -50,9 +51,15 @@ const routes: Array<RouteRecordRaw> = [
children: [],
},
{
//cải thiện load khi cần thiết //
path: '/student-department', // phòng công tác sinh viên
component: StudentDepartment,
children: [],
children: [
{
path: 'student',
component: Student,
},
],
},
];

Expand Down
8 changes: 7 additions & 1 deletion src/renderer/views/student-department/StudentDepartment.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<div class="flex">
<SideBar title="phòng công tác sinh viên" />
<SideBar
:routes="[
{ name: 'bảng điều khiển', path: '/student-department' },
{ name: 'Sinh viên', path: '/student-department/student' },
]"
title="phòng công tác sinh viên"
/>
<div class="flex flex-col grow">
<Topbar />
<RouterView />
Expand Down
16 changes: 16 additions & 0 deletions src/renderer/views/student-department/student/Student.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts" setup>
import Table from './components/Table.vue';
import FunctionBar from './components/FunctionBar.vue';
import EditModal from './components/EditModal.vue';
import { Suspense } from 'vue';
</script>

<template>
<FunctionBar />
<Suspense>
<Table />
</Suspense>
<EditModal />
</template>

<style scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<template>
<button
class="btn bg-secondary-400 text-base-white hover:bg-secondary-300"
onclick="create_modal_student.showModal()"
>
Lập sinh viên
</button>
<dialog id="create_modal_student" class="modal">
<div class="modal-box min-w-[900px] w p-20">
<form method="dialog">
<button
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
@click="handleCloseModal"
>
</button>
</form>
<h1 class="font-semibold text-3xl">Thêm môn học</h1>
<button class="flex items-center gap-2">
<img :src="plusCircleIcon" alt="add icon" />
<p>Nhập từ CSV</p>
</button>
<Form class="mt-8 grid grid-cols-4 gap-10" @submit="handleSubmit">
<label class="flex flex-col col-span-2">
Họ và tên
<Field class="input input-bordered" name="name" type="text" />
<p
v-if="studentStore.errorMessages['name']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['name'] }}
</p>
</label>

<label class="flex flex-col">
Ngày sinh
<Field class="input input-bordered" name="dateOfBirth" type="date" />

<p
v-if="studentStore.errorMessages['dateOfBirth']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['dateOfBirth'] }}
</p>
</label>
<label>
Đối tượng ưu tiên
<Field as="select" class="select select-bordered" name="priorityId">
<option disabled value="">Chọn đối tượng ưu tiên</option>
<option
v-for="priority in studentStore.priorities"
:key="priority.id"
:value="priority.id"
>
{{ priority.name }}
</option>
</Field>

<p
v-if="studentStore.errorMessages['priorityId']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['priorityId'] }}
</p>
</label>
<label class="flex flex-col">
Địa chỉ

<select
class="select select-bordered"
@change="studentStore.getDistrict($event.target.value)"
>
<option>Chọn tỉnh thành</option>
<option
v-for="province in studentStore.provinces"
:key="province.id"
:value="province.id"
>
{{ province.name }}
</option>
</select>
</label>
<label class="flex flex-col">
<br />
<Field as="select" class="select select-bordered" name="districtId">
<option>Chọn quận/huyện</option>
<option
v-for="district in studentStore.districts"
:key="district.id"
:value="district.id"
>
{{ district.name }}
</option>
</Field>

<p
v-if="studentStore.errorMessages['districtId']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['districtId'] }}
</p>
</label>
<label class="flex flex-col col-span-2">
<br />
<Field class="input input-bordered" name="address" type="text" />
<p
v-if="studentStore.errorMessages['address']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['address'] }}
</p>
</label>
<label class="flex flex-col">
Giới tính
<Field as="select" class="select select-bordered" name="gender">
<option disabled selected value="">Chọn giới tính</option>
<option value="male">Nam</option>
<option value="female">Nữ</option>
</Field>

<p
v-if="studentStore.errorMessages['gender']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['gender'] }}
</p>
</label>

<label>
Chuyên ngành
<Field as="select" class="select select-bordered" name="majorId">
<option disabled selected value="">Chọn chuyên ngành</option>
<option
v-for="major in studentStore.majors"
:key="major.id"
:value="major.id"
>
{{ major.name }}
</option>
</Field>

<p
v-if="studentStore.errorMessages['majorId']"
class="text-red-700 text-[12px]"
>
{{ studentStore.errorMessages['majorId'] }}
</p>
</label>
<button
class="row-start-4 btn w-[200px] bg-secondary-400 text-base-white hover:bg-secondary-300"
type="submit"
>
Lưu lại
</button>
</Form>
</div>
</dialog>
</template>

<script setup>
import plusCircleIcon from '../../../../../assets/images/plusCircleIcon.svg';
import { useStudentStore } from '../stores/student';
import { Form, Field } from 'vee-validate';
const studentStore = useStudentStore();
const handleCloseModal = () => {
studentStore.clearErrorMessages();
};
const handleSubmit = async (value) => {
await studentStore.addStudent(value);
if (Object.keys(studentStore.errorMessages).length === 0) {
document.getElementById('create_modal_student').close();
await studentStore.fetchStudents(studentStore.search.query);
handleCloseModal();
}
};
</script>
Loading

0 comments on commit d724976

Please sign in to comment.