# UPLOAD LIST — Activity & Task · Subscription Management · Government / Agency product split

Everything below was built and tested end to end against a copy of your own database
(schema dump + every existing migration replayed, then `acvmigration.php` on top).
Task create → assign → update → hand-over → delete, plan create → price up → price down →
product add/remove → delete guard, and both product pages were all exercised and pass.

---

## 1. NEW FILES — upload these

| File | What it is |
|---|---|
| `acvmigration.php` | **root** — the database migration. Run once, then delete. |
| `includes/tasks.php` | The task engine: the catalogue of every task type, the task-number generator, the logging helper, and the who-can-do-what rules. |
| `admin/activity_task.php` | The Activity & Task board. |
| `admin/subscription_plans.php` | Subscription Management. |
| `admin/product_management_gov.php` | Government Portals product page (13 lines — it re-uses `product_management.php`). |

## 2. MODIFIED FILES — replace these

| File | What changed |
|---|---|
| `admin/product_management.php` | Split into two pages. It now reads `PM_GROUP` and shows either **Agency & Software** (`category_id <> 1`, full sheet) or **Government Portals** (`category_id = 1`, reduced sheet). All redirects, filter keys, export links and the AJAX URL follow the page it is running as. |
| `admin/includes/sidebar.php` | Added **Activity & Task** (Overview, with a live badge of the open tasks assigned to you), **Government Portals** under Service Management, and a new **Subscription Management** group. |
| `includes/rbac.php` | Two new modules an admin can hand to a role: `manage_tasks`, `manage_subscriptions`. |
| `includes/activity.php` | The audit trail now names the new pages properly (`Activity & Task`, `Subscription Management`, plus `leads.php`, `hero_slides.php`, `service_import.php`, `kyc_fields.php` which were falling through to a guessed label). |

**Nothing else was touched.** `db.php`, `config.php`, `subscription.php`, `includes/shares.php`,
`includes/functions.php` and every other file are unchanged.

---

## 3. HOW TO DEPLOY

1. Upload the four new PHP files and the four modified ones (keep the folder structure).
2. Open **`https://wbmcz.online/acvmigration.php`** in your browser.
   It shows a green line — *Migration completed successfully*.
   `includes/tasks.php` must already be uploaded, or the task catalogue will not be seeded
   (the page tells you so, and you can simply re-run it afterwards).
3. **Delete `acvmigration.php` from the server.**
4. Hard refresh the admin panel (Ctrl + Shift + R).

The migration is safe to run more than once — every step checks before it changes anything.

---

## 4. DATABASE CHANGES

### New tables

| Table | Holds |
|---|---|
| `tasks` | One row per piece of work: who it is about, which module, task type, who holds it, priority, status, progress, due date, hand-over count. |
| `task_activities` | The log every task carries — create, assign, hand-over, status, priority, due date, progress, notes — with the person, their role, the time and the IP. |
| `task_categories` | The task-type catalogue. Seeded with **174 task types** across 19 modules, and you can add your own rows later. |
| `subscription_plans` | Many plans: name, MRP, price, length in days, member discount %, scope, badge, colour, features, default / popular / hidden. |
| `subscription_plan_items` | Which product sits in which plan, with an optional per-product override (% off, ₹ off, or free). |
| `subscription_plan_history` | Every price move and every product added or dropped, with who did it and why. |
| `user_subscriptions` | Which customer is on which plan and until when (ready for renewals). |

### Changed tables

| Table | Column added |
|---|---|
| `users` | `is_subscribed` (only if missing), `subscription_plan_id`, `subscription_started_at`, `subscription_expires_at`, index `idx_users_plan` |
| `seller_services` | `product_group` (`government` / `agency`), index `idx_ss_group`. Back-filled from `category_id`. |
| `roles` | Every role that already holds `all` gains `manage_tasks` and `manage_subscriptions`. |
| `settings` | `subscription_price` is kept in step with the default plan, so the existing `subscription.php` keeps working untouched. |

---

## 5. ACTIVITY & TASK — how it works

**Admin → Activity & Task**

* **Five tabs across the top** — User · Seller · Employee · Admin · Super Admin.
  This says *who the task is about*.
* **Nineteen module chips under them** — Lead, User, KYC, Subscription, Refer, Follow-up,
  Order, Support, Notification, Offer, Product, Service, Seller, Wallet, Payout,
  Website, Staff, Report, General. Each carries its own count.
* **Six counters** — Total, Pending, In Progress, Completed, Rejected, Follow-up.
  Click one to filter by it. An overdue bar appears on its own when a deadline passes.
* **Filters** — search (task ID, name, mobile, task type), assigned to, priority, status,
  date range (today / 7 / 30 days / overdue only / custom). Plus CSV export.
* **Task numbers** read like the ones in your mock-up: `KYC260831001`, `WEB260831002`,
  `LED260831003` — module code, date, running serial.

### Who can do what

| | Super Admin / Admin | Employee |
|---|---|---|
| See every task | yes | no — only the tasks they hold or raised |
| Create a task | yes | no |
| Assign to anyone | yes | no |
| Update status, priority, progress, notes | yes | yes, on their own tasks |
| Change the deadline | yes | no — the admin's deadline stands |
| **Hand a task to a colleague** | yes | **yes — a reason is required** |
| Delete a task | yes | no |

A hand-over moves the task out of that employee's list, sets it back to **Pending** for the new
person, bumps the hand-over counter, and writes both names plus the reason into the task log —
so you can always see who had it before and why it moved. It also lands in the main Activity Log.

