diff --git a/backend/mobile/mobile.routes.ts b/backend/mobile/mobile.routes.ts index 996628e..b9fb924 100644 --- a/backend/mobile/mobile.routes.ts +++ b/backend/mobile/mobile.routes.ts @@ -1,4 +1,5 @@ import type { Express } from "express"; +import { featureCheck } from "../middleware/featureActive.middleware.js"; import available from "./availableScanIds.route.js"; import downloads from "./downloadApps.route.js"; import lanes from "./laneCheck.js"; @@ -10,13 +11,13 @@ import version from "./version.route.js"; export const setupMobileRoutes = (baseUrl: string, app: Express) => { //stats will be like this as we dont need to change this - app.use(`${baseUrl}/api/mobile/version`, version); - app.use(`${baseUrl}/api/mobile/apk`, downloads); - app.use(`${baseUrl}/api/mobile/logs`, logs); - app.use(`${baseUrl}/api/mobile/auth`, authPin); - app.use(`${baseUrl}/api/mobile/pin`, newPin); - app.use(`${baseUrl}/api/mobile/laneCheck`, lanes); - app.use(`${baseUrl}/api/mobile/available`, available); + app.use(`${baseUrl}/api/mobile/version`, featureCheck("mobile"), version); + app.use(`${baseUrl}/api/mobile/apk`, featureCheck("mobile"), downloads); + app.use(`${baseUrl}/api/mobile/logs`, featureCheck("mobile"), logs); + app.use(`${baseUrl}/api/mobile/auth`, featureCheck("mobile"), authPin); + app.use(`${baseUrl}/api/mobile/pin`, featureCheck("mobile"), newPin); + app.use(`${baseUrl}/api/mobile/laneCheck`, featureCheck("mobile"), lanes); + app.use(`${baseUrl}/api/mobile/available`, featureCheck("mobile"), available); // all other system should be under /api/system/* }; diff --git a/frontend/public/imgs/docs/mobile/critical_update.png b/frontend/public/imgs/docs/mobile/critical_update.png new file mode 100644 index 0000000..db4c501 Binary files /dev/null and b/frontend/public/imgs/docs/mobile/critical_update.png differ diff --git a/frontend/public/imgs/docs/mobile/ehs_homeScreen.png b/frontend/public/imgs/docs/mobile/ehs_homeScreen.png new file mode 100644 index 0000000..8be0d27 Binary files /dev/null and b/frontend/public/imgs/docs/mobile/ehs_homeScreen.png differ diff --git a/frontend/public/imgs/docs/mobile/ehs_menu.png b/frontend/public/imgs/docs/mobile/ehs_menu.png new file mode 100644 index 0000000..1d4922f Binary files /dev/null and b/frontend/public/imgs/docs/mobile/ehs_menu.png differ diff --git a/frontend/public/imgs/docs/mobile/stagenow.png b/frontend/public/imgs/docs/mobile/stagenow.png new file mode 100644 index 0000000..e75418c Binary files /dev/null and b/frontend/public/imgs/docs/mobile/stagenow.png differ diff --git a/frontend/public/imgs/docs/mobile/test2-1.png b/frontend/public/imgs/docs/mobile/test2-1.png new file mode 100644 index 0000000..5cb8127 Binary files /dev/null and b/frontend/public/imgs/docs/mobile/test2-1.png differ diff --git a/frontend/public/imgs/docs/mobile/test2-2.png b/frontend/public/imgs/docs/mobile/test2-2.png new file mode 100644 index 0000000..143d998 Binary files /dev/null and b/frontend/public/imgs/docs/mobile/test2-2.png differ diff --git a/frontend/public/imgs/docs/mobile/test2-3.png b/frontend/public/imgs/docs/mobile/test2-3.png new file mode 100644 index 0000000..a34778a Binary files /dev/null and b/frontend/public/imgs/docs/mobile/test2-3.png differ diff --git a/frontend/public/imgs/docs/mobile/tools.png b/frontend/public/imgs/docs/mobile/tools.png new file mode 100644 index 0000000..19214f4 Binary files /dev/null and b/frontend/public/imgs/docs/mobile/tools.png differ diff --git a/frontend/public/imgs/docs/mobile/update.png b/frontend/public/imgs/docs/mobile/update.png new file mode 100644 index 0000000..a2e73f6 Binary files /dev/null and b/frontend/public/imgs/docs/mobile/update.png differ diff --git a/frontend/public/stage-now/test2-stageNow.pdf b/frontend/public/stage-now/test2-stageNow.pdf new file mode 100644 index 0000000..d463830 Binary files /dev/null and b/frontend/public/stage-now/test2-stageNow.pdf differ diff --git a/frontend/src/components/Sidebar/DocBar.tsx b/frontend/src/components/Sidebar/DocBar.tsx index ab0ab6b..2a0cc36 100644 --- a/frontend/src/components/Sidebar/DocBar.tsx +++ b/frontend/src/components/Sidebar/DocBar.tsx @@ -1,11 +1,12 @@ +import { useSuspenseQuery } from "@tanstack/react-query"; import { Link, useRouterState } from "@tanstack/react-router"; -import { ChevronRight } from "lucide-react"; +import { ChevronRight, ScrollText } from "lucide-react"; +import { getSettings } from "../../lib/queries/getSettings"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "../ui/collapsible"; - import { SidebarGroup, SidebarGroupContent, @@ -19,43 +20,55 @@ import { useSidebar, } from "../ui/sidebar"; -const docs = [ - { - title: "Notifications", - url: "/intro", - //icon, - isActive: window.location.pathname.includes("notifications") ?? false, - items: [ - { - title: "Reprints", - url: "/reprints", - }, - { - title: "New Blocking order", - url: "/qualityBlocking", - }, - ], - }, - { - title: "Mobile", - url: "/updateInstructions", - isActive: false, - items: [ - { - title: "Settings", - url: "/mobile-settings", - }, - ], - }, -]; export default function DocBar() { const { setOpen } = useSidebar(); + const { data: settings, isLoading } = useSuspenseQuery(getSettings()); const pathname = useRouterState({ select: (s) => s.location.pathname, }); const isNotifications = pathname.includes("notifications"); + const docs = [ + { + title: "Notifications", + url: "notifications/intro", + //icon, + isActive: true, + items: [ + { + title: "Reprints", + icon: ScrollText, + url: "notifications/reprints", + }, + { + title: "New Blocking order", + icon: ScrollText, + url: "notifications/qualityBlocking", + }, + ], + }, + { + title: "Mobile", + url: "mobile/updateInstructions", + isActive: + !isLoading && + settings.filter((n: any) => n.name === "mobile")[0].active, + items: [ + { + title: "Update Instructions", + icon: ScrollText, + url: "mobile/updateInstructions", + }, + // { + // title: "Settings", + // icon: ScrollText, + // url: "mobile/mobile-settings", + // }, + ], + }, + ]; + return ( Docs @@ -72,42 +85,45 @@ export default function DocBar() { {docs.map((item) => ( - - - - - - {item.title} - - - - - - - {item.items?.map((subItem) => ( - - - - {subItem.title} - - - - ))} - - - - + <> + {item.isActive && ( + + + + + + {item.title} + + + + + + + {item.items?.map((subItem) => ( + + + setOpen(false)} + > + + {subItem.title} + + + + ))} + + + + + )} + ))} diff --git a/frontend/src/components/Sidebar/MobileBar.tsx b/frontend/src/components/Sidebar/MobileBar.tsx index 50c2c0b..b08c198 100644 --- a/frontend/src/components/Sidebar/MobileBar.tsx +++ b/frontend/src/components/Sidebar/MobileBar.tsx @@ -1,5 +1,5 @@ import { Link } from "@tanstack/react-router"; -import { ScanText, ScrollText } from "lucide-react"; +import { ScanText } from "lucide-react"; import { SidebarGroup, SidebarGroupContent, @@ -10,14 +10,14 @@ import { useSidebar, } from "../ui/sidebar"; -export default function MobileBar({ session }: any) { +export default function MobileBar() { const { setOpen } = useSidebar(); const items = [ - { - title: "Update Instructions", - url: "/", - icon: ScrollText, - }, + // { + // title: "Update Instructions", + // url: "/", + // icon: ScrollText, + // }, { title: "Scan Log", url: "/", diff --git a/frontend/src/components/Sidebar/sidebar.tsx b/frontend/src/components/Sidebar/sidebar.tsx index 243f302..9ff0046 100644 --- a/frontend/src/components/Sidebar/sidebar.tsx +++ b/frontend/src/components/Sidebar/sidebar.tsx @@ -1,3 +1,4 @@ +import { useSuspenseQuery } from "@tanstack/react-query"; import { Sidebar, SidebarContent, @@ -6,12 +7,14 @@ import { SidebarMenuItem, } from "@/components/ui/sidebar"; import { useSession } from "@/lib/auth-client"; +import { getSettings } from "../../lib/queries/getSettings"; import AdminSidebar from "./AdminBar"; import DocBar from "./DocBar"; import MobileBar from "./MobileBar"; export function AppSidebar() { const { data: session } = useSession(); + const { data: settings, isLoading } = useSuspenseQuery(getSettings()); return ( - + {!isLoading && + settings.filter((n: any) => n.name === "mobile")[0].active && ( + + )} + {session && (session.user.role === "admin" || session.user.role === "systemAdmin" || diff --git a/frontend/src/docs/mobile/updateInstructions.tsx b/frontend/src/docs/mobile/updateInstructions.tsx new file mode 100644 index 0000000..3feb373 --- /dev/null +++ b/frontend/src/docs/mobile/updateInstructions.tsx @@ -0,0 +1,137 @@ +import { useMutation } from "@tanstack/react-query"; +import { Button } from "../../components/ui/button"; +import { Separator } from "../../components/ui/separator"; + +export default function UpdateInstructions() { + const getFile = useMutation({ + mutationFn: async () => { + // 1. Fetch the file from the public folder + const response = await fetch( + `/lst/app/stage-now/${window.LST_CONFIG?.server}-stageNow.pdf`, + ); + if (!response.ok) throw new Error("Network response was not ok"); + + // 2. Convert to blob + return await response.blob(); + }, + onSuccess: (blob) => { + // 3. Create a temporary anchor element to trigger download + const url = window.URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = url; + a.download = `${window.LST_CONFIG?.server}-stageNow.pdf`; // Desired filename + document.body.appendChild(a); + a.click(); + + // 4. Cleanup + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + }, + }); + + return ( +
+
+
+
+

+ Updating the lst mobile scanner app +

+

+ NOTE: LST Mobile only works on TC8300 +

+
+
+ +
+
+ +
+

+ How to know the scanner has an update? +

+

+ The bottom part of the scanner will show a red or orange bar + indicating there is an update. As shown below +

+
+
+ Home +
+ +
+ Home +
+
+
+ + +
+

+ To update the scanner follow the below steps. +

+

Step 1) Tap the 3 dots top right of the home screen

