# Admin Area

Administrative features available in the WHMCS admin panel: per-service summary and history on the product page, and the time-logging header injected into every ticket.

# Product Home Screen

### Support by Time module **[WHMCS](https://puqcloud.com/link.php?id=77)**
#####  [Order now](https://puqcloud.com/whmcs-module-support-by-time.php) | [Download](https://download.puqcloud.com/WHMCS/servers/PUQ_WHMCS-Support-by-time/) | [Community](https://community.puqcloud.com/)

## Admin area service page

When the administrator opens a customer's Support by Time service in WHMCS, the module adds the following panels to the service page.

![Admin service page — summary, operator report, history and tickets](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-vsp65nsp.png)
*12-admin-product-page.png*

### License verification

If the license is invalid or unreachable, a red bar with the error message is shown. While the license is invalid, the module's lifecycle hooks (Create / Suspend / Unsuspend / Change Package / Terminate) all return errors.

### Summary

A one-row summary table for the current month: month, package hours, used hours, hours left, price per hour, hours outside the package, and the calculated overage amount.

### Operator report

Two side-by-side tables — **This month** and **Last month** — listing each operator who logged time on this service with their total hours and number of entries.

### History (recurring billing cycle)

A row of buttons that switches the **List of tickets** table to any past month for which time has been logged. The current month is the default. Clicking a button reloads the list via AJAX without leaving the WHMCS service page.

### List of tickets

One row per ticket logged in the selected month:

| Column | Description |
|--------|-------------|
| **Ticket** | Ticket number and title (links to the support ticket) |
| **Total** | Total time logged on the ticket, plus the number of entries |
| **Operator** | The operator(s) who logged time |
| **Date** | Date of the most recent entry |
| **Billable Item** | Link to the WHMCS billable item created for this ticket (if any) |
| **Invoice** | Link to the invoice that contains the billable item |
| **Status** | Open / Billed / Paid / Unpaid |

Expanding a ticket row reveals its **time entries** (date, time, note, operator) — each with **Edit** and **Delete** actions — followed by the per-ticket **audit trail**. Entries belonging to a ticket that has already been billed are locked (shown with a lock icon instead of the Edit/Delete buttons) so billed time cannot be altered.

Before any time has been logged for the selected month, the tickets list shows an empty state. The panels sit on the WHMCS service page below the standard product/billing fields:

![Service page with no tickets logged yet](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-6udr2dad.png)
*13-admin-product-overview.png*

### One Time services

For services with the *One Time* billing cycle the panel is simplified: a single **Status** block with package / used / left hours, and a list of all tickets that have consumed hours from the bucket.

---

## Floating active-timers widget

On every admin page the module shows a small floating widget in the bottom-right corner listing all timers the current operator has running, each with a live elapsed clock and a link to the ticket. It polls in the background and ticks every second, so a running timer is never lost when navigating away from the ticket.

![Floating active timers widget](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-1lfyxfiz.png)
*14-admin-floating-timers.png*

---

## License alert on the admin homepage

The module also adds an alert to the WHMCS admin **Home** page that lists every Support by Time product whose license is currently invalid or unreachable. Each entry links directly to the corresponding product configuration page so the operator can fix it in one click.


<!-- sync:11f568686e1420ab -->

# Ticket header

### Support by Time module **[WHMCS](https://puqcloud.com/link.php?id=77)**
#####  [Order now](https://puqcloud.com/whmcs-module-support-by-time.php) | [Download](https://download.puqcloud.com/WHMCS/servers/PUQ_WHMCS-Support-by-time/) | [Community](https://community.puqcloud.com/)

## Time-logging header

Whenever an administrator opens a ticket in the WHMCS admin area, the module injects a context-aware header above the ticket. The header loads its state over AJAX and renders entirely client-side — every action (save, close, reopen, timer, order) happens **without reloading the page**. It detects the situation (active service, terminated service, no service, ticket charged in a previous month, ticket closed, license issue) and renders the appropriate UI.

---

### Open ticket — time form

![Open ticket time form](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-pmv5jzwt.png)
*15-ticket-time-form.png*

The default view is a panel containing:

- **Service selector:** A drop-down listing all customer support services. Active services are listed first with `Active` priority, followed by suspended and terminated services. Each entry displays package allocation and remaining hours: `Service name (cycle - status) — Available: 3h 17m / 5h`.
  - **Smart default selection:** When opening a ticket with no hours logged yet, the header automatically pre-selects the first usable **Active** service (prioritizing packages with available quota).
  - **Reactive switching:** Switching services updates the form immediately without page reload, recalculating available time and adjusting controls while preserving any text already typed into the **Note** field.
