refactor/js-repositories #20
@@ -1,21 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import Views from "./Views.svelte";
|
import Views from "./Views.svelte";
|
||||||
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
||||||
export let params;
|
export let params
|
||||||
params = {
|
params = {
|
||||||
title: 'Monatsansicht',
|
title: 'Monatsansicht',
|
||||||
records: [],
|
promise: WorkingHoursViewsRepository.monthly()
|
||||||
isLoading: true
|
|
||||||
}
|
}
|
||||||
const View = {
|
|
||||||
'browse': () => {
|
|
||||||
WorkingHoursViewsRepository.monthly().then(data => {
|
|
||||||
params.records = data;
|
|
||||||
params.isLoading = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
View.browse();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Views {params} />
|
<Views {params} />
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export let params;
|
export let params = {};
|
||||||
|
let records = []
|
||||||
|
let isLoading = true
|
||||||
console.log(params)
|
console.log(params)
|
||||||
if (!String.prototype.startsWith) {
|
if (!String.prototype.startsWith) {
|
||||||
String.prototype.startsWith = function(searchString, position) {
|
String.prototype.startsWith = function(searchString, position) {
|
||||||
@@ -9,6 +11,12 @@
|
|||||||
}
|
}
|
||||||
$: isNegative = time => time.startsWith('-') ? 'absence-time' : '';
|
$: isNegative = time => time.startsWith('-') ? 'absence-time' : '';
|
||||||
$: cutMinusChar = time => time.startsWith('-') ? time.substr(1) : time;
|
$: cutMinusChar = time => time.startsWith('-') ? time.substr(1) : time;
|
||||||
|
|
||||||
|
const init = async () => await params.promise.then(data => {
|
||||||
|
records = data
|
||||||
|
isLoading = false
|
||||||
|
})
|
||||||
|
init()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
<h1>{params.title}</h1>
|
<h1>{params.title}</h1>
|
||||||
</header>
|
</header>
|
||||||
<article>
|
<article>
|
||||||
{#if params.isLoading === true}
|
{#if isLoading === true}
|
||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
{:else}
|
{:else}
|
||||||
<table>
|
<table>
|
||||||
@@ -39,7 +47,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each params.records as record}
|
{#each records as record}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{record.period}</td>
|
<td>{record.period}</td>
|
||||||
<td>{record.workingDays}</td>
|
<td>{record.workingDays}</td>
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import Views from "./Views.svelte";
|
import Views from "./Views.svelte";
|
||||||
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
||||||
export let params;
|
export let params
|
||||||
params = {
|
params = {
|
||||||
title: 'Wochenansicht',
|
title: 'Wochenansicht',
|
||||||
records: [],
|
promise: WorkingHoursViewsRepository.weekly()
|
||||||
isLoading: true
|
|
||||||
}
|
}
|
||||||
const View = {
|
|
||||||
'browse': () => {
|
|
||||||
WorkingHoursViewsRepository.weekly().then(data => {
|
|
||||||
params.records = data;
|
|
||||||
params.isLoading = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
View.browse();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Views {params} />
|
<Views {params} />
|
||||||
@@ -1,21 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import Views from "./Views.svelte";
|
import Views from "./Views.svelte";
|
||||||
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
||||||
export let params;
|
export let params
|
||||||
params = {
|
params = {
|
||||||
title: 'Jahresansicht',
|
title: 'Jahresansicht',
|
||||||
records: [],
|
promise: WorkingHoursViewsRepository.yearly()
|
||||||
isLoading: true
|
|
||||||
}
|
}
|
||||||
const View = {
|
|
||||||
'browse': () => {
|
|
||||||
WorkingHoursViewsRepository.yearly().then(data => {
|
|
||||||
params.records = data;
|
|
||||||
params.isLoading = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
View.browse();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Views {params} />
|
<Views {params} />
|
||||||
Reference in New Issue
Block a user