added taken_by_name + some links

This commit is contained in:
Dovi Cowan 2023-10-18 00:08:23 +01:00
parent b646b28a66
commit 44ce8eb0c0
Signed by: dcowan
GPG key ID: C110D77558FBC227
3 changed files with 9 additions and 5 deletions

View file

@ -36,8 +36,9 @@
> >
{/if} {/if}
{#each lists.documents as list} {#each lists.documents as list}
<Link class="text-blue-400" to="/list/{list['$id']}">{list['title']}</Link> <Link class="text-blue-400" to="/list/{list['$id']}">{list['title']}</Link><br>
{/each} {/each}
<Link class="text-blue-400" to="/lists/create">Create new list</Link>
{/await} {/await}
</div> </div>
</main> </main>

View file

@ -35,6 +35,7 @@
{#await members} {#await members}
Loading... Loading...
{:then members} {:then members}
<Link to="/list/{id}" class="text-blue-400">Back to {members.memberships[0].teamName}</Link><br>
{#each members.memberships as member} {#each members.memberships as member}
<div class="m-1"> <div class="m-1">
{member.userName} - {member.userEmail} {member.userName} - {member.userEmail}

View file

@ -2,7 +2,7 @@
import { ID, Permission, Query, Role } from "appwrite"; import { ID, Permission, Query, Role } from "appwrite";
import Header from "../../lib/Header.svelte"; import Header from "../../lib/Header.svelte";
import { database, loggedInUser } from "../../lib/appwrite"; import { database, loggedInUser } from "../../lib/appwrite";
import { Link } from "svelte-navigator"; import { Link } from "svelte-navigator";
export let id; export let id;
@ -33,11 +33,11 @@
perek: perek, perek: perek,
taken: true, taken: true,
taken_by: loggedInUser["$id"], taken_by: loggedInUser["$id"],
taken_by_name: loggedInUser['name']
}, },
[ [
Permission.read(Role.team(id)), Permission.read(Role.team(id)),
Permission.write(Role.user(loggedInUser["$id"])), Permission.write(Role.user(loggedInUser["$id"])),
Permission.write(Role.team("admins-" + id)),
], ],
) )
.then(() => { .then(() => {
@ -111,7 +111,7 @@
{:then list} {:then list}
<h1 class="text-2xl">List {list.title}</h1> <h1 class="text-2xl">List {list.title}</h1>
<br /> <br />
<Link class="text-blue-400" to="/list/{id}/members">Members</Link><br> <Link class="text-blue-400" to="/list/{id}/members">Members</Link><br />
{#await perakimPromise then perakimResolved} {#await perakimPromise then perakimResolved}
{#each Array.from(Array(150 + 1).keys()).slice(1) as i} {#each Array.from(Array(150 + 1).keys()).slice(1) as i}
{#if perekIndex(i) !== -1} {#if perekIndex(i) !== -1}
@ -141,8 +141,10 @@
class="dark:bg-gray-600 bg-gray-400 border p-1 mt-2 rounded" class="dark:bg-gray-600 bg-gray-400 border p-1 mt-2 rounded"
>Uncomplete</button >Uncomplete</button
> >
{:else if perakim[perekIndex(i)].completed == false}
Perek {i} - Taken by {perakim[perekIndex(i)].taken_by_name}
{:else} {:else}
Perek {i} - Taken Perek {i} - Completed by {perakim[perekIndex(i)].taken_by_name}
{/if} {/if}
{:else} {:else}
Perek {i} Perek {i}