feat: analytic

This commit is contained in:
ferdiansyah783
2025-08-08 17:59:39 +07:00
parent 7beee4c3a1
commit 67b747f0ff
34 changed files with 1227 additions and 2834 deletions
+3 -1
View File
@@ -4,12 +4,14 @@ import { configureStore } from '@reduxjs/toolkit'
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'
export const store = configureStore({
reducer: {
productReducer,
customerReducer,
paymentMethodReducer
paymentMethodReducer,
ingredientReducer
},
middleware: getDefaultMiddleware => getDefaultMiddleware({ serializableCheck: false })
})
+52
View File
@@ -0,0 +1,52 @@
// Third-party Imports
import type { PayloadAction } from '@reduxjs/toolkit'
import { createSlice } from '@reduxjs/toolkit'
// Type Imports
// Data Imports
import { IngredientItem } from '../../types/services/ingredient'
const initialState: { currentIngredient: IngredientItem } = {
currentIngredient: {
id: '',
organization_id: '',
outlet_id: '',
name: '',
unit_id: '',
cost: 0,
stock: 0,
is_semi_finished: false,
is_active: true,
metadata: {},
created_at: '',
updated_at: '',
unit: {
id: '',
organization_id: '',
outlet_id: '',
name: '',
abbreviation: '',
is_active: false,
created_at: '',
updated_at: ''
}
}
}
export const ingredientSlice = createSlice({
name: 'ingredient',
initialState,
reducers: {
setIngredient: (state, action: PayloadAction<IngredientItem>) => {
state.currentIngredient = action.payload
},
resetIngredient: state => {
state.currentIngredient = initialState.currentIngredient
}
}
})
export const { setIngredient, resetIngredient } = ingredientSlice.actions
export default ingredientSlice.reducer