Skip to content

Commit

Permalink
fix: conditional rendering for checkin ion-modal (backport #1678) (#1679
Browse files Browse the repository at this point in the history
)

(cherry picked from commit 5c8196f)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
  • Loading branch information
mergify[bot] and ruchamahabal committed Apr 18, 2024
1 parent 888d383 commit 8afc06a
Showing 1 changed file with 29 additions and 43 deletions.
72 changes: 29 additions & 43 deletions frontend/src/components/CheckInPanel.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>
<div class="flex flex-col bg-white rounded w-full py-6 px-4 border-none">
<h2 class="text-lg font-bold text-gray-900">
Hey, {{ employee?.data?.first_name }} 👋
</h2>
<h2 class="text-lg font-bold text-gray-900">Hey, {{ employee?.data?.first_name }} 👋</h2>

<template v-if="allowCheckinFromMobile.data">
<div class="font-medium text-sm text-gray-500 mt-1.5" v-if="lastLog">
Expand All @@ -15,48 +13,43 @@
>
<template #prefix>
<FeatherIcon
:name="
nextAction.action === 'IN'
? 'arrow-right-circle'
: 'arrow-left-circle'
"
:name="nextAction.action === 'IN' ? 'arrow-right-circle' : 'arrow-left-circle'"
class="w-4"
/>
</template>
{{ nextAction.label }}
</Button>

<ion-modal
ref="modal"
trigger="open-checkin-modal"
:initial-breakpoint="1"
:breakpoints="[0, 1]"
>
<div class="h-40 w-full flex flex-col items-center justify-center gap-5 p-4 mb-5">
<div class="flex flex-col gap-1.5 items-center justify-center">
<div class="font-bold text-xl">
{{ dayjs(checkinTimestamp).format("hh:mm:ss a") }}
</div>
<div class="font-medium text-gray-500 text-sm">
{{ dayjs().format("D MMM, YYYY") }}
</div>
</div>
<Button
variant="solid"
class="w-full py-5 text-sm"
@click="submitLog(nextAction.action)"
>
Confirm {{ nextAction.label }}
</Button>
</div>
</ion-modal>
</template>

<div v-else class="font-medium text-sm text-gray-500 mt-1.5">
{{ dayjs().format("ddd, D MMMM, YYYY") }}
</div>
</div>

<ion-modal
ref="modal"
trigger="open-checkin-modal"
:initial-breakpoint="1"
:breakpoints="[0, 1]"
>
<div
class="h-40 w-full flex flex-col items-center justify-center gap-5 p-4 mb-5"
>
<div class="flex flex-col gap-1.5 items-center justify-center">
<div class="font-bold text-xl">
{{ dayjs(checkinTimestamp).format("hh:mm:ss a") }}
</div>
<div class="font-medium text-gray-500 text-sm">
{{ dayjs().format("D MMM, YYYY") }}
</div>
</div>
<Button
variant="solid"
class="w-full py-5 text-sm"
@click="submitLog(nextAction.action)"
>
Confirm {{ nextAction.label }}
</Button>
</div>
</ion-modal>
</template>

<script setup>
Expand All @@ -74,14 +67,7 @@ const checkinTimestamp = ref(null)

const checkins = createListResource({
doctype: DOCTYPE,
fields: [
"name",
"employee",
"employee_name",
"log_type",
"time",
"device_id",
],
fields: ["name", "employee", "employee_name", "log_type", "time", "device_id"],
filters: {
employee: employee.data.name,
},
Expand Down

0 comments on commit 8afc06a

Please sign in to comment.