diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 00000000..85314b12 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,30 @@ +{ + "projects": { + "default": "krow-workforce-dev", + "dev": "krow-workforce-dev", + "staging": "krow-workforce-staging" + }, + "targets": { + "krow-workforce-dev": { + "hosting": { + "launchpad": [ + "krow-workforce-dev-launchpad" + ], + "app-dev": [ + "krow-workforce-dev" + ], + "app-staging": [ + "krow-workforce-staging" + ] + } + }, + "krow-workforce-staging": { + "hosting": { + "app-staging": [ + "krow-workforce-staging" + ] + } + } + }, + "etags": {} +} \ No newline at end of file diff --git a/Makefile b/Makefile index 97783865..2352a912 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,29 @@ # It is designed to be the main entry point for developers. # Use .PHONY to declare targets that are not files, to avoid conflicts. -.PHONY: install dev build prepare-export help +.PHONY: install dev build prepare-export help deploy-launchpad deploy-app # The default command to run if no target is specified (e.g., just 'make'). .DEFAULT_GOAL := help +# --- Firebase & GCP Configuration --- +GCP_DEV_PROJECT_ID := krow-workforce-dev +GCP_STAGING_PROJECT_ID := krow-workforce-staging + +# --- Environment Detection --- +ENV ?= dev + +# --- Conditional Variables by Environment --- +ifeq ($(ENV),staging) + GCP_PROJECT_ID := $(GCP_STAGING_PROJECT_ID) + FIREBASE_ALIAS := staging + HOSTING_TARGET := app-staging +else + GCP_PROJECT_ID := $(GCP_DEV_PROJECT_ID) + FIREBASE_ALIAS := dev + HOSTING_TARGET := app-dev +endif + # Installs all project dependencies using npm. install: @echo "--> Installing web frontend dependencies..." @@ -24,7 +42,7 @@ dev: # Builds the application for production. build: @echo "--> Building web frontend for production..." - @cd frontend-web && npm run build + @cd frontend-web && VITE_APP_ENV=$(ENV) npm run build # Integrates a new Base44 export into the current project. # It replaces the src directory and the index.html file in the frontend-web directory. @@ -45,6 +63,10 @@ integrate-export: @node scripts/patch-base44-client.js @echo " - Patching queryKey in Layout.jsx for local development..." @node scripts/patch-layout-query-key.js + @echo " - Patching Dashboard.jsx for environment label..." + @node scripts/patch-dashboard-for-env-label.js + @echo " - Patching index.html for title..." + @node scripts/patch-index-html.js @echo "--> Integration complete. Next step: 'make prepare-export'." # Applies all necessary patches to a fresh Base44 export to run it locally. @@ -54,6 +76,15 @@ prepare-export: @node scripts/prepare-export.js @echo "--> Preparation complete. You can now run 'make dev'." +# --- Firebase Deployment --- +deploy-launchpad: + @echo "--> Deploying Internal Launchpad to DEV project..." + @firebase deploy --only hosting:launchpad --project=dev + +deploy-app: build + @echo "--> Deploying Frontend Web App to [$(ENV)] environment..." + @firebase deploy --only hosting:$(HOSTING_TARGET) --project=$(FIREBASE_ALIAS) + # Shows this help message. help: @echo "--------------------------------------------------" @@ -64,6 +95,11 @@ help: @echo " make build - Builds the web frontend for production." @echo " make integrate-export - Integrates a new Base44 export from '../krow-workforce-export-latest'." @echo " make prepare-export - Prepares a fresh Base44 export for local use." + @echo "" + @echo " --- DEPLOYMENT ---" + @echo " make deploy-launchpad - Deploys the internal launchpad (always to dev)." + @echo " make deploy-app [ENV=staging] - Builds and deploys the main web app (default: dev)." + @echo "" @echo " make help - Shows this help message." @echo "--------------------------------------------------" diff --git a/firebase.json b/firebase.json index a25a05b0..78e46ee6 100644 --- a/firebase.json +++ b/firebase.json @@ -1,58 +1,49 @@ { + "firestore": { + "rules": "firebase/firestore.rules" + }, + "storage": { + "rules": "firebase/storage.rules" + }, "hosting": [ { - "target": "dev", - "public": "frontend-web/dist", - "ignore": [ - "firebase.json", - "**/.*", - "**/node_modules/**" - ], - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ] - }, - { - "target": "staging", - "public": "frontend-web/dist", - "ignore": [ - "firebase.json", - "**/.*", - "**/node_modules/**" - ], - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ] - }, - { - "target": "prod", - "public": "frontend-web/dist", - "ignore": [ - "firebase.json", - "**/.*", - "**/node_modules/**" - ], - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ] - }, - { - "target": "internal-launchpad", + "target": "launchpad", "public": "firebase/internal-launchpad", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] + }, + { + "target": "app-dev", + "public": "frontend-web/dist", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + }, + { + "target": "app-staging", + "public": "frontend-web/dist", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] } ] -} +} \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/0-infra-compliance.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/0-infra-compliance.mermaid new file mode 100644 index 00000000..daf53275 --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/0-infra-compliance.mermaid @@ -0,0 +1,67 @@ + +graph TB + Title["KROW - Cloud Architecture
Production Solution"] + + subgraph Prototype[" "] + Proto["🔧 Current KROW Prototype
(Demo Only)"] + end + + Title --> Prototype + Title --> Production + + subgraph Production["🏢 KROW - PRODUCTION ARCHITECTURE"] + subgraph GCP["☁️ Google Cloud Platform - US Regions"] + + subgraph Auth["🔐 Authentication"] + Firebase["Firebase Auth
• MFA
• OAuth 2.0"] + end + + subgraph Backend["⚙️ Backend"] + Functions["Cloud Functions
• Serverless
• Auto-scaling"] + API["API Gateway
• Secure APIs
• Rate limiting"] + end + + subgraph Data["💾 Data Storage"] + Firestore["Firestore/Cloud SQL
• Encrypted at rest
• Auto backup"] + Storage["Cloud Storage
• Encrypted
• Access control"] + end + + subgraph Security["🛡️ Security"] + IAM["Cloud IAM
• Access control
• Least privilege"] + Logs["Logging & Monitoring
• Audit trails
• Real-time alerts"] + end + end + + subgraph Compliance["✅ COMPLIANCE"] + GDPR["📋 GDPR Ready
• US data hosting
• User rights
• Data portability"] + SOC2["🏆 SOC 2 Ready
• Google certified
• Security controls
• Full audit trails"] + end + end + + Users["👥 End Users"] + + Proto -.->|Migration vers| Production + Users --> Auth + Auth --> API + API --> Functions + Functions --> Firestore + Functions --> Storage + IAM --> Auth + IAM --> Backend + IAM --> Data + Logs --> Security + GCP --> GDPR + GCP --> SOC2 + + style Prototype fill:#FFF3CD,stroke:#856404,stroke-width:2px,stroke-dasharray: 5 5 + style Proto fill:#FFF3CD,stroke:#856404 + style Title fill:#1976D2,stroke:#0D47A1,stroke-width:3px,color:#FFFFFF + style Production fill:#D4EDDA,stroke:#155724,stroke-width:3px + style GCP fill:#E3F2FD,stroke:#1976D2,stroke-width:2px + style Auth fill:#E8F5E9,stroke:#2E7D32 + style Backend fill:#E8F5E9,stroke:#2E7D32 + style Data fill:#E8F5E9,stroke:#2E7D32 + style Security fill:#FFE0B2,stroke:#E65100 + style Compliance fill:#F3E5F5,stroke:#6A1B9A,stroke-width:2px + style GDPR fill:#E1BEE7,stroke:#6A1B9A + style SOC2 fill:#E1BEE7,stroke:#6A1B9A \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/1-core-workflow.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/1-core-workflow.mermaid new file mode 100644 index 00000000..b6841714 --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/1-core-workflow.mermaid @@ -0,0 +1,70 @@ +sequenceDiagram + participant Client as 🏢 Client App + participant Backend as 🌐 Backend API + participant Admin as ⚙️ KROW Admin + participant Staff as 👥 Staff App + + %% Event Creation + Note over Client,Backend: 1. Event & Shift Creation + Client->>Backend: Create Event with Shifts & Positions + Backend-->>Client: Event Created (Draft) + Client->>Backend: Publish Event + Backend-->>Client: Event Published + + %% Staff Assignment + Note over Admin,Backend: 2. Staff Assignment + Admin->>Backend: View Available Events + Backend-->>Admin: Event List + Admin->>Backend: Assign Staff to Shift + Backend-->>Admin: Assignment Confirmed + Backend->>Staff: Notification: New Shift Assigned + + %% Shift Acceptance + Note over Staff,Backend: 3. Shift Acceptance + Staff->>Backend: View Shift Details + Backend-->>Staff: Shift Information + Staff->>Backend: Accept Shift + Backend-->>Staff: Shift Confirmed + Backend->>Client: Notification: Staff Confirmed + + %% Clock In + Note over Client,Staff: 4. Clock In - Day of Event + Client->>Client: Generate QR Code for Event + Staff->>Staff: Scan QR Code + Staff->>Backend: Clock In Request (via QR) + Backend-->>Staff: Clock In Confirmed + Backend->>Client: Notification: Staff Clocked In + Client->>Backend: (Alternative) Manual Clock In + Backend-->>Client: Manual Clock In Confirmed + + %% Shift Active + Note over Staff: 5. Shift In Progress + Staff->>Staff: View Real-time Timer + + %% Clock Out + Note over Client,Staff: 6. Clock Out - End of Shift + Staff->>Staff: Scan QR Code + Staff->>Backend: Clock Out Request (via QR) + Backend-->>Staff: Clock Out Confirmed + Backend-->>Staff: Shift Status: Completed + Backend->>Client: Notification: Staff Clocked Out + + %% Rating & Invoicing + Note over Client,Backend: 7. Post-Shift Activities + Client->>Backend: Rate Staff Performance + Backend-->>Client: Rating Recorded + Backend->>Backend: Generate Invoice + Backend->>Client: Invoice Created + Client->>Backend: Review & Approve Invoice + Backend-->>Client: Invoice Approved + + %% Payment + Note over Staff,Backend: 8. Staff Payment + Backend->>Staff: Payment Processed + Staff->>Backend: View Earnings & Payment History + Backend-->>Staff: Payment Details + + alt Payment Dispute + Staff->>Backend: Contest Payment Amount + Backend-->>Staff: Dispute Opened + end \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/2-high-level-architecture.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/2-high-level-architecture.mermaid new file mode 100644 index 00000000..d0084bc9 --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/2-high-level-architecture.mermaid @@ -0,0 +1,61 @@ +graph TB + subgraph "Actors" + Staff[👥 Staff/Employee] + Client[🏢 Client/Business] + Admin[⚙️ KROW Admin] + end + + subgraph "KROW Staff App" + SA_Auth[Authentication & Onboarding] + SA_Shifts[Shift Management] + SA_Earnings[Earnings & Payments] + SA_Profile[Profile Management] + end + + subgraph "KROW Client App" + CA_Events[Event Creation] + CA_Staff[Staff Management] + CA_Time[Time Tracking - QR Code] + CA_Invoice[Invoicing] + end + + subgraph "Backend System" + API[Backend API] + DB[(Database)] + end + + %% Staff interactions + Staff -->|Registers & Manages Profile| SA_Auth + Staff -->|Views & Accepts Shifts| SA_Shifts + Staff -->|Scans QR Code - Clock In/Out| SA_Shifts + Staff -->|Tracks Earnings| SA_Earnings + Staff -->|Updates Skills & Documents| SA_Profile + + %% Client interactions + Client -->|Creates Events & Shifts| CA_Events + Client -->|Views Assigned Staff| CA_Staff + Client -->|Generates QR Code| CA_Time + Client -->|Manual Clock In/Out| CA_Time + Client -->|Rates Staff| CA_Staff + Client -->|Reviews & Approves Invoices| CA_Invoice + + %% Admin interactions + Admin -->|Assigns Staff to Shifts| API + Admin -->|Validates Staff Profiles| API + + %% App to Backend connections + SA_Auth -.->|Profile Data| API + SA_Shifts -.->|Shift Status Updates| API + SA_Earnings -.->|Payment Data| API + SA_Profile -.->|User Data| API + + CA_Events -.->|Event & Shift Data| API + CA_Staff -.->|Staff Ratings| API + CA_Time -.->|Time Records| API + CA_Invoice -.->|Invoice Data| API + + API <-->|Data Storage & Retrieval| DB + + style Staff fill:#e1f5ff + style Client fill:#fff4e1 + style Admin fill:#f0e1ff \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/3-invoice-workflow-simple.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/3-invoice-workflow-simple.mermaid new file mode 100644 index 00000000..3ab370bd --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/3-invoice-workflow-simple.mermaid @@ -0,0 +1,40 @@ +graph LR + START[💼 Shift
Completed
& Rated] + + START --> CALC[📊 INTERNAL

Calculate Invoice
• Hours worked
• Rates × Hours
• Overtime calc
• Platform fees
• Tax amounts] + + CALC --> GENERATE[📄 INTERNAL

Generate Invoice
• Create PDF
• Invoice number
• Line items
• Due date] + + GENERATE --> SAVE[💾 INTERNAL

Save to Database
• Store invoice
• Status: pending
• Track history] + + SAVE --> SEND[📧 API INTEGRATION

SendGrid
• Send email
• Track delivery
• Reliable inbox] + + SEND --> CLIENT[📱 Client
Reviews
Invoice] + + CLIENT --> DECISION{Approve or
Dispute?} + + DECISION -->|⚠️ Dispute| DISPUTE[🔧 INTERNAL

Handle Dispute
• Admin reviews
• Adjustments
• Re-calculate] + + DISPUTE --> SAVE + + DECISION -->|✅ Approve| PAY[💳 API INTEGRATION

Stripe
• Credit card
• ACH transfer
• Payment tracking] + + PAY --> CONFIRM[💾 INTERNAL

Update Status
• Mark as paid
• Record payment
• Update reports] + + CONFIRM --> PAYOUT[💰 API INTEGRATION

Stripe Connect
• Pay staff
• Direct deposit
• Automated] + + PAYOUT --> RECORD[📊 INTERNAL

Track Payments
• Staff earnings
• Payment history
• Reports] + + RECORD --> DONE[✅ Complete] + + style START fill:#E1F5FF + style CALC fill:#FFF9E6,stroke:#F9A825,stroke-width:3px + style GENERATE fill:#FFF9E6,stroke:#F9A825,stroke-width:3px + style SAVE fill:#FFF9E6,stroke:#F9A825,stroke-width:3px + style DISPUTE fill:#FFF9E6,stroke:#F9A825,stroke-width:3px + style CONFIRM fill:#FFF9E6,stroke:#F9A825,stroke-width:3px + style RECORD fill:#FFF9E6,stroke:#F9A825,stroke-width:3px + style SEND fill:#E3F2FD,stroke:#1976D2,stroke-width:3px + style PAY fill:#E3F2FD,stroke:#1976D2,stroke-width:3px + style PAYOUT fill:#E3F2FD,stroke:#1976D2,stroke-width:3px + style DONE fill:#90EE90 \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/4-mobile-app-architecture.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/4-mobile-app-architecture.mermaid new file mode 100644 index 00000000..b8b8b470 --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/4-mobile-app-architecture.mermaid @@ -0,0 +1,24 @@ +graph TD + subgraph KROW Mobile Applications + direction LR + Mobile_Client[Mobile Client App
Flutter] + Mobile_Staff[Mobile Staff App
Flutter] + end + + subgraph Firebase Backend Services - GCP + direction TB + Auth[Firebase Authentication] + DataConnect[Firebase Data Connect
GraphQL API &
Generated SDKs] + SQL_DB[Cloud SQL for PostgreSQL
Managed by Data Connect] + end + + Mobile_Client -- "Authenticates with" --> Auth + Mobile_Client -- "Calls API via generated SDK" --> DataConnect + + Mobile_Staff -- "Authenticates with" --> Auth + Mobile_Staff -- "Calls API via generated SDK" --> DataConnect + + DataConnect -- "Manages & Queries" --> SQL_DB + + style Mobile_Client fill:#eef,stroke:#333,stroke-width:2px + style Mobile_Staff fill:#eef,stroke:#333,stroke-width:2px \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/5-web-app-architecture.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/5-web-app-architecture.mermaid new file mode 100644 index 00000000..c7a29e53 --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/5-web-app-architecture.mermaid @@ -0,0 +1,29 @@ +graph LR + subgraph Base44 Environment + direction TB + Client[Client] -- Modifies --> B44_UI[Base44 Visual Builder
Features:
- Event Management
- Staff Directory
- Vendor Onboarding] + B44_UI --> B44_Backend[Base44 Backend
Provides Entity Schemas
& SDK Operations] + B44_Backend --> B44_DB[Base44 Database] + end + + subgraph Firebase Ecosystem - GCP + direction TB + KROW_FE[KROW Frontend
Vite/React + TanStack Query
From Export] + + subgraph Firebase Services + direction TB + Auth[Firebase Authentication] + DataConnect[Firebase Data Connect
GraphQL API &
Generated SDKs] + SQL_DB[Cloud SQL for PostgreSQL
Managed by Data Connect] + end + + KROW_FE -- "Uses" --> Auth + KROW_FE -- "Calls Queries/Mutations via SDK" --> DataConnect + DataConnect -- "Manages & Queries" --> SQL_DB + end + + B44_UI -- "UI Code Export
(React Components)" --> KROW_FE + + style Client fill:#f9f,stroke:#333,stroke-width:2px + style B44_UI fill:#ffe,stroke:#333,stroke-width:2px + style KROW_FE fill:#eef,stroke:#333,stroke-width:2px \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/architectures/6-geofencing-clockin-clockout.mermaid b/firebase/internal-launchpad/assets/diagrams/architectures/6-geofencing-clockin-clockout.mermaid new file mode 100644 index 00000000..75628a52 --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/architectures/6-geofencing-clockin-clockout.mermaid @@ -0,0 +1,32 @@ +sequenceDiagram + participant Staff as Staff Member + participant App as KROW Staff App + participant Client as Client + participant Backend as Backend + + Staff->>App: Opens shift and taps "Clock In" + + activate App + App->>App: **1. Geofencing Check (GPS) BEFORE scan** + + alt Proximity Validated + App->>Client: Requests QR Code + Client-->>Staff: Presents QR Code + Staff->>App: Scans the code + App->>Backend: Validates Clock In with eventId + Backend-->>App: Confirmation + App->>Staff: Displays "Clock In Successful" + else Proximity Failed (GPS bug, too far) + App->>Staff: Displays "Error: You are too far" + end + deactivate App + + loop Continuous Monitoring DURING the shift + App->>App: **2. Checks GPS position (anti-fraud)** + opt Staff member leaves the > 500m area + App->>Backend: Notifies area exit + Backend-->>App: Triggers a "Force Clock-Out" + end + end + + %% Clock Out process follows a similar logic (Geofencing + QR Code) %% \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/diagrams-config.json b/firebase/internal-launchpad/assets/diagrams/diagrams-config.json index f381d734..9998cdd7 100644 --- a/firebase/internal-launchpad/assets/diagrams/diagrams-config.json +++ b/firebase/internal-launchpad/assets/diagrams/diagrams-config.json @@ -1,10 +1,62 @@ -[ - { +[ + { + "path": "assets/diagrams/architectures/0-infra-compliance.mermaid", + "title": "Infrastructure & Compliance", + "type": "mermaid", + "icon": "bi-shield-check" + }, + { + "path": "assets/diagrams/architectures/1-core-workflow.mermaid", + "title": "Core Workflow", + "type": "mermaid", + "icon": "bi-diagram-3" + }, + { + "path": "assets/diagrams/architectures/2-high-level-architecture.mermaid", + "title": "High-Level Architecture", + "type": "mermaid", + "icon": "bi-diagram-3" + }, + { + "path": "assets/diagrams/architectures/3-invoice-workflow-simple.mermaid", + "title": "Invoice Workflow (Simple)", + "type": "mermaid", + "icon": "bi-receipt" + }, + { + "path": "assets/diagrams/architectures/4-mobile-app-architecture.mermaid", + "title": "Mobile App Architecture", + "type": "mermaid", + "icon": "bi-phone" + }, + { + "path": "assets/diagrams/architectures/5-web-app-architecture.mermaid", + "title": "Web App Architecture", + "type": "mermaid", + "icon": "bi-window" + }, + { + "path": "assets/diagrams/architectures/6-geofencing-clockin-clockout.mermaid", + "title": "Geofencing Clock-In/Out", + "type": "mermaid", + "icon": "bi-geo-alt" + }, + { + "path": "assets/diagrams/roadmap/roadmap.mermaid", + "title": "Project Roadmap", + "type": "mermaid", + "icon": "bi-calendar-check" + }, + { "path": "assets/diagrams/legacy/staff-mobile-application/overview.mermaid", - "title": "Overview" + "title": "Legacy App Overview", + "type": "mermaid", + "icon": "bi-phone" }, { "path": "assets/diagrams/legacy/staff-mobile-application/use-case-flowchart.mermaid", - "title": "Use Case Flowchart" + "title": "Legacy App Use Cases", + "type": "mermaid", + "icon": "bi-diagram-2" } -] +] \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/high-level-overview.svg b/firebase/internal-launchpad/assets/diagrams/high-level-overview.svg deleted file mode 100644 index 16c28600..00000000 --- a/firebase/internal-launchpad/assets/diagrams/high-level-overview.svg +++ /dev/null @@ -1,102 +0,0 @@ -

