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