Skip to content

Commit 2118dfe

Browse files
authored
Merge pull request #248 from fairnesscoop/feat/187-pay-elements
Pay elements
2 parents e5af60f + a1093d4 commit 2118dfe

35 files changed

+1550
-70
lines changed

client/i18n/fr.json

+20
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,26 @@
265265
"not_a_working_date": "Ce jour n'est pas travaillé"
266266
}
267267
},
268+
"payslips": {
269+
"breadcrumb": "Fiches de paies",
270+
"title": "Éléments pour les fiches de paie",
271+
"user": "Salairé / stagiaire",
272+
"contract": "Type de contrat",
273+
"executive_position": "Cadre",
274+
"joining_date": "Date d'entrée",
275+
"annual_earnings": "Salaire brut annuel",
276+
"monthly_earnings": "Salaire brut mensuel",
277+
"working_time": "TC/TP",
278+
"transport_fee": "Transport",
279+
"meal_tickets": "Tickets resto",
280+
"full_time": "Temps complet",
281+
"partial_time": "Temps partiel",
282+
"health_insurance": "Mutuelle",
283+
"paid_leaves": "Congés payés",
284+
"unpaid_leaves": "Congés sans solde",
285+
"sick_leaves": "Congés maladie",
286+
"exceptional_leaves": "Congés exceptionnels"
287+
},
268288
"leaves": {
269289
"title": "Congés",
270290
"requests": {

client/src/components/Nav.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
{#if $session.user}
4242
<aside
43-
class="z-20 hidden overflow-y-auto bg-white dark:bg-gray-800 md:block flex-shrink-0"
43+
class="z-20 flex-shrink-0 hidden overflow-y-auto bg-white dark:bg-gray-800 md:block"
4444
class:open={$settings.openMobileMenu}>
4545
<div class="py-4 text-gray-500 dark:text-gray-400">
4646
<a
@@ -188,7 +188,7 @@
188188
<li class={subLinkClass}>
189189
<a
190190
class="w-full"
191-
href="human_resources/leaves">{$_('human_resources.leaves.title')}</a>
191+
href="human_resources/payslips">{$_('human_resources.payslips.breadcrumb')}</a>
192192
</li>
193193
<li class={subLinkClass}>
194194
<a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script>
2+
import { _ } from 'svelte-i18n';
3+
import { format } from 'date-fns';
4+
5+
export let userLeaves;
6+
7+
// TODO: factorize this function
8+
const formatDate = (date) => format(new Date(date), 'dd/MM/yyyy');
9+
</script>
10+
11+
{#if userLeaves.totalDays > 0}
12+
<div><strong>{userLeaves.totalDays}</strong></div>
13+
{#each userLeaves.leaves as userLeave}
14+
<div>{formatDate(userLeave.startDate)} -> {formatDate(userLeave.endDate)}</div>
15+
{/each}
16+
{/if}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<script>
2+
import { _ } from 'svelte-i18n';
3+
import { format } from 'normalizer/money';
4+
import Leave from './_Leave.svelte';
5+
6+
export let items;
7+
</script>
8+
9+
<table
10+
class="w-full px-4 py-3 mb-8 whitespace-no-wrap bg-white rounded-lg shadow-md dark:bg-gray-800">
11+
<thead>
12+
<tr
13+
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">
14+
<th class="px-4 py-3">{$_('human_resources.payslips.user')}</th>
15+
<th class="px-4 py-3">{$_('human_resources.payslips.contract')}</th>
16+
<th class="px-4 py-3">{$_('human_resources.payslips.joining_date')}</th>
17+
<th class="px-4 py-3">{$_('human_resources.payslips.annual_earnings')}</th>
18+
<th class="px-4 py-3">{$_('human_resources.payslips.monthly_earnings')}</th>
19+
<th class="px-4 py-3">{$_('human_resources.payslips.working_time')}</th>
20+
<th class="px-4 py-3">{$_('human_resources.payslips.transport_fee')}</th>
21+
<th class="px-4 py-3">{$_('human_resources.payslips.meal_tickets')}</th>
22+
<th class="px-4 py-3">{$_('human_resources.payslips.health_insurance')}</th>
23+
<th class="px-4 py-3">{$_('human_resources.payslips.paid_leaves')}</th>
24+
<th class="px-4 py-3">{$_('human_resources.payslips.unpaid_leaves')}</th>
25+
<th class="px-4 py-3">{$_('human_resources.payslips.sick_leaves')}</th>
26+
<th class="px-4 py-3">{$_('human_resources.payslips.exceptional_leaves')}</th>
27+
</tr>
28+
</thead>
29+
30+
<tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
31+
{#each items as { firstName, lastName, contract, isExecutivePosition, joiningDate,
32+
annualEarnings, monthlyEarnings, workingTime, transportFee, mealTickets,
33+
healthInsurance, paidLeaves, unpaidLeaves, sickLeaves, exceptionalLeaves }}
34+
<tr class="text-gray-700 dark:text-gray-400">
35+
<td class="px-4 py-3 text-sm">
36+
{firstName} {lastName}
37+
</td>
38+
<td class="px-4 py-3 text-sm">{contract} {isExecutivePosition ? $_('human_resources.payslips.executive_position') : ''}</td>
39+
<td class="px-4 py-3 text-sm">{joiningDate}</td>
40+
<td class="px-4 py-3 text-sm">{format(annualEarnings)}</td>
41+
<td class="px-4 py-3 text-sm">{format(monthlyEarnings)}</td>
42+
<td class="px-4 py-3 text-sm">{$_(`human_resources.users.form.working_time.${workingTime}`)}</td>
43+
<td class="px-4 py-3 text-sm">{format(transportFee)}</td>
44+
<td class="px-4 py-3 text-sm">{mealTickets}</td>
45+
<td class="px-4 py-3 text-sm">{$_(`common.${healthInsurance}`)}</td>
46+
<td class="px-4 py-3 text-sm"><Leave userLeaves={paidLeaves}></Leave></td>
47+
<td class="px-4 py-3 text-sm"><Leave userLeaves={unpaidLeaves}></Leave></td>
48+
<td class="px-4 py-3 text-sm"><Leave userLeaves={sickLeaves}></Leave></td>
49+
<td class="px-4 py-3 text-sm"><Leave userLeaves={exceptionalLeaves}></Leave></td>
50+
</tr>
51+
{/each}
52+
</tbody>
53+
</table>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script>
2+
import { onMount } from 'svelte';
3+
import { _ } from 'svelte-i18n';
4+
import { format } from 'date-fns';
5+
import { fr } from 'date-fns/locale';
6+
import Breadcrumb from 'components/Breadcrumb.svelte';
7+
import H4Title from 'components/H4Title.svelte';
8+
import { errorNormalizer } from 'normalizer/errors';
9+
import ServerErrors from 'components/ServerErrors.svelte';
10+
import { get } from 'utils/axios';
11+
import Table from './_Table.svelte';
12+
13+
const title = $_('human_resources.payslips.title', {
14+
values: {
15+
month: format(new Date(), 'MMMM yyyy', { locale: fr }),
16+
},
17+
});
18+
19+
let errors;
20+
let payslipElements = [];
21+
22+
onMount(async () => {
23+
try {
24+
({ data: payslipElements } = await get('payslips'));
25+
} catch (e) {
26+
errors = errorNormalizer(e);
27+
}
28+
});
29+
</script>
30+
31+
<svelte:head>
32+
<title>{title} - {$_('app')}</title>
33+
</svelte:head>
34+
35+
<Breadcrumb items={[{ title: $_('human_resources.breadcrumb') }, { title: $_('human_resources.payslips.breadcrumb') }]} />
36+
<ServerErrors {errors} />
37+
<div class="inline-flex items-center">
38+
<H4Title {title} />
39+
</div>
40+
<Table items={payslipElements} />

0 commit comments

Comments
 (0)