No - Retry

Yes

No - Missing Info

Yes

Rejected - Needs Corrections

Approved

Yes

No

Yes

No

Yes

No

Yes

No

Accept

Decline

No

Yes

Alternative Path

Yes

No

Yes

No

Yes

No

📱 START: STAFF ONBOARDING WORKFLOW

Staff Enters Phone Number

SMS Verification Sent

Staff Enters Verification Code

Code Valid?

✓ Account Created

Start Profile Creation Wizard

Step 1: Enter Personal Info
Name, Email, Photo

Step 2: Upload Legal Documents
ID, Work Permits

Step 3: Add Banking Information
Account Details for Payment

Step 4: Add Skills & Roles
Select Skills, Experience Level

Step 5: Add Certifications
Upload Professional Certificates

Step 6: Set Work Zones & Availability
Preferred Locations, Schedule

100% Complete Checklist?
All Required Fields Filled?

Submit Profile for Validation

⏳ Waiting Screen
Pending Admin Review

Admin Validates Profile?

✅ Account Activated - Ready to Work!

📅 START: EVENT CREATION WORKFLOW

Client Opens Client App

Click Create New Event

Enter Event Details
Name, Description, Type

Set Event Date & Location
Address, Venue Name

Define Shift 1
Start Time & End Time

Add Position 1 to Shift 1

