# Web Application: Use Case Overview

This document details the primary business actions and user flows within the **KROW Web Application**. It is organized according to the logical workflows for each primary user role as defined in the system's architecture.

---

## 1. Access & Authentication (Common)

### 1.1 Web Portal Login
*   **Actor:** All Users (Admin, Client, Vendor)
*   **Description:** Secure entry into the management console.
*   **Main Flow:**
    1. User enters email and password on the login screen.
    2. System verifies credentials.
    3. System determines user role (Admin, Client, or Vendor).
    4. User is directed to their specific role-based dashboard.

---

## 2. Admin Workflows (Operations Manager)

### 2.1 Global Operational Oversight
*   **Actor:** Admin
*   **Description:** Monitoring the pulse of the entire platform.
*   **Main Flow:** User accesses Admin Dashboard -> Views all active orders across all clients -> Monitors user registration trends.

### 2.2 Marketplace & Vendor Management
*   **Actor:** Admin
*   **Description:** Expanding the platform's supply network.
*   **Main Flow:**
    1. User navigates to Marketplace.
    2. User invites a new Vendor via email.
    3. User sets global default rates for roles.
    4. User audits vendor performance scores.

### 2.3 System Administration
*   **Actor:** Admin
*   **Description:** Configuring platform-wide settings and security.
*   **Main Flow:** User updates system configurations -> Reviews security audit logs -> Manages internal support tickets.

---

## 3. Client Executive Workflows

### 3.1 Strategic Insights (Savings Engine)
*   **Actor:** Client Executive
*   **Description:** Using AI to optimize labor spend.
*   **Main Flow:**
    1. User opens the Savings Engine.
    2. User reviews identified cost-saving opportunities.
    3. User clicks "Approve Strategy" to implement recommendations (e.g., vendor consolidation).

### 3.2 Finance & Billing Management
*   **Actor:** Client Executive / Finance Admin
*   **Description:** Managing corporate financial obligations.
*   **Main Flow:** User views all pending invoices -> Downloads detailed line-item reports -> Processes payments to KROW.

### 3.3 Operations Overview
*   **Actor:** Client Executive
*   **Description:** High-level monitoring of venue operations.
*   **Main Flow:** User views a summary of their venue orders -> Reviews ratings of assigned staff -> Monitors fulfillment rates.

---

## 4. Vendor Workflows (Staffing Agency)

### 4.1 Vendor Operations (Order Fulfillment)
*   **Actor:** Vendor Manager
*   **Description:** Fulfilling client staffing requests.
*   **Main Flow:**
    1. User views incoming shift requests.
    2. User selects a shift.
    3. User uses the **Worker Selection Tool** to assign the best-fit staff.
    4. User confirms assignment.

### 4.2 Workforce Roster Management
*   **Actor:** Vendor Manager
*   **Description:** Maintaining their agency's supply of workers.
*   **Main Flow:** User navigates to Roster -> Adds new workers -> Updates compliance documents and certifications -> Edits worker profiles.

### 4.3 Vendor Finance
*   **Actor:** Vendor Manager
*   **Description:** Managing agency revenue and worker payouts.
*   **Main Flow:** User views payout history -> Submits invoices for completed shifts -> Tracks pending payments from KROW.

---

## 5. Shared Functional Modules

### 5.1 Order Details & History
*   **Actor:** All Roles
*   **Description:** Accessing granular data for any specific staffing request.
*   **Main Flow:** User clicks any order ID -> System displays shift times, roles, assigned staff, and audit history.

### 5.2 Invoice Detail View
*   **Actor:** Admin, Client, Vendor
*   **Description:** Reviewing the breakdown of costs for a billing period.
*   **Main Flow:** User opens an invoice -> System displays worker names, hours worked, bill rates, and total totals per role.

---

# Use Case Diagram
```mermaid
flowchart TD
    subgraph AccessControl [Access & Authentication]
        Start[Start Web Portal] --> CheckSession{Check Session}
        CheckSession -- Valid --> CheckRole{Check User Role}
        CheckSession -- Invalid --> Login[Login Screen]
        Login --> EnterCreds[Enter Credentials]
        EnterCreds --> Verify{Verify}
        Verify -- Success --> CheckRole
        Verify -- Failure --> Error[Show Error]
        
        CheckRole -- Admin --> AdminDash[Admin Dashboard]
        CheckRole -- Client --> ClientDash[Client Dashboard]
        CheckRole -- Vendor --> VendorDash[Vendor Dashboard]
    end

    subgraph AdminWorkflows [Admin Workflows]
        AdminDash --> GlobalOversight[Global Oversight]
        GlobalOversight --> ViewAllOrders[View All Orders]
        GlobalOversight --> ViewAllUsers[View All Users]
        
        AdminDash --> MarketplaceMgmt[Marketplace Management]
        MarketplaceMgmt --> OnboardVendor[Onboard Vendor]
        MarketplaceMgmt --> ManageRates[Manage Global Rates]
        
        AdminDash --> SystemAdmin[System Administration]
        SystemAdmin --> ConfigSettings[Configure Settings]
        SystemAdmin --> AuditLogs[View Audit Logs]
    end

    subgraph ClientWorkflows [Client Executive Workflows]
        ClientDash --> ClientInsights[Strategic Insights]
        ClientInsights --> SavingsEngine[Savings Engine]
        SavingsEngine --> ViewOpp[View Opportunity]
        ViewOpp --> ApproveStrategy[Approve Strategy]
        
        ClientDash --> ClientFinance[Finance & Billing]
        ClientFinance --> ViewInvoices[View Invoices]
        ClientFinance --> PayInvoice[Pay Invoice]
        
        ClientDash --> ClientOps[Operations Overview]
        ClientOps --> ViewMyOrders[View My Orders]
        ClientOps --> ViewMyStaff[View Assigned Staff]
    end

    subgraph VendorWorkflows [Vendor Workflows]
        VendorDash --> VendorOps[Vendor Operations]
        VendorOps --> ViewRequests[View Shift Requests]
        ViewRequests --> AssignWorker[Assign Worker]
        VendorOps --> ManageRoster[Manage Worker Roster]
        ManageRoster --> UpdateWorkerProfile[Update Worker Profile]
        
        VendorDash --> VendorFinance[Vendor Finance]
        VendorFinance --> ViewPayouts[View Payouts]
        VendorFinance --> SubmitInvoice[Submit Invoice]
    end

    subgraph SharedModules [Shared Functional Modules]
        ViewAllOrders -.-> OrderDetail[Order Details]
        ViewMyOrders -.-> OrderDetail
        ViewRequests -.-> OrderDetail
        
        AssignWorker -.-> WorkerSelection[Worker Selection Tool]
        
        ViewInvoices -.-> InvoiceDetail[Invoice Detail View]
        SubmitInvoice -.-> InvoiceDetail
    end
```
