Skip to content

XetaSuite/React

Repository files navigation

XetaSuite Logo XetaSuite Logo

React Interface for XetaSuite - Multi-Tenant Facility Management ERP

React 19 TypeScript Vite Tailwind CSS Linter License MIT


πŸ“‹ About

XetaSuite-React is the modern and responsive user interface for XetaSuite, a multi-tenant ERP dedicated to facility, equipment, and inventory management.

This SPA (Single Page Application) communicates with the Laravel backend via Sanctum stateful authentication (secure cookies).


✨ Interface Features

πŸ” Authentication & Security

  • Secure login: Authentication via Laravel Sanctum (cookies)
  • Forgot password: Email-based password reset
  • Profile management: Personal information editing
  • Password change: With current password validation

🏒 Multi-Site Dashboard

  • Overview: Key statistics and indicators per site
  • Site selector: Quick switching between locations
  • Custom widgets: Real-time charts and metrics

πŸ—ΊοΈ Zone Management

  • Visual tree: Navigate through zone hierarchy
  • Nested creation: Add sub-zones in cascade

πŸ”§ Material Management

  • Paginated list: Advanced search and filters
  • Detailed records: Complete equipment information
  • QR Codes: Display and download for identification
  • History: View past interventions

πŸ“¦ Stock Management

  • Item catalog: List view with search
  • Stock movements: Entry/exit transfers with full traceability
  • QR Codes: Display and download for identification
  • Price history: Track purchase cost evolution

🏒 Company Management

  • Unified company model: Companies can be item providers, maintenance contractors, or both
  • Type-based display: Visual badges showing company roles (Item Provider, Maintenance Provider)
  • Tabbed detail view: Items tab and Maintenances tab based on company type
  • Headquarters management: Centralized database managed from HQ site
  • Full traceability: Track all items and maintenances linked to each company

πŸ› οΈ Interventions

Maintenances

  • Forms: Create and edit interventions
  • Statuses: Workflow tracking (scheduled β†’ completed)

Incidents

  • Quick reporting: Simplified form
  • Visual priorities: Color-coded urgency levels
  • Resolution: Processing workflow

Cleanings

  • Scheduling: Frequency management
  • Validation: Session confirmation

πŸ‘₯ Administration

  • Users: Create, edit, deactivate
  • Roles: Define access profiles
  • Permissions: Granular per-site attribution

πŸ”” Notifications

  • Notification center: Complete history
  • Real-time badge: Unread indicator in header
  • Bulk actions: Mark all as read

πŸ“… Calendar & Event Categories

  • Interactive calendar: FullCalendar-based view with month, week, day, and list modes
  • Unified display: Calendar events, maintenances, and incidents in one view
  • Toggle visibility: Show/hide maintenances and incidents independently
  • Event categories: Color-coded categories for organizing events
  • Drag & drop: Move events by dragging, resize for duration changes
  • Quick creation: Click on calendar to create event at that time
  • Event modal: Rich form with searchable category dropdown
  • Today's banner: Dashboard widget showing current day's events
  • Category management: Full CRUD interface for event categories

🌐 Internationalization

  • Multi-language: French and English
  • Auto-detection: Browser language
  • User preference: Saved choice

🎨 Modern Interface

  • Design System: Based on TailAdmin
  • Dark mode: Light/dark theme toggle
  • Responsive: Mobile and tablet optimized
  • Collapsible sidebar: Workspace efficiency

πŸ” Global Search

  • Quick access: Ctrl+K / Cmd+K keyboard shortcut or header search icon
  • Unified search: Search across materials, zones, items, incidents, maintenances, companies, sites
  • Keyboard navigation: Navigate results with arrow keys, select with Enter
  • Type indicators: Visual icons and colors for each result type
  • Permission-aware: Only shows results the user is allowed to see
  • Mobile support: Accessible via search button in header on mobile devices

πŸ—οΈ Technical Architecture

Technology Stack

Component Technology Version
UI Library React 19.2+
Language TypeScript 5.9+
Build Tool Vite 7.2+
Styling Tailwind CSS 4.1+
Routing React Router 7.9+
HTTP Client Axios 1.13+
i18n i18next + react-i18next 25.x / 16.x
Calendar FullCalendar 6.x
Charts ApexCharts 4.x
Notifications React Toastify 11.x

Code Architecture

src/
β”œβ”€β”€ app/                         # Application entry point
β”‚   β”œβ”€β”€ routes/                  # Route configuration
β”‚   β”œβ”€β”€ i18n/                    # Internationalization
β”‚   β”‚   └── locales/             # Translation files
β”‚   β”œβ”€β”€ styles/                  # Global styles
β”‚   β”œβ”€β”€ App.tsx                  # Main component
β”‚   └── AppRoutes.tsx            # Route generator
β”‚
β”œβ”€β”€ features/                    # Business modules
β”‚   β”œβ”€β”€ Auth/                    # Authentication
β”‚   β”‚   β”œβ”€β”€ services/            # Repository + Manager
β”‚   β”‚   β”œβ”€β”€ store/               # React Context
β”‚   β”‚   β”œβ”€β”€ hooks/               # useAuth, useRequireAuth
β”‚   β”‚   └── views/               # Login, reset pages, etc.
β”‚   β”œβ”€β”€ Sites/                   # Site management
β”‚   β”œβ”€β”€ Zones/                   # Zone management
β”‚   β”œβ”€β”€ Materials/               # Material management
β”‚   β”œβ”€β”€ Items/                   # Stock management
β”‚   β”œβ”€β”€ Maintenances/            # Interventions
β”‚   β”œβ”€β”€ Incidents/               # Reports
β”‚   β”œβ”€β”€ Cleanings/               # Cleanings
β”‚   β”œβ”€β”€ Companies/               # Company management (item providers & contractors)
β”‚   β”œβ”€β”€ Users/                   # Users
β”‚   β”œβ”€β”€ Roles/                   # Roles
β”‚   β”œβ”€β”€ Permissions/             # Permissions
β”‚   └── Notifications/           # Notifications
β”‚
└── shared/                      # Shared code
    β”œβ”€β”€ api/                     # httpClient, urlBuilder
    β”œβ”€β”€ components/              # Reusable UI components
    β”‚   β”œβ”€β”€ ui/                  # Button, Modal, Alert, Table
    β”‚   β”œβ”€β”€ form/                # Input, Select, Checkbox
    β”‚   └── common/              # Pagination, DeleteConfirmModal
    β”œβ”€β”€ hooks/                   # Utility hooks
    └── types/                   # Global TypeScript types

Repository + Manager Pattern

// Repository: Raw API calls
export const CompanyRepository = {
    getAll: async (params?) => {
        const response = await httpClient.get('/api/v1/companies', { params });
        return response.data;
    },
};

// Manager: Error handling + transformation
export const CompanyManager = {
    getAll: async (params?) => {
        try {
            const data = await CompanyRepository.getAll(params);
            return { success: true, data };
        } catch (error) {
            return { success: false, error: handleApiError(error) };
        }
    },
};

πŸš€ Installation

Prerequisites

Setup

# Clone the repository
git clone https://github.com/XetaIO/XetaSuite-React.git
cd XetaSuite-React

# Install dependencies
npm install

# Configure environment
cp .env.example .env

# Start development server
npm run dev

Environment Variables

# API URL (empty to use Vite proxy)
VITE_API_URL=

# In production
VITE_API_URL=https://api.xetasuite.com

πŸ“ Available Scripts

# Development server (http://localhost:5173)
npm run dev

# Production build (with TypeScript check)
npm run build

# Preview production build
npm run preview

# ESLint linter
npm run lint

πŸ” Sanctum Authentication

Authentication Flow

1. GET /sanctum/csrf-cookie  β†’ Retrieves CSRF token
2. POST /api/v1/auth/login   β†’ Authentication
3. Session cookie created    β†’ Used for all requests

Axios Configuration

const httpClient = axios.create({
    baseURL: import.meta.env.VITE_API_URL || '',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-Requested-With': 'XMLHttpRequest',
    },
    withCredentials: true,   // Required for Sanctum
    withXSRFToken: true,     // Auto-include XSRF token
});

πŸ›‘οΈ Permission Management

Checking in Components

import { useAuth } from '@/features/Auth/hooks';

function MyComponent() {
    const { hasPermission, hasRole, hasAnyPermission } = useAuth();

    return (
        <div>
            {hasPermission('company.create') && (
                <Button>Create Company</Button>
            )}
            {hasRole('admin') && <AdminPanel />}
        </div>
    );
}

Protected Routes

<Route element={
    <RequireAuth permissions={['material.viewAny']}>
        <AppLayout />
    </RequireAuth>
}>
    <Route path="/materials" element={<MaterialListPage />} />
</Route>

🎨 Styling with Tailwind CSS 4

Custom Theme

Colors are defined in src/app/styles/index.css:

@theme {
  --color-brand-500: #465fff;
  --color-success-500: #22c55e;
  --color-error-500: #ef4444;
  --color-warning-500: #f97316;
}

Dark Mode

<div className="bg-white dark:bg-gray-900 text-gray-800 dark:text-white">
  Theme-adaptive content
</div>

🌐 Internationalization

Configuration

i18n.init({
    resources: {
        en: { translation: en },
        fr: { translation: fr },
    },
    fallbackLng: 'en',
    detection: {
        order: ['cookie', 'localStorage', 'navigator'],
    },
});

Usage

import { useTranslation } from 'react-i18next';

function MyComponent() {
    const { t } = useTranslation();
    return <h1>{t('common.welcome')}</h1>;
}

🀝 Contributing

Contributions are welcome!

# Run linter before committing
npm run lint

πŸ“„ License

XetaSuite-React is open-source software licensed under the MIT license.


πŸ”— Links

About

XetaSuite is a multi-tenant ERP designed for comprehensive facility, equipment, and inventory management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors