ปรับ ui form

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-07 16:35:39 +07:00
parent 8ea5ad36da
commit 68ef892d62
8 changed files with 230 additions and 246 deletions

View file

@ -4,7 +4,7 @@ import { useCounterMixin } from "@/stores/mixin";
import moment, { Moment } from "moment";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const { date2Thai, covertDateObject } = mixin;
const props = defineProps({
dataById: {
@ -42,105 +42,103 @@ function onCkickSave() {
}
</script>
<template>
<!-- <q-card style="width: 350px; max-width: 80vw; higth: 100%"> -->
<div class="row q-pa-md q-col-q-gutter-sm">
<q-card
flat
bordered
:class="$q.screen.gt.xs ? 'col-12 bg-grey-1' : 'col-12 '"
>
<q-card-section class="bg-primary text-white" v-if="!$q.screen.gt.xs">
<div class="text-center">เวลาปจจ</div>
</q-card-section>
<div v-else class="q-pa-sm text-primary">เวลาปจจ</div>
<q-card-section class="text-center">
<div class="row q-gutter-md">
<!-- <div class="col">{{ data.date }}</div>
<div class="col">{{ data.in }} .</div> -->
<div class="col">{{ date2Thai(dateNow) }}</div>
<div class="col">{{ timeNoew }}</div>
</div>
</q-card-section>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 q-mt-sm" v-if="statusAction">
<VueDatePicker
v-model="date"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
<q-card-section class="col q-pt-none">
<div class="row q-pa-sm q-col-q-gutter-sm">
<q-card
flat
bordered
:class="$q.screen.gt.xs ? 'col-12 bg-grey-1' : 'col-12 '"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
borderless
dense
:model-value="date !== null ? date2Thai(date) : null"
:label="`${'กรอกวันที่'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input> </template
></VueDatePicker>
</q-card>
<q-card-section class="bg-primary text-white" v-if="!$q.screen.gt.xs">
<div class="text-center">เวลาปจจ</div>
</q-card-section>
<div v-else class="q-pa-sm text-primary">เวลาปจจ</div>
<q-card-section class="text-center">
<div class="row q-gutter-md">
<div class="col">{{ date2Thai(dateNow) }}</div>
<div class="col">{{ timeNoew }}</div>
</div>
</q-card-section>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 bg-grey-1 q-mt-sm" v-else>
<div class="row q-gutter-md text-grey-5">
<div class="col-1">
<q-icon color="grey-5" name="calendar_today" />
<q-card flat bordered class="q-pa-sm col-12 q-mt-sm" v-if="statusAction">
<VueDatePicker
v-model="date"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
borderless
dense
:model-value="date !== null ? date2Thai(date) : null"
:label="`${'กรอกวันที่'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input> </template
></VueDatePicker>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 bg-grey-1 q-mt-sm" v-else>
<div class="row q-gutter-md text-grey-5">
<div class="col-1">
<q-icon color="grey-5" name="calendar_today" />
</div>
<div class="col">{{ covertDateObject(dataById.date) }}</div>
</div>
<div class="col">31 .. 56</div>
</div>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 q-mt-sm">
<div class="row q-gutter-xs">
<div class="col-12">
<q-checkbox
keep-color
color="primary"
v-model="checkboxIn"
label="ขอแก้ไขเวลาเข้างาน"
/>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 q-mt-sm">
<div class="row q-gutter-xs">
<div class="col-12">
<q-checkbox
keep-color
color="primary"
v-model="checkboxIn"
label="ขอแก้ไขเวลาเข้างาน"
/>
</div>
<div class="col-12">
<q-checkbox
keep-color
v-model="checkboxOut"
color="primary"
label="ขอแก้ไขเวลาออกงาน"
/>
</div>
</div>
<div class="col-12">
<q-checkbox
keep-color
v-model="checkboxOut"
color="primary"
label="ขอแก้ไขเวลาออกงาน"
/>
</div>
</div>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 q-mt-sm">
<q-input
borderless
v-model="reason"
label="เหตุผล"
type="textarea"
rows="1"
label-color="grey-5"
/>
</q-card>
</div>
</q-card>
<q-card flat bordered class="q-pa-sm col-12 q-mt-sm">
<q-input
borderless
v-model="reason"
label="เหตุผล"
type="textarea"
:rows="$q.screen.gt.xs ? '5' : '1'"
label-color="grey-5"
/>
</q-card>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn dense color="secondary" label="บันทึก" @click="onCkickSave" />
</q-card-actions>
<!-- </q-card> -->
</template>
<style scoped></style>

View file

@ -21,8 +21,7 @@ function findNearestPlace() {
lng: position.coords.longitude,
};
// userLocation API
// Location API
findNearestPlaceFromAPI(userLocation);
center.value = userLocation;
},
@ -42,22 +41,14 @@ function findNearestPlaceFromAPI(userLocation: any) {
const request = {
location: userLocation,
radius: 500, //
types: [
"hospital",
"school",
"stadium",
"cafe",
"gym",
"store",
"accounting",
"amusement_park",
], //
radius: 1000, //
types: ["point_of_interest"], //
};
placesService.nearbySearch(request, (results: any, status: any) => {
if (status === google.maps.places.PlacesServiceStatus.OK) {
console.log("Nearby places:", results);
console.log("Nearby places:", results[0].name);
location.value = results[0].name;
} else {
console.error("Error fetching nearby places:", status);
}
@ -70,20 +61,26 @@ function findNearestPlaceFromAPI(userLocation: any) {
bordered
flat
class="col-12 bg-grey-2 shadow-0"
:style="$q.screen.gt.xs ? 'height: 350px;' : 'height: 220px;'"
:style="$q.screen.gt.xs ? 'height: 350px;' : 'height: 360px;'"
>
<div style="width: 100%; height: 90%">
<GoogleMap
api-key="AIzaSyBzPSF5NxUZ1G8DKBnJvJPTqCR0Ct2xf58"
style="width: 100%; height: 100%"
:center="center"
:zoom="15"
:zoom="17"
>
<Marker :options="{ position: center }" />
</GoogleMap>
</div>
<div class="q-pa-md text-weight-medium text-grey-8">
<div
:class="
$q.screen.gt.xs
? 'q-pa-sm text-weight-medium text-grey-8'
: ' text-weight-medium text-grey-8'
"
>
นทใกลเคยง
<span class="q-px-sm">:</span>
{{ location }}

View file

@ -34,15 +34,8 @@ watch(props, () => {
});
</script>
<template>
<!-- <q-dialog v-model="props.modal" full-height>
<q-card class="column full-height" style="width: 300px">
<HeaderPopup :title="props.title" :clickClose="clickClosePopup" />
<FormTime :dataById="data" />
</q-card>
</q-dialog> -->
<q-dialog v-model="props.modal" full-height>
<q-card class="column full-height" style="width: 350px">
<q-card class="column full-height" style="width: 300px">
<HeaderPopup :title="props.title" :clickClose="clickClosePopup" />
<FormTime :dataById="data" />
</q-card>

View file

@ -110,6 +110,10 @@ function classStatus(status: string) {
break;
}
}
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
</script>
<template>
<q-table
@ -122,6 +126,7 @@ function classStatus(status: string) {
:virtual-scroll-sticky-size-start="48"
:style="$q.screen.gt.xs ? 'max-height: 64vh' : ''"
:grid="$q.screen.gt.xs ? false : true"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
@ -152,13 +157,19 @@ function classStatus(status: string) {
</q-td>
<q-td>
<q-btn
v-if="props.row.statusEdit === 'edit'"
outline
rounded
icon="edit"
label="ขอแก้ไข"
color="info"
@click="openPopup(props.row)"
/>
<q-chip
v-else
:color="`${stores.classColorStatus(props.row.statusEdit)}-1`"
:text-color="`${stores.classColorStatus(props.row.statusEdit)}-7`"
>{{ props.row.statusEditName }}</q-chip
>
</q-td>
</q-tr>
</template>
@ -190,20 +201,48 @@ function classStatus(status: string) {
<q-separator />
</q-item>
</q-list>
<q-card-section class="q-card-section-last">
<q-btn
outline
rounded
icon="edit"
label="ขอแก้ไข"
color="info"
size="sm"
@click="openPopup(props.row)"
/>
<q-card-section>
<div class="row">
<div class="col" v-if="props.row.statusEdit === 'edit'">
<q-btn
class="full-width text-cen"
outline
rounded
icon="edit"
label="ขอแก้ไข"
color="info"
size="sm"
@click="openPopup(props.row)"
/>
</div>
<div class="col" v-else>
<q-chip
class="full-width"
:color="`${stores.classColorStatus(props.row.statusEdit)}-1`"
:text-color="`${stores.classColorStatus(
props.row.statusEdit
)}-7`"
>
{{ props.row.statusEditName }}
</q-chip>
</div>
</div>
</q-card-section>
</q-card>
</div>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
<Popup
@ -219,6 +258,11 @@ function classStatus(status: string) {
color: #4154b3;
}
.items-center {
align-items: center;
justify-content: center;
}
.custom-table2 {
.q-table tr:nth-child(odd) td {
background: white;