Configure Position:
• Skill Required
• Staff Count Needed
• Hourly Rate
• Department

Add More Positions
to This Shift?

Add More Shifts
to This Event?

Recurring Event?

Set Recurrence Pattern
Daily, Weekly, Custom

Preview Complete Event

Publish Event

✅ Event Available for Admin Assignment

📋 START: SHIFT ASSIGNMENT WORKFLOW

Admin Views Published Events

Admin Selects Event

Admin Reviews Requirements
Skills, Count, Schedule

Search Available Staff

Apply Filters:
• Required Skills
• Location Match
• Availability
• Rating Score

Admin Selects Staff Member

Admin Assigns Staff to Position

More Positions
to Fill?

Send Notifications to All Assigned Staff

Staff Receives Notification

Staff Opens Shift Details
Views: Event, Location, Rate, Hours

Staff Decision?

✅ Shift Status: CONFIRMED

Staff Provides Decline Reason

Notify Admin

🕒 START: QR CODE TIME TRACKING WORKFLOW

📅 Event Day Arrives

Client Opens Event in Client App

Client Clicks Generate QR Code

📱 QR Code Displayed on Client Screen

Staff Arrives at Venue

Staff Opens Staff App

Staff Clicks Clock In

Staff Scans QR Code

Backend Verifies:
• QR Code Valid?
• Location Match?
• Staff Assigned?

