- {`${widgetsRole?.role?.label || 'Users'}'s widgets`}
-
- )}
-
-
- {(isFetchingQuery || loading) && (
-
- {' '}
- Loading widgets...
-
- )}
-
- { rolesWidgets &&
- rolesWidgets.map((widget) => (
-
- ))}
-
-
- {!!rolesWidgets.length &&
-
-
- {hasPermission(currentUser, 'READ_USERS') &&
-
-
-
-
- Users
-
-
- {users}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_ROLES') &&
-
-
-
-
- Roles
-
-
- {roles}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_PERMISSIONS') &&
-
-
-
-
- Permissions
-
-
- {permissions}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_STAFF_ROLES') &&
-
-
-
-
- Staff roles
-
-
- {staff_roles}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_CUSTOMERS') &&
-
-
-
-
- Customers
-
-
- {customers}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_TABLES') &&
-
-
-
-
- Tables
-
-
- {tables}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_RESERVATIONS') &&
-
-
-
-
- Reservations
-
-
- {reservations}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_TABS') &&
-
-
-
-
- Tabs
-
-
- {tabs}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_LINE_ITEMS') &&
-
-
-
-
- Line items
-
-
- {line_items}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_MENU_ITEMS') &&
-
-
-
-
- Menu items
-
-
- {menu_items}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_INVENTORY_ITEMS') &&
-
-
-
-
- Inventory items
-
-
- {inventory_items}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_SUPPLIERS') &&
-
-
-
-
- Suppliers
-
-
- {suppliers}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_PAYMENTS') &&
-
-
-
-
- Payments
-
-
- {payments}
-
-
-
-
-
-
-
- }
-
- {hasPermission(currentUser, 'READ_PROMOTIONS') &&
-
-
-
-
- Promotions
-
-
- {promotions}
-
-
-
-
-
-
-
- }
-
-
-
>
)
diff --git a/frontend/src/stores/openAiSlice.ts b/frontend/src/stores/openAiSlice.ts
index 1328235..2443b72 100644
--- a/frontend/src/stores/openAiSlice.ts
+++ b/frontend/src/stores/openAiSlice.ts
@@ -4,7 +4,7 @@ import axios from 'axios';
interface MainState {
isFetchingQuery: boolean;
errorMessage: string;
- smartWidgets: any[];
+
gptResponse: string | null;
aiResponse: any | null;
isAskingQuestion: boolean;
@@ -18,7 +18,7 @@ interface MainState {
const initialState: MainState = {
isFetchingQuery: false,
errorMessage: '',
- smartWidgets: [],
+
gptResponse: null,
aiResponse: null,
isAskingQuestion: false,
@@ -36,20 +36,6 @@ const fulfilledNotify = (state, msg, type?: string) => {
state.notify.showNotification = true;
};
-export const aiPrompt = createAsyncThunk(
- 'openai/aiPrompt',
- async (data: any, { rejectWithValue }) => {
- try {
- return await axios.post('/openai/create_widget', data);
- } catch (error) {
- if (!error.response) {
- throw error;
- }
- return rejectWithValue(error.response.data);
- }
- },
-);
-
export const askGpt = createAsyncThunk(
'openai/askGpt',
async (prompt: string, { rejectWithValue }) => {
@@ -94,21 +80,6 @@ export const openAiSlice = createSlice({
},
},
extraReducers: (builder) => {
- builder.addCase(aiPrompt.pending, (state) => {
- state.isFetchingQuery = true;
- });
- builder.addCase(aiPrompt.fulfilled, (state, action: Record