เพิม่ปุ่มลบ ประวัติการศึกษา

This commit is contained in:
Kittapath 2023-03-20 13:01:27 +07:00
parent e7198525a2
commit 6b78719b59
16 changed files with 432 additions and 147 deletions

View file

@ -54,7 +54,7 @@
</div>
<div class="row justify-center q-pa-md">
<q-btn color="primary" class="q-ml-md" label="สมัครสอบ" @click="applyCandidate" />
<q-btn color="primary" class="q-ml-md" label="ต่อไป" @click="applyCandidate" />
</div>
</div>
</template>

View file

@ -18,18 +18,22 @@
<q-tab-panels v-model="tab" animated class="bg-white">
<!-- อมลสวนบคคล -->
<q-tab-panel name="profile">
<Profile :loader="loader" v-model:statusEdit="statusEditProfile" :step="step" />
<Profile :loader="loader" v-model:statusEdit="statusEdit" :step="step" />
</q-tab-panel>
<!-- ประวการศกษา -->
<q-tab-panel name="education"><Education :loader="loader" :step="step" /></q-tab-panel>
<q-tab-panel name="education"
><Education :loader="loader" v-model:statusEdit="statusEdit" :step="step"
/></q-tab-panel>
<!-- ประวการทำงาน/กงาน -->
<q-tab-panel name="career"><Career :loader="loader" :step="step" /></q-tab-panel>
<q-tab-panel name="career"
><Career :loader="loader" v-model:statusEdit="statusEdit" :step="step"
/></q-tab-panel>
<!-- ไฟล -->
<q-tab-panel name="document">
<Document :loader="loader" v-model:statusEdit="statusEditDocument" :step="step" />
<Document :loader="loader" v-model:statusEdit="statusEdit" :step="step" />
</q-tab-panel>
</q-tab-panels>
@ -37,17 +41,34 @@
<q-checkbox
v-model="acceptTermOfUse"
:disable="step !== 2"
v-if="step !== 2 || tab == 'document'"
label="ข้าพเจ้ารับรองว่า ข้าพเจ้ามีคุณสมบัติครบถ้วนตามประกาศรับสมัคร ข้อความข้างต้นตรงตามความจริงทุกประการ"
/>
</div>
<div class="row justify-center q-pa-md">
<q-btn
color="primary"
class="q-ml-md"
label="กลับ"
@click="clickPreview(tab)"
v-if="step === 2 && (tab == 'education' || tab == 'career' || tab == 'document')"
icon="mdi-chevron-left"
/>
<q-btn
color="primary"
class="q-ml-md"
label="ต่อไป"
@click="clickNext(tab)"
v-if="step === 2 && (tab == 'profile' || tab == 'education' || tab == 'career')"
icon-right="mdi-chevron-right"
/>
<q-btn
color="primary"
class="q-ml-md"
label="สมัครสอบ"
@click="okModalComfirm"
v-if="step === 2"
v-if="step === 2 && tab == 'document'"
:disable="!acceptTermOfUse"
/>
</div>
@ -90,8 +111,7 @@ const props = defineProps({
const tab = ref<string>('profile')
const tabRaw = ref<string>('profile')
const loader = ref<boolean>(false)
const statusEditProfile = ref<boolean>(false)
const statusEditDocument = ref<boolean>(false)
const statusEdit = ref<boolean>(false)
const acceptTermOfUse = ref<boolean>(false)
const modalComfirm = ref<boolean>(false)
const modalComfirmTittle = ref<string>('ยืนยันการสมัครสอบ?')
@ -107,7 +127,7 @@ onMounted(async () => {
})
const okModalComfirm = () => {
if (statusEditProfile.value == true || statusEditDocument.value == true) {
if (statusEdit.value == true) {
modalNoEditTittle.value = 'ไม่สามารถสมัครสอบได้?'
modalNoEditDetail.value = 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล'
modalNoEdit.value = true
@ -128,8 +148,39 @@ const applyCandidate = () => {
props.fetchStep()
}
const clickPreview = (val: string) => {
console.log(val)
switch (val) {
case 'profile':
return (tab.value = 'profile')
case 'education':
return (tab.value = 'profile')
case 'career':
return (tab.value = 'education')
case 'document':
return (tab.value = 'career')
default:
return (tab.value = 'profile')
}
}
const clickNext = (val: string) => {
switch (val) {
case 'profile':
return (tab.value = 'education')
case 'education':
return (tab.value = 'career')
case 'career':
return (tab.value = 'document')
case 'document':
return (tab.value = 'profile')
default:
return (tab.value = 'profile')
}
}
const changeTab = () => {
if (statusEditProfile.value == true || statusEditDocument.value == true) {
if (statusEdit.value == true) {
modalNoEditTittle.value = 'ไม่สามารถเปลี่ยนแท็ปได้?'
modalNoEditDetail.value = 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล'
tab.value = tabRaw.value

View file

@ -2,14 +2,17 @@
<template>
<q-card flat bordered class="col-12 q-px-lg q-py-md">
<q-form ref="myForm">
<ProfileTable
<Table
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
v-model:editvisible="edit"
:add="clickAdd"
:edit="clickEdit"
:cancel="clickCancel"
:nameHeader="false"
:addData="addData"
>
@ -32,9 +35,20 @@
{{ col.value }}
</div>
</q-td>
<q-td auto-width v-if="edit === true">
<q-btn
color="red"
flat
dense
round
size="14px"
icon="mdi-trash-can-outline"
@click="clickDeleteRow(props.row)"
/>
</q-td>
</q-tr>
</template>
</ProfileTable>
</Table>
</q-form>
</q-card>
<!-- popup Edit window-->
@ -171,7 +185,7 @@
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { useExamDataStore } from '@/modules/01_exam/store'
import ProfileTable from '@/components/Table.vue'
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
import { useQuasar } from 'quasar'
@ -194,6 +208,10 @@ const props = defineProps({
step: {
type: Number,
required: true
},
statusEdit: {
type: Boolean,
required: true
}
})
@ -232,7 +250,7 @@ const closeModalError = () => {
}
}
const emit = defineEmits(['update:loader'])
const emit = defineEmits(['update:loader', 'update:statusEdit'])
const rows = ref<RequestItemsObject[]>([
{
@ -317,6 +335,10 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
await changeExamColumns('career', count)
})
watch(edit, (count: boolean, prevCount: boolean) => {
emit('update:statusEdit', count)
})
onMounted(async () => {
// await fetchData()
rawHistory.value = rows.value
@ -331,7 +353,7 @@ const fetchData = async () => {}
* กดดอมลกอนหน
*/
const clickPrevious = () => {
edit.value = false
// edit.value = false
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
location.value = row.location
@ -347,7 +369,7 @@ const clickPrevious = () => {
* กดดอมลตอไป
*/
const clickNext = () => {
edit.value = false
// edit.value = false
rowIndex.value += 1
const row = rows.value[rowIndex.value]
location.value = row.location
@ -391,6 +413,7 @@ const checkRowPage = () => {
* กดปมแกไขใน dialog
*/
const clickEdit = () => {
edit.value = true
next.value = false
previous.value = false
}
@ -402,6 +425,23 @@ const clickAdd = () => {
addRow()
}
/**
* ลบขอมลใน table
*/
const clickDeleteRow = (row: RequestItemsObject) => {
$q.dialog({
title: 'ยืนยันการลบข้อมูล',
message: 'หากต้องการลบกดให้กดตกลง',
cancel: true,
persistent: true
})
.onOk(() => {
rows.value = rows.value.filter((val: any) => val.id != row.id)
})
.onCancel(() => {})
.onDismiss(() => {})
}
/**
* กดบนทกใน dialog
*/
@ -447,7 +487,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
edit.value = false
// edit.value = false
editRow.value = false
// loader.value = true;
@ -501,7 +541,7 @@ const clickClose = async () => {
const selectData = (props: DataProps) => {
modalEdit.value = true
modal.value = true
edit.value = false
// edit.value = false
rawItem.value = props.row
rowIndex.value = props.rowIndex
location.value = props.row.location
@ -510,7 +550,12 @@ const selectData = (props: DataProps) => {
duration.value = props.row.duration
reason.value = props.row.reason
id.value = props.row.id
checkRowPage()
if (edit.value == true) {
next.value = false
previous.value = false
} else {
checkRowPage()
}
}
/**
@ -519,7 +564,7 @@ const selectData = (props: DataProps) => {
const addRow = () => {
modalEdit.value = false
modal.value = true
edit.value = true
// edit.value = true
location.value = ''
position.value = ''
salary.value = null
@ -531,22 +576,23 @@ const addRow = () => {
* งกนปมยกเลกการแกไขขอม
*/
const clickCancel = async () => {
if (editRow.value == true) {
$q.dialog({
title: `ข้อมูลมีการแก้ไข`,
message: `ยืนยันการบันทึกข้อมูลใช่หรือไม่?`,
cancel: 'ยกเลิก',
ok: 'ยืนยัน',
persistent: true
}).onOk(async () => {
edit.value = false
checkRowPage()
await getData()
})
} else {
edit.value = false
checkRowPage()
}
// if (editRow.value == true) {
// $q.dialog({
// title: ``,
// message: `?`,
// cancel: '',
// ok: '',
// persistent: true
// }).onOk(async () => {
// // edit.value = false
// checkRowPage()
// await getData()
// })
// } else {
// // edit.value = false
// checkRowPage()
// }
edit.value = false
}
/**

View file

@ -1,6 +1,6 @@
<!-- card เอกสารหลกฐาน -->
<template>
<q-card flat bordered class="col-12 row q-px-lg q-py-md q-mt-md">
<q-card flat bordered class="col-12 q-px-lg q-py-md">
<HeaderTop
v-model:edit="edit"
header="เอกสารหลักฐาน(เช่น สำเนาบัตรประชาชน ทะเบียนบ้าน วุฒิการศึกษา)"
@ -21,42 +21,52 @@
<q-item-label caption> สถานะ: {{ file.status }} / {{ file.sizeLabel }} </q-item-label>
</q-item-section>
<q-item-section top side>
<div class="row col-12">
<div class="q-gutter-sm">
<q-btn size="12px" flat dense round color="blue" icon="mdi-download-outline">
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
class="gt-xs"
size="12px"
flat
dense
round
color="blue"
icon="mdi-download-outline"
/>
<q-btn
class="gt-xs"
size="12px"
flat
dense
round
color="red"
icon="mdi-delete-outline"
v-show="edit"
/>
v-if="edit"
>
<q-tooltip>ลบไฟล</q-tooltip>
</q-btn>
</div>
</q-item-section>
</q-item>
</q-list>
</q-card>
<q-uploader
v-show="edit"
color="blue"
type="file"
flat
auto-upload
:factory="fileUpload"
class="full-width"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
bordered
label="[ไฟล์ jpg,png,pdf,csv,doc]"
/>
<div v-if="edit" class="col-12 q-ma-none">
<q-separator class="q-mt-sm" />
<q-input
class="q-my-sm"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="name"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อเอกสาร'}`]"
:label="`${'ชื่อเอกสาร'}`"
/>
<q-uploader
color="blue"
type="file"
flat
auto-upload
:factory="fileUpload"
class="full-width"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
bordered
label="[ไฟล์ jpg,png,pdf,csv,doc]"
/>
</div>
</div>
</q-card>
</template>
@ -86,6 +96,7 @@ const props = defineProps({
const edit = ref<boolean>(false)
const addData = ref<boolean>(true)
const name = ref<string>('')
const files = ref<any>([
{
key: 1,

View file

@ -2,14 +2,17 @@
<template>
<q-card flat bordered class="col-12 q-px-lg q-py-md">
<q-form ref="myForm">
<ProfileTable
<Table
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
v-model:editvisible="edit"
:add="clickAdd"
:edit="clickEdit"
:cancel="clickCancel"
:nameHeader="false"
:addData="addData"
>
@ -29,9 +32,20 @@
{{ col.value }}
</div>
</q-td>
<q-td auto-width v-if="edit === true">
<q-btn
color="red"
flat
dense
round
size="14px"
icon="mdi-trash-can-outline"
@click="clickDeleteRow(props.row)"
/>
</q-td>
</q-tr>
</template>
</ProfileTable>
</Table>
</q-form>
</q-card>
<!-- popup Edit window-->
@ -172,7 +186,7 @@
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { useExamDataStore } from '@/modules/01_exam/store'
import ProfileTable from '@/components/Table.vue'
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
import { useQuasar } from 'quasar'
@ -196,6 +210,10 @@ const props = defineProps({
step: {
type: Number,
required: true
},
statusEdit: {
type: Boolean,
required: true
}
})
@ -235,7 +253,7 @@ const closeModalError = () => {
// fetchData();
}
}
const emit = defineEmits(['update:loader'])
const emit = defineEmits(['update:loader', 'update:statusEdit'])
const rows = ref<RequestItemsObject[]>([
{
@ -322,6 +340,10 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
await changeExamColumns('education', count)
})
watch(edit, (count: boolean, prevCount: boolean) => {
emit('update:statusEdit', count)
})
onMounted(async () => {
// await fetchData()
// await fetchQualification()
@ -355,7 +377,7 @@ const fetchData = async () => {}
* กดดอมลกอนหน
*/
const clickPrevious = () => {
edit.value = false
// edit.value = false
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
qualification.value = row.qualification
@ -372,7 +394,7 @@ const clickPrevious = () => {
* กดดอมลตอไป
*/
const clickNext = () => {
edit.value = false
// edit.value = false
rowIndex.value += 1
const row = rows.value[rowIndex.value]
qualification.value = row.qualification
@ -418,6 +440,7 @@ const checkRowPage = () => {
* กดปมแกไขใน dialog
*/
const clickEdit = () => {
edit.value = true
next.value = false
previous.value = false
}
@ -429,6 +452,23 @@ const clickAdd = () => {
addRow()
}
/**
* ลบขอมลใน table
*/
const clickDeleteRow = (row: RequestItemsObject) => {
$q.dialog({
title: 'ยืนยันการลบข้อมูล',
message: 'หากต้องการลบกดให้กดตกลง',
cancel: true,
persistent: true
})
.onOk(() => {
rows.value = rows.value.filter((val: any) => val.id != row.id)
})
.onCancel(() => {})
.onDismiss(() => {})
}
/**
* กดบนทกใน dialog
*/
@ -474,7 +514,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
edit.value = false
// edit.value = false
editRow.value = false
// loader.value = true;
@ -528,7 +568,7 @@ const clickClose = async () => {
const selectData = (props: DataProps) => {
modalEdit.value = true
modal.value = true
edit.value = false
// edit.value = false
rawItem.value = props.row
rowIndex.value = props.rowIndex
qualification.value = props.row.qualification
@ -538,7 +578,12 @@ const selectData = (props: DataProps) => {
name.value = props.row.name
duration.value = props.row.duration
id.value = props.row.id
checkRowPage()
if (edit.value == true) {
next.value = false
previous.value = false
} else {
checkRowPage()
}
}
/**
@ -547,7 +592,7 @@ const selectData = (props: DataProps) => {
const addRow = () => {
modalEdit.value = false
modal.value = true
edit.value = true
// edit.value = true
qualification.value = ''
qualificationId.value = ''
major.value = ''
@ -560,22 +605,23 @@ const addRow = () => {
* งกนปมยกเลกการแกไขขอม
*/
const clickCancel = async () => {
if (editRow.value == true) {
$q.dialog({
title: `ข้อมูลมีการแก้ไข`,
message: `ยืนยันการบันทึกข้อมูลใช่หรือไม่?`,
cancel: 'ยกเลิก',
ok: 'ยืนยัน',
persistent: true
}).onOk(async () => {
edit.value = false
checkRowPage()
await getData()
})
} else {
edit.value = false
checkRowPage()
}
// if (editRow.value == true) {
// $q.dialog({
// title: ``,
// message: `?`,
// cancel: '',
// ok: '',
// persistent: true
// }).onOk(async () => {
// edit.value = false
// checkRowPage()
// await getData()
// })
// } else {
// edit.value = false
// checkRowPage()
// }
edit.value = false
}
/**

View file

@ -314,7 +314,7 @@
</q-img>
</q-file>
</div>
<div class="col-12 text-center" v-show="disabledPic">
<div class="col-12 text-center" v-if="disabledPic">
<q-btn outline dense color="black" icon="mdi-content-save-outline" @click="savePic">
<q-tooltip content-class="bg-grey-2 text-black">นทกร</q-tooltip>
</q-btn>