Verification Passed?

❌ Error Message Displayed

✅ Staff Clocked In Successfully

⏱️ Real-time Timer Starts in Staff App

Staff Works During Shift

End of Shift

Staff Scans Same QR Code

Staff Clicks Clock Out

Backend Calculates Total Hours

✅ Staff Clocked Out Successfully

Shift Status: COMPLETED

⚠️ Staff Has Issue
No Battery, App Problem

Client Uses Manual Clock In

⭐ START: POST-SHIFT RATING & INVOICING WORKFLOW

All Shifts Completed

Client Receives Notification
Please Rate Your Staff

Client Opens Event Details

Client Views List of Assigned Staff

Client Selects Staff Member

Client Rates Performance
1 to 5 Stars ⭐⭐⭐⭐⭐

Client Adds Comments Optional
Feedback About Performance

Rating Submitted & Saved

More Staff
to Rate?

Backend Auto-Generates Invoice

Invoice Calculation:
• Total Hours per Staff
• Rate × Hours
• Platform Fees

📧 Invoice Sent to Client

Client Reviews Invoice Details

Client Agrees
with Invoice?

Client Approves Invoice

✅ Invoice Approved - Payment Scheduled

Client Contests Invoice

Client Adds Reason for Dispute
Incorrect Hours, Wrong Rate, etc.

