Commit ccec28

2025-08-08 20:00:53 Tebby Dog: wording
2-code/flask/employee-hour-tracker.md ..
@@ 1,98 1,93 @@
# πŸ“Š Employee Hour Tracker
- > A comprehensive web application for tracking employee work time with real-time analytics, management features, and automated backups.
+ > A badass web app to monitor employees entering their time, serve up real-time analytics, and automate your backups β€” so you can stop worrying and focus on getting sh*t done.
![Node.js](https://img.shields.io/badge/Node.js-18%2B-green)
![Express](https://img.shields.io/badge/Express-4.18-blue)
![SQLite](https://img.shields.io/badge/SQLite-3-orange)
![Docker](https://img.shields.io/badge/Docker-Ready-blue)
+ ---
+
## ✨ Features
- ### πŸ“… **Time Tracking**
- - Interactive weekly grid interface for tracking employee time entries
- - Click-to-cycle through status states: Not Entered β†’ Entered β†’ Incorrect
- - Week navigation with integrated calendar picker
- - Configurable default week settings
- - Auto-save functionality for all changes
+ ### πŸ“… **Time Tracking (A.K.A. Keeping Tabs on Your Squad)**
+
+ - Weekly grid interface sharp enough to make spreadsheets cry
+ - Click once? Log it. Twice? Flag it. Thrice? Fix-it mode, baby
+ - Built-in calendar picker so you don't fat-finger the wrong week
+ - Default week your way β€” past, present, or hell, even the future
+ - No β€œSave” button needed β€” everything saves itself like grown-up software
### πŸ“ˆ **Analytics Dashboard**
- - **Visual Analytics**: Interactive charts powered by Chart.js
- - **Date Filtering**: Preset ranges (Last Week, Last Month, Last 90 Days) or custom date selection
- - **Status Distribution**: Pie chart showing overall entry patterns
- - **Employee Comparison**: Bar chart for performance analysis
- - **Summary Cards**: Quick statistics at a glance
+
+ - Sexy-ass charts courtesy of Chart.js
+ - Date ranges? Yep. Choose from Last Week, Month, 90 Days, or freestyle
+ - Pie charts of shame: See who's not entered a damn thing
+ - Employee comparisons so you know who’s crushing it
+ - Summary stats that slap you with truths at a glance
### πŸ‘₯ **Employee Management**
- - Complete employee lifecycle management
- - Add new employees with immediate tracking integration
- - Inline editing for employee names
- - Safe removal with confirmation dialogs
- - Session-based authentication for secure access
+
+ - Add, edit, and yeet employees in or out with full control
+ - Inline editing β€” because popups can get bent
+ - Confirmation dialogs keep you from rage-deleting poor Jim by mistake
+ - Secure, session-based login β€” no freeloaders allowed
### πŸ’Ύ **Data Export & Backup**
- - **Multiple Export Formats**:
- - Colored Excel files maintaining visual status indicators
- - JSON format for system integrations
- - CSV for universal compatibility
- - **Automated Backups**: Scheduled database backups with configurable retention
-
- ### 🎨 **Modern UI/UX**
- - Responsive design optimized for all devices
- - Cohesive purple gradient theme throughout
- - Smooth animations and transitions
- - Mobile-friendly touch interactions
- - Clean, intuitive navigation
+
+ - Export in:
+ - Colored Excel (preserves all that green/yellow/red goodness)
+ - JSON (for the nerds and the APIs)
+ - CSV (because boring as hell = universal)
+ - Auto-backups so you can sleep like a baby β€” configurable too
+
+ ### 🎨 **Beautiful AF UI**
+
+ - Responsive as heck β€” use it on a tablet, a phone, or a potato
+ - A glorious purple gradient worth showing off to design nerds
+ - Smooth transitions that don’t make you nauseous
+ - Touch support that'll make any mobile user say β€œdamn that’s clean”
+ - You might actually enjoy navigating this one
+
+ ---
## πŸš€ Quick Start
- ### Prerequisites
- - Node.js 18+ and npm
- - OR Docker and Docker Compose
+ ### Prerequisites (Don’t Skip This, Ya Animal)
- ### Installation Options
+ - Node.js 18+
+ - OR Docker & Docker Compose (we’re fancy)
- #### **Option 1: Node.js**
+ ---
+ ### πŸ§ͺ Option 1: Raw Node.js
```bash
- # Clone the repository
git clone https://github.com/tebwritescode/employee-hour-tracker.git
cd employee-hour-tracker
-
- # Install dependencies
npm install
-
- # Start the application
- npm start
-
- # For development with auto-reload
- npm run dev
+ npm start # Start like a regular ol' app
+ npm run dev # If you want auto-reload magic
```
- #### **Option 2: Docker Compose** (Recommended)
+ ---
+
+ ### 🐳 Option 2: Docker Compose (Recommended as Hell)
```bash
- # Clone the repository
git clone https://github.com/tebwritescode/employee-hour-tracker.git
cd employee-hour-tracker
-
- # Start with Docker Compose
docker-compose up -d
-
- # View logs
- docker-compose logs -f
-
- # Stop the application
- docker-compose down
+ docker-compose logs -f # Because watching logs is oddly satisfying
+ docker-compose down # When it’s time to kill it
```
- #### **Option 3: Docker CLI**
+ ---
+
+ ### πŸ”¨ Option 3: Docker CLI (For Hardcore Terminal Nerds)
```bash
- # Build the image
docker build -t employee-hour-tracker .
-
- # Run the container
docker run -d \
--name employee-tracker \
-p 3000:3000 \
@@ 100,25 95,28 @@
employee-hour-tracker
```
- Access the application at `http://localhost:3000`
+ App launches at `http://localhost:3000`
+ Go ahead, open it. We dare you.
- ## πŸ”§ Configuration
+ ---
- ### Environment Variables
+ ## πŸ”§ Configuration (Don't Screw These Up)
| Variable | Default | Description |
|----------|---------|-------------|
- | `PORT` | `3000` | Server port |
- | `NODE_ENV` | `development` | Environment mode (`development` or `production`) |
- | `DB_PATH` | `./employee_tracker.db` | Database file location |
- | `SESSION_SECRET` | `employee-tracker-secret-key` | Session encryption key |
- | `DEFAULT_ADMIN_USERNAME` | `admin` | Initial admin username |
- | `DEFAULT_ADMIN_PASSWORD` | `admin123` | Initial admin password |
- | `BACKUP_ENABLED` | `true` | Enable automated backups |
- | `BACKUP_INTERVAL` | `86400000` | Backup interval in milliseconds (default: 24 hours) |
- | `BACKUP_RETENTION_DAYS` | `30` | Number of days to keep backup files |
-
- ### Docker Compose Configuration
+ | `PORT` | `3000` | Where the hell the server listens |
+ | `NODE_ENV` | `development` | Pick your poison: `development` vs `production` |
+ | `DB_PATH` | `./employee_tracker.db` | Where your crucial time data lives |
+ | `SESSION_SECRET` | `employee-tracker-secret-key` | Hide this like it’s your banking password |
+ | `DEFAULT_ADMIN_USERNAME` | `admin` | The overlord’s default login |
+ | `DEFAULT_ADMIN_PASSWORD` | `admin123` | CHANGE THIS ASAP πŸ”₯ |
+ | `BACKUP_ENABLED` | `true` | Yeah, you want this on |
+ | `BACKUP_INTERVAL` | `86400000` | How often to save your backside (MS) |
+ | `BACKUP_RETENTION_DAYS` | `30` | How long to keep your safety net |
+
+ ---
+
+ ### πŸ‹ Docker Compose Config
```yaml
version: '3.8'
@@ 137,113 135,136 @@
- ./backups:/app/backups
```
+ ---
+
## πŸ“– Usage Guide
- ### **Time Tracking** (`/tracking`)
- 1. Select the desired week using the date picker or arrow navigation
- 2. Click on any cell in the grid to cycle through status states
- 3. Changes are automatically saved to the database
- 4. Use the week selector to navigate between different time periods
+ ### ⏱️ Time Tracking `/tracking`
+
+ 1. Pick your week and start clicking grid cells like a god
+ 2. Cycle statuses like a boss
+ 3. Sit back β€” auto-save’s doing the work for you
+ 4. Use arrows & selectors if you like jumping through time
+
+ ### πŸ“Š Analytics `/analytics`
- ### **Analytics** (`/analytics`)
- 1. Select a date range using preset options or custom dates
- 2. View status distribution in the pie chart
- 3. Compare employee performance in the bar chart
- 4. Export data using the export buttons
+ 1. Choose your dates
+ 2. Interpret shame-slices in the pie chart
+ 3. Compare your team’s hustle in bar form
+ 4. Click Export and flex on your boss with pretty data
- ### **Management** (`/management`)
- 1. Login with admin credentials (default: `admin`/`admin123`)
- 2. Add new employees using the "Add Employee" form
- 3. Edit employee names by clicking the edit icon
- 4. Remove employees with the delete button (requires confirmation)
- 5. Access global settings and export options
+ ### πŸ‘¨β€πŸ’Ό Admin Stuff `/management`
+
+ 1. Log in as admin (`admin` / `admin123`) β€” seriously, change that
+ 2. Add new employees like it’s HR day
+ 3. Click to edit names (typos won’t fix themselves)
+ 4. Boot off old names thoughtfully (confirmation included)
+ 5. Global settings & data export tools right at your manicured fingertips
+
+ ---
- ## πŸ—οΈ Architecture
+ ## πŸ—οΈ Project Architecture
```
employee-hour-tracker/
- β”œβ”€β”€ πŸ“„ server.js # Express server and API endpoints
- β”œβ”€β”€ πŸ“„ backup.js # Automated backup functionality
- β”œβ”€β”€ πŸ“„ package.json # Dependencies and scripts
- β”œβ”€β”€ πŸ“„ docker-compose.yml # Docker composition
- β”œβ”€β”€ πŸ“„ Dockerfile # Container configuration
- β”œβ”€β”€ πŸ“ public/ # Frontend assets
- β”‚ β”œβ”€β”€ πŸ“„ index.html # Main application HTML
- β”‚ β”œβ”€β”€ πŸ“„ style.css # Styles and responsive design
- β”‚ β”œβ”€β”€ πŸ“„ script.js # Frontend logic and interactions
- β”‚ └── πŸ“„ chart.js # Analytics visualization
- β”œβ”€β”€ πŸ“ backups/ # Automated backup storage
- └── πŸ“— employee_tracker.db # SQLite database
+ β”œβ”€β”€ πŸ“„ server.js # RESTful backend engine of doom
+ β”œβ”€β”€ πŸ“„ backup.js # Makes sure your data doesn’t go *poof*
+ β”œβ”€β”€ πŸ“„ package.json # Clearly you’ve heard of this
+ β”œβ”€β”€ πŸ“„ docker-compose.yml # Container boyband orchestration
+ β”œβ”€β”€ πŸ“„ Dockerfile # Turns your app into deployable magic
+ β”œβ”€β”€ πŸ“ public/ # Frontend good stuff
+ β”‚ β”œβ”€β”€ index.html # Your glorious entry point
+ β”‚ β”œβ”€β”€ style.css # Sharp purple swagger
+ β”‚ β”œβ”€β”€ script.js # Grid logic + admin finesse
+ β”‚ └── chart.js # Analytics eye-candy
+ β”œβ”€β”€ πŸ“ backups/ # This folder saves asses
+ └── πŸ“— employee_tracker.db # Don't delete this... seriously
```
- ### Tech Stack
- - **Backend**: Node.js + Express.js
- - **Database**: SQLite3 with better-sqlite3
- - **Frontend**: Vanilla JavaScript + Chart.js
- - **Authentication**: Express-session + bcryptjs
- - **Containerization**: Docker + Docker Compose
+ ---
+
+ ### βš™οΈ Tech Stack
+
+ - **Backend**: Node.js + Express
+ - **Database**: SQLite3 + better-sqlite3 (the better part matters)
+ - **Frontend**: Raw Vanilla JS (no extra calories) + Chart.js
+ - **Auth**: express-session + bcryptjs (like a bouncer for your admin area)
+ - **Containerization**: Docker & Docker Compose
+
+ ---
## πŸ” Security
- - Password hashing using bcryptjs
- - Session-based authentication
- - CORS protection
- - SQL injection prevention via parameterized queries
- - Secure session management with configurable secrets
+ - Hashed passwords (get rekt plain text)
+ - Session-based login β€” no silly tokens
+ - CORS-tight so outsiders can’t jack your data
+ - SQL injection-proof β€” parameterized 'cause we’re not amateurs
+ - Secrets optional but highly encouraged (you’ve been warned)
- ## πŸ› οΈ Development
+ ---
- ### Available Scripts
+ ## πŸ”§ Dev Life
```bash
- # Start development server with auto-reload
- npm run dev
+ npm run dev # Hot reload fixups
+ npm start # Serious prod mode
+ npm run install-deps # Just in case you skipped setup like a rebel
+ ```
- # Start production server
- npm start
+ ---
- # Install all dependencies
- npm run install-deps
- ```
+ ### πŸ”Œ API Endpoints
+
+ | Method | URL | What-It-Does | Auth |
+ |--------|-----|--------------|------|
+ | GET | `/api/employees` | Fetch worker list | ❌ |
+ | POST | `/api/employees` | Add a badass | βœ… |
+ | PUT | `/api/employees/:id` | Update someone’s stuff | βœ… |
+ | DELETE | `/api/employees/:id`| Boot 'em | βœ… |
+ | GET | `/api/time-entries` | Fetch time logs | ❌ |
+ | POST | `/api/time-entries` | Save/correct logs | ❌ |
+ | GET | `/api/analytics` | Data candy | ❌ |
+ | POST | `/api/login` | Get in | ❌ |
+ | POST | `/api/logout` | Peace out | βœ… |
+ | GET | `/api/export/:format` | Download your victory proof | βœ… |
- ### API Endpoints
+ ---
- | Method | Endpoint | Description | Auth Required |
- |--------|----------|-------------|---------------|
- | GET | `/api/employees` | List all employees | No |
- | POST | `/api/employees` | Add new employee | Yes |
- | PUT | `/api/employees/:id` | Update employee | Yes |
- | DELETE | `/api/employees/:id` | Remove employee | Yes |
- | GET | `/api/time-entries` | Get time entries | No |
- | POST | `/api/time-entries` | Update time entry | No |
- | GET | `/api/analytics` | Get analytics data | No |
- | POST | `/api/login` | Admin authentication | No |
- | POST | `/api/logout` | End admin session | Yes |
- | GET | `/api/export/:format` | Export data | Yes |
+ ## 🐞 Known WTFs
- ## πŸ› Known Issues
+ - Week nav is a little moody if you click like a caffeinated squirrel
+ - In rare cases, the status marker’s a lazy bastard and doesn’t update instantly
- - Week navigation may occasionally show incorrect dates when changing weeks rapidly
- - Status markers might not update immediately in some edge cases with week transitions
+ (Fix coming soon. Or yell at us, that works too.)
+
+ ---
## πŸ“ License
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
+ MIT License β€” do whatever the hell you want, just don't sue us.
- ## 🀝 Contributing
+ ---
- Contributions are welcome! Please feel free to submit a Pull Request.
+ ## 🀝 Contributions
- 1. Fork the project
- 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
- 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
- 4. Push to the branch (`git push origin feature/AmazingFeature`)
- 5. Open a Pull Request
+ Pull requests welcome! The more brains, the better.
+
+ ```bash
+ git checkout -b feature/CoolSh*t
+ git commit -m 'Add wild feature'
+ git push origin feature/CoolSh*t
+ ```
+
+ Then make that PR and take your place in README glory.
+
+ ---
- ## πŸ“§ Support
+ ## πŸ“§ Need Help?
- For issues, questions, or suggestions, please open an issue on the [GitHub repository](https://github.com/tebwritescode/employee-hour-tracker/issues).
+ Open an issue [on the repo](https://github.com/tebwritescode/employee-hour-tracker/issues), or @ us like you're summoning Gandalf.
---
- <p align="center">Made with ❀️ by <a href="https://github.com/tebwritescode">tebwritescode</a></p>
+ <p align="center">
+ Made with ❀️, coffee, and not enough sleep by <a href="https://github.com/tebwritescode">tebwritescode</a>
+ </p>
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9