+ Home +

Step 2) Tap tools

+ Home +

Step 3) Tap Stage Now

+ Home +

+ Step 4) Scan the 3 barcode's to the right or from the printed sheet +

+ Home +
+
+
+

Scan Commands

+ +
+ Home + Home + Home +
+
+
+ ); +} diff --git a/frontend/src/docs/notifications/updateInstructions.tsx b/frontend/src/docs/notifications/updateInstructions.tsx deleted file mode 100644 index e972a5a..0000000 --- a/frontend/src/docs/notifications/updateInstructions.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function updateInstructions() { - return
updateInstructions
; -} diff --git a/frontend/src/lib/docs.ts b/frontend/src/lib/docs.ts index 8479cff..408deb8 100644 --- a/frontend/src/lib/docs.ts +++ b/frontend/src/lib/docs.ts @@ -13,9 +13,7 @@ const docsMap: Record = {}; for (const path in modules) { const mod = modules[path] as DocModule; - const slug = path - .replace("../docs/", "") - .replace(".tsx", ""); + const slug = path.replace("../docs/", "").replace(".tsx", ""); // "notifications/intro" docsMap[slug] = mod.default; @@ -23,4 +21,4 @@ for (const path in modules) { export function getDoc(slug: string) { return docsMap[slug]; -} \ No newline at end of file +}