Skip to content

About

Ứng dụng quản lý công việc: kế hoạch + Gantt, báo cáo ngày/tháng/năm, kho báo cáo, song ngữ Việt/Anh (FastAPI + SQLite)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

📋 Task Manager — Plans · Gantt · Reports

🇻🇳 Tiếng Việt · 🇬🇧 English

Python FastAPI SQLite Tests License i18n

Web app for daily task tracking, monthly assignment, work plans + Gantt chart, daily / monthly / yearly reports (multi-sheet Excel, CSV), a report vault with subfolders, data storage (backup/restore, JSON) and user accounts — bilingual Vietnamese / English, orange–white–blue theme, lightweight FastAPI + SQLite.

Ứng dụng web quản lý công việc hằng ngày, phân công tháng, kế hoạch + Gantt, báo cáo ngày/tháng/năm, kho báo cáo, lưu trữ dữ liệu, tài khoản — song ngữ Việt / Anh, tông cam–trắng–xanh dương, chạy nhẹ FastAPI + SQLite.

Plans & Gantt (EN) Yearly report — 3D chart (EN)
Gantt EN Yearly EN

🇻🇳 Tiếng Việt

v2.1 — thêm song ngữ Việt / Anh (nút 🇻🇳 VI / 🇬🇧 EN, ghi nhớ lựa chọn; dịch cả giao diện lẫn file Excel/CSV xuất ra). v2.0 — theme cam·trắng·xanh dương, module Kế hoạch + Gantt, báo cáo năm, kho báo cáo thư mục con ngày/tháng/năm, hệ thống tài khoản.

✨ Tính năng

Nhóm Chi tiết
🌐 Song ngữ VI / EN Nút chuyển 🇻🇳 VI / 🇬🇧 EN ở góc trên (và màn đăng nhập), ghi nhớ trong trình duyệt. Dịch toàn bộ giao diện (menu, nút, bảng, modal, thông báo lỗi) và file báo cáo Excel/CSV (tên sheet, tiêu đề cột, nhãn trạng thái/ưu tiên, định dạng ngày). Dữ liệu người dùng nhập giữ nguyên
🔐 Tài khoản Đăng ký / đăng nhập để truy cập (cookie phiên 7 ngày, mật khẩu băm PBKDF2 200k vòng). Tài khoản đầu tiên = quản trị viên. Admin tạo/xóa tài khoản, đổi quyền; mọi người tự đổi mật khẩu
Công việc hằng ngày Xem theo ngày, thêm–sửa–xóa, đổi trạng thái ngay trong bảng, lọc nhân sự & trạng thái, thống kê + tỷ lệ hoàn thành, cảnh báo quá hạn, gắn việc vào kế hoạch
Phân công tháng Lịch tháng, kéo thả dời lịch, bấm ô ngày giao việc nhanh, thanh khối lượng theo nhân sự
📋 Kế hoạch Tạo kế hoạch (tên, mô tả, khoảng ngày, người phụ trách, màu), tiến độ % tự tính từ công việc thuộc kế hoạch; xóa kế hoạch → việc về "không thuộc kế hoạch"
📊 Gantt Biểu đồ Gantt theo khoảng ngày tùy chọn: thanh kế hoạch (phần sáng = % hoàn thành) + ô công việc theo trạng thái, đường cam đánh dấu hôm nay, cuộn ngang, bấm thanh/ô để sửa
Báo cáo ngày / tháng / năm Tổng quan, theo nhân sự, theo ưu tiên; tháng có biểu đồ 3D theo ngày, năm có biểu đồ 3D theo 12 tháng → xuất Excel / CSV, tự lưu vào kho
🗃️ Kho báo cáo Thư mục con data/reports/ngay/, thang/, nam/ — điều hướng folder như cây thư mục, mỗi file một link tải trực tiếp, copy link, lọc định dạng, lưu báo cáo 1 chạm
💾 Lưu trữ dữ liệu Backup 1 chạm (sqlite backup API), tải/khôi phục/xóa backup (tự tạo bản an toàn trước khi khôi phục); xuất/nhập toàn bộ JSON (nhân sự + kế hoạch + công việc)
Nhân sự Thêm/sửa/xóa (tên, vai trò, màu), thống kê tháng
🎨 Giao diện Cam – trắng – xanh dương, thẻ nghiêng 3D theo chuột, biểu đồ cột 3D kéo-để-xoay, nền hạt parallax; responsive mobile (bảng cuộn ngang, Gantt cuộn)
Dữ liệu mẫu Lần chạy đầu tự sinh ~180 việc cho 5 nhân sự, 4 kế hoạch mẫu (gán việc theo chủ đề) và báo cáo ngày/tháng/năm vào kho

