feat: init cash flow
This commit is contained in:
@@ -115,10 +115,11 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"></th>
|
||||
<th scope="col">hour 1</th>
|
||||
<th scope="col">hour 2</th>
|
||||
<th scope="col">hour 3</th>
|
||||
<th scope="col">hour 4</th>
|
||||
<th scope="col">8:00</th>
|
||||
<th scope="col">9:00</th>
|
||||
<th scope="col">10:00</th>
|
||||
<th scope="col">11:00</th>
|
||||
<th>dock</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -136,6 +137,27 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {
|
||||
<option value="hat">Hat</option>
|
||||
</select>
|
||||
</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>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -215,7 +237,8 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {
|
||||
<div>
|
||||
<span v-if="heijunkaStore.meta.currentHour > 0">
|
||||
day: {{ heijunkaStore.currentDay }} | current hour:
|
||||
{{ heijunkaStore.meta.currentHour }} hours
|
||||
{{ heijunkaStore.meta.currentHour }} hours | cash flow:
|
||||
{{ heijunkaStore.cashFlow }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -359,6 +382,12 @@ li {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.factory {
|
||||
border: 2px solid var(--primary-color);
|
||||
padding: 0 1rem;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.shop {
|
||||
display: flex;
|
||||
border: 2px solid var(--primary-color);
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export const NUMBER_OF_DAYS = 3
|
||||
export const NUMBER_OF_HOURS_PER_DAY = 4
|
||||
export const INITIAL_CASH_FLOW = 20
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
INITIAL_CASH_FLOW,
|
||||
NUMBER_OF_DAYS,
|
||||
NUMBER_OF_HOURS_PER_DAY
|
||||
} from '@/modules/heijkunka/heijunka-config'
|
||||
@@ -20,7 +21,6 @@ type Inventory = {
|
||||
}
|
||||
|
||||
type HeijunkaState = {
|
||||
money: number
|
||||
inventory: Inventory
|
||||
orders: Order[]
|
||||
meta: {
|
||||
@@ -52,7 +52,6 @@ const initialInventory: Inventory = {
|
||||
|
||||
export const useHeijunkaStore = defineStore('heijunka', {
|
||||
state: (): HeijunkaState => ({
|
||||
money: 100,
|
||||
inventory: { ...initialInventory },
|
||||
orders: [],
|
||||
meta: {
|
||||
@@ -141,6 +140,10 @@ export const useHeijunkaStore = defineStore('heijunka', {
|
||||
getters: {
|
||||
currentDay: (state) =>
|
||||
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 => ({
|
||||
shirt: Math.max(
|
||||
state.inventory.shirt -
|
||||
|
||||
Reference in New Issue
Block a user