# IPTV Panel - Project Status

## Project Goal

Build a custom IPTV business management panel using:

- Node.js
- Express
- EJS
- SQLite
- better-sqlite3
- dotenv
- node-cron
- nodemailer
- express-session
- bcrypt

The panel will manage clients, supports, mailers, free tests, subscriptions, renewals, payments, charges, reminders, tracking, conversions, refunds, commissions, and dashboard statistics.

---

## Main Business Logic

The system must support:

- Admin login
- Support user login
- Mailer user login
- Clients management
- Supports management
- Mailers management
- Free test/trial management
- Subscription management
- Renewal management
- Payments management
- Charges/expenses management
- Email reminders
- Campaign click tracking
- Buy Now click tracking
- Mailer attribution
- Conversions
- Refunds
- Commissions
- Dashboard statistics
- Date-filtered reports

---

## User Roles

### Admin

Admin can see and manage everything:

- Clients
- Services
- Payments
- Charges
- Supports
- Mailers
- Reports
- Revenue
- Profit
- Commissions
- Tracking statistics

### Support

Support users can only see clients/services assigned to them.

Support users should not see:

- Full income
- Charges
- Profit
- Mailer commissions
- Other supports' clients

### Mailer

Mailer users can only see their own performance:

- Total clicks
- Valid clicks
- Unique clicks
- Duplicate clicks
- Invalid clicks
- Bot/proxy/suspicious clicks
- Free trial requests
- Buy Now clicks
- Conversions
- Refunds
- Revenue generated
- Commission earned

Mailer users should not see:

- Full client private data
- Other mailers
- Charges
- Profit
- Admin settings

---

## Current Beta Version

Beta Version 1 includes:

- Project initialized with npm
- Required packages installed
- Folder structure prepared
- package.json configured
- Database schema planned
- Admin/support/mailer roles planned
- Tracking and attribution structure planned

---

## Completed

- npm project initialized
- Required packages installed:
  - express
  - ejs
  - better-sqlite3
  - dotenv
  - node-cron
  - nodemailer
  - express-session
  - bcrypt
  - nodemon
- package.json scripts added:
  - npm start
  - npm run dev
  - npm run init-db
  - npm run seed

---

## Pending

- Create .env
- Create database connection
- Create database schema
- Create database initializer
- Create database seed file
- Create login routes
- Create dashboard routes
- Create middleware
- Create views
- Create CSS
- Initialize database
- Seed admin/supports/mailers
- Test login
