Compare commits
3 Commits
a953349c14
...
e9cf2bc849
Author | SHA1 | Date | |
---|---|---|---|
e9cf2bc849 | |||
103ad57ddc | |||
2856c5c1b7 |
@ -99,8 +99,18 @@
|
|||||||
<td class="px-6 py-4 whitespace-nowrap">
|
<td class="px-6 py-4 whitespace-nowrap">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
{#if editTracks.includes(t.id)}
|
{#if editTracks.findIndex((tr) => tr.id === t.id) !== -1}
|
||||||
<input class="shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-0.5" type="text" value={t.name} />
|
<input
|
||||||
|
class="shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-0.5"
|
||||||
|
type="text"
|
||||||
|
value={t.name}
|
||||||
|
on:input={(e) => {
|
||||||
|
const i = editTracks.findIndex(
|
||||||
|
(tr) => tr.id === t.id
|
||||||
|
);
|
||||||
|
editTracks[i].name = e.target.value;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="text-sm font-medium text-gray-900">
|
<div class="text-sm font-medium text-gray-900">
|
||||||
{t.name}
|
{t.name}
|
||||||
@ -112,18 +122,46 @@
|
|||||||
<td class="px-6 py-4 whitespace-nowrap">
|
<td class="px-6 py-4 whitespace-nowrap">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
|
{#if editTracks.findIndex((tr) => tr.id === t.id) !== -1}
|
||||||
|
<input
|
||||||
|
class="shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-0.5"
|
||||||
|
type="number"
|
||||||
|
value={t.distance}
|
||||||
|
on:input={(e) => {
|
||||||
|
const i = editTracks.findIndex(
|
||||||
|
(tr) => tr.id === t.id
|
||||||
|
);
|
||||||
|
editTracks[i].distance = parseInt(e.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
<div class="text-sm font-medium text-gray-900">
|
<div class="text-sm font-medium text-gray-900">
|
||||||
{t.distance}
|
{t.distance}
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
<td class="px-6 py-4 whitespace-nowrap">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
|
{#if editTracks.findIndex((tr) => tr.id === t.id) !== -1}
|
||||||
|
<input
|
||||||
|
class="shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-0.5"
|
||||||
|
type="number"
|
||||||
|
value={t.minimumLapTime}
|
||||||
|
on:input={(e) => {
|
||||||
|
const i = editTracks.findIndex(
|
||||||
|
(tr) => tr.id === t.id
|
||||||
|
);
|
||||||
|
editTracks[i].minimumLapTime = parseInt(e.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
<div class="text-sm font-medium text-gray-900">
|
<div class="text-sm font-medium text-gray-900">
|
||||||
{t.minimumLapTime}
|
{t.minimumLapTime}
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -169,7 +207,23 @@
|
|||||||
<button
|
<button
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
console.log("TODO:");
|
toast.loading($_("track-is-being-updated"));
|
||||||
|
const i = editTracks.findIndex(
|
||||||
|
(tr) => tr.id === t.id
|
||||||
|
);
|
||||||
|
const res = await TrackService.trackControllerPut(
|
||||||
|
t.id,
|
||||||
|
editTracks[i]
|
||||||
|
);
|
||||||
|
tracksstore.set(
|
||||||
|
$tracksstore.filter((tr) => tr.id !== t.id)
|
||||||
|
);
|
||||||
|
$tracksstore.push(res)
|
||||||
|
editTracks = editTracks.filter((tr) => {
|
||||||
|
tr.id !== t.id;
|
||||||
|
});
|
||||||
|
toast.dismiss();
|
||||||
|
toast.success($_("track-updated"));
|
||||||
}}
|
}}
|
||||||
class="ml-4 text-green-600 hover:text-green-900 cursor-pointer"
|
class="ml-4 text-green-600 hover:text-green-900 cursor-pointer"
|
||||||
>{$_("save")}</button
|
>{$_("save")}</button
|
||||||
|
@ -503,5 +503,7 @@
|
|||||||
"you-have-to-provide-an-organization": "Du musst eine Organisation angeben",
|
"you-have-to-provide-an-organization": "Du musst eine Organisation angeben",
|
||||||
"you-have-to-save-your-changes-to-generate-a-link": "Du musst deine Änderungen speichern, um einen Link zu generieren.",
|
"you-have-to-save-your-changes-to-generate-a-link": "Du musst deine Änderungen speichern, um einen Link zu generieren.",
|
||||||
"you-must-create-at-least-one-card-or-cancel": "Du musst mindestens eine Blankokarte erstellen.",
|
"you-must-create-at-least-one-card-or-cancel": "Du musst mindestens eine Blankokarte erstellen.",
|
||||||
"zip-postal-code": "Postleitzahl"
|
"zip-postal-code": "Postleitzahl",
|
||||||
|
"track-is-being-deleted": "Track wird gelöscht",
|
||||||
|
"track-updated": "Track aktualisiert"
|
||||||
}
|
}
|
@ -503,5 +503,7 @@
|
|||||||
"you-have-to-provide-an-organization": "You have to provide an organization",
|
"you-have-to-provide-an-organization": "You have to provide an organization",
|
||||||
"you-have-to-save-your-changes-to-generate-a-link": "You have to save your changes to generate a link.",
|
"you-have-to-save-your-changes-to-generate-a-link": "You have to save your changes to generate a link.",
|
||||||
"you-must-create-at-least-one-card-or-cancel": "You must create at least one card.",
|
"you-must-create-at-least-one-card-or-cancel": "You must create at least one card.",
|
||||||
"zip-postal-code": "ZIP/ postal code"
|
"zip-postal-code": "ZIP/ postal code",
|
||||||
|
"track-is-being-deleted": "Track is being deleted",
|
||||||
|
"track-updated": "Track deleted"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user