🖼️ Giao diện

Đăng nhập Kế hoạch công việc
Đăng nhập Kế hoạch
Biểu đồ Gantt Báo cáo năm — biểu đồ 3D
Gantt Báo cáo năm
Kho báo cáo (thư mục con) Lịch phân công tháng
Kho báo cáo Lịch tháng
Lưu trữ dữ liệu Quản trị tài khoản
Lưu trữ Tài khoản

🚀 Chạy nhanh

Yêu cầu: Python 3.10+

git clone https://github.com/Aniworld123/Task-management.git
cd Task-management
python -m venv .venv && source .venv/bin/activate   # (Windows: .venv\Scripts\activate)
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# mở http://localhost:8000  ·  API docs: http://localhost:8000/docs

Lần đầu mở app: bấm Tạo tài khoản — tài khoản đầu tiên tự động là quản trị viên, các tài khoản sau là thành viên (admin có thể nâng quyền trong mục Tài khoản).

Tùy chọn dữ liệu

python -m app.seed --reset        # Xóa dữ liệu cũ, tạo lại dữ liệu mẫu + kế hoạch + báo cáo kho
QLCV_SEED=0 uvicorn app.main:app  # Không tự seed
QLCV_DB_PATH=/duong/dan/khac.db uvicorn app.main:app   # Đổi vị trí SQLite

Nâng cấp từ v1.x: chỉ cần chạy bản mới — DB cũ tự migrate (thêm bảng plans/users/sessions, cột tasks.plan_id), file kho cũ tự chuyển vào thư mục con, không mất dữ liệu.

🌐 Song ngữ Việt / Anh

  • Nút 🇻🇳 VI / 🇬🇧 EN ở thanh trên cùng và màn hình đăng nhập; lựa chọn được ghi nhớ trong localStorage (mỗi trình duyệt một lựa chọn).
  • Mặc định tiếng Việt. Đổi sang EN: toàn bộ menu, tiêu đề, nút, bảng, biểu đồ, modal, thông báo (kể cả lỗi từ API) hiển thị tiếng Anh; ngày tháng theo định dạng Anh (December 1, 2026, lịch Mon…Sun, Gantt Dec 2026).
  • File xuất ra cũng theo ngôn ngữ đang chọn: Excel tiếng Anh có sheet Overview / By member / By day / By month / Task details, cột Task, Member, Priority, Status…; CSV tương tự. API nhận tham số lang=vi|en (mặc định vi).
  • Dữ liệu do người dùng nhập (tên công việc, nhân sự, kế hoạch) không bị dịch — chỉ nhãn giao diện và báo cáo được dịch.

🔐 Tài khoản & phân quyền

  • Đăng ký mở cho người đầu tiên (thành admin); mật khẩu ≥ 6 ký tự, băm PBKDF2-HMAC-SHA256 200.000 vòng + salt riêng.
  • Phiên đăng nhập: cookie qlcv_session (HttpOnly, SameSite=Lax) hạn 7 ngày; mọi API (trừ đăng nhập/đăng ký) trả 401 khi chưa đăng nhập.
  • Admin: tạo/xóa tài khoản, đổi quyền admin ↔ thành viên (không tự xóa/hạ quyền chính mình). Thành viên: dùng đầy đủ công việc/kế hoạch/báo cáo, không thấy mục Tài khoản.
  • Link tải kho báo cáo cũng yêu cầu đăng nhập (mở trong trình duyệt đã đăng nhập là tải được).

💾 Lưu trữ dữ liệu

