3 Commits
+13 -17
View File
@@ -52,19 +52,17 @@
console.log(err);
});
},
'add': record => {
'add': async record => {
console.log(record);
// noinspection JSUnresolvedVariable
fetch(env.API_URL + '/working-hours', {
await fetch(env.API_URL + '/working-hours', {
method: 'POST',
mode: 'no-cors',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
credentials: 'omit',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: JSON.stringify(record)
})
.then(res => {
@@ -79,19 +77,17 @@
console.log(err);
});
},
'update': (date, record) => {
'update': async (date, record) => {
console.log(record);
// noinspection JSUnresolvedVariable
fetch(env.API_URL + '/working-hours/' + date, {
await fetch(env.API_URL + '/working-hours/' + date, {
method: 'PUT',
mode: 'no-cors',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
credentials: 'omit',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: JSON.stringify(record)
})
.then(res => {
@@ -151,7 +147,7 @@
<!--suppress HtmlUnknownTarget -->
<form action="/working-hours">
<fieldset>
<button on:click={Controller.newRecord}>Neuer Eintrag
<button on:click={Controller.newRecord} type="button">Neuer Eintrag
<IconifyIcon icon={documentIcon}/>
</button>
</fieldset>
@@ -170,7 +166,7 @@
<td>{record.workingDay}</td>
<td>{record.workingTime}</td>
<td>
<button on:click={() => Controller.selectActiveRecord(record)}>Bearbeiten
<button on:click={() => Controller.selectActiveRecord(record)} type="button">Bearbeiten
<IconifyIcon icon={wrenchIcon}/>
</button>
</td>
@@ -193,7 +189,7 @@
<div>
<label for="workingDay">Arbeitstag</label>
<input bind:value={activeRecord.workingDay} type="date"
id="workingDay" required pattern="\d{4}-\d{2}-\d{2}">
id="workingDay" required pattern="\d\{4}-[0-1]\d-[0-3]\d\">
</div>
<div>
<label for="workingTime">Arbeitszeit</label>
@@ -202,10 +198,10 @@
</div>
</fieldset>
<fieldset name="buttons">
<button on:click={Controller.saveRecord}>Übernehmen
<button on:click={Controller.saveRecord} type="button">Übernehmen
<IconifyIcon icon={checkIcon} color="green"/>
</button>
<button on:click={Controller.cancelActiveRecord}>Abbrechen
<button on:click={Controller.cancelActiveRecord} type="button">Abbrechen
<IconifyIcon icon={xIcon}/>
</button>
</fieldset>