⚠️ Dispute Created for Admin Review

💰 START: STAFF EARNINGS & PAYMENT WORKFLOW

Shift Completed & Invoice Approved

Backend Calculates Staff Payment

Formula: Hours Worked × Hourly Rate

Payment Added to Staff Earnings Balance

Staff Opens Earnings Dashboard

Staff Views:
• Weekly Earnings
• Monthly Earnings
• Total Hours Worked
• Earnings Breakdown by Shift

Payment Processing Cycle
Weekly/Bi-weekly

💳 Payment Transferred to Bank Account

Staff Receives Payment Notification

Payment Appears in History Tab

Staff Checks:
Payment Amount Correct?

✅ Payment Complete - All Good!

Staff Opens Dispute

Staff Selects Payment in History

Staff Provides Dispute Reason
Wrong Hours, Wrong Rate, Missing Hours

⚠️ Dispute Sent to KROW Admin

Admin Reviews & Resolves

🎉 END OF ALL WORKFLOWS

\ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/invoice-workflow.svg b/firebase/internal-launchpad/assets/diagrams/invoice-workflow.svg deleted file mode 100644 index 974b2299..00000000 --- a/firebase/internal-launchpad/assets/diagrams/invoice-workflow.svg +++ /dev/null @@ -1,102 +0,0 @@ -