data/
├── tasks.db        # Dữ liệu chính (SQLite): members, plans, tasks, users, sessions
├── backups/        # qlcv-YYYYMMDD-HHMMSS-ffffff.db — bản sao lưu 1 chạm
└── reports/        # Kho báo cáo theo thư mục con:
    ├── ngay/       #   bao-cao-ngay-YYYY-MM-DD.xlsx/.csv
    ├── thang/      #   bao-cao-thang-YYYY-MM.xlsx/.csv
    └── nam/        #   bao-cao-nam-YYYY.xlsx/.csv
  • Backup dùng sqlite3.Connection.backup() → nhất quán cả khi app đang chạy; khôi phục tự tạo bản an toàn trước.
  • Xuất JSON (version 2) gom members + plans + tasks; Nhập JSON validate rồi thay thế cả 3 bảng, giữ đúng quan hệ.
  • Kho báo cáo: mỗi lần xuất Excel/CSV, file vừa tải về vừa lưu vào đúng thư mục con; tên theo kỳ nên xuất lại cùng kỳ sẽ ghi đè bản mới nhất.
  • Thư mục data/ đã gitignore — chuyển máy chỉ cần copy folder này.

🧪 Kiểm thử

pip install -r requirements-dev.txt
python -m pytest -q     # 35 test: auth & phân quyền, plans, báo cáo năm, kho, backup/restore, JSON, migration, song ngữ

🛣️ Hướng mở rộng

  • Phân quyền chi tiết theo kế hoạch/phòng ban; giới hạn đăng ký (invite-only)
  • Backup tự động theo lịch (cron gọi POST /api/backups)
  • Lặp việc định kỳ, việc nhiều ngày trên Gantt, dependency giữa các việc
  • PostgreSQL khi quy mô lớn (thay lớp database.py)

🇬 English

A lightweight web app to track daily tasks, assign work on a monthly calendar, organize tasks into plans with a Gantt chart, and generate daily / monthly / yearly reports (multi-sheet Excel with charts, CSV). Includes a report vault organized in subfolders, one-click backup/restore + JSON export/import, and user accounts with roles. Fully bilingual Vietnamese / English — both the UI and the exported report files.

v2.1 — full Vietnamese / English support (🇻🇳 VI / 🇬🇧 EN toggle, remembered per browser; translates the UI and exported Excel/CSV files). v2.0 — orange·white·blue theme, Plans + Gantt module, yearly reports, report vault with daily/monthly/yearly subfolders, account system.

✨ Features

Area Details
🌐 Bilingual VI / EN 🇻🇳 VI / 🇬 EN toggle in the top bar (and on the login screen), remembered in the browser. Translates the entire UI (menus, buttons, tables, modals, error messages) and exported Excel/CSV reports (sheet names, column headers, status/priority labels, date formats). User-entered data is never translated
🔐 Accounts Register / sign in to access the app (7-day session cookie, PBKDF2 200k-round password hashing). First account = administrator. Admins create/delete accounts and change roles; everyone can change their own password
Daily tasks Day view, add–edit–delete, change status inline, filter by member & status, stats + completion rate, overdue warnings, link tasks to a plan
Monthly assignment Month calendar, drag & drop to reschedule, click a day cell to assign quickly, per-member workload bars
📋 Plans Create plans (name, description, date range, owner, color); progress % computed automatically from the plan's tasks; deleting a plan moves its tasks to "No plan"
📊 Gantt Gantt chart for any date range: plan bars (bright part = % complete) + task cells colored by status, orange "today" line, horizontal scrolling, click a bar/cell to edit
Daily / monthly / yearly reports Overview, by member, by priority; monthly has a 3D chart by day, yearly has a 3D chart across 12 months → export Excel / CSV, auto-saved to the vault
🗃️ Report vault Subfolders data/reports/ngay/ (daily), thang/ (monthly), nam/ (yearly) — folder-style navigation, one direct download link per file, copy link, filter by format, one-click save
💾 Data storage One-click backup (SQLite backup API), download/restore/delete backups (a safety backup is created before restoring); export/import everything as JSON (members + plans + tasks)
Team Add/edit/delete members (name, role, color), monthly statistics
🎨 UI Orange–white–blue theme, 3D tilt cards, drag-to-rotate 3D bar charts, parallax particle background; mobile responsive (scrollable tables and Gantt)
Demo data First run seeds ~180 tasks for 5 members, 4 sample plans (tasks auto-assigned by topic) and daily/monthly/yearly reports into the vault

