feat: add author field

This commit is contained in:
Methapon2001 2024-01-10 17:48:33 +07:00
parent 257a112eae
commit 04f33808d5
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
3 changed files with 43 additions and 10 deletions

View file

@ -19,6 +19,7 @@ const props = withDefaults(
description?: string
keyword?: string[]
category?: string[]
author?: string
}>(),
{
open: false,
@ -34,6 +35,7 @@ const emit = defineEmits([
'update:description',
'update:keyword',
'update:category',
'update:author',
'filechange',
'reset',
'submit',
@ -56,6 +58,7 @@ function reset() {
emit('update:description', '')
emit('update:keyword', '')
emit('update:category', '')
emit('update:author', '')
emit('reset')
}
@ -67,6 +70,7 @@ function submit() {
description: props.description ?? '',
keyword: props.keyword,
category: props.category,
author: props.author,
})
}
@ -165,7 +169,9 @@ const file = ref<File | undefined>()
: ''
"
id="inputFile"
:rules="[(v) => (v !== undefined || mode === 'edit' ) || ('โปรดอัปโหลดไฟล์')]"
:rules="[
(v) => v !== undefined || mode === 'edit' || 'โปรดอัปโหลดไฟล์',
]"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -181,7 +187,10 @@ const file = ref<File | undefined>()
class="q-my-sm"
placeholder="กรอกชื่อเรื่อง"
:model-value="title"
:rules="[(v) => (v != undefined && v.length > 3) || 'ชื่อต้องยาวกว่า 3 ตัวอักษร']"
:rules="[
(v) =>
(v != undefined && v.length > 3) || 'ชื่อต้องยาวกว่า 3 ตัวอักษร',
]"
@update:model-value="(v) => $emit('update:title', v)"
id="inputTitle"
/>
@ -217,7 +226,6 @@ const file = ref<File | undefined>()
@new-value="createCategory"
:options="filterDataCategory"
@filter="filterCategory"
style="width: 250px"
@update:model-value="(v) => $emit('update:category', v)"
data-testid="filterDataCategory"
>
@ -237,7 +245,6 @@ const file = ref<File | undefined>()
multiple
hide-dropdown-icon
input-debounce="0"
style="width: 250px"
:model-value="props.keyword"
@update:model-value="(v) => $emit('update:keyword', v)"
@new-value="createKeyword"
@ -247,6 +254,23 @@ const file = ref<File | undefined>()
</div>
</section>
<section class="q-mb-md">
<span class="text-weight-bold">เจาของผลงาน</span>
<q-input
outlined
dense
class="q-my-sm"
placeholder="เจ้าของผลงาน"
:model-value="author"
:rules="[
(v) =>
(v != undefined && v.length > 3) || 'ชื่อต้องยาวกว่า 3 ตัวอักษร',
]"
@update:model-value="(v) => $emit('update:author', v)"
id="inputAuthor"
/>
</section>
<section :style="{ display: 'flex', gap: '.5rem' }">
<q-btn
label="บันทึก"