Option A

Option B

Recommended

Budget Option

Approve ✅

Dispute ⚠️

Option A

Option B

Option C

Option A

Option B

Option C

Recommended

Manual

Adjust Invoice

Reject Dispute

💼 Shift Completed & Rated

📊 INTERNAL: Calculate Invoice

• Hours worked per staff
• Regular + Overtime + Double
• Rate × Hours
• Platform fees
• Tax calculations

📄 INTERNAL: Generate Invoice Document

How to generate PDF?

✅ Internal PDF Library
Laravel DomPDF/Snappy
Full control, no extra cost

🔌 API Service
DocuPDF, PDFShift
Cost per invoice

💾 INTERNAL: Save Invoice to Database

• Invoice number
• Status: pending
• Due date
• Payment terms
• Stored in your DB

📧 Send Invoice to Client

How to send email?

🔌 Email Service API
SendGrid / Mailgun / AWS SES
~$0.001 per email
Better deliverability

⚠️ Internal SMTP
Your own server
Risk: spam folder

📱 Client Receives Invoice

Client Reviews

Invoice Approved

INTERNAL: Dispute Management
Admin reviews & resolves

💳 Payment Processing

How to collect payment?

🔌 Stripe API
• Credit card processing
• ACH bank transfer
• Fee: 2.9% + $0.30