🖼️ Screenshots (English UI)

Login Yearly report — 3D chart
EN login EN yearly report
Gantt chart Plans
EN Gantt Plans

🚀 Quick start

Requires Python 3.10+

git clone https://github.com/Aniworld123/Task-management.git
cd Task-management
python -m venv .venv && source .venv/bin/activate   # (Windows: .venv\Scripts\activate)
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# open http://localhost:8000  ·  API docs: http://localhost:8000/docs

First launch: click Create account — the first account automatically becomes the administrator; later accounts are members (admins can promote them in Accounts). Click 🇬🇧 EN in the top bar to switch the whole app to English.

Data options

python -m app.seed --reset        # Wipe and re-seed demo data + plans + vault reports
QLCV_SEED=0 uvicorn app.main:app  # Disable auto-seeding
QLCV_DB_PATH=/path/to/other.db uvicorn app.main:app   # Relocate the SQLite file

Upgrading from v1.x: just run the new version — the old DB migrates automatically (adds plans/users/sessions tables and tasks.plan_id), legacy vault files move into subfolders, no data loss.

🌐 Vietnamese / English

  • 🇻🇳 VI / 🇬🇧 EN toggle in the top bar and on the login screen; the choice is stored in localStorage (per browser).
  • Default is Vietnamese. Switching to EN translates all menus, titles, buttons, tables, charts, modals and messages (including API errors); dates use English formats (December 1, 2026, calendar Mon…Sun, Gantt Dec 2026).
  • Exports follow the selected language: English Excel has sheets Overview / By member / By day / By month / Task details with columns Task, Member, Priority, Status…; CSV likewise. The API accepts lang=vi|en (default vi).
  • User-entered data (task titles, member and plan names) is never translated — only UI labels and report scaffolding are.

🔐 Accounts & roles

  • Open registration for the first user (becomes admin); passwords ≥ 6 characters, hashed with PBKDF2-HMAC-SHA256, 200,000 rounds + per-user salt.
  • Session: qlcv_session cookie (HttpOnly, SameSite=Lax), 7-day expiry; every API (except login/register) returns 401 when not signed in.
  • Admin: create/delete accounts, switch admin ↔ member roles (cannot delete/demote yourself). Member: full access to tasks/plans/reports, no Accounts section.
  • Vault download links also require sign-in (they work in a browser that is already signed in).

💾 Data storage

data/
├── tasks.db        # Main SQLite DB: members, plans, tasks, users, sessions
├── backups/        # qlcv-YYYYMMDD-HHMMSS-ffffff.db — one-click backups
└── reports/        # Report vault subfolders:
    ├── ngay/       #   bao-cao-ngay-YYYY-MM-DD.xlsx/.csv   (daily)
    ├── thang/      #   bao-cao-thang-YYYY-MM.xlsx/.csv     (monthly)
    └── nam/        #   bao-cao-nam-YYYY.xlsx/.csv          (yearly)
  • Backups use sqlite3.Connection.backup() → consistent even while the app is running; restoring creates a safety backup first.
  • JSON export (version 2) bundles members + plans + tasks; JSON import validates, then replaces all three tables while preserving relationships.
  • Report vault: every Excel/CSV export is downloaded and saved into the right subfolder; filenames are period-based, so re-exporting a period overwrites it with the latest version.
  • data/ is gitignored — to move machines, just copy this folder.

🧪 Tests

pip install -r requirements-dev.txt
python -m pytest -q     # 35 tests: auth & roles, plans, yearly reports, vault, backup/restore, JSON, migration, VI/EN

🛣️ Roadmap

  • Fine-grained permissions per plan/department; invite-only registration
  • Scheduled automatic backups (cron calling POST /api/backups)
  • Recurring tasks, multi-day tasks on the Gantt, task dependencies
  • PostgreSQL for larger scale (swap the database.py layer)

