Skip to content

Commit 5c8196f

Browse files
authored
fix: conditional rendering for checkin ion-modal (#1678)
1 parent 095c4e6 commit 5c8196f

File tree

1 file changed

+29
-43
lines changed

1 file changed

+29
-43
lines changed

frontend/src/components/CheckInPanel.vue

+29-43
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<template>
22
<div class="flex flex-col bg-white rounded w-full py-6 px-4 border-none">
3-
<h2 class="text-lg font-bold text-gray-900">
4-
Hey, {{ employee?.data?.first_name }} 👋
5-
</h2>
3+
<h2 class="text-lg font-bold text-gray-900">Hey, {{ employee?.data?.first_name }} 👋</h2>
64

75
<template v-if="allowCheckinFromMobile.data">
86
<div class="font-medium text-sm text-gray-500 mt-1.5" v-if="lastLog">
@@ -15,48 +13,43 @@
1513
>
1614
<template #prefix>
1715
<FeatherIcon
18-
:name="
19-
nextAction.action === 'IN'
20-
? 'arrow-right-circle'
21-
: 'arrow-left-circle'
22-
"
16+
:name="nextAction.action === 'IN' ? 'arrow-right-circle' : 'arrow-left-circle'"
2317
class="w-4"
2418
/>
2519
</template>
2620
{{ nextAction.label }}
2721
</Button>
22+
23+
<ion-modal
24+
ref="modal"
25+
trigger="open-checkin-modal"
26+
:initial-breakpoint="1"
27+
:breakpoints="[0, 1]"
28+
>
29+
<div class="h-40 w-full flex flex-col items-center justify-center gap-5 p-4 mb-5">
30+
<div class="flex flex-col gap-1.5 items-center justify-center">
31+
<div class="font-bold text-xl">
32+
{{ dayjs(checkinTimestamp).format("hh:mm:ss a") }}
33+
</div>
34+
<div class="font-medium text-gray-500 text-sm">
35+
{{ dayjs().format("D MMM, YYYY") }}
36+
</div>
37+
</div>
38+
<Button
39+
variant="solid"
40+
class="w-full py-5 text-sm"
41+
@click="submitLog(nextAction.action)"
42+
>
43+
Confirm {{ nextAction.label }}
44+
</Button>
45+
</div>
46+
</ion-modal>
2847
</template>
48+
2949
<div v-else class="font-medium text-sm text-gray-500 mt-1.5">
3050
{{ dayjs().format("ddd, D MMMM, YYYY") }}
3151
</div>
3252
</div>
33-
34-
<ion-modal
35-
ref="modal"
36-
trigger="open-checkin-modal"
37-
:initial-breakpoint="1"
38-
:breakpoints="[0, 1]"
39-
>
40-
<div
41-
class="h-40 w-full flex flex-col items-center justify-center gap-5 p-4 mb-5"
42-
>
43-
<div class="flex flex-col gap-1.5 items-center justify-center">
44-
<div class="font-bold text-xl">
45-
{{ dayjs(checkinTimestamp).format("hh:mm:ss a") }}
46-
</div>
47-
<div class="font-medium text-gray-500 text-sm">
48-
{{ dayjs().format("D MMM, YYYY") }}
49-
</div>
50-
</div>
51-
<Button
52-
variant="solid"
53-
class="w-full py-5 text-sm"
54-
@click="submitLog(nextAction.action)"
55-
>
56-
Confirm {{ nextAction.label }}
57-
</Button>
58-
</div>
59-
</ion-modal>
6053
</template>
6154

6255
<script setup>
@@ -74,14 +67,7 @@ const checkinTimestamp = ref(null)
7467
7568
const checkins = createListResource({
7669
doctype: DOCTYPE,
77-
fields: [
78-
"name",
79-
"employee",
80-
"employee_name",
81-
"log_type",
82-
"time",
83-
"device_id",
84-
],
70+
fields: ["name", "employee", "employee_name", "log_type", "time", "device_id"],
8571
filters: {
8672
employee: employee.data.name,
8773
},

0 commit comments

Comments
 (0)