*"Admin, employee tara nijeder task dekhte pabe"* — an employee opening the page sees only their
own work, with a note saying so. The sidebar badge shows how many open tasks are waiting for them.

### The 174 task types, by module

* **Lead** — new lead, verify, first call, follow-up, qualification, demo, quotation, conversion, re-assign, close/lost, bulk import, source analysis
* **User** — add, onboarding call, verify, correct profile, collect document, upgrade, downgrade, block/unblock, delete, restore, password help, ID card, bulk import, data audit
* **KYC** — verification, re-check, Aadhaar, PAN, address proof, bank details, photo/signature, call for missing document, rejection review, set up KYC questions, bulk review
* **Subscription** — create plan, price up, price down, add product, remove product, activate, renewal, expiry, cancellation, refund, upgrade call
* **Refer** — verify, payout, dispute, campaign, level check, report
* **Follow-up** — call back, WhatsApp, email, field visit, meeting, payment reminder, feedback
* **Order** — process, collect document, verify, work in progress, deliver, delayed, cancel, refund, complaint, report
* **Support** — new ticket, reply, follow-up, escalate, close, callback, complaint, help article
* **Notification** — push, email campaign, SMS, WhatsApp broadcast, in-app, schedule, template
* **Offer** — create coupon, offer price, attach to product, banner design, expire, performance review
* **Product** — add, edit, price & MRP, share %, image/icon, description & SEO, required KYC, serviceable area, links, add government portal, update government portal, approve, reject, bulk CSV import, remove, data audit
* **Service** — main category, sub category, re-order, icon/colour, pending approval, new request, map to seller, list audit
* **Seller** — onboarding, KYC, agreement, review product, payout check, commission setup, training, complaint, block/unblock, upgrade request
* **Wallet** — verify top-up, manual credit/debit, verify bank, withdrawal, failed transaction, reconciliation, dispute
* **Payout** — process, verify, commission calculation, staff share, hold/release, earning report
* **Website** — **home page carousel/slider**, after-login banner, banner design, general settings, logo & favicon, contact & address, SEO/meta, page content, video section, team members, why choose us, statistics counter, language/translation, build request, delivery, bug fix
* **Staff** — add account, assign role, set target, training, performance review, attendance, exit
* **Report** — daily, weekly, monthly analysis, sales analysis, data audit, export
* **General** — general task, meeting, document work, research, office purchase, other

Add your own at any time with a row in `task_categories` — the board picks it up straight away.

---

## 6. SUBSCRIPTION MANAGEMENT — how it works

**Admin → Subscription Management → All Plans**

* **As many plans as you want.** Each has its own name, code, MRP, selling price, length in
  days, member discount %, badge, colour and feature list.
* **Price up / Price down** are one click on the plan card. Choose by amount (₹), by
  percentage (%), or type an exact new price — a live preview shows what it will become, and
  the reason you type is kept forever in the plan history.
* **Products** — a plan either covers **every product on the site**, or only the ones you tick.
  Search the catalogue, tick, add. Each product can carry its own deal inside the plan:
  a % off, a ₹ off, or **free for members**. The box shows MRP → what a member actually pays.
* **History** — every price move (up or down, colour coded), and every product added or dropped,
  with the person and the reason.
* **Safety** — a plan someone is subscribed to cannot be deleted; the page tells you how many
  customers are on it and suggests hiding it instead. The default plan cannot be deleted either.
* **Nothing breaks** — the old `subscription_price` setting is kept in step with the default
  plan, so the customer-facing `subscription.php` carries on working exactly as before.

---

## 7. PRODUCT MANAGEMENT — the government / agency split

Two menu entries, one shared code file.

| | Product Management | Government Portals |
|---|---|---|
| URL | `product_management.php` | `product_management_gov.php` |
| Shows | `category_id <> 1` — agency & software | `category_id = 1` — government portals |
| Columns | Product No · Category · Name · **MRP · Discount Price · Seller Details · Seller Share · Discount Share · Referral Share · Staff Share · Company Share · Quick Response** · Update · Notes · Action | Product No · Category · Name · **Portal Links · Customer Data** · Update · Notes · Action |
| Price & Share button | yes | no — a government portal is always free |
| Category dropdown | every category except Government Portals | Government Portals only |

The removed columns are exactly the ones you asked for: MRP, Discount Price, Seller Details,
and all five share columns including Discount Share (Subscription). In their place the
government page shows what a portal actually needs — **Website / App / Tutorial links**, and
**how many KYC fields and service areas** the customer must satisfy.

Because the two pages share one file, a fix or a new feature added to Product Management
appears on the Government Portals page at the same time. Their filters are remembered
separately, so a search on one page does not follow you to the other.

---

## 8. WHAT TO CHECK AFTER UPLOADING

1. **Admin → Activity & Task** — click *Create Task*, pick Lead → New Lead Entry, assign it to a
   staff member, save. The task number appears, and the eye icon opens the full history.
2. Log in as that employee — they see only that task, can update it, and can hand it back with
   a reason. Open the task again as admin: the whole trail is there.
3. **Admin → Subscription Management** — the *Standard Plan* is already there at your old price.
   Try *Price up* → ₹100, then open *History*.
4. **Admin → Service Management → Government Portals** — your 12 government products, with no
   price or share columns.
5. **Admin → Service Management → Product Management** — the agency & software products, with the
   full share breakdown as before.
6. **Admin → User Management → Custom Roles** — the two new modules *Manage Activity & Task* and
   *Manage Subscription Plans* are now tickable for any staff role.
