Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ npm install && npm run dev
3. Update Pydantic models when changing JSON data structure
4. Inventory filters don't support month (no time dimension)
5. Revenue goals: $800K/month single, $9.6M YTD all months
6. Always document non-obvious logic changes with comments

## File Locations
- Views: `client/src/views/*.vue`
Expand Down
3 changes: 3 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<router-link to="/reports" :class="{ active: $route.path === '/reports' }">
Reports
</router-link>
<router-link to="/restocking" :class="{ active: $route.path === '/restocking' }">
Restocking
</router-link>
</nav>
<LanguageSwitcher />
<ProfileMenu
Expand Down
18 changes: 18 additions & 0 deletions client/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,23 @@ export const api = {
async getPurchaseOrderByBacklogItem(backlogItemId) {
const response = await axios.get(`${API_BASE_URL}/purchase-orders/${backlogItemId}`)
return response.data
},

async getRestockRecommendations(budget) {
const params = new URLSearchParams()
if (budget !== undefined && budget !== null) params.append('budget', budget)

const response = await axios.get(`${API_BASE_URL}/restocking/recommendations?${params.toString()}`)
return response.data
},

async submitRestockingOrder(orderData) {
const response = await axios.post(`${API_BASE_URL}/restocking/orders`, orderData)
return response.data
},

async getRestockingOrders() {
const response = await axios.get(`${API_BASE_URL}/restocking/orders`)
return response.data
}
}
4 changes: 3 additions & 1 deletion client/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Orders from './views/Orders.vue'
import Demand from './views/Demand.vue'
import Spending from './views/Spending.vue'
import Reports from './views/Reports.vue'
import Restocking from './views/Restocking.vue'

const router = createRouter({
history: createWebHistory(),
Expand All @@ -16,7 +17,8 @@ const router = createRouter({
{ path: '/orders', component: Orders },
{ path: '/demand', component: Demand },
{ path: '/spending', component: Spending },
{ path: '/reports', component: Reports }
{ path: '/reports', component: Reports },
{ path: '/restocking', component: Restocking }
]
})

Expand Down
75 changes: 74 additions & 1 deletion client/src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,49 @@
</table>
</div>
</div>

<div class="card">
<div class="card-header">
<h3 class="card-title">Submitted Orders ({{ restockingOrders.length }})</h3>
</div>
<div v-if="restockingOrders.length === 0" class="empty-state">
No restocking orders have been submitted yet.
</div>
<div v-else class="table-container">
<table class="restocking-orders-table">
<thead>
<tr>
<th class="col-order-number">Order Number</th>
<th class="col-items">Items</th>
<th class="col-value">Total Value</th>
<th class="col-lead-time">Lead Time (days)</th>
<th class="col-date">Expected Delivery</th>
</tr>
</thead>
<tbody>
<tr v-for="order in restockingOrders" :key="order.id">
<td class="col-order-number"><strong>{{ order.order_number }}</strong></td>
<td class="col-items">
<details class="items-details">
<summary class="items-summary">
{{ order.items.length }} item{{ order.items.length === 1 ? '' : 's' }}
</summary>
<div class="items-dropdown">
<div v-for="(item, idx) in order.items" :key="idx" class="item-entry">
<span class="item-name">{{ item.name }}</span>
<span class="item-meta">Qty: {{ item.quantity }} @ {{ currencySymbol }}{{ item.unit_price }}</span>
</div>
</div>
</details>
</td>
<td class="col-value"><strong>{{ currencySymbol }}{{ order.total_value.toLocaleString() }}</strong></td>
<td class="col-lead-time">{{ order.lead_time_days }}</td>
<td class="col-date">{{ formatDate(order.expected_delivery) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</template>
Expand All @@ -95,6 +138,7 @@ export default {
const loading = ref(true)
const error = ref(null)
const orders = ref([])
const restockingOrders = ref([])

// Use shared filters
const {
Expand Down Expand Up @@ -124,6 +168,14 @@ export default {
}
}

const loadRestockingOrders = async () => {
try {
restockingOrders.value = await api.getRestockingOrders()
} catch (err) {
console.error('Failed to load restocking orders:', err)
}
}

// Watch for filter changes and reload data
watch([selectedPeriod, selectedLocation, selectedCategory, selectedStatus], () => {
loadOrders()
Expand Down Expand Up @@ -153,13 +205,17 @@ export default {
})
}

onMounted(loadOrders)
onMounted(() => {
loadOrders()
loadRestockingOrders()
})

return {
t,
loading,
error,
orders,
restockingOrders,
getOrdersByStatus,
getOrderStatusClass,
formatDate,
Expand Down Expand Up @@ -276,4 +332,21 @@ export default {
font-size: 0.813rem;
color: #64748b;
}

/* Submitted (restocking) orders table */
.restocking-orders-table {
table-layout: fixed;
width: 100%;
}

.col-lead-time {
width: 140px;
}

.empty-state {
padding: 2rem;
text-align: center;
color: #64748b;
font-size: 0.938rem;
}
</style>
Loading