-
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.
feat: allow faculty to edit participant list before approval
- Loading branch information
1 parent
162f98a
commit 7fa68d6
Showing
5 changed files
with
216 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<DialogModal :show="showModal" @close="$emit('close')"> | ||
<template #title> | ||
แก้ไขข้อมูลนิสิตผู้เกี่ยวข้อง | ||
</template> | ||
|
||
<template #content v-if="participant"> | ||
<div class="grid sm:grid-cols-2 gap-4"> | ||
<div class="space-y-2"> | ||
<Label>นิสิต</Label> | ||
{{ participant.user.name }} | ||
</div> | ||
<div class="space-y-2"> | ||
<Label>เลขประจำตัว</Label> | ||
{{ participant.user.student_id }} | ||
</div> | ||
</div> | ||
<div class="mt-4"> | ||
<label for="type" class="block text-sm font-medium text-gray-700">บทบาท</label> | ||
<select id="type" v-model="form.type" required | ||
class="mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"> | ||
<option v-for="(name, value) in PROJECT_PARTICIPANT_ROLES" | ||
:key="value" :value="value"> | ||
{{ name }} | ||
</option> | ||
</select> | ||
<InputError :message="form.errors.department_id" class="mt-2"/> | ||
</div> | ||
<div class="mt-4"> | ||
<Label for="title" value="ตำแหน่ง"/> | ||
<Input id="title" type="text" class="mt-2 block w-full" v-model.trim="form.title"/> | ||
</div> | ||
</template> | ||
|
||
<template #footer> | ||
<SecondaryButton @click.native="$emit('close')"> | ||
ปิด | ||
</SecondaryButton> | ||
<Button @click="submit" class="ml-4"> | ||
บันทึก | ||
</Button> | ||
</template> | ||
</DialogModal> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import {useForm} from '@inertiajs/vue3'; | ||
import Button from "@/Jetstream/Button.vue"; | ||
import DialogModal from "@/Jetstream/DialogModal.vue"; | ||
import Input from "@/Jetstream/Input.vue"; | ||
import InputError from '@/Jetstream/InputError.vue'; | ||
import Label from "@/Jetstream/Label.vue"; | ||
import SecondaryButton from "@/Jetstream/SecondaryButton.vue"; | ||
import {ProjectParticipant} from '@/types'; | ||
import {PROJECT_PARTICIPANT_ROLES} from '@/static'; | ||
import {watch} from 'vue'; | ||
const props = defineProps<{ | ||
showModal: Boolean, | ||
participant: ProjectParticipant | null, | ||
}>(); | ||
const emit = defineEmits(['close']); | ||
const form = useForm({ | ||
title: props.participant?.title, | ||
type: props.participant?.type, | ||
}); | ||
watch(() => props.participant, (participant) => { | ||
form.title = participant?.title; | ||
form.type = participant?.type; | ||
}); | ||
const submit = () => { | ||
form.post(route('projects.editParticipant', {participant: props.participant.id}), { | ||
onSuccess: () => { | ||
emit('close'); | ||
}, | ||
}); | ||
}; | ||
</script> |
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,67 @@ | ||
export interface Project { | ||
id: number; | ||
created_at: string | null; | ||
updated_at: string | null; | ||
year: number; | ||
number: number; | ||
name: string; | ||
advisor: string | null; | ||
type: string | null; | ||
recurrence: string | null; | ||
period_start: string | null; | ||
period_end: string | null; | ||
background: string | null; | ||
aims: string | null; | ||
outcomes: string | null; | ||
objectives: string | null; | ||
expense: string | null; | ||
user_id: number | null; | ||
department_id: number | null; | ||
approval_document_id: number | null; | ||
duration: number | null; | ||
estimated_attendees: string | null; | ||
closure_reminded_at: string | null; | ||
closure_submitted_at: string | null; | ||
closure_submitted_by: number | null; | ||
closure_approved_at: string | null; | ||
closure_approved_message: string | null; | ||
closure_approved_by: number | null; | ||
closure_approved_status: number; | ||
// Relationship | ||
participants: ProjectParticipant[]; | ||
user: User; | ||
} | ||
|
||
export interface ProjectParticipant { | ||
id: number; | ||
created_at: string | null; | ||
updated_at: string | null; | ||
user_id: number; | ||
project_id: number; | ||
type: 'organizer' | 'staff' | 'attendee'; | ||
title: string | null; | ||
verify_status: number; | ||
reject_reason: string | null; | ||
reject_participants: number[]; | ||
approve_status: number; | ||
// Relationship | ||
user: User; | ||
} | ||
|
||
export interface User { | ||
id: number; | ||
name: string; | ||
email: string; | ||
email_verified_at: string | null; | ||
password: string; | ||
remember_token: string | null; | ||
current_team_id: number | null; | ||
profile_photo_path: string | null; | ||
google_id: string | null; | ||
student_id: string | null; | ||
created_at: string; | ||
updated_at: string; | ||
two_factor_secret: string | null; | ||
two_factor_recovery_codes: string | null; | ||
roles: string; | ||
} |
Oops, something went wrong.