-
Notifications
You must be signed in to change notification settings - Fork 35
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 #248 from fairnesscoop/feat/187-pay-elements
Pay elements
- Loading branch information
Showing
35 changed files
with
1,550 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import { _ } from 'svelte-i18n'; | ||
import { format } from 'date-fns'; | ||
export let userLeaves; | ||
// TODO: factorize this function | ||
const formatDate = (date) => format(new Date(date), 'dd/MM/yyyy'); | ||
</script> | ||
|
||
{#if userLeaves.totalDays > 0} | ||
<div><strong>{userLeaves.totalDays}</strong></div> | ||
{#each userLeaves.leaves as userLeave} | ||
<div>{formatDate(userLeave.startDate)} -> {formatDate(userLeave.endDate)}</div> | ||
{/each} | ||
{/if} |
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,53 @@ | ||
<script> | ||
import { _ } from 'svelte-i18n'; | ||
import { format } from 'normalizer/money'; | ||
import Leave from './_Leave.svelte'; | ||
export let items; | ||
</script> | ||
|
||
<table | ||
class="w-full px-4 py-3 mb-8 whitespace-no-wrap bg-white rounded-lg shadow-md dark:bg-gray-800"> | ||
<thead> | ||
<tr | ||
class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800"> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.user')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.contract')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.joining_date')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.annual_earnings')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.monthly_earnings')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.working_time')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.transport_fee')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.meal_tickets')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.health_insurance')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.paid_leaves')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.unpaid_leaves')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.sick_leaves')}</th> | ||
<th class="px-4 py-3">{$_('human_resources.payslips.exceptional_leaves')}</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | ||
{#each items as { firstName, lastName, contract, isExecutivePosition, joiningDate, | ||
annualEarnings, monthlyEarnings, workingTime, transportFee, mealTickets, | ||
healthInsurance, paidLeaves, unpaidLeaves, sickLeaves, exceptionalLeaves }} | ||
<tr class="text-gray-700 dark:text-gray-400"> | ||
<td class="px-4 py-3 text-sm"> | ||
{firstName} {lastName} | ||
</td> | ||
<td class="px-4 py-3 text-sm">{contract} {isExecutivePosition ? $_('human_resources.payslips.executive_position') : ''}</td> | ||
<td class="px-4 py-3 text-sm">{joiningDate}</td> | ||
<td class="px-4 py-3 text-sm">{format(annualEarnings)}</td> | ||
<td class="px-4 py-3 text-sm">{format(monthlyEarnings)}</td> | ||
<td class="px-4 py-3 text-sm">{$_(`human_resources.users.form.working_time.${workingTime}`)}</td> | ||
<td class="px-4 py-3 text-sm">{format(transportFee)}</td> | ||
<td class="px-4 py-3 text-sm">{mealTickets}</td> | ||
<td class="px-4 py-3 text-sm">{$_(`common.${healthInsurance}`)}</td> | ||
<td class="px-4 py-3 text-sm"><Leave userLeaves={paidLeaves}></Leave></td> | ||
<td class="px-4 py-3 text-sm"><Leave userLeaves={unpaidLeaves}></Leave></td> | ||
<td class="px-4 py-3 text-sm"><Leave userLeaves={sickLeaves}></Leave></td> | ||
<td class="px-4 py-3 text-sm"><Leave userLeaves={exceptionalLeaves}></Leave></td> | ||
</tr> | ||
{/each} | ||
</tbody> | ||
</table> |
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,40 @@ | ||
<script> | ||
import { onMount } from 'svelte'; | ||
import { _ } from 'svelte-i18n'; | ||
import { format } from 'date-fns'; | ||
import { fr } from 'date-fns/locale'; | ||
import Breadcrumb from 'components/Breadcrumb.svelte'; | ||
import H4Title from 'components/H4Title.svelte'; | ||
import { errorNormalizer } from 'normalizer/errors'; | ||
import ServerErrors from 'components/ServerErrors.svelte'; | ||
import { get } from 'utils/axios'; | ||
import Table from './_Table.svelte'; | ||
const title = $_('human_resources.payslips.title', { | ||
values: { | ||
month: format(new Date(), 'MMMM yyyy', { locale: fr }), | ||
}, | ||
}); | ||
let errors; | ||
let payslipElements = []; | ||
onMount(async () => { | ||
try { | ||
({ data: payslipElements } = await get('payslips')); | ||
} catch (e) { | ||
errors = errorNormalizer(e); | ||
} | ||
}); | ||
</script> | ||
|
||
<svelte:head> | ||
<title>{title} - {$_('app')}</title> | ||
</svelte:head> | ||
|
||
<Breadcrumb items={[{ title: $_('human_resources.breadcrumb') }, { title: $_('human_resources.payslips.breadcrumb') }]} /> | ||
<ServerErrors {errors} /> | ||
<div class="inline-flex items-center"> | ||
<H4Title {title} /> | ||
</div> | ||
<Table items={payslipElements} /> |
Oops, something went wrong.