Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Edwin950821/BodegaX/llms.txt

Use this file to discover all available pages before exploring further.

The Settings page (/settings) is the administrative control centre for BodegaX. It surfaces user management tools, the workday-termination flow, and sidebar navigation toggles — all in a single, auth-guarded view. Only users whose session carries role: 'admin' should access this page; regular warehouse users are directed away by the application’s route and UI logic. This page covers session management, sidebar configuration, browser compatibility, screen-resolution requirements, and the API base URL — the operational details that keep BodegaX running smoothly day to day.
User creation, editing, and deletion are covered in depth on the User Management page. This page focuses on the broader system-level settings and configuration concerns.

Accessing the Settings Page

The Settings route (/settings) is protected by CheckLoginGuard, which redirects unauthenticated visitors to /login. Once authenticated, the component reads the active session from sessionStorage['bodegax'] on initialisation:
user5 = JSON.parse(sessionStorage.getItem("bodegax") || "{'role': ''}");
The logged-in user’s nombre field is displayed in the top-right corner of the page header. The Terminar Jornada button is always present on this page — because the Settings page itself is the admin-only area, no additional *ngIf role check is applied to the button within the template.

Session Management

BodegaX sessions live entirely in the browser’s sessionStorage under the key "bodegax". The session object is a serialised JSON document that includes the user’s nombre, role, uuid, and other account fields written by AppService.logIn() at authentication time.

Logging Out

Calling AppService.logOut() performs four actions in sequence:
logOut() {
  sessionStorage.removeItem('bodegax'); // 1. Erase the session token
  this.isLogged.next(false);            // 2. Broadcast logged-out state to all subscribers
  this.role.next('client');             // 3. Reset the role observable to its default
  this.router.navigate(['/login']);     // 4. Navigate to the login screen
}
After logOut() completes, any component still subscribed to isLogged$ or role$ receives the updated values immediately thanks to the BehaviorSubject pattern.
When switching between an admin account and a user account during testing or support work, always click Log Out first to clear the current session before logging in with different credentials. Because BodegaX stores its session in sessionStorage (not localStorage), the session is automatically discarded when the browser tab is closed — but within the same tab, an explicit logout is required to switch accounts cleanly.
Every page in BodegaX features a collapsible left sidebar. Its open/closed state is managed centrally by AppService using a BehaviorSubject<boolean> so that all pages stay in sync regardless of which component triggers the toggle.

AppService Sidebar API

// Observable — components subscribe to reactively update the layout
get showSidebar$(): Observable<boolean> {
  return this.showSidebar.asObservable();
}

// Toggle between open and closed
toggleSidebar() {
  if (this.showSidebar.getValue()) {
    this.showSidebar.next(false);
  } else {
    this.showSidebar.next(true);
  }
}

// Explicitly open the sidebar
openSidebar() {
  this.showSidebar.next(true);
}

// Explicitly close the sidebar
closeSidebar() {
  this.showSidebar.next(false);
}
The Settings page triggers the toggle via the hamburger menu icon in the top-left corner:
openSidebar() {
  this.appSvc.toggleSidebar(); // Delegates to AppService
  this.sidebarOpen = !this.sidebarOpen; // Keeps local state in sync
}

Mobile Sidebar Behaviour

SettingsComponent tracks the viewport width to adapt the layout for smaller screens:
isMobile: boolean = window.innerWidth <= 768;

constructor(...) {
  window.addEventListener('resize', () => {
    this.isMobile = window.innerWidth <= 768;
  });
}

get shouldShowUserName(): boolean {
  return !this.sidebarOpen || !this.isMobile || window.innerWidth > 768;
}
When isMobile is true (viewport ≤ 768 px), the username label in the header is hidden to save horizontal space.

Browser and Device Requirements

Supported Browsers

BodegaX is tested and supported on the latest stable releases of Chrome, Firefox, Edge, and Safari. Older browser versions or non-standard engines may encounter rendering issues with Angular Material components.

Screen Resolution

The minimum recommended resolution is 1366 × 768 px. The responsive layout adapts for mobile viewports at the 768 px breakpoint, but the full admin interface (tables, dialogs, sidebar) is optimised for desktop screens.