- An **HH:MM** time input with `−` / `+` buttons (minute steps; minutes roll over into hours). For *One Time* services the value is automatically capped at the hours remaining in the bucket.
- An optional **Note** field (visible to the client when *Show work log to client* is enabled on the product).
- Action buttons:
  - **Save time** — appends the entered time as a new entry; the ticket stays open.
  - **Close ticket and save time** — appends the entry and sets the WHMCS ticket status to *Closed*.
  - **Start** — starts a live timer (see below).

> Each save **adds** a new entry to the ticket — it does not overwrite previous entries. The running total ("Already logged") and the full breakdown are shown in the audit trail.

#### Dynamic button state and status guard

The action buttons and time picker adapt dynamically to the selected service's status and remaining quota:

- **Active recurring service:** Buttons and inputs are always enabled. If usage exceeds included quota, an orange notice displays the overage rate per hour.
- **Active One Time service with hours remaining:** Buttons and inputs are enabled; the maximum loggable time is capped at the remaining bucket hours.
- **Active One Time service exhausted (0 hours left):** Action buttons (**Save time**, **Close & save**, **Start**) and the time input are disabled. A red notice informs: *Package hours exhausted. All prepaid hours for this One Time service have been used. Additional time cannot be added. Please order a new support package.*
- **Non-Active service (Terminated / Suspended):** Action buttons and inputs are disabled, and a warning alert is displayed: *Selected service is {Status}. You cannot log time to this service.*
- **Instant unblocking:** If an operator switches in the drop-down from a Terminated or Suspended service to an Active service, the alert banner disappears immediately and all action buttons and inputs are unblocked without reloading the page.
- **Backend security validation:** All backend endpoints (`save_time`, `timer_start`, `SetItem`) enforce `domainstatus === 'Active'`. Any attempt to log time or start a timer against a non-Active service is rejected at the server level.

#### Audit trail

Below the form, a timeline lists every action taken on the ticket (time logged, edited, deleted, timer start/stop/cancel, service ordered), with the operator name and a relative timestamp.

![Time form with audit trail](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-r3recfdt.png)
*16-ticket-time-form-audit.png*

---

### Live timer

Pressing **Start** opens a red *Timer running* panel with a server-anchored running clock and **Stop** / **Cancel** buttons. **Stop** rounds the elapsed time up to the nearest minute and appends it as a regular time entry (with the note, if any); **Cancel** discards it.

![Timer running](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-bsrg9ki6.png)
*17-ticket-timer-running.png*

After stopping, the action is recorded in the audit trail (elapsed time, added hours, new total):

![Audit trail after stopping the timer](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-l9nm1ld0.png)
*18-ticket-timer-audit.png*

---

### Closed ticket

![Closed ticket](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-vkbir0nx.png)
*19-ticket-closed.png*

When the ticket is closed, the header shows a compact summary (logged time + service) plus a **ReOpen** button that switches the WHMCS ticket status back to *Open* so the operator can log more time. If the ticket has already been billed, ReOpen is refused (the time is locked).

---

### Ticket charged in a previous month

![Ticket charged in a previous month](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-sgql7ele.png)
*20-ticket-past-month.png*

If the ticket's time belongs to a previous month, editing is locked: the header shows a red panel with the recorded time, the service, and a hint to **recreate or split the ticket** if more time needs to be logged. This prevents retroactive changes after the monthly billable item has been created.

---

### Inactive or terminated service handling

If a ticket has existing logged time associated with a service that has since been terminated or suspended:
- The header displays an alert informing that the selected service is not active and time cannot be added to it.
- If the customer has other active services, the operator can simply switch to an active service in the drop-down — the buttons unblock immediately.
- If the customer has no active services, the operator can order or activate a new package directly from the ticket header using the inline order form.

---

### Client without a support service

![Order service inline](https://doc.puq.info/uploads/images/gallery/2026-10/embedded-image-rsqqec8s.png)
*21-ticket-order-service.png*

If the client does not yet have an Active or Suspended Support by Time service, the header shows an inline order form: a drop-down with all available Support by Time products and a drop-down with available WHMCS payment methods. Submitting it creates a WHMCS order, accepts it, runs auto-setup and reloads the ticket.

---

### License issue

When any of the customer's Support by Time products has an invalid or unreachable license, the header shows a red banner instead of the time form, with the product name and the error message returned by the license server.


<!-- sync:513a3693a84b92ea -->

