186 lines
8.6 KiB
PHP
186 lines
8.6 KiB
PHP
<?php
|
|
require_once 'auth.php';
|
|
|
|
// Check if user is logged in
|
|
if (!is_logged_in()) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
if (!hasPermission('view_workflows')) {
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
require_once 'db/config.php';
|
|
|
|
$pdo = db();
|
|
|
|
// Fetch workflows from the database
|
|
$stmt = $pdo->query("SELECT * FROM workflows ORDER BY created_at DESC");
|
|
$workflows = $stmt->fetchAll();
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Workflows</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
<style>
|
|
.workflow-card {
|
|
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
|
}
|
|
.workflow-card:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
|
}
|
|
.workflow-card .bi {
|
|
font-size: 2.5rem;
|
|
}
|
|
.status-badge {
|
|
font-size: 0.8rem;
|
|
padding: 0.3em 0.6em;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header class="header d-flex justify-content-between align-items-center">
|
|
<div class="logo">FinMox<span class="dot">.</span></div>
|
|
<nav class="d-flex align-items-center">
|
|
<a href="index.php" class="btn btn-outline-primary me-2">Home</a>
|
|
<a href="chat.php" class="btn btn-outline-primary me-2">Chat</a>
|
|
<a href="dashboard.php" class="btn btn-outline-primary me-2">Dashboard</a>
|
|
<a href="workflows.php" class="btn btn-primary me-3">Workflows</a>
|
|
<div class="dropdown">
|
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="userDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<?php echo htmlspecialchars($_SESSION['username']); ?>
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
|
|
<?php if (hasPermission('manage_roles')): ?>
|
|
<li><a class="dropdown-item" href="roles.php">Manage Roles</a></li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<?php endif; ?>
|
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container-fluid mt-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2 class="h2">Your Automation Workflows</h2>
|
|
<?php if (hasPermission('manage_workflows')): ?>
|
|
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addWorkflowModal">Create New Workflow</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-4 g-4">
|
|
<!-- Smart Candidate Intake -->
|
|
<div class="col">
|
|
<div class="card h-100 workflow-card">
|
|
<div class="card-body text-center">
|
|
<i class="bi bi-inbox-fill text-primary"></i>
|
|
<h5 class="card-title mt-3">Smart Candidate Intake</h5>
|
|
<span class="badge bg-success status-badge">Active</span>
|
|
<p class="card-text text-muted mt-2">"Automatically captures, enriches, and routes new candidates"</p>
|
|
<p class="fw-bold">142 candidates processed this month</p>
|
|
</div>
|
|
<div class="card-footer bg-white text-center">
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">View Details</a>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">Edit</a>
|
|
<a href="#" class="btn btn-sm btn-outline-warning">Pause</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Interview Scheduling -->
|
|
<div class="col">
|
|
<div class="card h-100 workflow-card">
|
|
<div class="card-body text-center">
|
|
<i class="bi bi-calendar-check-fill text-success"></i>
|
|
<h5 class="card-title mt-3">Interview Scheduling</h5>
|
|
<p class="card-text text-muted mt-2">"Automates calendar checks and interview coordination"</p>
|
|
<p class="fw-bold">28 interviews scheduled this month</p>
|
|
</div>
|
|
<div class="card-footer bg-white text-center">
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">View Details</a>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">Edit</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Onboarding Automation -->
|
|
<div class="col">
|
|
<div class="card h-100 workflow-card">
|
|
<div class="card-body text-center">
|
|
<i class="bi bi-person-check-fill text-info"></i>
|
|
<h5 class="card-title mt-3">Onboarding Automation</h5>
|
|
<p class="card-text text-muted mt-2">"Creates and tracks onboarding tasks automatically"</p>
|
|
<p class="fw-bold">5 active onboardings</p>
|
|
</div>
|
|
<div class="card-footer bg-white text-center">
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">View Details</a>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">Edit</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Weekly Reports -->
|
|
<div class="col">
|
|
<div class="card h-100 workflow-card">
|
|
<div class="card-body text-center">
|
|
<i class="bi bi-bar-chart-line-fill text-warning"></i>
|
|
<h5 class="card-title mt-3">Weekly Reports</h5>
|
|
<p class="card-text text-muted mt-2">"AI-generated weekly summary for leadership"</p>
|
|
<p class="fw-bold">Last report sent Friday 4pm</p>
|
|
</div>
|
|
<div class="card-footer bg-white text-center">
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">View Details</a>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary">Edit</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Add Workflow Modal -->
|
|
<div class="modal fade" id="addWorkflowModal" tabindex="-1" aria-labelledby="addWorkflowModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="addWorkflowModalLabel">Create New Workflow</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form method="POST">
|
|
<input type="hidden" name="add_workflow" value="1">
|
|
<div class="mb-3">
|
|
<label for="name" class="form-label">Name</label>
|
|
<input type="text" class="form-control" id="name" name="name" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="trigger" class="form-label">Trigger</label>
|
|
<select class="form-select" id="trigger" name="trigger" required>
|
|
<option value="" disabled selected>Select a trigger</option>
|
|
<option value="candidate_created">New Candidate is Created</option>
|
|
<option value="task_completed">Task is Completed</option>
|
|
</select>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
<button type="submit" class="btn btn-primary">Save Workflow</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|