diff --git a/src/models/products.ts b/src/models/products.ts index c74ffef..4268cdb 100644 --- a/src/models/products.ts +++ b/src/models/products.ts @@ -46,6 +46,7 @@ export interface PInventory { amount: any metal_id: any file_id: any + file?: ProductFile | null active: boolean show: boolean open_sell: boolean diff --git a/src/utils/productAssets.ts b/src/utils/productAssets.ts index d3c9f5a..e60ae7c 100644 --- a/src/utils/productAssets.ts +++ b/src/utils/productAssets.ts @@ -23,7 +23,8 @@ const GROUP_DEFAULT_IMAGES: Record = { مکعب: mokaabImg, سکه: sekkeImg, مس: mesImg, - [LEGACY_GROUP_KATOD]: mesImg, + [LEGACY_GROUP_KATOD]: defaultImg, + [LEGACY_GROUP_MAFTOL]: defaultImg, نقره: noghrehImg, 'سکه پارسیان': parsianImg, طلا: defaultImg, diff --git a/src/views/base/physicalReceive/components/PhysicalReceiveCartRow.vue b/src/views/base/physicalReceive/components/PhysicalReceiveCartRow.vue index 478ae3a..0af2ec0 100644 --- a/src/views/base/physicalReceive/components/PhysicalReceiveCartRow.vue +++ b/src/views/base/physicalReceive/components/PhysicalReceiveCartRow.vue @@ -1,46 +1,43 @@ + + diff --git a/src/views/base/physicalReceive/composables/useNewPhysicalRequestPage.ts b/src/views/base/physicalReceive/composables/useNewPhysicalRequestPage.ts index eb29229..5af6146 100644 --- a/src/views/base/physicalReceive/composables/useNewPhysicalRequestPage.ts +++ b/src/views/base/physicalReceive/composables/useNewPhysicalRequestPage.ts @@ -3,11 +3,13 @@ import { cloneDeep } from 'lodash' import { message } from 'ant-design-vue' import router from '@/router' import { getProductInventory } from '@/api/products' +import { getProductsCatalog } from '@/composables/useProductsCatalog' import { physicalReceiveApi } from '@/api/physicalreceive' import { tableAddress } from '@/api/address' import type { CountPInventory, PInventory } from '@/models/products' import type { Address } from '@/models/address' import { loading } from '@/utils' +import { enrichInventoryWithCatalog } from '@/utils/productAssets' import { usePhysicalReceiveShellContext } from './usePhysicalReceiveShell' export interface NewPhysicalRequestContext { @@ -71,8 +73,13 @@ export function useNewPhysicalRequestPage() { async function initProductWallet() { try { loading.value = true - items.value = (await getProductInventory()).rows - baseItems.value = cloneDeep(items.value) + const [inventory, catalog] = await Promise.all([ + getProductInventory(), + getProductsCatalog(), + ]) + const enriched = enrichInventoryWithCatalog(inventory.rows ?? [], catalog ?? []) + items.value = enriched + baseItems.value = cloneDeep(enriched) } catch (e) { console.log(e) } finally { diff --git a/src/views/base/products/components/ProductItem.vue b/src/views/base/products/components/ProductItem.vue index 5112f8b..6e57c99 100644 --- a/src/views/base/products/components/ProductItem.vue +++ b/src/views/base/products/components/ProductItem.vue @@ -15,19 +15,11 @@ diff --git a/src/views/base/products/desktop/components/DesktopProductCard.vue b/src/views/base/products/desktop/components/DesktopProductCard.vue index c426085..01913af 100644 --- a/src/views/base/products/desktop/components/DesktopProductCard.vue +++ b/src/views/base/products/desktop/components/DesktopProductCard.vue @@ -29,18 +29,11 @@