📝 Manual Payment
• Bank wire
• Check
• Tracked in your system

🔌 Other Payment API
• PayPal
• Square
• Authorize.net

✅ Payment Received

💾 INTERNAL: Update Invoice Status

Accounting Integration?

🔌 QuickBooks API
Auto-sync invoices
to accounting system

🔌 Xero API
For accounting sync

📊 Internal Reports Only
Export CSV for accountant

💰 Pay Staff Their Earnings

How to pay staff?

🔌 Payroll API
• Stripe Connect
• Gusto
• ADP
Automated payouts

🏦 Manual Bank Transfers
You process each one

🎉 Invoice Cycle Complete

Admin Reviews Dispute

Decision?

\ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/roadmap/roadmap.mermaid b/firebase/internal-launchpad/assets/diagrams/roadmap/roadmap.mermaid new file mode 100644 index 00000000..3d243cec --- /dev/null +++ b/firebase/internal-launchpad/assets/diagrams/roadmap/roadmap.mermaid @@ -0,0 +1,17 @@ +timeline + title KROW Platform - Accelerated Migration & Enhancement Roadmap (2 Months to Production) + + section Phase 1: Foundation & New Workflow Adoption + Week 1-2 : Initialize Firebase projects (Dev, Staging) and configure hosting
Set up CI/CD pipelines for automated deployments
Adopt new development and deployment workflows + Week 3-4 : Configure internal launchpad for easy access to resources
Team training on new tools and workflows
Documentation setup + Key Milestones : Dev & Staging environments fully operational
Team ready to work with new infrastructure + + section Phase 2: Functional Parity & New Experience + Week 5-6 : Migrate core backend logic (Cloud Functions, Firestore/Cloud SQL)
Reconnect Web and Mobile apps to new APIs
Database migration and validation + Week 7-8 : Integrate new UI/UX design across all applications
Implement new core business workflows
Feature parity testing + Key Milestones : All existing features are ISO-functional on the new platform
New design and core workflows fully integrated and tested + + section Phase 3: Preparation & Production Launch + Week 9-10 : Complete end-to-end testing and performance optimization
Security audits and penetration testing
Load testing and optimization + Week 11-12 : Set up robust monitoring and alerting system for production
Final production deployment
Legacy infrastructure decommissioning plan + Key Milestones : KROW is live in production with new design and workflows
Legacy infrastructure ready for decommissioning \ No newline at end of file diff --git a/firebase/internal-launchpad/assets/diagrams/shift-lifecycle-workflow.svg b/firebase/internal-launchpad/assets/diagrams/shift-lifecycle-workflow.svg deleted file mode 100644 index 31a3ac92..00000000 Binary files a/firebase/internal-launchpad/assets/diagrams/shift-lifecycle-workflow.svg and /dev/null differ diff --git a/firebase/internal-launchpad/index.html b/firebase/internal-launchpad/index.html index dbb09f4e..91404173 100644 --- a/firebase/internal-launchpad/index.html +++ b/firebase/internal-launchpad/index.html @@ -5,243 +5,363 @@ KROW Launchpad - - - - - + + + + + - - + + + + + - -
+ +
+ - - + + -
- -
-

Welcome to the Project Launchpad

-
-
-
-

Applications

-
- +
+ + +
+ +
+

Welcome to KROW Launchpad

+

Your central hub for workforce management infrastructure

