fix: user management & profit chart

This commit is contained in:
ferdiansyah783
2025-08-10 15:47:04 +07:00
parent de93de2e6d
commit 48570c018f
23 changed files with 989 additions and 599 deletions
+3 -1
View File
@@ -5,13 +5,15 @@ import productReducer from '@/redux-store/slices/product'
import customerReducer from '@/redux-store/slices/customer'
import paymentMethodReducer from '@/redux-store/slices/paymentMethod'
import ingredientReducer from '@/redux-store/slices/ingredient'
import orderReducer from '@/redux-store/slices/order'
export const store = configureStore({
reducer: {
productReducer,
customerReducer,
paymentMethodReducer,
ingredientReducer
ingredientReducer,
orderReducer
},
middleware: getDefaultMiddleware => getDefaultMiddleware({ serializableCheck: false })
})
+64
View File
@@ -0,0 +1,64 @@
// Third-party Imports
import type { PayloadAction } from '@reduxjs/toolkit'
import { createSlice } from '@reduxjs/toolkit'
// Type Imports
// Data Imports
import { Order } from '../../types/services/order'
const initialState: { currentOrder: Order } = {
currentOrder: {
id: '',
order_number: '',
outlet_id: '',
user_id: '',
table_number: '',
order_type: '',
status: '',
subtotal: 0,
tax_amount: 0,
discount_amount: 0,
total_amount: 0,
total_cost: 0,
remaining_amount: 0,
payment_status: '',
refund_amount: 0,
is_void: false,
is_refund: false,
notes: '',
metadata: {
customer_name: '',
last_split_amount: 0,
last_split_customer_id: '',
last_split_customer_name: '',
last_split_payment_id: '',
last_split_quantities: {},
last_split_type: ''
},
created_at: '',
updated_at: '',
order_items: [],
payments: [],
total_paid: 0,
payment_count: 0,
split_type: ''
}
}
export const orderSlice = createSlice({
name: 'order',
initialState,
reducers: {
setOrder: (state, action: PayloadAction<Order>) => {
state.currentOrder = action.payload
},
resetOrder: state => {
state.currentOrder = initialState.currentOrder
}
}
})
export const { setOrder, resetOrder } = orderSlice.actions
export default orderSlice.reducer