# tracking_kits

Classic ASP (VBScript) web app for managing **Mail Tracking Kits**.

At a high level, this app helps you:
- Browse/search **Jurisdictions** (by JCode, name, address, IMB fields)
- Create/print tracking kits / labels tied to a jurisdiction
- View existing kits and related job types (Purple Envelope jobs, Custom Office Copies)
- Run an import service that pulls tracking export files into the database

> Entry point: `index.asp` redirects into the MVC controller: `App/Controllers/Home/HomeController.asp`

---

## How the app works

### Architecture
- **Classic ASP + MVC helpers**: The app uses a lightweight MVC framework under `/MVC`.
- **Controllers/Views/ViewModels** live under `/App`.
- **Repositories** under `/App/DomainModels` handle database access.
- `App/include_all.asp` loads MVC + DAL + repositories.

### Key routes / screens
- `/` → `index.asp` → redirects to `App/Controllers/Home/HomeController.asp`
- **Switchboard (home)**: `HomeController.Index`
  - Links to:
    - Create Kit
    - View Tracking Kits
    - View Purple Envelope Jobs
    - Custom Office Copies

- **Create Kit**: `HomeController.CreateKit`
  - Paged list of jurisdictions
  - Search box (posts to `HomeController.Search`)
  - Each row has an action button that routes to `KitController.createTrackingKit` for the selected `JCode`

- **Search**: `HomeController.Search`
  - Searches across jurisdiction fields: `JCode`, `Name`, `Mailing_Address`, `CSZ`, `IMB`, `IMB_Digits`

- **Print (label report demo)**: `HomeController.Print`
  - Uses ReportMan ActiveX to render a `.rep` report and save to a PDF.

---

## Data + dependencies

### Database
- Data access is via `App/DAL/lib.DAL.asp` (ADO) + repositories in `App/DomainModels/*Repository.asp`.

Key repositories referenced in `App/include_all.asp`:
- `JurisdictionRepository`
- `KitRepository`
- `KitLabelsRepository`
- `InkjetRecordsRepository`
- `SettingsRepository`
- `ContactsRepository`
- `SnailWorksRepository`
- `CustomOfficeCopyJobRepository`
- `ColorsRepository`

### Config
- `App/app.config.asp`
  - Initializes routes with `Routes.Initialize "/App/"`
  - Sets `siteTitle = "Mail Tracking Kits"`
  - Sets `ExportDirectory` based on the `dev` flag

### External/ActiveX dependencies
This repo includes Windows/ActiveX dependencies under `/Dependancies` (examples):
- Chilkat ActiveX DLLs (license/unlock in `App/app.config.asp`)
- ReportMan OCX
- Debenu PDF Library ActiveX
- NSSM + PsExec utilities

---

## Running locally (IIS)

### Requirements
- Windows + IIS with Classic ASP enabled
- The ActiveX dependencies must be installed/registered if you use printing/export features

### IIS setup
- Point the IIS site root at the repo root (so `index.asp` is the default document).
- Ensure Classic ASP is enabled.

The repo includes a basic `web.config` that sets `index.asp` as the default document.

---

## Import service

There is an import script/service under:
- `ImportService/TrackingDataImport.vbs`

And a helper installer:
- `InstallService.vbs`

These are intended to run on Windows to import tracking export data from the configured `ExportDirectory`.

---

## Dev tooling

### Docker (Codex dev container)
This repo includes a `docker-compose.yml` and `Dockerfile` meant for a Codex development container.
It does **not** run IIS inside Docker; it’s a dev environment for working on the code.

---

## Where to look next
- UI: `App/Views/Home/*`
- Controller logic: `App/Controllers/Home/HomeController.asp`
- Jurisdiction data access: `App/DomainModels/JurisdictionRepository.asp`
- Printing/report templates: `/Data/*.rep`
