-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into ssa-leave-encashment-amount
- Loading branch information
Showing
183 changed files
with
39,242 additions
and
36,696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule frappe-ui
updated
53 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<template> | ||
<div class="flex flex-col w-full gap-5" v-if="calendarEvents.data"> | ||
<div class="text-lg text-gray-800 font-bold">Attendance Calendar</div> | ||
|
||
<div class="flex flex-col gap-6 bg-white py-6 px-3.5 rounded-lg border-none"> | ||
<!-- Month Change --> | ||
<div class="flex flex-row justify-between items-center px-4"> | ||
<Button | ||
icon="chevron-left" | ||
variant="ghost" | ||
@click="firstOfMonth = firstOfMonth.subtract(1, 'M')" | ||
/> | ||
<span class="text-lg text-gray-800 font-bold"> | ||
{{ firstOfMonth.format("MMMM") }} {{ firstOfMonth.format("YYYY") }} | ||
</span> | ||
<Button | ||
icon="chevron-right" | ||
variant="ghost" | ||
@click="firstOfMonth = firstOfMonth.add(1, 'M')" | ||
/> | ||
</div> | ||
|
||
<!-- Calendar --> | ||
<div class="grid grid-cols-7 gap-y-3"> | ||
<div | ||
v-for="day in DAYS" | ||
class="flex justify-center text-gray-600 text-sm font-medium leading-6" | ||
> | ||
{{ day }} | ||
</div> | ||
<div v-for="_ in firstOfMonth.get('d')" /> | ||
<div v-for="index in firstOfMonth.endOf('M').get('D')"> | ||
<div | ||
class="h-8 w-8 flex rounded-full mx-auto" | ||
:class="getEventOnDate(index) && `bg-${colorMap[getEventOnDate(index)]}`" | ||
> | ||
<span class="text-gray-800 text-sm font-medium m-auto"> | ||
{{ index }} | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<hr /> | ||
|
||
<!-- Summary --> | ||
<div class="grid grid-cols-4 mx-2"> | ||
<div v-for="status in summaryStatuses" class="flex flex-col gap-1"> | ||
<div class="flex flex-row gap-1 items-center"> | ||
<span class="rounded full h-3 w-3" :class="`bg-${colorMap[status]}`" /> | ||
<span class="text-gray-600 text-sm font-medium leading-5"> {{ status }} </span> | ||
</div> | ||
<span class="text-gray-800 text-base font-semibold leading-6 mx-auto"> | ||
{{ summary[status] || 0 }} | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, inject, ref, watch } from "vue" | ||
import { createResource } from "frappe-ui" | ||
const dayjs = inject("$dayjs") | ||
const employee = inject("$employee") | ||
const firstOfMonth = ref(dayjs().date(1).startOf("D")) | ||
const colorMap = { | ||
Present: "green-200", | ||
"Work From Home": "green-200", | ||
"Half Day": "yellow-100", | ||
Absent: "red-100", | ||
"On Leave": "blue-100", | ||
Holiday: "gray-100", | ||
} | ||
const summaryStatuses = ["Present", "Half Day", "Absent", "On Leave"] | ||
const summary = computed(() => { | ||
const summary = {} | ||
for (const status of Object.values(calendarEvents.data)) { | ||
let updatedStatus = status === "Work From Home" ? "Present" : status | ||
if (updatedStatus in summary) { | ||
summary[updatedStatus] += 1 | ||
} else { | ||
summary[updatedStatus] = 1 | ||
} | ||
} | ||
return summary | ||
}) | ||
watch( | ||
() => firstOfMonth.value, | ||
() => { | ||
calendarEvents.fetch() | ||
} | ||
) | ||
const getEventOnDate = (date) => { | ||
return calendarEvents.data[firstOfMonth.value.date(date).format("YYYY-MM-DD")] | ||
} | ||
const DAYS = ["S", "M", "T", "W", "T", "F", "S"] | ||
//resources | ||
const calendarEvents = createResource({ | ||
url: "hrms.api.get_attendance_calendar_events", | ||
auto: true, | ||
cache: "hrms:attendance_calendar_events", | ||
makeParams() { | ||
return { | ||
employee: employee.data.name, | ||
from_date: firstOfMonth.value.format("YYYY-MM-DD"), | ||
to_date: firstOfMonth.value.endOf("M").format("YYYY-MM-DD"), | ||
} | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<ListItem> | ||
<template #left> | ||
<AttendanceIcon class="h-5 w-5 text-gray-500" /> | ||
<div class="flex flex-col items-start gap-1.5"> | ||
<div class="text-base font-normal text-gray-800"> | ||
{{ props.doc.reason }} | ||
</div> | ||
<div class="text-xs font-normal text-gray-500"> | ||
<span>{{ props.doc.attendance_dates || getDates(props.doc) }}</span> | ||
<span v-if="props.doc.to_date"> | ||
<span class="whitespace-pre"> · </span> | ||
<span class="whitespace-nowrap">{{ | ||
`${props.doc.total_attendance_days || getTotalDays(props.doc)}d` | ||
}}</span> | ||
</span> | ||
</div> | ||
</div> | ||
</template> | ||
<template #right> | ||
<Badge variant="outline" :theme="colorMap[status]" :label="status" size="md" /> | ||
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" /> | ||
</template> | ||
</ListItem> | ||
</template> | ||
|
||
<script setup> | ||
import { computed } from "vue" | ||
import { Badge, FeatherIcon } from "frappe-ui" | ||
import ListItem from "@/components/ListItem.vue" | ||
import AttendanceIcon from "@/components/icons/AttendanceIcon.vue" | ||
import { getDates, getTotalDays } from "@/data/attendance" | ||
const props = defineProps({ | ||
doc: { | ||
type: Object, | ||
}, | ||
workflowStateField: { | ||
type: String, | ||
required: false, | ||
}, | ||
}) | ||
const status = computed(() => { | ||
if (props.workflowStateField) return props.doc[props.workflowStateField] | ||
return props.doc.docstatus ? "Submitted" : "Draft" | ||
}) | ||
const colorMap = { | ||
Draft: "gray", | ||
Submitted: "blue", | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.