generated from prokawsar/dashboard-starter
-
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.
- Loading branch information
Showing
8 changed files
with
112 additions
and
117 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script lang="ts"> | ||
import { get40Percent, type CostHistoryType } from '$lib/utils/services' | ||
import Icon from '@iconify/svelte' | ||
import dayjs from 'dayjs' | ||
import { createEventDispatcher } from 'svelte' | ||
export let cost: CostHistoryType | ||
export let isTrash: boolean = false | ||
const dispatch = createEventDispatcher() | ||
let deleteConfirm = '' | ||
</script> | ||
|
||
<div class="flex flex-col gap-1 items-center w-full p-1 border border-dashed rounded shadow-sm"> | ||
{#if cost} | ||
<a href="/history/{cost.id}" class="flex flex-row items-center pl-1 justify-between w-full"> | ||
<p class:hidden={!cost.name} class="truncate w-[40%]"> | ||
{cost.name} | ||
</p> | ||
<p class="text-gray-500 text-sm truncate"> | ||
{cost.final_price.toFixed(2)} | ||
<span class=" text-teal-600"> | ||
({(cost.final_price + get40Percent(cost.final_price)).toFixed(2)}) | ||
</span> | ||
</p> | ||
<p class="w-fit text-[10px] text-gray-500 truncate"> | ||
{dayjs(cost.created_at).format('DD-MM-YYYY')} | ||
</p> | ||
|
||
<div class="flex flex-row items-center gap-[2px]"> | ||
<button | ||
class:hidden={deleteConfirm == cost.id || !isTrash} | ||
class="border border-green-300 rounded text-green-600 p-[3px] w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45" | ||
on:click|stopPropagation|preventDefault={() => dispatch('restore', cost.id)} | ||
> | ||
<Icon icon="ic:round-settings-backup-restore" /> | ||
</button> | ||
<button | ||
class:hidden={deleteConfirm == cost.id} | ||
class="border border-red-300 rounded text-red-600 p-[3px] w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45" | ||
on:click|stopPropagation|preventDefault={() => (deleteConfirm = cost.id || '')} | ||
> | ||
{#if isTrash} | ||
<Icon icon="ic:baseline-delete-forever" /> | ||
{:else} | ||
<Icon icon="ph:trash-light" width="16px" /> | ||
{/if} | ||
</button> | ||
{#if deleteConfirm == cost.id} | ||
<button | ||
class="border border-yellow-300 p-[3px] rounded text-yellow-600 w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45" | ||
on:click|stopPropagation|preventDefault={() => (deleteConfirm = '')} | ||
> | ||
<Icon icon="majesticons:multiply" width="16px" /> | ||
</button> | ||
<button | ||
class="border border-green-300 p-[3px] rounded text-green-700 w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45" | ||
on:click|stopPropagation|preventDefault={() => dispatch('delete', cost.id)} | ||
> | ||
<Icon icon="teenyicons:tick-solid" width="15px" /> | ||
</button> | ||
{/if} | ||
</div> | ||
</a> | ||
{/if} | ||
</div> |
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,20 +1,22 @@ | ||
<script lang="ts"> | ||
import { get40Percent } from '$lib/utils/services' | ||
export let total: number = 0 | ||
$: _40Percent = (total * 40) / 100 | ||
$: _40Percent = get40Percent(total) | ||
</script> | ||
|
||
<div class="flex flex-col gap-1 w-full border shadow-md rounded py-1 px-2"> | ||
<div class="flex flex-row justify-between"> | ||
<p class="text-teal-600">Total:</p> | ||
<p> | ||
{total.toFixed(3)} | ||
{total.toFixed(2)} | ||
</p> | ||
</div> | ||
<div class="flex flex-row justify-between"> | ||
<p class="text-teal-600">Total with (40%):</p> | ||
<p> | ||
{(total + _40Percent).toFixed(3)} | ||
{(total + _40Percent).toFixed(2)} | ||
</p> | ||
</div> | ||
</div> |
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
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
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