2025-11-19 12:34:08 +00:00
|
|
|
# Worker Presence Manager
|
2025-11-04 14:18:19 +00:00
|
|
|
|
|
|
|
|
A Next.js application for tracking worker presence with a point system.
|
|
|
|
|
|
|
|
|
|
## Point System
|
|
|
|
|
|
|
|
|
|
- Each worker has **13 points** for a 2-week sprint (10 working days)
|
|
|
|
|
- Each presence day = 1.3 points
|
|
|
|
|
- Points are calculated based on the number of presential days worked
|
|
|
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
|
|
### Development Mode
|
|
|
|
|
|
|
|
|
|
1. Install dependencies:
|
|
|
|
|
```bash
|
|
|
|
|
npm install
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Start the JSON server (in one terminal):
|
|
|
|
|
```bash
|
|
|
|
|
npm run json-server
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. Run the development server (in another terminal):
|
|
|
|
|
```bash
|
|
|
|
|
npm run dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
4. Open [http://localhost:3000](http://localhost:3000) in your browser
|
|
|
|
|
|
|
|
|
|
### Docker Deployment
|
|
|
|
|
|
|
|
|
|
#### Local Testing with Docker Compose
|
|
|
|
|
```bash
|
|
|
|
|
docker-compose up -d
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Docker Swarm Deployment
|
|
|
|
|
|
|
|
|
|
1. Build the images:
|
|
|
|
|
```bash
|
|
|
|
|
./deploy.sh
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Deploy to swarm:
|
|
|
|
|
```bash
|
|
|
|
|
docker stack deploy -c docker-compose.swarm.yml presence-tracker
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. Check the deployment:
|
|
|
|
|
```bash
|
|
|
|
|
docker stack services presence-tracker
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
4. Remove the stack:
|
|
|
|
|
```bash
|
|
|
|
|
docker stack rm presence-tracker
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The application will be available at:
|
|
|
|
|
- Web UI: http://localhost:3000
|
|
|
|
|
- JSON API: http://localhost:3001
|
|
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
|
|
- Add workers with their presence days
|
|
|
|
|
- Edit worker presence days inline
|
|
|
|
|
- Automatic point calculation
|
|
|
|
|
- View points earned, points used, and remaining points
|
|
|
|
|
- Summary statistics (total workers, average presence, etc.)
|
|
|
|
|
- Reset all presences button (for new sprint)
|
|
|
|
|
- Persistent storage with json-server
|
|
|
|
|
- Responsive design with Tailwind CSS
|