Skip to content

Proposal & payment workflow overhaul#69

Merged
iaretechnician merged 1 commit into
unstablefrom
copilot/update-runlevel-systems-workflow
Jun 1, 2026
Merged

Proposal & payment workflow overhaul#69
iaretechnician merged 1 commit into
unstablefrom
copilot/update-runlevel-systems-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

Replaces the multi-step proposal/approval process with a single canonical proposal object per customer request, with a linear flow: request → staff drafts proposal → customer views/accepts/requests changes → payment → work begins.

Data layer

  • New data/payments.json store; portalLoadPayments/portalSavePayments helpers
  • portalGenerateUniqueProposalId() / portalGenerateUniquePaymentId() (date-prefixed: PROP-YYYYMMDD-XXXX)
  • Expanded PayPal settings in portalDefaultAdminSettings: nested sandbox/live credential sub-objects, mode enum (manual/sandbox/live), general fields (currency, payment_instructions, enable_webhook_logging, etc.)
  • PORTAL_PAYPAL_WEBHOOK_LOG constant; backward-compat fallback reads old flat status field

Staff pages (new)

  • staff/proposals.php — pipeline list with status badges, bulk actions
  • staff/proposal-edit.php — full editor: all proposal fields, dynamic milestone support (0–5), contract-required toggle, save-draft / send-to-customer
  • staff/proposal-view.php — read-only view with change requests panel
  • staff/proposal-send.php — sets proposal_status=sent, stamps sent_at, fires email
  • staff/payment-record.php — manual payment recorder; writes payments.json, advances proposal/milestone status

Client pages

  • client/proposal-view.php — full detail view: accept form (with checkbox confirmation), request-changes form (stores into proposal.change_requests[]), conditional PayPal payment link based on configured mode
  • client/proposals.php — updated with "How This Works" steps, status cards, highlighted call-to-action per status
  • client/proposal.php — now a redirect to proposal-view.php

Proposal statuses

draftsentchanges_requestedacceptedpayment_pendingpaid_startin_progresscompleted / cancelled

PayPal webhook placeholder

  • paypal-webhook.php — logs raw POST payloads to data/paypal-webhook-log.json (gated on enable_webhook_logging), capped at 500 entries, returns 200. Stubbed TODOs for signature verification and transaction-to-proposal matching.

Settings UI (settings.php)

  • PayPal section replaced: mode dropdown, separate Sandbox / Live credential cards, masked secrets (placeholder •••• shown after save; secret only overwritten on non-blank submit), general settings checkboxes

Dashboard (dashboard.php)

  • Staff: Proposal Pipeline row (Draft / Sent / Changes Requested / Accepted / Awaiting Payment / Paid+Ready / In Progress) + quick-links (Proposals, + New Proposal, Record Payment)
  • Client: "Proposals to Review" card (highlights amber when > 0), My Proposals count

Copilot AI requested a review from iaretechnician June 1, 2026 20:26
@iaretechnician iaretechnician marked this pull request as ready for review June 1, 2026 20:27
Copilot AI review requested due to automatic review settings June 1, 2026 20:27
@iaretechnician iaretechnician merged commit e059410 into unstable Jun 1, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants