π Live Demo
Try the application live at: https://gestionale-three.vercel.app
Demo Credentials:
- Email:
demo@gestionale.com
- Password:
demo2024
Note: The demo account has read-only access. Some features requiring write permissions may be limited.
π Features
Employee Management
- Complete Employee Profiles: Store detailed information including personal data, birth information, residence details, and notes
- Document Management: Upload and manage employee documents with secure cloud storage
- Qualification Tracking: Track various employee qualifications with detailed scoring systems
- Search & Filter: Advanced search functionality across all employee fields
- Employment Status: Track and filter employees by employment status
Qualification System
- Multiple Qualification Types: Support for various job roles including:
- Tubista (Pipe Fitter)
- Saldatore (Welder) - with technique and material specifications
- Carpentiere (Carpenter)
- Impiegato (Employee)
- Capo Tecnico (Technical Manager)
- Manovale (Laborer)
- Aiutante (Helper)
- Accoppiatorista (Coupler)
- Montatore (Assembler)
- Scoring System: 0-5 point scoring system for qualification assessment
- Qualification Overview: Dedicated section to view all qualifications across the organization
Security & Permissions
- Firebase Authentication: Secure email/password authentication
- Role-based Access Control: Read/write permissions management
- Secure Document Storage: Firebase Storage integration for document management
User Experience
- Responsive Design: Mobile-friendly interface using HeroUI components
- Dark/Light Theme: Automatic theme switching support
- Italian Localization: Complete Italian language interface
- Toast Notifications: User-friendly feedback system
- Loading States: Smooth loading indicators and state management
π οΈ Technology Stack
- Frontend: Next.js 15.1.3, React 19.0.0, TypeScript
- UI Framework: HeroUI (Tailwind CSS-based component library)
- Backend: Firebase (Firestore Database, Authentication, Storage)
- Styling: Tailwind CSS with custom theme
- State Management: React Context API
- Date Handling: @internationalized/date
- Notifications: react-hot-toast
- Icons: Custom SVG icons
- Deployment: Vercel-ready configuration
π Prerequisites
- Node.js 18+
- npm/yarn/pnpm/bun
- Firebase project with Firestore, Authentication, and Storage enabled
π§ Installation
Clone the repository
git clone https://github.com/VincenzoImp/iwn.git cd iwn
Install dependencies
npm install # or yarn install # or pnpm install
Configure Firebase
Create a
.env.local
file in the root directory based onenv.example
:NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
Set up Firebase Security Rules
Apply the security rules found in
app/firebase/rules.md
to your Firebase project:Firestore Rules:
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read: if request.auth != null; allow write: if request.auth != null && request.auth.uid in get(/databases/$(database)/documents/settings/permissions).data.write; } } }
Storage Rules:
rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read: if request.auth != null; allow write: if request.auth != null && request.auth.uid in ["YOUR_ADMIN_UID"]; } } }
Initialize Firebase Data
Create a
settings/permissions
document in Firestore with the following structure:{ "write": ["user_uid_1", "user_uid_2"] }
Run the development server
npm run dev # or yarn dev # or pnpm dev
Open your browser
Navigate to http://localhost:3000
π Database Structure
Firestore Collections
employees
{
id: string (auto-generated)
name: string | null
surname: string | null
email: string | null
phone: string | null
gender: "male" | "female" | "other" | null
taxCode: string | null
employed: "yes" | "no" | null
birthdate: string | null (ISO date)
birthplaceCity: string | null
birthplaceProvincia: string | null
birthplaceNation: string | null
birthplaceZipcode: number | null
livingplaceAddress: string | null
livingplaceCity: string | null
livingplaceProvincia: string | null
livingplaceNation: string | null
livingplaceZipcode: number | null
notes: string | null
documents: string[] | null
qualifications: {
[qualificationType]: Array<{
score?: number
technique?: string
material?: string
}>
} | null
}
settings/permissions
{
write: string[] // Array of user UIDs with write permissions
}
Firebase Storage Structure
/employees/documents/
βββ uuid_filename1.pdf
βββ uuid_filename2.jpg
βββ ...
π Authentication & Authorization
Authentication
- Email/password authentication via Firebase Auth
- Persistent login sessions with localStorage
- Automatic redirect handling for authenticated/unauthenticated users
Authorization Levels
- Read Access: All authenticated users can view data
- Write Access: Only users listed in
settings/permissions.write
array can:- Add new employees
- Edit existing employees
- Delete employees
- Upload/delete documents
π― Usage
Getting Started
- Login: Use the authentication page to log in with your credentials
- Home: Overview of the system features and navigation guide
- Employees: Browse, search, and manage employee records
- Qualifications: View employees organized by their qualifications
Managing Employees
- View All Employees: Navigate to βRisorseβ (Resources)
- Search: Use the search bar to find specific employees
- Filter: Filter by employment status (Employed/Unemployed/All)
- Add New Employee: Click βAggiungiβ (Add) button (requires write permissions)
- Edit Employee: Click on an employee row, then βModificaβ (Edit)
Managing Qualifications
- Add Qualifications: In employee edit mode, use the + button in qualifications section
- Score Qualifications: Use the 0-5 scale scoring system
- Specialized Qualifications: For welders, specify technique and material
- View by Qualification: Use the βQualificheβ (Qualifications) section
Document Management
- Upload Documents: In employee edit mode, use the + button in documents section
- View Documents: Click the external link icon to open documents
- Delete Documents: Use the delete icon in edit mode
π§ Configuration
Required Fields
The following fields are required for all employees:
- Name (nome)
- Surname (cognome)
- Phone (telefono)
- Gender (genere)
- Tax Code (codice fiscale)
- Employment Status (assunto)
- Birth Nation (nazione di nascita)
- Residence Nation (nazione di residenza)
- Residence Province (provincia di residenza)
Customization
- Qualification Types: Modify
qualificationsList
inapp/context.tsx
- Required Fields: Update
attributesEmployees.requiredKeys
inapp/context.tsx
- Search Fields: Modify
attributesEmployees.searchKeys
inapp/context.tsx
- UI Text: All text strings are centralized in the
text
object inapp/context.tsx
π Deployment
Vercel (Recommended)
- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically on push to main branch
Manual Deployment
npm run build
npm start
Environment Variables
Ensure all Firebase configuration variables are set in your deployment environment.
π Project Structure
iwn/
βββ app/
β βββ api.tsx # Firebase API functions
β βββ context.tsx # Global state management
β βββ firebase/ # Firebase configuration
β βββ components/ # Reusable components
β βββ home/ # Home page
β βββ autenticazione/ # Authentication pages
β βββ risorse/ # Employee management
β β βββ [id]/ # Individual employee pages
β βββ qualifiche/ # Qualification overview
β βββ icons.tsx # Custom SVG icons
β βββ modifiers.tsx # Route guards
β βββ providers.tsx # Theme and UI providers
βββ package.json
βββ tailwind.config.ts
βββ next.config.mjs
βββ README.md
π Troubleshooting
Common Issues
Firebase Connection Issues
- Verify all environment variables are correctly set
- Check Firebase project configuration
- Ensure Firebase services (Auth, Firestore, Storage) are enabled
Permission Denied Errors
- Verify user UID is in the
settings/permissions.write
array - Check Firebase security rules are properly configured
- Verify user UID is in the
Build Errors
- Ensure Node.js version 18+
- Clear
.next
folder and reinstall dependencies - Check for TypeScript errors
Authentication Issues
- Verify Firebase Auth domain configuration
- Check network connectivity
- Clear browser localStorage if login persists incorrectly
Performance Optimization
- Images are optimized using Next.js Image component
- Firebase queries include proper indexing
- Large lists use pagination
- Document uploads include progress indicators
π Support
For technical support or feature requests, please contact the development team or create an issue in the project repository.