Skip to content
Merged
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
351 changes: 263 additions & 88 deletions client/src/App.vue

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions client/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,15 @@ export const api = {
async getPurchaseOrderByBacklogItem(backlogItemId) {
const response = await axios.get(`${API_BASE_URL}/purchase-orders/${backlogItemId}`)
return response.data
},

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

async createRestockingOrder(items) {
const response = await axios.post(`${API_BASE_URL}/orders`, { items })
return response.data
}
}
4 changes: 2 additions & 2 deletions client/src/components/LanguageSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const selectLanguage = (locale) => {

.dropdown-menu {
position: absolute;
top: calc(100% + 0.5rem);
right: 0;
bottom: calc(100% + 0.5rem);
left: 0;
min-width: 160px;
background: white;
border: 1px solid #e2e8f0;
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ProfileMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ const handleLogout = () => {

.dropdown-menu {
position: absolute;
top: calc(100% + 0.5rem);
right: 0;
bottom: calc(100% + 0.5rem);
left: 0;
min-width: 280px;
background: white;
border: 1px solid #e2e8f0;
Expand Down
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
64 changes: 62 additions & 2 deletions client/src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<div class="card">
<div class="card-header">
<h3 class="card-title">{{ t('orders.allOrders') }} ({{ orders.length }})</h3>
<h3 class="card-title">{{ t('orders.allOrders') }} ({{ customerOrders.length }})</h3>
</div>
<div class="table-container">
<table class="orders-table">
Expand All @@ -45,7 +45,7 @@
</tr>
</thead>
<tbody>
<tr v-for="order in orders" :key="order.id">
<tr v-for="order in customerOrders" :key="order.id">
<td class="col-order-number"><strong>{{ order.order_number }}</strong></td>
<td class="col-customer">{{ translateCustomerName(order.customer) }}</td>
<td class="col-items">
Expand Down Expand Up @@ -74,6 +74,52 @@
</table>
</div>
</div>

<div v-if="submittedOrders.length > 0" class="card submitted-orders-card">
<div class="card-header">
<h3 class="card-title">Submitted Restocking Orders ({{ submittedOrders.length }})</h3>
</div>
<div class="table-container">
<table class="orders-table">
<thead>
<tr>
<th class="col-order-number">Order #</th>
<th class="col-customer">Type</th>
<th class="col-items">Items</th>
<th class="col-status">Status</th>
<th class="col-date">Order Date</th>
<th class="col-date">Expected Delivery</th>
<th class="col-value">Total Value</th>
Comment on lines +86 to +92
</tr>
</thead>
<tbody>
<tr v-for="order in submittedOrders" :key="order.id">
<td class="col-order-number"><strong>{{ order.order_number }}</strong></td>
<td class="col-customer">{{ order.customer }}</td>
<td class="col-items">
<details class="items-details">
<summary class="items-summary">
{{ order.items.length }} item{{ order.items.length !== 1 ? 's' : '' }}
</summary>
Comment on lines +101 to +103
<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 }} @ ${{ item.unit_price }}</span>
Comment on lines +106 to +107
</div>
</div>
</details>
</td>
<td class="col-status">
<span class="badge info">Submitted</span>
</td>
<td class="col-date">{{ formatDate(order.order_date) }}</td>
<td class="col-date">{{ formatDate(order.expected_delivery) }}</td>
<td class="col-value"><strong>{{ currencySymbol }}{{ order.total_value.toLocaleString() }}</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</template>
Expand All @@ -96,6 +142,14 @@ export default {
const error = ref(null)
const orders = ref([])

const submittedOrders = computed(() =>
orders.value.filter(o => o.status === 'Submitted')
)

const customerOrders = computed(() =>
orders.value.filter(o => o.status !== 'Submitted')
)

// Use shared filters
const {
selectedPeriod,
Expand Down Expand Up @@ -160,6 +214,8 @@ export default {
loading,
error,
orders,
submittedOrders,
customerOrders,
getOrdersByStatus,
getOrderStatusClass,
formatDate,
Expand Down Expand Up @@ -276,4 +332,8 @@ export default {
font-size: 0.813rem;
color: #64748b;
}

.submitted-orders-card {
margin-top: 1.5rem;
}
</style>
Loading
Loading