-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #822 from ruchamahabal/payslips
- Loading branch information
Showing
20 changed files
with
640 additions
and
46 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<template> | ||
<!-- Header --> | ||
<div class="flex flex-row justify-between items-center"> | ||
<h2 class="text-lg font-semibold text-gray-800">{{ type }}</h2> | ||
<span class="text-lg font-semibold text-gray-800"> | ||
{{ total }} | ||
</span> | ||
</div> | ||
|
||
<!-- Table --> | ||
<div | ||
v-if="items" | ||
class="flex flex-col bg-white mt-5 rounded-lg border overflow-auto" | ||
> | ||
<div | ||
class="flex flex-row p-3.5 items-center justify-between border-b" | ||
v-for="(item, idx) in items" | ||
:key="idx" | ||
> | ||
<div | ||
class="text-lg font-normal whitespace-nowrap overflow-hidden text-ellipsis text-gray-800" | ||
> | ||
{{ item.salary_component }} | ||
</div> | ||
<span class="text-gray-700 font-normal rounded-lg text-lg"> | ||
{{ formatCurrency(item.amount, salarySlip.currency) }} | ||
</span> | ||
</div> | ||
</div> | ||
<EmptyState v-else message="No expenses added" /> | ||
</template> | ||
|
||
<script setup> | ||
import { computed } from "vue" | ||
import EmptyState from "@/components/EmptyState.vue" | ||
import { formatCurrency } from "@/utils/formatters" | ||
const props = defineProps({ | ||
salarySlip: { | ||
type: Object, | ||
required: true, | ||
}, | ||
type: { | ||
type: String, | ||
required: true, | ||
}, | ||
isReadOnly: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}) | ||
const items = computed(() => { | ||
return props.type === "Earnings" | ||
? props.salarySlip.earnings | ||
: props.salarySlip.deductions | ||
}) | ||
const total = computed(() => { | ||
return props.type === "Earnings" | ||
? props.salarySlip.gross_pay | ||
: props.salarySlip.total_deduction | ||
}) | ||
</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,55 @@ | ||
<template> | ||
<div class="flex flex-col w-full justify-center gap-2.5"> | ||
<div class="flex flex-row items-center justify-between"> | ||
<div class="flex flex-row items-start gap-3 grow"> | ||
<SalaryIcon class="h-4 w-4 mt-0.5 text-gray-500" /> | ||
<div class="flex flex-col items-start"> | ||
<div class="text-lg font-normal text-gray-800"> | ||
{{ title }} | ||
</div> | ||
<div class="text-sm font-normal text-gray-500"> | ||
<span> | ||
{{ `Gross Pay: ${formatCurrency(doc.gross_pay, doc.currency)}` }} | ||
</span> | ||
<span class="whitespace-pre"> · </span> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="flex flex-row justify-end items-center gap-2"> | ||
<span class="text-gray-700 font-normal rounded-lg text-lg"> | ||
{{ formatCurrency(doc.net_pay, doc.currency) }} | ||
</span> | ||
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" /> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, inject } from "vue" | ||
import { FeatherIcon } from "frappe-ui" | ||
import SalaryIcon from "@/components/icons/SalaryIcon.vue" | ||
import { formatCurrency } from "@/utils/formatters" | ||
const dayjs = inject("$dayjs") | ||
const props = defineProps({ | ||
doc: { | ||
type: Object, | ||
}, | ||
}) | ||
const title = computed(() => { | ||
if (dayjs(props.doc.start_date).isSame(props.doc.end_date, "month")) { | ||
// monthly salary | ||
return dayjs(props.doc.start_date).format("MMM YYYY") | ||
} else { | ||
// quarterly, bimonthly, etc | ||
return `${dayjs(props.doc.start_date).format("MMM YYYY")} - ${dayjs( | ||
props.doc.end_date | ||
).format("MMM YYYY")}` | ||
} | ||
}) | ||
</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,19 @@ | ||
<template> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
viewBox="0 0 14 14" | ||
> | ||
<g | ||
fill="none" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
> | ||
<rect width="13" height="9" x=".5" y="2.5" rx="1"></rect> | ||
<circle cx="7" cy="7" r="1.5"></circle> | ||
<path d="M3 5h.5m7 4h.5"></path> | ||
</g> | ||
</svg> | ||
</template> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const routes = [ | ||
{ | ||
path: "/salary-slip/dashboard", | ||
name: "SalarySlips", | ||
component: () => import("@/views/salary_slip/Dashboard.vue"), | ||
}, | ||
{ | ||
path: "/salary-slip/:id", | ||
name: "SalarySlipDetailView", | ||
props: true, | ||
component: () => import("@/views/salary_slip/Detail.vue"), | ||
}, | ||
] | ||
|
||
export default routes |
Oops, something went wrong.