Compare commits
19
Commits
1.2.0
..
af61eb2334
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af61eb2334 | ||
|
|
616ed6383e | ||
|
|
e187bdeab7 | ||
|
|
c35b3a86f3 | ||
|
|
4b12eb3897 | ||
|
|
3452aa9999 | ||
|
|
072e99c6fb | ||
|
|
608d96ac4e | ||
|
|
51b5eb423c | ||
|
|
6e9ec73db4 | ||
|
|
1e48a5b608 | ||
|
|
dc7d84e35f | ||
|
|
5bbcc961e6 | ||
|
|
94b22c1d26 | ||
|
|
99cee223de | ||
|
|
fbbb563aad | ||
|
|
d7e99cbf30 | ||
|
|
3e291171a8 | ||
|
|
7ef5c43901 |
@@ -2,10 +2,13 @@
|
|||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
/.idea/*
|
||||||
|
|
||||||
# User-specific stuff
|
# User-specific stuff
|
||||||
.idea/**/workspace.xml
|
.idea/**/workspace.xml
|
||||||
.idea/**/tasks.xml
|
.idea/**/tasks.xml
|
||||||
.idea/**/usage.statistics.xml
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/markdown.xml
|
||||||
.idea/**/dictionaries
|
.idea/**/dictionaries
|
||||||
.idea/**/shelf
|
.idea/**/shelf
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
create_css_files() {
|
||||||
|
cd ui/public || exit 2
|
||||||
|
lessc --source-map less/print.less print.css
|
||||||
|
lessc --source-map less/global.less global.css
|
||||||
|
cd ../..
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
install_ui_dependence() {
|
||||||
|
cd ui/ || exit 2
|
||||||
|
npm install
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
install_api_dependence() {
|
install_api_dependence() {
|
||||||
cd api/ || exit 2
|
cd api/ || exit 2
|
||||||
composer install
|
composer install
|
||||||
@@ -26,7 +41,7 @@ test_api() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
composer_run() {
|
composer_run() {
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
}
|
}
|
||||||
|
|
||||||
install_api_dependence && build_ui && test_unit && composer_run && test_api
|
create_css_files && install_ui_dependence && install_api_dependence && build_ui && test_unit && composer_run && test_api
|
||||||
Executable
+62
@@ -0,0 +1,62 @@
|
|||||||
|
Aktivität;Dauer;Von;Bis;Kommentar
|
||||||
|
Arbeit;04:19;2021-07-30 13:01;2021-07-30 17:20;
|
||||||
|
Mittagspause ;00:45;2021-07-30 12:16;2021-07-30 13:01;
|
||||||
|
Arbeit;04:22;2021-07-30 07:54;2021-07-30 12:16;
|
||||||
|
Arbeit;03:25;2021-07-29 13:25;2021-07-29 16:50;
|
||||||
|
Mittagspause ;01:01;2021-07-29 12:23;2021-07-29 13:25;
|
||||||
|
Arbeit;04:44;2021-07-29 07:39;2021-07-29 12:23;
|
||||||
|
Arbeit;04:47;2021-07-28 12:49;2021-07-28 17:37;
|
||||||
|
Mittagspause ;00:58;2021-07-28 11:51;2021-07-28 12:49;
|
||||||
|
Arbeit;03:48;2021-07-28 08:02;2021-07-28 11:51;
|
||||||
|
Arbeit;03:49;2021-07-27 12:34;2021-07-27 16:24;
|
||||||
|
Mittagspause ;00:47;2021-07-27 11:47;2021-07-27 12:34;
|
||||||
|
Arbeit;03:20;2021-07-27 08:27;2021-07-27 11:47;
|
||||||
|
Arbeit;04:47;2021-07-26 12:59;2021-07-26 17:47;
|
||||||
|
Mittagspause ;00:52;2021-07-26 12:07;2021-07-26 12:59;
|
||||||
|
Arbeit;03:59;2021-07-26 08:08;2021-07-26 12:07;
|
||||||
|
Arbeit;05:53;2021-07-23 12:43;2021-07-23 18:37;
|
||||||
|
Mittagspause ;00:36;2021-07-23 12:07;2021-07-23 12:43;
|
||||||
|
Arbeit;04:10;2021-07-23 07:57;2021-07-23 12:07;
|
||||||
|
Arbeit;04:09;2021-07-22 12:54;2021-07-22 17:04;
|
||||||
|
Mittagspause ;00:42;2021-07-22 12:11;2021-07-22 12:54;
|
||||||
|
Arbeit;04:16;2021-07-22 07:55;2021-07-22 12:11;
|
||||||
|
Arbeit;03:11;2021-07-21 13:37;2021-07-21 16:48;
|
||||||
|
Mittagspause ;01:07;2021-07-21 12:29;2021-07-21 13:37;
|
||||||
|
Arbeit;04:58;2021-07-21 07:31;2021-07-21 12:29;
|
||||||
|
Arbeit;01:17;2021-07-20 18:44;2021-07-20 20:02;
|
||||||
|
Arbeit;03:50;2021-07-20 13:14;2021-07-20 17:04;
|
||||||
|
Mittagspause ;00:41;2021-07-20 12:32;2021-07-20 13:14;
|
||||||
|
Arbeit;04:55;2021-07-20 07:37;2021-07-20 12:32;
|
||||||
|
Arbeit;03:19;2021-07-19 13:12;2021-07-19 16:31;
|
||||||
|
Mittagspause ;00:52;2021-07-19 12:20;2021-07-19 13:12;
|
||||||
|
Arbeit;04:28;2021-07-19 07:51;2021-07-19 12:20;
|
||||||
|
Arbeit;02:48;2021-07-16 12:55;2021-07-16 15:43;
|
||||||
|
Mittagspause ;00:47;2021-07-16 12:07;2021-07-16 12:55;
|
||||||
|
Arbeit;04:01;2021-07-16 08:06;2021-07-16 12:07;
|
||||||
|
Arbeit;03:38;2021-07-15 13:05;2021-07-15 16:43;
|
||||||
|
Mittagspause ;01:05;2021-07-15 11:59;2021-07-15 13:05;
|
||||||
|
Arbeit;03:56;2021-07-15 08:02;2021-07-15 11:59;
|
||||||
|
Arbeit;03:38;2021-07-14 13:07;2021-07-14 16:45;
|
||||||
|
Mittagspause ;01:00;2021-07-14 12:07;2021-07-14 13:07;
|
||||||
|
Arbeit;04:00;2021-07-14 08:06;2021-07-14 12:07;
|
||||||
|
Arbeit;04:22;2021-07-13 12:53;2021-07-13 17:15;
|
||||||
|
Mittagspause ;01:03;2021-07-13 11:50;2021-07-13 12:53;
|
||||||
|
Arbeit;03:47;2021-07-13 08:02;2021-07-13 11:50;
|
||||||
|
Arbeit;03:26;2021-07-12 13:02;2021-07-12 16:28;
|
||||||
|
Mittagspause ;01:03;2021-07-12 11:58;2021-07-12 13:02;
|
||||||
|
Arbeit;04:14;2021-07-12 07:44;2021-07-12 11:58;
|
||||||
|
Arbeit;03:57;2021-07-09 13:09;2021-07-09 17:06;
|
||||||
|
Mittagspause ;01:06;2021-07-09 12:02;2021-07-09 13:09;
|
||||||
|
Arbeit;03:57;2021-07-09 08:04;2021-07-09 12:02;
|
||||||
|
Arbeit;03:17;2021-07-08 13:12;2021-07-08 16:29;
|
||||||
|
Mittagspause ;01:07;2021-07-08 12:04;2021-07-08 13:12;
|
||||||
|
Arbeit;04:00;2021-07-08 08:03;2021-07-08 12:04;
|
||||||
|
Arbeit;03:41;2021-07-07 13:08;2021-07-07 16:49;
|
||||||
|
Mittagspause ;01:00;2021-07-07 12:07;2021-07-07 13:08;
|
||||||
|
Arbeit;04:05;2021-07-07 08:02;2021-07-07 12:07;
|
||||||
|
Arbeit;02:50;2021-07-06 13:05;2021-07-06 15:55;
|
||||||
|
Mittagspause ;01:05;2021-07-06 11:59;2021-07-06 13:05;
|
||||||
|
Arbeit;03:49;2021-07-06 08:10;2021-07-06 11:59;
|
||||||
|
Arbeit;03:32;2021-07-05 13:00;2021-07-05 16:33;
|
||||||
|
Mittagspause ;00:59;2021-07-05 12:00;2021-07-05 13:00;
|
||||||
|
Arbeit;03:48;2021-07-05 08:12;2021-07-05 12:00;
|
||||||
|
+2
-1
@@ -25,6 +25,7 @@
|
|||||||
"rollup-plugin-svelte": "^6.0.0",
|
"rollup-plugin-svelte": "^6.0.0",
|
||||||
"rollup-plugin-terser": "^7.0.0",
|
"rollup-plugin-terser": "^7.0.0",
|
||||||
"sirv-cli": "^1.0.8",
|
"sirv-cli": "^1.0.8",
|
||||||
"svelte": "^3.4.4"
|
"svelte": "^3.4.4",
|
||||||
|
"svelte-paginate": "^0.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,3 +74,28 @@ section article {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Einstellungen für die Pagination-Navigation
|
||||||
|
.pagination-nav {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: 1rem;
|
||||||
|
.option {
|
||||||
|
&.number, &.ellipsis {
|
||||||
|
line-height: 1.25rem;
|
||||||
|
span {
|
||||||
|
margin: .25rem .5rem;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
text-decoration: underline solid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.disabled {
|
||||||
|
svg {
|
||||||
|
path {
|
||||||
|
fill: darken(@mainColorLight,40%,relativ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+7
File diff suppressed because one or more lines are too long
@@ -1,16 +1,21 @@
|
|||||||
<script>
|
<script>
|
||||||
export let params = {};
|
import { paginate, PaginationNav } from 'svelte-paginate'
|
||||||
|
|
||||||
|
export let params = {}
|
||||||
let records = []
|
let records = []
|
||||||
let isLoading = true
|
let isLoading = true
|
||||||
console.log(params)
|
console.log(params)
|
||||||
|
let currentPage = 1
|
||||||
|
let pageSize = 15
|
||||||
|
$: paginatedItems = paginate({ items: records, pageSize, currentPage })
|
||||||
if (!String.prototype.startsWith) {
|
if (!String.prototype.startsWith) {
|
||||||
String.prototype.startsWith = function (searchString, position) {
|
String.prototype.startsWith = function (searchString, position) {
|
||||||
position = position || 0;
|
position = position || 0
|
||||||
return this.indexOf(searchString, position) === position;
|
return this.indexOf(searchString, position) === position
|
||||||
};
|
|
||||||
}
|
}
|
||||||
$: isNegative = time => time.startsWith('-') ? 'absence-time' : '';
|
}
|
||||||
$: cutMinusChar = time => time.startsWith('-') ? time.substr(1) : time;
|
$: isNegative = time => time.startsWith('-') ? 'absence-time' : ''
|
||||||
|
$: cutMinusChar = time => time.startsWith('-') ? time.substr(1) : time
|
||||||
|
|
||||||
const init = async () => await params.promise.then(data => {
|
const init = async () => await params.promise.then(data => {
|
||||||
records = data
|
records = data
|
||||||
@@ -47,7 +52,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each records as record}
|
{#each paginatedItems as record}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{record.period}</td>
|
<td>{record.period}</td>
|
||||||
<td>{record.workingDays}</td>
|
<td>{record.workingDays}</td>
|
||||||
@@ -56,6 +61,20 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
<PaginationNav
|
||||||
|
totalItems="{records.length}"
|
||||||
|
pageSize="{pageSize}"
|
||||||
|
currentPage="{currentPage}"
|
||||||
|
limit="{1}"
|
||||||
|
showStepOptions="{true}"
|
||||||
|
on:setPage="{(e) => currentPage = e.detail.page}"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
let TITLE = "Bearbeitung Einträge"
|
let TITLE = "Bearbeitung Einträge"
|
||||||
let activeRecord = null;
|
let activeRecord = null;
|
||||||
|
let currentPage = 1
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
<h1>{TITLE}</h1>
|
<h1>{TITLE}</h1>
|
||||||
</header>
|
</header>
|
||||||
<article>
|
<article>
|
||||||
<List bind:activeRecord={activeRecord}/>
|
<List bind:activeRecord={activeRecord} bind:currentPage/>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
import xIcon from '@iconify-icons/oi/x'
|
import xIcon from '@iconify-icons/oi/x'
|
||||||
import EditByDay from "./Formular/EditByDay.svelte";
|
import EditByDay from "./Formular/EditByDay.svelte";
|
||||||
import EditByWeek from "./Formular/EditByWeek.svelte";
|
import EditByWeek from "./Formular/EditByWeek.svelte";
|
||||||
|
import ImportCsv from "./Formular/ImportCsv.svelte";
|
||||||
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte";
|
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte";
|
||||||
|
|
||||||
const DAILY_EDIT = 0
|
const DAILY_EDIT = 0
|
||||||
const WEEKLY_EDIT = 1
|
const WEEKLY_EDIT = 1
|
||||||
|
const CSV_IMPORT = 2
|
||||||
|
|
||||||
const Controller = {
|
const Controller = {
|
||||||
'saveRecord': () => {
|
'saveRecord': () => {
|
||||||
@@ -65,6 +67,11 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const CsvController = {
|
||||||
|
'makeTimekeepingList': () => {
|
||||||
|
MenuController.dailyEdit()
|
||||||
|
}
|
||||||
|
}
|
||||||
const MenuController = {
|
const MenuController = {
|
||||||
'dailyEdit': () => {
|
'dailyEdit': () => {
|
||||||
period_of_edit = DAILY_EDIT
|
period_of_edit = DAILY_EDIT
|
||||||
@@ -75,6 +82,11 @@
|
|||||||
period_of_edit = WEEKLY_EDIT
|
period_of_edit = WEEKLY_EDIT
|
||||||
makeTimekeepingList = WeekController.makeTimekeepingList
|
makeTimekeepingList = WeekController.makeTimekeepingList
|
||||||
makeTimekeepingList()
|
makeTimekeepingList()
|
||||||
|
},
|
||||||
|
'csvImport': () => {
|
||||||
|
period_of_edit = CSV_IMPORT
|
||||||
|
activeRecordList = []
|
||||||
|
makeTimekeepingList = CsvController.makeTimekeepingList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +102,9 @@
|
|||||||
<!--suppress HtmlUnknownTarget -->
|
<!--suppress HtmlUnknownTarget -->
|
||||||
<form action="/working-hours" name="editRecord">
|
<form action="/working-hours" name="editRecord">
|
||||||
<nav class="menu">
|
<nav class="menu">
|
||||||
<span on:click={MenuController.dailyEdit} class:active={period_of_edit === DAILY_EDIT}>Täglich</span>
|
<span on:click={MenuController.dailyEdit} on:keypress={() => {}} class:active={period_of_edit === DAILY_EDIT}>Täglich</span>
|
||||||
<span on:click={MenuController.weeklyEdit} class:active={period_of_edit === WEEKLY_EDIT}>Wöchentlich</span>
|
<span on:click={MenuController.weeklyEdit} on:keypress={() => {}} class:active={period_of_edit === WEEKLY_EDIT}>Wöchentlich</span>
|
||||||
|
<span on:click={MenuController.csvImport} on:keypress={() => {}} class:active={period_of_edit === CSV_IMPORT}>Import per CSV</span>
|
||||||
</nav>
|
</nav>
|
||||||
{#if period_of_edit === DAILY_EDIT}
|
{#if period_of_edit === DAILY_EDIT}
|
||||||
<EditByDay bind:activeRecordList bind:activeDate bind:makeTimekeepingList/>
|
<EditByDay bind:activeRecordList bind:activeDate bind:makeTimekeepingList/>
|
||||||
@@ -99,6 +112,9 @@
|
|||||||
{#if period_of_edit === WEEKLY_EDIT}
|
{#if period_of_edit === WEEKLY_EDIT}
|
||||||
<EditByWeek bind:activeRecordList bind:activeDate bind:makeTimekeepingList/>
|
<EditByWeek bind:activeRecordList bind:activeDate bind:makeTimekeepingList/>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if period_of_edit === CSV_IMPORT}
|
||||||
|
<ImportCsv bind:activeRecordList bind:makeTimekeepingList/>
|
||||||
|
{/if}
|
||||||
<fieldset name="buttons">
|
<fieldset name="buttons">
|
||||||
<button on:click={Controller.saveRecord} type="button">Übernehmen und Weiter
|
<button on:click={Controller.saveRecord} type="button">Übernehmen und Weiter
|
||||||
<IconifyIcon icon={checkIcon} color="green"/>
|
<IconifyIcon icon={checkIcon} color="green"/>
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<script>
|
||||||
|
import Papa from '../../../papaparse.min'
|
||||||
|
import { paginate, PaginationNav } from 'svelte-paginate'
|
||||||
|
|
||||||
|
export let activeRecordList = []
|
||||||
|
let imported_data = []
|
||||||
|
export let currentPage = 1
|
||||||
|
let pageSize = 15
|
||||||
|
$: paginatedItems = paginate({ items: imported_data, pageSize, currentPage })
|
||||||
|
|
||||||
|
let files = null
|
||||||
|
|
||||||
|
const VerarbeiteDateien = () => {
|
||||||
|
for (const file of files) {
|
||||||
|
VerarbeiteCsv(file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const VerarbeiteCsv = file => {
|
||||||
|
Papa.parse(file, {
|
||||||
|
header: true,
|
||||||
|
skipEmptyLines: true,
|
||||||
|
complete: results => {
|
||||||
|
let cash_work_days = {}
|
||||||
|
results.data.forEach(item => {
|
||||||
|
// noinspection JSNonASCIINames
|
||||||
|
let activity = item['Aktivität']
|
||||||
|
if (activity.trim() === 'Mittagspause') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let work_from = new Date(item['Von'])
|
||||||
|
let work_to = new Date(item['Bis'])
|
||||||
|
let actual_day = work_from.toISOString().substring(0, 10)
|
||||||
|
let actual_work_hours = (work_to - work_from) / (1000 * 60 * 60)
|
||||||
|
cash_work_days[actual_day] ??= 0
|
||||||
|
cash_work_days[actual_day] += actual_work_hours
|
||||||
|
})
|
||||||
|
for (let day in cash_work_days) {
|
||||||
|
let hours = cash_work_days[day]
|
||||||
|
let hours_digits = Math.trunc(hours)
|
||||||
|
let minutes_digits = Math.round((hours - hours_digits) * 60)
|
||||||
|
let working_time = String(hours_digits).padStart(2, '0') + ':'
|
||||||
|
+ String(minutes_digits).padStart(2, '0') + ':00'
|
||||||
|
activeRecordList.push({ workingTime: working_time, workingDay: day })
|
||||||
|
}
|
||||||
|
imported_data = activeRecordList
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Download-Liste</legend>
|
||||||
|
<div class="zelle">
|
||||||
|
<label for="csv-file">Download der Zeiten von <i>aTimeLogger2</i></label>
|
||||||
|
<input type="file" accept="text/csv" id="csv-file" bind:files/>
|
||||||
|
<button type="button" on:click={VerarbeiteDateien}>Upload</button>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset name="record-data-for-import">
|
||||||
|
<div>
|
||||||
|
{#if imported_data.length < 1}
|
||||||
|
<p>Loading...</p>
|
||||||
|
{:else}
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
{#each imported_data as item}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{item.workingDay}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{item.workingTime}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
<PaginationNav
|
||||||
|
totalItems="{imported_data.length}"
|
||||||
|
pageSize="{pageSize}"
|
||||||
|
currentPage="{currentPage}"
|
||||||
|
limit="{1}"
|
||||||
|
showStepOptions="{true}"
|
||||||
|
on:setPage="{(e) => currentPage = e.detail.page}"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
@@ -1,22 +1,26 @@
|
|||||||
<script>
|
<script>
|
||||||
import {WorkingHoursRepository} from "../../components/Repositories.svelte"
|
import { WorkingHoursRepository } from '../../components/Repositories.svelte'
|
||||||
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte"
|
import { TimekeepingDate } from '../../components/TimekeepingDate.svelte'
|
||||||
|
import { paginate, PaginationNav } from 'svelte-paginate'
|
||||||
export let activeRecord = null
|
|
||||||
let isLoading = true
|
|
||||||
let records = []
|
|
||||||
import IconifyIcon from '@iconify/svelte'
|
import IconifyIcon from '@iconify/svelte'
|
||||||
import wrenchIcon from '@iconify-icons/oi/wrench'
|
import wrenchIcon from '@iconify-icons/oi/wrench'
|
||||||
import documentIcon from '@iconify-icons/oi/document'
|
import documentIcon from '@iconify-icons/oi/document'
|
||||||
|
|
||||||
|
export let activeRecord = null
|
||||||
|
let isLoading = true
|
||||||
|
let records = []
|
||||||
|
export let currentPage = 1
|
||||||
|
let pageSize = 15
|
||||||
|
$: paginatedItems = paginate({ items: records, pageSize, currentPage })
|
||||||
|
|
||||||
const Controller = {
|
const Controller = {
|
||||||
'listRecords': () => {
|
'listRecords': () => {
|
||||||
Controller.cancelActiveRecord();
|
Controller.cancelActiveRecord()
|
||||||
WorkingHoursRepository.browse().then(data => {
|
WorkingHoursRepository.browse().then(data => {
|
||||||
Controller.cancelActiveRecord()
|
Controller.cancelActiveRecord()
|
||||||
records = data
|
records = data
|
||||||
isLoading = false
|
isLoading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
'newRecord': async () => {
|
'newRecord': async () => {
|
||||||
const actDate = new TimekeepingDate()
|
const actDate = new TimekeepingDate()
|
||||||
@@ -27,11 +31,11 @@
|
|||||||
Controller.listRecords()
|
Controller.listRecords()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
activeRecord = data;
|
activeRecord = data
|
||||||
}),
|
}),
|
||||||
'cancelActiveRecord': () => {
|
'cancelActiveRecord': () => {
|
||||||
activeRecord = null;
|
activeRecord = null
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
Controller.listRecords()
|
Controller.listRecords()
|
||||||
</script>
|
</script>
|
||||||
@@ -61,7 +65,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each records as record}
|
{#each paginatedItems as record}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{record.workingDay}</td>
|
<td>{record.workingDay}</td>
|
||||||
<td>{record.workingTime}</td>
|
<td>{record.workingTime}</td>
|
||||||
@@ -73,5 +77,19 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
<PaginationNav
|
||||||
|
totalItems="{records.length}"
|
||||||
|
pageSize="{pageSize}"
|
||||||
|
currentPage="{currentPage}"
|
||||||
|
limit="{1}"
|
||||||
|
showStepOptions="{true}"
|
||||||
|
on:setPage="{(e) => currentPage = e.detail.page}"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
Reference in New Issue
Block a user