diff --git a/src/App.js b/src/App.js index 5da5f07..825e739 100644 --- a/src/App.js +++ b/src/App.js @@ -23,6 +23,8 @@ import GuestSideLogin from "./pages/GuestSideLogin"; import GuestSide from "./pages/GuestSide"; import { getItemTypesWithItems } from "./helpers/itemHelper.js"; +import MaterialList from "./pages/MaterialList"; + import { getConnectedGuestSides, getClerks, @@ -115,6 +117,17 @@ function App() { }); } + //for guest + socket.on("transaction_pending", async (data) => { + console.log("transaction notification"); + setModal("transaction_pending"); + }); + socket.on("transaction_success", async (data) => { + console.log("transaction notification"); + setModal("transaction_success"); + }); + + //for clerk socket.on("transaction_created", async (data) => { console.log("transaction notification"); setModal("new_transaction"); @@ -136,7 +149,7 @@ function App() { } else { setDeviceType("guestDevice"); } - if (data.data.user.roleId == 1) { + if (data.data.user.roleId == 1 && user.userId == shop.ownerId) { // shopClerks is can only be obtained by the shop owner // so every user that is admin will try to getting shopClerks, even not yet proven that this is their shop const shopClerks = await getClerks(shopId); @@ -209,7 +222,9 @@ function App() { } + element={ + + } /> } /> - - +