next #180
@ -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}
|
||||||
@ -155,7 +165,7 @@
|
|||||||
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer"
|
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer"
|
||||||
>{$_("confirm-delete")}</button
|
>{$_("confirm-delete")}</button
|
||||||
>
|
>
|
||||||
{:else if editTracks.findIndex((tr)=>tr.id === t.id) !== -1}
|
{:else if editTracks.findIndex((tr) => tr.id === t.id) !== -1}
|
||||||
<button
|
<button
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
@ -169,7 +179,20 @@
|
|||||||
<button
|
<button
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
console.log("TODO:");
|
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;
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user