-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Gschaftlhaberer/feat/create-and-delete-sh…
…opping-lists Feat/create and delete shopping lists
- Loading branch information
Showing
22 changed files
with
511 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ vite.config.js.timestamp-* | |
vite.config.ts.timestamp-* | ||
couchdb | ||
shopping | ||
test-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
import type { ExistingDocument, Product } from '$lib/db'; | ||
import { db as DB } from '$lib/db'; | ||
import { get } from 'svelte/store'; | ||
import { Card, Heading, Button } from 'flowbite-svelte'; | ||
export let product: ExistingDocument<Product>; | ||
async function deleteProduct() { | ||
const db = get(DB); | ||
await db.remove(product); | ||
} | ||
</script> | ||
|
||
<Card {...$$restProps} class="flex flex-row items-center justify-between"> | ||
<div class="flex-grow"> | ||
<Heading class="inline-block flex-shrink" tag="h4">{product.name}</Heading> | ||
</div> | ||
<div class="flex flex-col items-center text-neutral-500 dark:text-neutral-300"> | ||
<span class="text-xl">{product.count}</span> | ||
<span class="text-sm">Stück</span> | ||
</div> | ||
<Button on:click={deleteProduct} class="ml-4"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
class="h-6 w-6" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" | ||
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" | ||
></path> | ||
</svg> | ||
</Button> | ||
</Card> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,48 @@ | ||
<script lang="ts"> | ||
import type { ExistingDocument, ProductList } from '$lib/db'; | ||
import { Card, Heading } from 'flowbite-svelte'; | ||
import { Button, Card, Heading, Modal } from 'flowbite-svelte'; | ||
import TrashBinSolid from '~icons/flowbite/trash-bin-solid'; | ||
import ExclamationCircleSolid from '~icons/flowbite/exclamation-circle-solid'; | ||
export let productlist: ExistingDocument<ProductList>; | ||
import { db as DB } from '$lib/db'; | ||
import { get } from 'svelte/store'; | ||
async function deleteList() { | ||
const db = get(DB); | ||
const list = await db.get(deleteModalId); | ||
await db.remove(list); | ||
} | ||
let deleteModal = false; | ||
let deleteModalId = ''; | ||
</script> | ||
|
||
<Card href={`/items/${productlist._id}`} {...$$restProps}> | ||
<Heading tag="h4">{productlist.name}</Heading> | ||
<div class="flex items-center justify-between"> | ||
<Heading tag="h4">{productlist.name}</Heading> | ||
<Button | ||
color="red" | ||
on:click={(e) => { | ||
e.preventDefault(); | ||
deleteModal = true; | ||
deleteModalId = productlist._id; | ||
}} | ||
aria-label="Löschen" | ||
> | ||
<TrashBinSolid /> | ||
</Button> | ||
</div> | ||
</Card> | ||
|
||
<Modal bind:open={deleteModal} size="xs" autoclose outsideclose> | ||
<div class="text-center"> | ||
<ExclamationCircleSolid class="mx-auto mb-4 h-12 w-12 text-gray-400 dark:text-gray-200" /> | ||
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400"> | ||
Sicher, dass sie dieses Produkt löschen möchten? | ||
</h3> | ||
<Button color="red" class="me-2" on:click={deleteList}>Ja, ich bin sicher</Button> | ||
<Button color="alternative">Nein, abbrechen</Button> | ||
</div> | ||
</Modal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
// place files you want to import through the `$lib` alias in this folder. | ||
export { default as getSlug } from 'speakingurl'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.