API Base URL Configuration

All HTTP calls in BodegaX target a hard-coded base URL of http://localhost:8080. This value is embedded directly in every component file that makes API requests — there is no environment-variable system or Angular environment.ts configuration in the current version. Example calls from settings.component.ts and user-form-message.ts:
// Settings component
this.http.get("http://localhost:8080/admin/all")
this.http.delete("http://localhost:8080/admin/delete", { body: user })

// UserFormDialog
this.http.post("http://localhost:8080/admin/create", { ... })
this.http.put("http://localhost:8080/admin/edit",    { ... })

// RegisterComponent
this.http.post("http://localhost:8080/admin/create", { ... })
this.http.post("http://localhost:8080/admin/login",  { ... })
The API base URL (http://localhost:8080) is not environment-configurable in the current version of BodegaX. To point the application at a remote or staging backend, you must perform a find-and-replace across all component TypeScript files and rebuild the Angular application. A future improvement would be to centralise this in Angular’s environment.ts files or an HTTP_INTERCEPTOR that prepends the base URL automatically.

Frequently Asked Settings Questions

The Settings page displays a Nombre de Bodega heading and a text input labelled Bodega in the HTML template. However, the corresponding guardar() method in SettingsComponent is currently an empty stub with no implementation — clicking save has no effect. The input exists as a UI placeholder for a future configuration feature. The warehouse name shown in the page header comes from the authenticated user’s nombre field stored in sessionStorage['bodegax'].
Terminar Jornada (End Workday) is an admin action available on the Settings page. Clicking it opens the TerminarJornada dialog, which processes end-of-day operations for active warehouse clients. The Settings page is itself restricted to admin sessions, so the button is always rendered on this page without an additional role check in the template.
Yes. Because BodegaX sessions are stored in sessionStorage (which is tab-isolated in modern browsers), two different browser tabs — or two different browsers — can maintain independent admin sessions simultaneously. Each tab’s session is independent and does not interfere with the other.
sessionStorage is cleared automatically by the browser when the tab or window is closed. The next time BodegaX is opened, AppService finds no entry under "bodegax" and sets isLogged to false, sending the user to /login. No manual logout is needed between sessions.
You need to update the hard-coded http://localhost:8080 base URL in every component TypeScript file to point to your production Spring Boot server address. After updating, rebuild the Angular application with ng build --configuration production and serve the output from /dist using a web server such as Nginx or Apache. Ensure your Spring Boot application’s CORS configuration allows requests from the Angular app’s origin.
BodegaX’s Spring Boot backend manages all database schema creation and migrations. Verify the specific PostgreSQL version requirement in the backend’s application.properties or pom.xml. Generally, PostgreSQL 12 or later is recommended for compatibility with Spring Boot’s JPA/Hibernate layer.

Settings Page Component Reference

Property / MethodTypeDescription
sidebarOpenbooleanLocal flag tracking whether the sidebar is expanded; initialised to true.
isMobilebooleantrue when window.innerWidth <= 768; recalculated on every window resize event.
usuariosany[]Array of user objects populated by GET /admin/all on component init.
user5objectParsed session object from sessionStorage['bodegax']; provides nombre for the header.
ngOnInit()voidLifecycle hook — calls getUsers() to pre-populate the user table.
getUsers()voidIssues GET /admin/all and assigns the response to usuarios.
crear()voidOpens UserFormDialog with no data (new-user mode). Does not subscribe to afterClosed().
editar(user)voidOpens UserFormDialog pre-filled with the selected user’s data; subscribes to afterClosed() to refresh the table.
eliminar(user)voidOpens ConfirmDialog; on confirmation issues DELETE /admin/delete with the user in the body, then refreshes the table.
terminar()voidOpens TerminarJornada dialog for end-of-day workday closure.
guardar()voidStub method — currently empty, not yet implemented.
openSidebar()voidCalls AppService.toggleSidebar() and flips the local sidebarOpen flag.
shouldShowUserNameboolean (getter)Returns true when the username label should be visible based on sidebar and viewport state.

Build docs developers (and LLMs) love