Skip to content

Commit

Permalink
feat: show faculty signers, enter to submit in PersonnelCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
keenthekeen committed Oct 25, 2023
1 parent 33c80d4 commit 30e4f7b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function show(Request $request, Document $document): Response {
$isAuthorized = $request->user()->can('update-document', $document);
$document->can = [
'download-document' => $isAuthorized,
'update-document' => $isAuthorized AND $document->created_at->isCurrentWeek(),
'update-document' => $isAuthorized and ($document->created_at->diffInDays() <= 14),
];
$document->has_attachment = $isAuthorized && !empty($document->attachment_path);
$document->has_approved = $isAuthorized && !empty($document->approved_path);
$document->load(['user:id,name', 'department:id,name', 'project:id,name']);
$document->load(['user:id,name', 'department:id,name', 'project:id,name,advisor']);
if ($document->user) {
unset($document->user->id);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/PersonnelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PersonnelController extends Controller
{
public function index(Request $request)
{
$year = $request->input('year', Helper::buddhistYear(now()->subMonths(2)->year));
$year = $request->input('year', self::getYearList()[0]);

return Inertia::render('PersonnelIndex', [
'list' => Personnel::query()->with('department')->where('year', $year)->orderBy('sequence')->get(),
Expand Down
26 changes: 24 additions & 2 deletions resources/js/Pages/DocumentShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
<span class="text-lg py-1 px-2 bg-blue-200 text-blue-600">
สพจ <span class="font-mono">{{ item.number }}-{{ item.year }}</span> {{ item.title.substring(0, 90) }}<span class="font-mono">.pdf</span>
</span>
<template v-if="item.signers">
<template v-if="item.signers && item.signers.length > 0">
<p class="mt-2">
และส่งให้ผู้เกี่ยวข้องลงลายมือชื่อตามลำดับ
และส่งให้ผู้เกี่ยวข้องลงลายมือชื่อตามลำดับ ซึ่งอาจมีดังนี้
</p>
<table>
<tr v-for="signer in item.signers">
Expand All @@ -119,6 +119,28 @@
<td class="px-2">{{ signer.position }}</td>
<td class="px-2 font-mono">{{ signer.email }}</td>
</tr>
<tr v-if="item.project_id">
<td class="px-1">-</td>
<td class="px-2">{{ item.project.advisor }}</td>
<td class="px-2" colspan="2">อาจารย์ที่ปรึกษาโครงการ</td>
</tr>
<tr v-if="item.tag === 'approval'">
<td class="px-1">-</td>
<td class="px-2" colspan="3">แล้วส่งต่อไฟล์ที่ผู้เกี่ยวข้องลงลายมือชื่อผ่านระบบแล้ว ไปยังฝ่ายกิจการนิสิต
(studentmd@chula.md) โดยขอให้เจ้าหน้าที่ฝ่ายกิจการนิสิตพิมพ์และนำเรียนรองคณบดีลงลายมือชื่อบนกระดาษ
</td>
</tr>
<tr v-else-if="item.recipient === 'รองคณบดีฝ่ายกิจการนิสิต'">
<td class="px-1">-</td>
<td class="px-2" colspan="2">รองคณบดีฝ่ายกิจการนิสิต (เป็นผู้รับไม่ต้องมีช่องให้ลงชื่อในเอกสาร)</td>
<td class="px-2 font-mono">sittisak.h@chula.ac.th</td>
</tr>
<tr v-else>
<td class="px-1">-</td>
<td class="px-2">ศ.ดร.นพ.สิทธิศักดิ์ หรรษาเวก</td>
<td class="px-2">รองคณบดีฝ่ายกิจการนิสิต</td>
<td class="px-2 font-mono">sittisak.h@chula.ac.th</td>
</tr>
</table>
</template>
<p class="mt-1 text-xs text-blue-400">
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/PersonnelCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</template>

<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
<jet-form-section>
<jet-form-section @submit="submit">
<template #title>Office</template>
<template #description></template>
<template #form>
Expand Down Expand Up @@ -61,7 +61,7 @@
</template>
</jet-form-section>
<jet-section-border/>
<jet-form-section>
<jet-form-section @submit="submit">
<template #title>Student</template>
<template #description>
For current students, enter email or student ID to search.
Expand Down
6 changes: 6 additions & 0 deletions resources/js/Pages/PersonnelIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-2 py-2 md:px-4 md:py-3 text-left text-xs font-medium text-gray-500 tracking-wider" scope="col">
#
</th>
<th class="px-2 py-2 md:px-4 md:py-3 text-left text-xs font-medium text-gray-500 tracking-wider" scope="col">
Name / Email
</th>
Expand All @@ -28,6 +31,9 @@
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr v-for="item in list" :id="'row-'+item.id" :key="item.id">
<td class="px-2 py-2 md:px-4 md:py-3 text-xs">
{{ item.id }}
</td>
<td class="px-2 py-2 md:px-4 md:py-3">
<inertia-link :href="is_admin ? route('personnels.edit', {personnel: item.id}) : ('#row-'+item.id)">{{
item.name
Expand Down

0 comments on commit 30e4f7b

Please sign in to comment.