+
+ +
+ + +
+
+
+ + +
+

Applications

-
-

Legacy Mobile Apps

-
- -
-
-
- - - -
-
-

-
- - - + + +
- - + - + \ No newline at end of file diff --git a/firebase/internal-launchpad/logo.svg b/firebase/internal-launchpad/logo.svg index b5220ffe..cbeedbc2 100644 --- a/firebase/internal-launchpad/logo.svg +++ b/firebase/internal-launchpad/logo.svg @@ -1,45 +1,18 @@ - + viewBox="200 180 280 140" style="enable-background:new 0 0 500 500;" xml:space="preserve"> - - - - - - - - - - - - - - - + diff --git a/frontend-web/index.html b/frontend-web/index.html index 8131cdb4..92c517d6 100644 --- a/frontend-web/index.html +++ b/frontend-web/index.html @@ -2,9 +2,9 @@ - + - Base44 APP + KROW
diff --git a/frontend-web/src/pages/Dashboard.jsx b/frontend-web/src/pages/Dashboard.jsx index 7cf606f1..0033d94d 100644 --- a/frontend-web/src/pages/Dashboard.jsx +++ b/frontend-web/src/pages/Dashboard.jsx @@ -88,7 +88,13 @@ export default function Dashboard() {
+ Welcome to KROW + {import.meta.env.VITE_APP_ENV === 'staging' && Staging} + {import.meta.env.VITE_APP_ENV === 'dev' && Dev} +
+ } subtitle="Your Complete Workforce Management Ecosystem" actions={ <> diff --git a/scripts/patch-dashboard-for-env-label.js b/scripts/patch-dashboard-for-env-label.js new file mode 100644 index 00000000..2886256b --- /dev/null +++ b/scripts/patch-dashboard-for-env-label.js @@ -0,0 +1,35 @@ +const fs = require('fs'); +const path = require('path'); + +const projectRoot = path.resolve(__dirname, '..'); +const dashboardFilePath = path.join(projectRoot, 'frontend-web', 'src', 'pages', 'Dashboard.jsx'); + +const oldString = ` + Welcome to KROW + {import.meta.env.VITE_APP_ENV === 'staging' && Staging} + {import.meta.env.VITE_APP_ENV === 'dev' && Dev} +
+ }`; + +try { + const content = fs.readFileSync(dashboardFilePath, 'utf8'); + + if (content.includes(oldString)) { + const newContent = content.replace(oldString, newString); + fs.writeFileSync(dashboardFilePath, newContent, 'utf8'); + console.log('✅ Successfully patched Dashboard.jsx to include environment label.'); + } else if (content.includes('VITE_APP_ENV')) { + console.log('ℹ️ Dashboard.jsx is already patched for environment labels. Skipping.'); + } else { + console.error('❌ Patching Dashboard.jsx failed: Could not find the PageHeader title.'); + process.exit(1); + } +} catch (error) { + console.error('❌ An error occurred during patching Dashboard.jsx:', error); + process.exit(1); +} diff --git a/scripts/patch-index-html.js b/scripts/patch-index-html.js new file mode 100644 index 00000000..77f868fe --- /dev/null +++ b/scripts/patch-index-html.js @@ -0,0 +1,41 @@ +const fs = require('fs'); +const path = require('path'); + +const projectRoot = path.resolve(__dirname, '..'); +const indexPath = path.join(projectRoot, 'frontend-web', 'index.html'); + +const oldTitle = 'Base44 APP'; +const newTitle = 'KROW'; + +const oldFavicon = ''; +const newFavicon = ''; + +try { + let content = fs.readFileSync(indexPath, 'utf8'); + + if (content.includes(oldTitle)) { + content = content.replace(oldTitle, newTitle); + console.log('✅ Successfully patched title in frontend-web/index.html.'); + } else if (content.includes(newTitle)) { + console.log('ℹ️ index.html title is already patched. Skipping.'); + } else { + console.error('❌ Patching index.html failed: Could not find the expected title tag.'); + process.exit(1); + } + + if (content.includes(oldFavicon)) { + content = content.replace(oldFavicon, newFavicon); + console.log('✅ Successfully patched favicon in frontend-web/index.html.'); + } else if (content.includes(newFavicon)) { + console.log('ℹ️ index.html favicon is already patched. Skipping.'); + } else { + console.error('❌ Patching index.html failed: Could not find the expected favicon link.'); + process.exit(1); + } + + fs.writeFileSync(indexPath, content, 'utf8'); + +} catch (error) { + console.error('❌ An error occurred during patching index.html:', error); + process.exit(1); +}