-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from maikusobu/feature/issue-#29
feat: added finance department views
- Loading branch information
Showing
15 changed files
with
424 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
src/renderer/views/finance-department/FinanceDepartment.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div class="grow flex flex-col gap-8 items-center p-[40px]"> | ||
<FunctionBar /> | ||
<Table /> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import FunctionBar from './components/FunctionBar.vue'; | ||
import Table from './components/Table.vue'; | ||
</script> |
68 changes: 68 additions & 0 deletions
68
src/renderer/views/finance-department/payment/components/FunctionBar.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<div class="flex items-center gap-[50px]"> | ||
<label> | ||
Năm học: | ||
<select | ||
class="select select-bordered" | ||
v-model="paymentStore.year" | ||
@change="paymentStore.getPayments" | ||
> | ||
<option | ||
v-for="year in getYears()" | ||
:key="year" | ||
:value="year" | ||
:selected="year === new Date().getFullYear()" | ||
> | ||
{{ year }} | ||
</option> | ||
</select> | ||
</label> | ||
|
||
<label> | ||
Học kì: | ||
<select | ||
class="select select-bordered" | ||
v-model="paymentStore.term" | ||
@change="paymentStore.getPayments" | ||
> | ||
<option value="first">Học kì 1</option> | ||
<option value="second">Học kì 2</option> | ||
<option value="third">Học kì 3</option> | ||
</select> | ||
</label> | ||
|
||
<div class="flex"> | ||
<img | ||
:src="searchIcon" | ||
alt="search icon" | ||
class="bg-base-silver pl-4 rounded-l" | ||
/> | ||
<input | ||
type="search" | ||
placeholder="Tìm kiếm họ tên sinh viên" | ||
class="input bg-base-silver max-w-[500px] placeholder:text-black focus:border-transparent" | ||
v-model="paymentStore.studentName" | ||
@input="paymentStore.getPayments" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import searchIcon from '../../../../../assets/images/searchIcon.svg'; | ||
import { usePaymentStore } from '../stores/payment.ts'; | ||
const paymentStore = usePaymentStore(); | ||
const getYears = () => { | ||
const years = []; | ||
const currentYear = new Date().getFullYear(); | ||
for (let i = 4; i >= 0; i--) { | ||
years.push(currentYear - i); | ||
} | ||
return years; | ||
}; | ||
</script> |
37 changes: 37 additions & 0 deletions
37
src/renderer/views/finance-department/payment/components/Table.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<div class="overflow-x-auto w-full h-[calc(100vh-300px)]"> | ||
<table class="table table-zebra"> | ||
<thead> | ||
<tr> | ||
<th>Mã biên lai</th> | ||
<th>Mã số sinh viên</th> | ||
<th>Họ tên</th> | ||
<th>Ngày lập biên lai</th> | ||
<th>Số tiền thu</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="payment in paymentStore.payments" | ||
:key="payment.id" | ||
class="hover:!bg-secondary-100" | ||
> | ||
<td>{{ payment?.id }}</td> | ||
<td>{{ payment?.studentId }}</td> | ||
<td>{{ payment?.studentName }}</td> | ||
<td>{{ formateDateString(payment?.paymentDate) }}</td> | ||
<td>{{ payment?.ammount.toLocaleString() }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { usePaymentStore } from '../stores/payment.ts'; | ||
import formateDateString from '../../../../../utils/formatDateString'; | ||
const paymentStore = usePaymentStore(); | ||
paymentStore.getPayments(); | ||
</script> |
54 changes: 54 additions & 0 deletions
54
src/renderer/views/finance-department/payment/stores/payment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { defineStore } from 'pinia'; | ||
import { axiosClient } from '../../../../../api/axiosClient'; | ||
|
||
enum Term { | ||
FIRST = 'first', | ||
SECOND = 'second', | ||
THIRD = 'third', | ||
} | ||
|
||
type Payment = { | ||
id: number; | ||
ammount: number; | ||
paymentDate: string; | ||
year: number; | ||
term: Term; | ||
studentId: number; | ||
studentName: string; | ||
}; | ||
|
||
type State = { | ||
payments: Payment[]; | ||
year: number; | ||
term: Term; | ||
studentName: string; | ||
}; | ||
|
||
const usePaymentStore = defineStore('payment', { | ||
state: (): State => ({ | ||
payments: [], | ||
year: new Date().getFullYear(), | ||
term: Term.FIRST, | ||
studentName: '', | ||
}), | ||
|
||
actions: { | ||
async getPayments() { | ||
const response = await axiosClient.get( | ||
`/payment/history?year=${this.year}&term=${this.term}&studentName=${this.studentName}`, | ||
{ | ||
id: `list-payment`, | ||
cache: { | ||
update: { | ||
[`list-payment`]: 'delete', | ||
}, | ||
}, | ||
} | ||
); | ||
|
||
this.payments = response.data; | ||
}, | ||
}, | ||
}); | ||
|
||
export { usePaymentStore }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div class="grow flex flex-col gap-8 items-center p-[40px]"> | ||
<FunctionBar /> | ||
<Table /> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import FunctionBar from './components/FunctionBar.vue'; | ||
import Table from './components/Table.vue'; | ||
</script> |
81 changes: 81 additions & 0 deletions
81
src/renderer/views/finance-department/report/components/FunctionBar.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<div class="flex items-center gap-[50px]"> | ||
<label> | ||
Năm học: | ||
<select | ||
class="select select-bordered" | ||
v-model="reportStore.year" | ||
@change="reportStore.getReports" | ||
> | ||
<option | ||
v-for="year in getYears()" | ||
:key="year" | ||
:value="year" | ||
:selected="year === new Date().getFullYear()" | ||
> | ||
{{ year }} | ||
</option> | ||
</select> | ||
</label> | ||
|
||
<label> | ||
Học kì: | ||
<select | ||
class="select select-bordered" | ||
v-model="reportStore.term" | ||
@change="reportStore.getReports" | ||
> | ||
<option value="first">Học kì 1</option> | ||
<option value="second">Học kì 2</option> | ||
<option value="third">Học kì 3</option> | ||
</select> | ||
</label> | ||
|
||
<label> | ||
Trạng thái: | ||
<select | ||
class="select select-bordered" | ||
v-model="reportStore.status" | ||
@change="reportStore.getReports" | ||
> | ||
<option value="ALL">Tất cả</option> | ||
<option value="PAID">Đã đóng đủ</option> | ||
<option value="PENDING">Chưa đóng đủ</option> | ||
</select> | ||
</label> | ||
|
||
<div class="flex"> | ||
<img | ||
:src="searchIcon" | ||
alt="search icon" | ||
class="bg-base-silver pl-4 rounded-l" | ||
/> | ||
<input | ||
type="search" | ||
placeholder="Tìm kiếm họ tên sinh viên" | ||
class="input bg-base-silver max-w-[500px] placeholder:text-black focus:border-transparent" | ||
v-model="reportStore.studentName" | ||
@input="reportStore.getReports" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import searchIcon from '../../../../../assets/images/searchIcon.svg'; | ||
import { useReportStore } from '../stores/report.ts'; | ||
const reportStore = useReportStore(); | ||
const getYears = () => { | ||
const years = []; | ||
const currentYear = new Date().getFullYear(); | ||
for (let i = 4; i >= 0; i--) { | ||
years.push(currentYear - i); | ||
} | ||
return years; | ||
}; | ||
</script> |
Oops, something went wrong.