Skip to content
Commits on Source (4)
# [0.13.0](https://gitlab.pentacore.se/penta/alboneon/compare/v0.12.11...v0.13.0) (2022-11-10)
### Features
* **inventory:** [#39](https://gitlab.pentacore.se/penta/alboneon/issues/39) - Add dropdown to show the value of each respective inventory ([80f50d0](https://gitlab.pentacore.se/penta/alboneon/commit/80f50d0ba57db8b05c0c1b49f93a8ee3a936865f))
## [0.12.11](https://gitlab.pentacore.se/penta/alboneon/compare/v0.12.10...v0.12.11) (2022-11-10)
......
{
"name": "alboneon",
"version": "0.12.11",
"version": "0.13.0",
"description": "A Pen & Paper party management system",
"main": "index.js",
"repository": "https://github.com/pentacore/RPG.git",
......
......@@ -13,7 +13,18 @@
<template v-if="(variant === values.all || variant.includes(values.valuables)) && inventoryValue">
<VRow v-if="multiLine" dense class="py-0">
<VCol class="py-0">
Valuables: {{ inventoryValue }}
<VExpansionPanels flat accordion tile>
<VExpansionPanel>
<VExpansionPanelHeader class="py-0">
Valuables: {{ inventoryValue }}
</VExpansionPanelHeader>
<VExpansionPanelContent class="py-0">
<VList tile outlined dense class="py-0">
<VListItem v-for="(inv,i) in inventoryValues" :key="i" class="py-0">{{inv.name}}: {{inv.value}}</VListItem>
</VList>
</VExpansionPanelContent>
</VExpansionPanel>
</VExpansionPanels>
</VCol>
</VRow>
<template v-else>
......@@ -95,6 +106,9 @@ export default Vue.extend({
coinValue(): string {
const value = '' + this.$store.getters["party/coinage/coinValue"]
return this.formatValue(value).trim()
},
inventoryValues(): {name:string, value: string}[] {
return this.$store.getters["party/inventories/individualValues"]
}
},
methods: {
......
......@@ -3,6 +3,7 @@ import {RootState} from "~/store";
import {Enums} from "@alboneon/library/types/Enums";
import {InventoryState} from "~/store/party/inventories/state";
import {GetterTree} from "vuex";
import {formatCoinValue} from "@alboneon/library/helpers/CoinValueFormatter";
export default {
get(state: Interfaces.Inventory[]): Interfaces.Inventory[] {
......@@ -38,5 +39,22 @@ export default {
}
})
return Math.floor(value * 100) / 100
},
individualValues(state: Interfaces.Inventory[], _, rootState: RootState): {name:string, value: string}[] {
const values:{name:string, value: string}[] = []
state.filter(i => !i.settings.ignoreValue).forEach(inventory => {
let value = 0;
if (inventory.items) {
inventory.items.forEach((item: Interfaces.Item) => {
if (rootState.party.settings.inventoryValueMethod === Enums.InventoryValueMethod.SELL_VALUE) {
value += item.value * item.quantity * inventory.settings.defaultSellPrice
} else {
value += item.value * item.quantity
}
})
}
values.push({name: inventory.settings.name, value: formatCoinValue(value)})
})
return values
}
} as GetterTree<InventoryState, RootState>