Skip to content

feat(territories): zone-based mode (polygon, no buildings) #110

Description

@mindsers

Context

Every territory today is building-based. TerritoryKind (schema.prisma:18-24) has Classical, Univ, Commerces, Phone, Hotel; each maps to an EntranceKind (buildings.server.ts:8-14). Some territory types don't fit this model: markets, taxi areas, book-sharing boxes, boat docks, beaches — anywhere addresses don't apply. Currently they can only be tracked as fake-address buildings or unattached overlays on the assembly map.

Per-congregation polygons exist (TerritoryPerimeter for the assembly perimeter, TerritoryCardOverlay for card overlays) but neither attaches a polygon to a specific territory.

Proposal

Add a mode on each territory, orthogonal to TerritoryKind, that controls how it is managed:

  • Buildings mode (current): addresses, entrances, prospection per building. Used for doors-to-door, commerce, hotels, campus.
  • Zone mode (new): a polygon drawn on the map plus notes. No buildings, no entrances. Used for markets, taxis, book boxes, beaches — anything without a stable address.

A congregation can mix the two: most territories continue in buildings mode, niche ones use zone mode. The choice is made when creating a territory.

Acceptance criteria

Data model

  • Add a way to mark a territory as zone-based (e.g., mode: TerritoryMode { Buildings | Zone }, default Buildings)
  • Zone-mode territories own a per-territory polygon. Buildings-mode territories do not.
  • Existing territories default to Buildings mode

Authoring

  • Create form: choose mode (default Buildings)
  • Zone-mode edit screen reuses the assembly map perimeter editor as a per-territory variant
  • The variant can visualise nearby territories for context (non-blocking nice-to-have)
  • Buildings-mode UX is unchanged

Reading / display

  • Territory list shows mode indicator
  • Territory view: zone territories show polygon + notes; the buildings/entrances panel is hidden
  • PDF card export for zone territories: polygon snapshot on map + notes (no buildings table)
  • Map view renders the polygon for zone territories

Existing flows (must keep working)

  • Attribution lifecycle (new, edit, delete, history)
  • Search and filters

Out of scope

  • New TerritoryKind values — kinds stay as-is; mode is orthogonal
  • Migrating an existing buildings territory to zone (or vice versa) post-creation
  • Mixed mode (a territory with both buildings and a polygon)

Files

  • app/database/schema.prismaTerritory.mode + per-territory polygon (extend TerritoryPerimeter or sibling model)
  • app/features/territories/routes/territory/new.tsx, edit.tsx, view.tsx
  • app/features/territories/server/buildings.server.ts — zone territories skip building/entrance work
  • PDF generation — alternate template for zone territories
  • Per-territory perimeter editor (variant of the assembly map editor)

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Mid Term

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions