aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/InvoiceActions.svelte
blob: 23268a19623fe7de3b0464317d28d5117d5a3498 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script>
  let {
    user,
    invoice,
    copy,
    t,
    link,
    type,
    showQr = $bindable(),
    txt,
    toggleAmount,
    toggleMemo,
  } = $props();
</script>

<div class="text-secondary space-y-2 text-xl pt-2">
  <button type="button" class="btn" onclick={() => copy(txt)}>
    <iconify-icon icon="ph:copy-bold" width="32"></iconify-icon>
    <div class="my-auto">
      {t("payments.copy")}
    </div>
  </button>

  {#if user?.id === invoice?.user?.id}
    <button class="btn" onclick={toggleAmount}>
      <iconify-icon icon="ph:pencil-simple-bold" width="32"></iconify-icon>
      <div class="my-auto">{t("payments.setAmount")}</div>
    </button>
  {:else}
    <a href={link} class="block">
      <button class="btn">
        <iconify-icon icon="ph:wallet-bold" width="32"></iconify-icon>
        <div class="my-auto">{t("payments.openLink")}</div>
      </button>
    </a>
  {/if}

  <button class="btn" onclick={toggleMemo}>
    <iconify-icon icon="ph:chat-centered-text-bold" width="32"></iconify-icon>
    <div class="my-auto">
      {t("invoice.setMemo")}
    </div>
  </button>

  {#if txt.length > 120}
    <div class="w-full flex justify-center gap-2 flex-wrap">
      <button class="btn" onclick={() => (showQr = !showQr)}>
        {#if showQr}
          <iconify-icon icon="ph:text-align-center-bold" width="32"
          ></iconify-icon>
        {:else}
          <iconify-icon icon="ph:qr-code-bold" width="32"></iconify-icon>
        {/if}
        <div class="my-auto">
          {showQr ? t("payments.showText") : t("payments.showQr")}
        </div></button
      >
    </div>
  {/if}
</div>