some trigger handled

This commit is contained in:
2026-06-10 18:40:29 +03:30
parent 5b525bd2c7
commit 84db7b013d
13 changed files with 264 additions and 117 deletions
@@ -12,7 +12,7 @@
icon="vuesax-linear:info-circle"
size="18"
color="tertiary"
@click="$emit('openGoldModal')"
@click="$emit('openGoldModal', primaryMetalTotal)"
/>
</div>
</template>
@@ -29,13 +29,13 @@
icon="vuesax-linear:info-circle"
size="18"
color="tertiary"
@click="$emit('openGoldModal')"
@click="$emit('openGoldModal', metal)"
/>
</div>
</template>
<div class="flex mt-2 justify-center text-tertiary w-full z-20">
دارایی ریالی:
<div class="text-l mr-2 font-bold">{{ usePriceWithoutType(cashWallet) }} ریال</div>
<div class="text-l mr-2 font-bold">{{ usePriceWithoutType(totalRialValue) }} ریال</div>
<BasicIcon @click="$emit('openRialModal')" icon="vuesax-linear:info-circle" size="18" color="tertiary" />
</div>
</div>
@@ -52,14 +52,14 @@ import { resolveSummaryMetalWeight } from '@/utils/productAssets'
const { assetsSummary, loadWalletAssets } = useWalletAssets()
defineEmits<{
openGoldModal: []
openGoldModal: [metal: WalletMetalTotal]
openRialModal: []
}>()
const meta = computed(() => assetsSummary.value?.meta)
const metalTotals = computed(() => assetsSummary.value?.metal_totals ?? [])
const primaryMetalTotal = computed(() => metalTotals.value[0])
const cashWallet = computed(() => assetsSummary.value?.cash_wallet ?? 0)
const totalRialValue = computed(() => assetsSummary.value?.total_rial_value ?? 0)
const inventoryCards = computed(() => assetsSummary.value?.inventory_cards ?? [])
const countBasedInventory = computed(() =>
(assetsSummary.value?.count_products ?? []).reduce((sum, item) => sum + Number(item.quantity ?? 0), 0)
@@ -31,7 +31,14 @@
<a-divider class="!my-1" />
<BasicInfoItem
class="flex justify-between"
title="معادل ریالی مجموع دارایی ها"
title="معادل ریالی محصولات"
is-line
:value="usePrice(assetsRialValue)"
/>
<a-divider class="!my-1" />
<BasicInfoItem
class="flex justify-between"
title="مجموع دارایی ریالی"
is-line
:value="usePrice(totalRialValue)"
/>
@@ -49,7 +56,7 @@ import BasicInfoItem from '@/components/BasicPacks/BasicInfoItem.vue'
import { usePrice } from '@/utils/usePrice'
import { useWalletAssets } from '@/composables/useWalletAssets'
import type { WalletMetalTotal } from '@/models/walletAssets'
import { formatInventoryCardValue } from '@/utils/productAssets'
import { formatInventoryCardValue, assetSheetInventoryCards } from '@/utils/productAssets'
const props = defineProps<{
show: boolean
@@ -71,6 +78,7 @@ const visible = computed({
const inventoryCards = computed(() => assetsSummary.value?.inventory_cards ?? [])
const metalTotals = computed(() => assetsSummary.value?.metal_totals ?? [])
const cashWallet = computed(() => assetsSummary.value?.cash_wallet ?? 0)
const assetsRialValue = computed(() => assetsSummary.value?.assets_rial_value ?? 0)
const totalRialValue = computed(() => assetsSummary.value?.total_rial_value ?? 0)
onMounted(() => {
@@ -87,7 +95,7 @@ watch(
)
function cardsByMetal(metalId: number) {
return inventoryCards.value.filter((card) => Number(card.metal_id) === metalId)
return assetSheetInventoryCards(inventoryCards.value, metalId)
}
function formatMetalTotal(metal: WalletMetalTotal) {