feat: init cash flow
This commit is contained in:
@@ -115,10 +115,11 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"></th>
|
<th scope="col"></th>
|
||||||
<th scope="col">hour 1</th>
|
<th scope="col">8:00</th>
|
||||||
<th scope="col">hour 2</th>
|
<th scope="col">9:00</th>
|
||||||
<th scope="col">hour 3</th>
|
<th scope="col">10:00</th>
|
||||||
<th scope="col">hour 4</th>
|
<th scope="col">11:00</th>
|
||||||
|
<th>dock</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -136,6 +137,27 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {
|
|||||||
<option value="hat">Hat</option>
|
<option value="hat">Hat</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
class="icon icon-tabler icons-tabler-outline icon-tabler-truck"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
|
<path d="M5 17a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
|
||||||
|
<path d="M15 17a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
|
||||||
|
<path
|
||||||
|
d="M5 17h-2v-11a1 1 0 0 1 1 -1h9v12m-4 0h6m4 0h2v-6h-8m0 -5h5l3 5"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -215,7 +237,8 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {
|
|||||||
<div>
|
<div>
|
||||||
<span v-if="heijunkaStore.meta.currentHour > 0">
|
<span v-if="heijunkaStore.meta.currentHour > 0">
|
||||||
day: {{ heijunkaStore.currentDay }} | current hour:
|
day: {{ heijunkaStore.currentDay }} | current hour:
|
||||||
{{ heijunkaStore.meta.currentHour }} hours
|
{{ heijunkaStore.meta.currentHour }} hours | cash flow:
|
||||||
|
{{ heijunkaStore.cashFlow }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -359,6 +382,12 @@ li {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.factory {
|
||||||
|
border: 2px solid var(--primary-color);
|
||||||
|
padding: 0 1rem;
|
||||||
|
margin: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
.shop {
|
.shop {
|
||||||
display: flex;
|
display: flex;
|
||||||
border: 2px solid var(--primary-color);
|
border: 2px solid var(--primary-color);
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export const NUMBER_OF_DAYS = 3
|
export const NUMBER_OF_DAYS = 3
|
||||||
export const NUMBER_OF_HOURS_PER_DAY = 4
|
export const NUMBER_OF_HOURS_PER_DAY = 4
|
||||||
|
export const INITIAL_CASH_FLOW = 20
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
INITIAL_CASH_FLOW,
|
||||||
NUMBER_OF_DAYS,
|
NUMBER_OF_DAYS,
|
||||||
NUMBER_OF_HOURS_PER_DAY
|
NUMBER_OF_HOURS_PER_DAY
|
||||||
} from '@/modules/heijkunka/heijunka-config'
|
} from '@/modules/heijkunka/heijunka-config'
|
||||||
@@ -20,7 +21,6 @@ type Inventory = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type HeijunkaState = {
|
type HeijunkaState = {
|
||||||
money: number
|
|
||||||
inventory: Inventory
|
inventory: Inventory
|
||||||
orders: Order[]
|
orders: Order[]
|
||||||
meta: {
|
meta: {
|
||||||
@@ -52,7 +52,6 @@ const initialInventory: Inventory = {
|
|||||||
|
|
||||||
export const useHeijunkaStore = defineStore('heijunka', {
|
export const useHeijunkaStore = defineStore('heijunka', {
|
||||||
state: (): HeijunkaState => ({
|
state: (): HeijunkaState => ({
|
||||||
money: 100,
|
|
||||||
inventory: { ...initialInventory },
|
inventory: { ...initialInventory },
|
||||||
orders: [],
|
orders: [],
|
||||||
meta: {
|
meta: {
|
||||||
@@ -141,6 +140,10 @@ export const useHeijunkaStore = defineStore('heijunka', {
|
|||||||
getters: {
|
getters: {
|
||||||
currentDay: (state) =>
|
currentDay: (state) =>
|
||||||
Math.ceil(state.meta.currentHour / NUMBER_OF_HOURS_PER_DAY),
|
Math.ceil(state.meta.currentHour / NUMBER_OF_HOURS_PER_DAY),
|
||||||
|
cashFlow: (state) =>
|
||||||
|
INITIAL_CASH_FLOW -
|
||||||
|
state.meta.currentHour * 3 +
|
||||||
|
state.orders.filter((o) => o.status === 'received').length * 4,
|
||||||
remainingInventory: (state): Inventory => ({
|
remainingInventory: (state): Inventory => ({
|
||||||
shirt: Math.max(
|
shirt: Math.max(
|
||||||
state.inventory.shirt -
|
state.inventory.shirt -
|
||||||
|
|||||||
Reference in New Issue
Block a user