📁 Repository structure / Cấu trúc repo

Task-management/
├── app/
│   ├── main.py            # FastAPI + auth middleware, tasks/reports routers
│   ├── auth.py            # PBKDF2 + cookie sessions
│   ├── auth_api.py        # /api/auth/* + /api/users (admin)
│   ├── plans_api.py       # /api/plans — CRUD + progress from tasks
│   ├── database.py        # SQLite schema v2 + auto-migration from v1
│   ├── models.py          # Pydantic schemas
│   ├── reports.py         # Daily/monthly/yearly reports + Excel/CSV (bilingual)
│   ├── i18n.py            # VI/EN labels for reports & exports
│   ├── storage.py         # Backup/restore, vault subfolders, JSON v2
│   ├── storage_api.py     # Storage & vault routers
│   ├── seed.py            # Demo data + 4 plans + vault reports
│   └── static/            # Orange–white–blue UI (vanilla HTML/CSS/JS)
│       ├── i18n.js        # VI/EN dictionary + language toggle (localStorage)
│       └── app.js · index.html · style.css
├── scripts/xuat_bao_cao_mau.py   # Generate sample reports into examples/
├── tests/test_api.py      # 35 tests
├── examples/              # Sample reports committed to the repo
├── data/                  # tasks.db + backups/ + reports/{ngay,thang,nam}/ (gitignored)
├── requirements.txt · requirements-dev.txt · LICENSE (MIT)
└── README.md              # This bilingual README / README song ngữ này

🔌 Main API / API chính

Method Endpoint Description / Mô tả
POST /api/auth/register · /api/auth/login Create account (first = admin) / sign in · Tạo tài khoản / đăng nhập
POST /api/auth/logout · /api/auth/password Sign out / change password · Đăng xuất / đổi mật khẩu
GET /api/auth/me Current session info · Phiên hiện tại
GET/POST /api/users · DELETE /api/users/{id} · PUT /api/users/{id}/role User administration (admin) · Quản trị tài khoản
GET/POST /api/plans · GET/PUT/DELETE /api/plans/{id} Plans + progress % · Kế hoạch + tiến độ
GET /api/tasks?date=&month=&year=&from=&to=&plan_id=&member_id=&status=&q= Filter tasks (from/to feed the Gantt) · Lọc công việc
GET/POST/PUT/DELETE /api/tasks · /api/tasks/{id} Task CRUD (with plan_id)
GET /api/reports/{daily,monthly,yearly}?date=&month=&year=&lang= JSON reports (lang=vi|en, default vi)
GET /api/reports/{daily,monthly,yearly}.{xlsx,csv}?…&lang= Localized export, auto-saved to vault · Xuất file theo ngôn ngữ, tự lưu kho
GET/POST /api/reports/archive Vault listing (kind, folder, url) / save report (kind: ngay/thang/nam)
GET/DELETE /api/reports/archive/{name} Direct download link / delete · Link tải / xóa file
GET/POST /api/backups · POST /api/backups/{name}/restore Backup / restore · Sao lưu / khôi phục
GET/POST /api/data/export · /api/data/import Full JSON (v2: + plans)

Conventions / Quy ước: status chua_lam (to do) / dang_lam (in progress) / hoan_thanh (done); priority cao (high) / trung_binh (medium) / thap (low); overdue = before today & not done; plan progress = % of tasks done.

📊 Report formats / Định dạng báo cáo

  • Daily Excel: Overview / Tổng quan + Details / Chi tiết (status colors, overdue in red, auto-filter).
  • Monthly Excel: Overview · By member · By day (bar chart) · Task details.
  • Yearly Excel: Overview · By member · By month (12-month bar chart) · Task details.
  • CSV: UTF-8 BOM — Vietnamese displays correctly in Excel.
  • On the web: monthly/yearly reports have drag-to-rotate 3D charts; the Plans view has a Gantt for any date range.

📄 License / Giấy phép

MIT

About

Ứng dụng quản lý công việc: kế hoạch + Gantt, báo cáo ngày/tháng/năm, kho báo cáo, song ngữ Việt/Anh (FastAPI + SQLite)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages