Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1db3c7ce8a | ||
|
|
bde2f08dda | ||
|
|
1b93899dae | ||
|
|
0c9c7ad511 | ||
|
|
ee17043571 | ||
|
|
b2cba70f79 | ||
|
|
b07191224e | ||
|
|
0b5f3d6ac9 | ||
|
|
2b25ebf5a2 |
130
assets/css/chatbot.css
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/* assets/css/chatbot.css */
|
||||||
|
#chat-widget-container {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-icon {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
background-color: #007bff;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-icon:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-icon svg {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-window {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 90px;
|
||||||
|
right: 20px;
|
||||||
|
width: 350px;
|
||||||
|
max-width: 90vw;
|
||||||
|
height: 500px;
|
||||||
|
max-height: 70vh;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||||
|
display: none;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-window.open {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-header {
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
padding: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#close-chat {
|
||||||
|
cursor: pointer;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-messages {
|
||||||
|
flex-grow: 1;
|
||||||
|
padding: 15px;
|
||||||
|
overflow-y: auto;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-input-container {
|
||||||
|
padding: 15px;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-input {
|
||||||
|
flex-grow: 1;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-send {
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-send:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message {
|
||||||
|
padding: 10px 15px;
|
||||||
|
border-radius: 18px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
max-width: 80%;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message.user {
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
align-self: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message.bot {
|
||||||
|
background-color: #e9e9eb;
|
||||||
|
color: #333;
|
||||||
|
align-self: flex-start;
|
||||||
|
}
|
||||||
83
assets/css/custom.css
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
body {
|
||||||
|
padding-top: 56px; /* Adjust for fixed-top navbar */
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
background: linear-gradient(45deg, #0A74DA, #1F85DE) !important;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-family: 'Lora', serif;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background-color: #F8F9FA;
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: 'Lora', serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
background: linear-gradient(45deg, #0A74DA, #1F85DE);
|
||||||
|
color: white;
|
||||||
|
padding: 4rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-step {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-step.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-bar {
|
||||||
|
transition: width 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Landing Page Sections */
|
||||||
|
#features .card, #goals .card {
|
||||||
|
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#features .card:hover, #goals .card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 8px 12px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
#outputs img, #dashboard img {
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dashboard Styles */
|
||||||
|
#dashboard {
|
||||||
|
background-color: #1a1a1a !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dashboard .card {
|
||||||
|
background-color: #2a2a2a !important;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dashboard .kpi-value {
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dashboard .trend-up {
|
||||||
|
color: #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dashboard .trend-down {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
BIN
assets/images/pexels/1181311.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
assets/images/pexels/34128237.jpg
Normal file
|
After Width: | Height: | Size: 247 KiB |
BIN
assets/images/pexels_gtm_diagram_669610.jpg
Normal file
|
After Width: | Height: | Size: 208 KiB |
50
assets/js/chatbot.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const chatIcon = document.getElementById('chat-icon');
|
||||||
|
const chatWindow = document.getElementById('chat-window');
|
||||||
|
const closeChat = document.getElementById('close-chat');
|
||||||
|
const chatInput = document.getElementById('chat-input');
|
||||||
|
const chatSend = document.getElementById('chat-send');
|
||||||
|
const chatMessages = document.getElementById('chat-messages');
|
||||||
|
|
||||||
|
chatIcon.addEventListener('click', () => {
|
||||||
|
chatWindow.classList.toggle('open');
|
||||||
|
});
|
||||||
|
|
||||||
|
closeChat.addEventListener('click', () => {
|
||||||
|
chatWindow.classList.remove('open');
|
||||||
|
});
|
||||||
|
|
||||||
|
const addMessage = (message, sender) => {
|
||||||
|
const messageElement = document.createElement('div');
|
||||||
|
messageElement.classList.add('chat-message', sender);
|
||||||
|
messageElement.textContent = message;
|
||||||
|
chatMessages.appendChild(messageElement);
|
||||||
|
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSendMessage = () => {
|
||||||
|
const message = chatInput.value.trim();
|
||||||
|
if (message) {
|
||||||
|
addMessage(message, 'user');
|
||||||
|
chatInput.value = '';
|
||||||
|
|
||||||
|
// Placeholder bot response
|
||||||
|
setTimeout(() => {
|
||||||
|
addMessage("Thanks for your message! I'm just a prototype, but I'll be able to help soon.", 'bot');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
chatSend.addEventListener('click', handleSendMessage);
|
||||||
|
|
||||||
|
chatInput.addEventListener('keypress', (e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
handleSendMessage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initial bot message
|
||||||
|
setTimeout(() => {
|
||||||
|
addMessage("Hello! How can I help you today?", 'bot');
|
||||||
|
}, 1500);
|
||||||
|
});
|
||||||
71
assets/js/main.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const form = document.getElementById('gtm-form');
|
||||||
|
|
||||||
|
if (form) {
|
||||||
|
const steps = document.querySelectorAll('.form-step');
|
||||||
|
const nextButtons = document.querySelectorAll('.btn-next');
|
||||||
|
const prevButtons = document.querySelectorAll('.btn-prev');
|
||||||
|
const progressBar = document.querySelector('.progress-bar');
|
||||||
|
|
||||||
|
let currentStep = 0;
|
||||||
|
|
||||||
|
function updateProgress() {
|
||||||
|
if (progressBar) {
|
||||||
|
const progress = ((currentStep + 1) / steps.length) * 100;
|
||||||
|
progressBar.style.width = progress + '%';
|
||||||
|
progressBar.setAttribute('aria-valuenow', progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showStep(stepIndex) {
|
||||||
|
steps.forEach((step, index) => {
|
||||||
|
step.classList.toggle('active', index === stepIndex);
|
||||||
|
});
|
||||||
|
currentStep = stepIndex;
|
||||||
|
updateProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
nextButtons.forEach(button => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
if (currentStep < steps.length - 1) {
|
||||||
|
showStep(currentStep + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
prevButtons.forEach(button => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
if (currentStep > 0) {
|
||||||
|
showStep(currentStep - 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
form.addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const formData = new FormData(form);
|
||||||
|
|
||||||
|
fetch('submit_profile.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
window.location.href = 'profile.php?id=' + data.profile_id;
|
||||||
|
} else {
|
||||||
|
alert('An error occurred: ' + data.error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
alert('A network error occurred. Please try again.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if(steps.length > 0) {
|
||||||
|
showStep(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
BIN
assets/pasted-20251003-180728-e982398f.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
assets/pasted-20251003-182128-a1c67c6d.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
assets/pasted-20251006-164429-f2a5211b.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/pasted-20251006-165942-e40aece1.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/pasted-20251006-170246-c39c6bc6.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
assets/pasted-20251006-210028-b0cc286e.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
assets/pasted-20251015-173324-71b99b3e.jpg
Normal file
|
After Width: | Height: | Size: 257 KiB |
BIN
assets/vm-shot-2025-10-15T17-32-11-606Z.jpg
Normal file
|
After Width: | Height: | Size: 257 KiB |
12
db/migrations/001_create_gtm_profiles_table.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS gtm_profiles (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
business_name VARCHAR(255) NOT NULL,
|
||||||
|
sells_what TEXT NOT NULL,
|
||||||
|
icp TEXT NOT NULL,
|
||||||
|
market_size VARCHAR(50) NOT NULL,
|
||||||
|
sales_motions VARCHAR(255) NOT NULL,
|
||||||
|
org_size VARCHAR(50) NOT NULL,
|
||||||
|
roles TEXT NOT NULL,
|
||||||
|
goals TEXT NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
1
db/migrations/002_add_diagram_text_to_profiles.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `gtm_profiles` ADD `diagram_mermaid_text` TEXT NULL DEFAULT NULL;
|
||||||
1
db/migrations/003_add_roles_text_to_profiles.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `gtm_profiles` ADD `roles_text` TEXT;
|
||||||
1
db/migrations/004_add_tools_text_to_profiles.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `gtm_profiles` ADD `tools_text` TEXT;
|
||||||
1
db/migrations/005_add_kpi_data_to_profiles.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE gtm_profiles ADD COLUMN kpi_data TEXT;
|
||||||
0
form_submission.log
Normal file
136
generate_diagram.php
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// --- OpenAI API Configuration ---
|
||||||
|
// IMPORTANT: Do not hardcode API keys in production. Use environment variables.
|
||||||
|
// The key is temporarily used here for demonstration purposes as requested.
|
||||||
|
// You should revoke this key and use getenv('OPENAI_API_KEY') instead.
|
||||||
|
$openai_api_key = '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';
|
||||||
|
$openai_api_url = 'https://api.openai.com/v1/chat/completions';
|
||||||
|
|
||||||
|
$profile_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$profile_id) {
|
||||||
|
echo json_encode(['error' => 'Profile ID is missing.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$profile = null;
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM gtm_profiles WHERE id = ?");
|
||||||
|
$stmt->execute([$profile_id]);
|
||||||
|
$profile = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log($e->getMessage());
|
||||||
|
echo json_encode(['error' => 'Database error while fetching profile.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$profile) {
|
||||||
|
echo json_encode(['error' => 'Profile not found.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Prompt Engineering ---
|
||||||
|
$profile_details = "
|
||||||
|
- Ideal Customer Profile (ICP): {$profile['icp']}
|
||||||
|
- Market Size: {$profile['market_size']}
|
||||||
|
- Sales Motions: {$profile['sales_motions']}
|
||||||
|
- Organization Size: {$profile['org_size']}
|
||||||
|
- Sells What: {$profile['sells_what']}
|
||||||
|
- Business Name: {$profile['business_name']}
|
||||||
|
";
|
||||||
|
|
||||||
|
$prompt = "You are an expert Go-To-Market strategist. Based on the following company profile, generate a clear, customized GTM process flow diagram using Mermaid.js syntax.
|
||||||
|
|
||||||
|
Company Profile:
|
||||||
|
{$profile_details}
|
||||||
|
|
||||||
|
Instructions:
|
||||||
|
1. The diagram should visualize the ideal GTM workflow from customer acquisition to retention/upselling.
|
||||||
|
2. The output MUST be a valid Mermaid.js graph, starting with 'graph TD;'.
|
||||||
|
3. Use the format: A[\"Step 1\"] --> B[\"Step 2\"] --> C[\"Step 3\"];
|
||||||
|
4. **Crucially, node text MUST be enclosed in double quotes**, like A[\"This is a node\"];
|
||||||
|
5. The steps should be logical and tailored to the company's profile (e.g., a product-led motion should have steps like 'Free Tier Signup', while an enterprise motion should have 'SDR Touchpoint').
|
||||||
|
6. Make the flow concise, with 5 to 7 key steps.
|
||||||
|
7. Do not include any explanation, just the Mermaid.js code.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
graph TD;
|
||||||
|
A[\"Lead Gen via Social Media\"] --> B[\"Free Tier Signup (Product-Led)\"];
|
||||||
|
B --> C[\"Auto-Onboarding Email\"];
|
||||||
|
C --> D[\"SDR Touchpoint\"];
|
||||||
|
D --> E[\"Upsell via Partner Integration\"];";
|
||||||
|
|
||||||
|
// --- API Call via cURL ---
|
||||||
|
$payload = [
|
||||||
|
'model' => 'gpt-4o',
|
||||||
|
'messages' => [
|
||||||
|
['role' => 'system', 'content' => 'You are a GTM strategy expert that only outputs Mermaid.js code.'],
|
||||||
|
['role' => 'user', 'content' => $prompt]
|
||||||
|
],
|
||||||
|
'max_tokens' => 300,
|
||||||
|
'temperature' => 0.5,
|
||||||
|
];
|
||||||
|
|
||||||
|
$ch = curl_init($openai_api_url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Authorization: Bearer ' . $openai_api_key
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error_message = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
// --- Process Response ---
|
||||||
|
if ($http_code !== 200 || $response === false) {
|
||||||
|
error_log("OpenAI API Error: HTTP {$http_code}, " . curl_error($ch) . ", Response: " . $response);
|
||||||
|
echo json_encode(['error' => 'Failed to generate diagram from AI. The API returned an error.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = json_decode($response, true);
|
||||||
|
$diagram = $result['choices'][0]['message']['content'] ?? 'graph TD; A[Error: Could not parse AI response];';
|
||||||
|
|
||||||
|
// --- Log the raw AI response for debugging ---
|
||||||
|
$log_file = __DIR__ . '/../ai_responses.log';
|
||||||
|
$log_entry = "---" . date('Y-m-d H:i:s') . " ---
|
||||||
|
" . $diagram . "\n\n";
|
||||||
|
file_put_contents($log_file, $log_entry, FILE_APPEND);
|
||||||
|
|
||||||
|
// Clean up the response and extract the Mermaid code
|
||||||
|
$diagram = trim($diagram);
|
||||||
|
$is_error = false;
|
||||||
|
|
||||||
|
// Regex to find Mermaid code block, with or without backticks and optional "mermaid" label
|
||||||
|
if (preg_match('/```(?:mermaid)?\s*(graph\s(TD|LR|BT|RL);?[\s\S]*?)```|^(graph\s(TD|LR|BT|RL);?[\s\S]*)/', $diagram, $matches)) {
|
||||||
|
// We have two possible capture groups for the main content
|
||||||
|
$mermaid_code = !empty($matches[1]) ? $matches[1] : $matches[3];
|
||||||
|
$diagram = trim($mermaid_code);
|
||||||
|
} else {
|
||||||
|
// If no match, log the bad response and set an error for the user
|
||||||
|
error_log("Invalid AI response format: " . $diagram);
|
||||||
|
$diagram = "graph TD; A[Error: Invalid AI response format.];";
|
||||||
|
$is_error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Auto-save the generated diagram to the database ---
|
||||||
|
if (!$is_error) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("UPDATE gtm_profiles SET diagram_mermaid_text = ? WHERE id = ?");
|
||||||
|
$stmt->execute([$diagram, $profile_id]);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Log the error, but don't block the user. The diagram was generated, just not saved.
|
||||||
|
error_log("DB Error saving diagram for profile {$profile_id}: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode(['diagram' => $diagram]);
|
||||||
116
generate_kpis.php
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$profile_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$profile_id) {
|
||||||
|
echo json_encode(['error' => 'Profile ID is missing.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic AI/Rule-based KPI generation
|
||||||
|
function generate_kpi_data($profile) {
|
||||||
|
// Default values
|
||||||
|
$base_mrr = 5000;
|
||||||
|
$base_cac = 400;
|
||||||
|
$base_nrr = 95;
|
||||||
|
|
||||||
|
// Adjust KPIs based on profile data
|
||||||
|
if (isset($profile['organization_size'])) {
|
||||||
|
switch ($profile['organization_size']) {
|
||||||
|
case '1-10':
|
||||||
|
$base_mrr = 5000;
|
||||||
|
break;
|
||||||
|
case '11-50':
|
||||||
|
$base_mrr = 25000;
|
||||||
|
break;
|
||||||
|
case '51-200':
|
||||||
|
$base_mrr = 75000;
|
||||||
|
break;
|
||||||
|
case '201+':
|
||||||
|
$base_mrr = 200000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($profile['market_approach'])) {
|
||||||
|
if ($profile['market_approach'] === 'Product-led') {
|
||||||
|
$base_nrr = 110;
|
||||||
|
$base_cac = 200;
|
||||||
|
} elseif ($profile['market_approach'] === 'Sales-led') {
|
||||||
|
$base_nrr = 98;
|
||||||
|
$base_cac = 800;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_mrr = $base_mrr * (rand(80, 120) / 100);
|
||||||
|
$target_mrr = $base_mrr * 2;
|
||||||
|
|
||||||
|
$current_cac = $base_cac * (rand(90, 130) / 100);
|
||||||
|
$target_cac = $base_cac * 0.8;
|
||||||
|
|
||||||
|
$current_nrr = $base_nrr * (rand(95, 105) / 100);
|
||||||
|
$target_nrr = $base_nrr * 1.1;
|
||||||
|
|
||||||
|
$kpis = [
|
||||||
|
['name' => 'Monthly Recurring Revenue (MRR)', 'current' => number_format($current_mrr), 'target' => number_format($target_mrr)],
|
||||||
|
['name' => 'Customer Acquisition Cost (CAC)', 'current' => number_format($current_cac), 'target' => number_format($target_cac)],
|
||||||
|
['name' => 'Net Revenue Retention (NRR)', 'current' => round($current_nrr) . '%', 'target' => round($target_nrr) . '%']
|
||||||
|
];
|
||||||
|
|
||||||
|
// Generate sample data for the chart
|
||||||
|
$labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'];
|
||||||
|
|
||||||
|
$mrr_growth_rate = ($target_mrr - $current_mrr) / 5;
|
||||||
|
|
||||||
|
$datasets = [
|
||||||
|
[
|
||||||
|
'label' => 'MRR (Actual)',
|
||||||
|
'data' => array_map(fn($i) => $current_mrr + ($mrr_growth_rate * $i * (rand(80,120)/100)), range(0, 5)),
|
||||||
|
'borderColor' => '#0d6efd',
|
||||||
|
'tension' => 0.2
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => 'MRR (Target)',
|
||||||
|
'data' => array_map(fn($i) => $current_mrr + ($mrr_growth_rate * $i), range(0, 5)),
|
||||||
|
'borderColor' => '#dc3545',
|
||||||
|
'borderDash' => [5, 5],
|
||||||
|
'tension' => 0.2
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return [
|
||||||
|
'kpis' => $kpis,
|
||||||
|
'chartData' => [
|
||||||
|
'labels' => $labels,
|
||||||
|
'datasets' => $datasets
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM gtm_profiles WHERE id = ?");
|
||||||
|
$stmt->execute([$profile_id]);
|
||||||
|
$profile = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$profile) {
|
||||||
|
echo json_encode(['error' => 'Profile not found.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$kpi_data = generate_kpi_data($profile);
|
||||||
|
$kpi_data_json = json_encode($kpi_data);
|
||||||
|
|
||||||
|
// Save the generated data to the database
|
||||||
|
$update_stmt = $pdo->prepare("UPDATE gtm_profiles SET kpi_data = ? WHERE id = ?");
|
||||||
|
$update_stmt->execute([$kpi_data_json, $profile_id]);
|
||||||
|
|
||||||
|
echo json_encode(['success' => true, 'kpi_data' => $kpi_data]);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log('KPI Generation Error: ' . $e->getMessage());
|
||||||
|
echo json_encode(['error' => 'Database error during KPI generation.']);
|
||||||
|
}
|
||||||
53
generate_roles.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$profile_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$profile_id) {
|
||||||
|
echo json_encode(['error' => 'Profile ID is missing.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM gtm_profiles WHERE id = ?");
|
||||||
|
$stmt->execute([$profile_id]);
|
||||||
|
$profile = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$profile) {
|
||||||
|
echo json_encode(['error' => 'Profile not found.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simulate AI-powered recommendations based on profile data
|
||||||
|
$recommendations = '<ul>';
|
||||||
|
|
||||||
|
if (strpos(strtolower($profile['sales_motions']), 'outbound') !== false) {
|
||||||
|
$recommendations .= '<li><strong>SDR:</strong> 2 roles (Lead nurturing, qualification, demo scheduling)</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos(strtolower($profile['sells_what']), 'product') !== false) {
|
||||||
|
$recommendations .= '<li><strong>Product Marketing Manager:</strong> 1 role (Positioning, ICP refinement)</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos(strtolower($profile['sales_motions']), 'partner') !== false) {
|
||||||
|
$recommendations .= '<li><strong>Partner Marketing Manager:</strong> 1 role (Managing partner relationships)</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recommendations === '<ul>') {
|
||||||
|
$recommendations = '<p>No specific role recommendations for this profile.</p>';
|
||||||
|
} else {
|
||||||
|
$recommendations .= '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$update_stmt = $pdo->prepare("UPDATE gtm_profiles SET roles_text = ? WHERE id = ?");
|
||||||
|
$update_stmt->execute([$recommendations, $profile_id]);
|
||||||
|
|
||||||
|
echo json_encode(['recommendations' => $recommendations]);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log($e->getMessage());
|
||||||
|
echo json_encode(['error' => 'Database error occurred.']);
|
||||||
|
}
|
||||||
53
generate_tools.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$profile_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$profile_id) {
|
||||||
|
echo json_encode(['error' => 'Profile ID is missing.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM gtm_profiles WHERE id = ?");
|
||||||
|
$stmt->execute([$profile_id]);
|
||||||
|
$profile = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$profile) {
|
||||||
|
echo json_encode(['error' => 'Profile not found.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simulate AI-powered recommendations based on profile data
|
||||||
|
$recommendations = '<ul>';
|
||||||
|
|
||||||
|
if (strpos(strtolower($profile['sales_motions']), 'outbound') !== false || strpos(strtolower($profile['roles']), 'sdr') !== false) {
|
||||||
|
$recommendations .= '<li><strong>CRM:</strong> HubSpot (Integrates with SDR workflows)</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos(strtolower($profile['sells_what']), 'product') !== false) {
|
||||||
|
$recommendations .= '<li><strong>Analytics:</strong> Mixpanel (Tracks Product-led growth)</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos(strtolower($profile['market_size']), 'large') !== false || strpos(strtolower($profile['market_size']), 'enterprise') !== false) {
|
||||||
|
$recommendations .= '<li><strong>Automation:</strong> Zapier (Connects CRM to email marketing tools)</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recommendations === '<ul>') {
|
||||||
|
$recommendations = '<p>No specific tool recommendations for this profile.</p>';
|
||||||
|
} else {
|
||||||
|
$recommendations .= '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$update_stmt = $pdo->prepare("UPDATE gtm_profiles SET tools_text = ? WHERE id = ?");
|
||||||
|
$update_stmt->execute([$recommendations, $profile_id]);
|
||||||
|
|
||||||
|
echo json_encode(['recommendations' => $recommendations]);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log($e->getMessage());
|
||||||
|
echo json_encode(['error' => 'Database error occurred.']);
|
||||||
|
}
|
||||||
25
includes/pexels.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
function pexels_key() {
|
||||||
|
$k = getenv('PEXELS_KEY');
|
||||||
|
return $k && strlen($k) > 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18';
|
||||||
|
}
|
||||||
|
function pexels_get($url) {
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt_array($ch, [
|
||||||
|
CURLOPT_URL => $url,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ],
|
||||||
|
CURLOPT_TIMEOUT => 15,
|
||||||
|
]);
|
||||||
|
$resp = curl_exec($ch);
|
||||||
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function download_to($srcUrl, $destPath) {
|
||||||
|
$data = file_get_contents($srcUrl);
|
||||||
|
if ($data === false) return false;
|
||||||
|
if (!is_dir(dirname($destPath))) mkdir(dirname($destPath), 0775, true);
|
||||||
|
return file_put_contents($destPath, $data) !== false;
|
||||||
|
}
|
||||||
419
index.php
@ -1,150 +1,305 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>GTM Maximizer</title>
|
||||||
<?php
|
<meta name="description" content="GTM Maximizer: AI Powered Solutions Generating Profitable and Efficient Revenue and Customer Growth.">
|
||||||
// Read project preview data from environment
|
<meta name="keywords" content="GTM strategy, B2B SaaS, go-to-market, AI tools, sales strategy, marketing plan, revenue growth, customer acquisition, market analysis, business planning">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta property="og:title" content="GTM Maximizer">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta property="og:description" content="GTM Maximizer: AI Powered Solutions Generating Profitable and Efficient Revenue and Customer Growth.">
|
||||||
?>
|
<meta property="og:image" content="https://project-screens.s3.amazonaws.com/screenshots/34602/app-hero-20251002-202548.png">
|
||||||
<?php if ($projectDescription): ?>
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<!-- Meta description -->
|
<meta name="twitter:image" content="https://project-screens.s3.amazonaws.com/screenshots/34602/app-hero-20251002-202548.png">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter&family=Lora:wght@700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<link rel="stylesheet" href="assets/css/chatbot.css?v=<?php echo time(); ?>">
|
||||||
<style>
|
<style>
|
||||||
:root {
|
.kpi-card {
|
||||||
--bg-color-start: #6a11cb;
|
margin-bottom: 1.5rem;
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
}
|
||||||
body {
|
.trend-up {
|
||||||
margin: 0;
|
color: #28a745;
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
}
|
||||||
body::before {
|
.trend-down {
|
||||||
content: '';
|
color: #dc3545;
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
}
|
||||||
@keyframes bg-pan {
|
.kpi-value {
|
||||||
0% { background-position: 0% 0%; }
|
font-size: 2.5rem;
|
||||||
100% { background-position: 100% 100%; }
|
font-weight: bold;
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
||||||
|
<script>mermaid.initialize({ startOnLoad: true });</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<a class="navbar-brand" href="index.php">GTM Maximizer</a>
|
||||||
<span class="sr-only">Loading…</span>
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="kpi_dashboard.php">Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="profile.php">Profile</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
Tools
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<li><a class="dropdown-item" href="#">Design</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Diagram</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Integrations</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Settings</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Account</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<header class="hero text-center">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="display-4">GTM Maximizer</h1>
|
||||||
|
<p class="lead">AI Powered Solutions Generating Profitable and Efficient Revenue and Customer Growth</p>
|
||||||
|
<a href="start.php" class="btn btn-light btn-lg mt-3">Build New Process and Organization</a>
|
||||||
|
<a href="list_profiles.php" class="btn btn-outline-light btn-lg mt-3">Existing Process</a>
|
||||||
|
<a href="list_profiles.php" class="btn btn-outline-light btn-lg mt-3">Existing Organization</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container my-5">
|
||||||
|
<!-- Features Section -->
|
||||||
|
<section id="features" class="py-5">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2>Key Features</h2>
|
||||||
|
<p class="lead">Everything you need to build a world-class GTM strategy.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">GTM Profile Builder</h5>
|
||||||
|
<p class="card-text">Input your business, market, and sales data to create a comprehensive GTM profile.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Process Flow Generator</h5>
|
||||||
|
<p class="card-text">Automatically generate customized GTM process flows based on your unique profile.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Tool & Integration Recommendations</h5>
|
||||||
|
<p class="card-text">Get AI-powered suggestions for the best tools and integrations to execute your strategy.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Outputs & Results Section -->
|
||||||
|
<section id="outputs" class="py-5 bg-light">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2>Visualize Your Strategy</h2>
|
||||||
|
<p class="lead">From high-level diagrams to detailed dashboards, see your GTM plan come to life.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h3>Sample Process Diagram</h3>
|
||||||
|
<p>Our AI generates clear, actionable diagrams that map out your entire customer journey and the internal processes required to support it.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div style="max-width: 50%; margin: auto;">
|
||||||
|
<div class="mermaid">graph TD
|
||||||
|
subgraph "GTM Strategy Workflow"
|
||||||
|
A[Start] --> B[Input Market & Product Data];
|
||||||
|
B --> C{Generate GTM Strategy};
|
||||||
|
C --> D[Review Generated Plan];
|
||||||
|
D --> E{Is the Plan Approved?};
|
||||||
|
E -- Yes --> F[Launch GTM Campaign];
|
||||||
|
E -- No --> G[Refine Inputs & Regenerate];
|
||||||
|
G --> B;
|
||||||
|
F --> H[Monitor KPIs & Optimize];
|
||||||
|
H --> F;
|
||||||
|
end</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Dashboard Preview Section -->
|
||||||
|
<section id="dashboard" class="py-5 bg-dark text-white">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2>Track Your Progress</h2>
|
||||||
|
<p class="lead text-white-50">A fully customizable dashboard to monitor your key metrics and GTM goals</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Revenue</h5>
|
||||||
|
<p class="kpi-value text-white">$250,000</p>
|
||||||
|
<p class="card-text text-white-50">Target: $300,000 <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Revenue Growth (MoM)</h5>
|
||||||
|
<p class="kpi-value text-white">15%</p>
|
||||||
|
<p class="card-text text-white-50">Target: 20% <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Gross Profit Margin</h5>
|
||||||
|
<p class="kpi-value text-white">60%</p>
|
||||||
|
<p class="card-text text-white-50">Target: 65% <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Customer Acquisition Cost (CAC)</h5>
|
||||||
|
<p class="kpi-value text-white">$120</p>
|
||||||
|
<p class="card-text text-white-50">Target: $100 <span class="trend-down">▼</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Operating Expenses</h5>
|
||||||
|
<p class="kpi-value text-white">$50,000</p>
|
||||||
|
<p class="card-text text-white-50">Target: $45,000 <span class="trend-down">▼</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Net Operating Income</h5>
|
||||||
|
<p class="kpi-value text-white">$100,000</p>
|
||||||
|
<p class="card-text text-white-50">Target: $120,000 <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">New Customers Added</h5>
|
||||||
|
<p class="kpi-value text-white">50</p>
|
||||||
|
<p class="card-text text-white-50">Target: 60 <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark.
|
||||||
|
text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Total Customers</h5>
|
||||||
|
<p class="kpi-value text-white">500</p>
|
||||||
|
<p class="card-text text-white-50">Target: 550 <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-6 mb-4">
|
||||||
|
<div class="card h-100 bg-dark text-white">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Annual Recurring Revenue (ARR)</h5>
|
||||||
|
<p class="kpi-value text-white">$3,000,000</p>
|
||||||
|
<p class="card-text text-white-50">Target: $3,500,000 <span class="trend-up">▲</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Goals Section -->
|
||||||
|
<section id="goals" class="py-5 bg-light">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2>Achieve Your Goals</h2>
|
||||||
|
<p class="lead">Align your entire organization around clear, measurable objectives.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-4">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Revenue Growth</h5>
|
||||||
|
<p class="card-text">Optimize your sales and marketing funnels to drive predictable revenue growth.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-4">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Customer Acquisition</h5>
|
||||||
|
<p class="card-text">Lower your customer acquisition costs by targeting the right ICP with the right message.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<footer class="text-center py-4">
|
||||||
|
<p>© <?php echo date("Y"); ?> GTM Maximizer. All Rights Reserved.</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
<script src="assets/js/chatbot.js?v=<?php echo time(); ?>"></script>
|
||||||
|
|
||||||
|
<!-- Chatbot Widget -->
|
||||||
|
<div id="chat-widget-container">
|
||||||
|
<div id="chat-icon">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
||||||
|
<path d="M8 15c4.418 0 8-3.134 8-7s-3.582-7-8-7-8 3.134-8 7c0 1.76.743 3.37 1.97 4.6-.097 1.016-.417 2.13-.771 2.966-.079.186.074.394.273.362 2.256-.37 3.597-.938 4.18-1.234A9.06 9.06 0 0 0 8 15z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div id="chat-window">
|
||||||
|
<div id="chat-header">
|
||||||
|
<span>Chat with us</span>
|
||||||
|
<button id="close-chat">×</button>
|
||||||
|
</div>
|
||||||
|
<div id="chat-messages"></div>
|
||||||
|
<div id="chat-input-container">
|
||||||
|
<input type="text" id="chat-input" placeholder="Type a message...">
|
||||||
|
<button id="chat-send">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-send" viewBox="0 0 16 16">
|
||||||
|
<path d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
86
list_profiles.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$profiles = [];
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query("SELECT id, business_name, sells_what, created_at FROM gtm_profiles ORDER BY created_at DESC");
|
||||||
|
$profiles = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Handle database connection error
|
||||||
|
error_log($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Existing GTM Profiles</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter&family=Lora:wght@700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">GTM Maximizer</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="index.php">Home</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container my-5 pt-5">
|
||||||
|
<h1 class="mb-4">Existing GTM Profiles</h1>
|
||||||
|
<?php if (!empty($profiles)): ?>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Business Name</th>
|
||||||
|
<th scope="col">Sells What</th>
|
||||||
|
<th scope="col">Created At</th>
|
||||||
|
<th scope="col">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($profiles as $profile): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($profile['business_name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($profile['sells_what']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($profile['created_at']); ?></td>
|
||||||
|
<td><a href="profile.php?id=<?php echo $profile['id']; ?>" class="btn btn-primary btn-sm">View</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
No GTM profiles found. Please <a href="start.php">create one</a> first.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="text-center py-4">
|
||||||
|
<p>© <?php echo date("Y"); ?> GTM Maximizer. All Rights Reserved.</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
527
profile.php
Normal file
@ -0,0 +1,527 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$profile = null;
|
||||||
|
$profile_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if ($profile_id) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
// Updated to fetch the diagram text as well
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM gtm_profiles WHERE id = ?");
|
||||||
|
$stmt->execute([$profile_id]);
|
||||||
|
$profile = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>My GTM Profile</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter&family=Lora:wght@700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">GTM Maximizer</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Dashboard</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link active" aria-current="page" href="profile.php">Profile</a></li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Tools</a>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<li><a class="dropdown-item" href="#">Design</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Diagram</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Integrations</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Settings</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Account</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container my-5 pt-5">
|
||||||
|
<?php if ($profile): ?>
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h1 class="display-4 fw-bold"><?php echo htmlspecialchars($profile['business_name']); ?></h1>
|
||||||
|
<p class="lead text-muted">GTM Strategy Profile</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<!-- Left column for main content -->
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<!-- Diagram Card -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<h5 class="card-title mb-0">GTM Process Flow Diagram</h5>
|
||||||
|
<button id="generate-diagram-btn" class="btn btn-primary" data-profile-id="<?php echo htmlspecialchars($profile_id); ?>">Generate Diagram</button>
|
||||||
|
</div>
|
||||||
|
<div id="diagram-container" class="mb-3">
|
||||||
|
<!-- Diagram will be rendered here by JavaScript -->
|
||||||
|
</div>
|
||||||
|
<div id="diagram-editor-container" style="display: none;">
|
||||||
|
<h6 class="card-subtitle mb-2 text-muted">Diagram Editor</h6>
|
||||||
|
<div id="save-status" class="mb-2"></div>
|
||||||
|
<textarea id="diagram-editor" class="form-control" rows="10"></textarea>
|
||||||
|
<button id="save-diagram-btn" class="btn btn-success mt-2">Save Diagram</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- KPI Dashboard Card -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<h5 class="card-title mb-0">AI-Generated KPI Dashboard</h5>
|
||||||
|
<div>
|
||||||
|
<button id="edit-kpi-btn" class="btn btn-secondary btn-sm" style="display: none;">Edit KPIs</button>
|
||||||
|
<button id="generate-kpi-btn" class="btn btn-primary <?php if (!empty($profile['kpi_data'])) echo 'd-none'; ?>" data-profile-id="<?php echo htmlspecialchars($profile_id); ?>">Generate Dashboard</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="card-text text-muted">Set and refine KPIs, and track them with an auto-generated dashboard.</p>
|
||||||
|
<div id="kpi-container" class="mt-3">
|
||||||
|
<!-- KPI Dashboard will be rendered here by JavaScript -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Right column for supporting content -->
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<!-- Roles Card -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Role Recommendations</h5>
|
||||||
|
<p class="card-text text-muted small">AI-powered suggestions for marketing and sales roles.</p>
|
||||||
|
<div id="roles-container" class="mt-3">
|
||||||
|
<?php if (!empty($profile['roles_text'])): ?>
|
||||||
|
<?php echo $profile['roles_text']; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<button id="generate-roles-btn" class="btn btn-primary btn-sm <?php if (!empty($profile['roles_text'])) echo 'd-none'; ?>" data-profile-id="<?php echo htmlspecialchars($profile_id); ?>">Generate Roles</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tools Card -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Tools & Integrations</h5>
|
||||||
|
<p class="card-text text-muted small">Discover top industry solutions and integrations.</p>
|
||||||
|
<div id="tools-container" class="mt-3">
|
||||||
|
<?php if (!empty($profile['tools_text'])): ?>
|
||||||
|
<?php echo $profile['tools_text']; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<button id="generate-tools-btn" class="btn btn-primary btn-sm <?php if (!empty($profile['tools_text'])) echo 'd-none'; ?>" data-profile-id="<?php echo htmlspecialchars($profile_id); ?>">Generate Tools</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Profile Details Card -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Profile Details</h5>
|
||||||
|
<p class="card-text"><strong>Sells:</strong> <?php echo htmlspecialchars($profile['sells_what']); ?></p>
|
||||||
|
<hr>
|
||||||
|
<h6 class="card-subtitle mb-2 text-muted">Market & Sales</h6>
|
||||||
|
<p class="card-text"><strong>ICP:</strong> <?php echo htmlspecialchars($profile['icp']); ?></p>
|
||||||
|
<p class="card-text"><strong>Market Size:</strong> <?php echo htmlspecialchars($profile['market_size']); ?></p>
|
||||||
|
<p class="card-text"><strong>Sales Motions:</strong> <?php echo htmlspecialchars($profile['sales_motions']); ?></p>
|
||||||
|
<hr>
|
||||||
|
<h6 class="card-subtitle mb-2 text-muted">Team & Roles</h6>
|
||||||
|
<p class="card-text"><strong>Org Size:</strong> <?php echo htmlspecialchars($profile['org_size']); ?></p>
|
||||||
|
<p class="card-text"><strong>Current Roles:</strong> <?php echo htmlspecialchars($profile['roles']); ?></p>
|
||||||
|
<hr>
|
||||||
|
<h6 class="card-subtitle mb-2 text-muted">Goals</h6>
|
||||||
|
<p class="card-text"><strong>Growth Goals:</strong> <?php echo htmlspecialchars($profile['goals']); ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
No GTM profile found. Please <a href="list_profiles.php">select one</a> or <a href="start.php">create a new one</a>.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="text-center py-4">
|
||||||
|
<p>© <?php echo date("Y"); ?> GTM Maximizer. All Rights Reserved.</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
||||||
|
<script>mermaid.initialize({ startOnLoad: false });</script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const profileId = "<?php echo $profile_id; ?>";
|
||||||
|
const generateBtn = document.getElementById('generate-diagram-btn');
|
||||||
|
const diagramContainer = document.getElementById('diagram-container');
|
||||||
|
const editorContainer = document.getElementById('diagram-editor-container');
|
||||||
|
const editor = document.getElementById('diagram-editor');
|
||||||
|
const saveBtn = document.getElementById('save-diagram-btn');
|
||||||
|
const saveStatus = document.getElementById('save-status');
|
||||||
|
|
||||||
|
const generateRolesBtn = document.getElementById('generate-roles-btn');
|
||||||
|
const rolesContainer = document.getElementById('roles-container');
|
||||||
|
const generateToolsBtn = document.getElementById('generate-tools-btn');
|
||||||
|
const toolsContainer = document.getElementById('tools-container');
|
||||||
|
const generateKpiBtn = document.getElementById('generate-kpi-btn');
|
||||||
|
const kpiContainer = document.getElementById('kpi-container');
|
||||||
|
|
||||||
|
if (generateRolesBtn) {
|
||||||
|
generateRolesBtn.addEventListener('click', function () {
|
||||||
|
rolesContainer.innerHTML = '<div class="text-center"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div><p>Generating roles...</p></div>';
|
||||||
|
generateRolesBtn.disabled = true;
|
||||||
|
|
||||||
|
fetch(`generate_roles.php?id=${profileId}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.error) {
|
||||||
|
rolesContainer.innerHTML = `<div class="alert alert-danger">${data.error}</div>`;
|
||||||
|
} else {
|
||||||
|
rolesContainer.innerHTML = data.recommendations;
|
||||||
|
generateRolesBtn.classList.add('d-none');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error generating roles:', error);
|
||||||
|
rolesContainer.innerHTML = '<div class="alert alert-danger">An error occurred while generating roles.</div>';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
generateRolesBtn.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (generateToolsBtn) {
|
||||||
|
generateToolsBtn.addEventListener('click', function () {
|
||||||
|
toolsContainer.innerHTML = '<div class="text-center"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div><p>Generating tools...</p></div>';
|
||||||
|
generateToolsBtn.disabled = true;
|
||||||
|
|
||||||
|
fetch(`generate_tools.php?id=${profileId}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.error) {
|
||||||
|
toolsContainer.innerHTML = `<div class="alert alert-danger">${data.error}</div>`;
|
||||||
|
} else {
|
||||||
|
toolsContainer.innerHTML = data.recommendations;
|
||||||
|
generateToolsBtn.classList.add('d-none');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error generating tools:', error);
|
||||||
|
toolsContainerinnerHTML = '<div class="alert alert-danger">An error occurred while generating tools.</div>';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
generateToolsBtn.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to render the diagram
|
||||||
|
const renderDiagram = (mermaidCode, isSample = false) => {
|
||||||
|
if (!mermaidCode) {
|
||||||
|
diagramContainer.innerHTML = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const title = isSample ? 'Sample GTM Process Flow' : 'GTM Process Flow Diagram';
|
||||||
|
const footer = isSample ? '<p class="text-center text-muted mt-2">This is a sample diagram. Click "Generate" to create one based on your profile.</p>' : '';
|
||||||
|
|
||||||
|
diagramContainer.innerHTML = `
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">${title}</h5>
|
||||||
|
<div class="mermaid text-center">${mermaidCode}</div>
|
||||||
|
${footer}
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
// Ensure Mermaid is available before running
|
||||||
|
if (window.mermaid) {
|
||||||
|
mermaid.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isSample) {
|
||||||
|
editor.value = mermaidCode;
|
||||||
|
editorContainer.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
editorContainer.style.display = 'none';
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
diagramContainer.innerHTML = '<div class="alert alert-danger">Invalid diagram syntax.</div>';
|
||||||
|
console.error("Mermaid render error:", e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderKpiDashboard = (kpiData, isSample = false) => {
|
||||||
|
if (!kpiData) return;
|
||||||
|
|
||||||
|
let kpiHtml = '<form id="kpi-form"><div class="row">';
|
||||||
|
kpiData.kpis.forEach((kpi, index) => {
|
||||||
|
kpiHtml += `
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="card-title">${kpi.name}</h6>
|
||||||
|
<div class="mb-2">
|
||||||
|
<label class="form-label">Current</label>
|
||||||
|
<input type="text" class="form-control" name="kpi_${index}_current" value="${kpi.current}" readonly>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="form-label">Target</label>
|
||||||
|
<input type="text" class="form-control" name="kpi_${index}_target" value="${kpi.target}" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
kpiHtml += '</div></form>';
|
||||||
|
|
||||||
|
kpiHtml += '<div class="row"><div class="col-12"><canvas id="kpi-chart"></canvas></div></div>';
|
||||||
|
kpiContainer.innerHTML = kpiHtml;
|
||||||
|
|
||||||
|
const ctx = document.getElementById('kpi-chart').getContext('2d');
|
||||||
|
if(window.kpiChart instanceof Chart) {
|
||||||
|
window.kpiChart.destroy();
|
||||||
|
}
|
||||||
|
window.kpiChart = new Chart(ctx, {
|
||||||
|
type: 'line',
|
||||||
|
data: kpiData.chartData,
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const editBtn = document.getElementById('edit-kpi-btn');
|
||||||
|
if (isSample) {
|
||||||
|
editBtn.style.display = 'none';
|
||||||
|
} else {
|
||||||
|
editBtn.style.display = 'inline-block';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const existingKpiData = <?php echo $profile['kpi_data'] ?? 'null'; ?>;
|
||||||
|
if (existingKpiData) {
|
||||||
|
renderKpiDashboard(existingKpiData);
|
||||||
|
} else {
|
||||||
|
const sampleKpiData = {
|
||||||
|
kpis: [
|
||||||
|
{ name: "Website Visitors", current: "1,200", target: "5,000" },
|
||||||
|
{ name: "Lead Conversion Rate", current: "2.5%", target: "4%" },
|
||||||
|
{ name: "Customer Acquisition Cost (CAC)", current: "$150", target: "$120" }
|
||||||
|
],
|
||||||
|
chartData: {
|
||||||
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
||||||
|
datasets: [{
|
||||||
|
label: 'Sample: Monthly Active Users',
|
||||||
|
data: [500, 650, 800, 750, 900, 1100],
|
||||||
|
borderColor: 'rgba(75, 192, 192, 1)',
|
||||||
|
tension: 0.1
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
renderKpiDashboard(sampleKpiData, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (generateKpiBtn) {
|
||||||
|
generateKpiBtn.addEventListener('click', function() {
|
||||||
|
kpiContainer.innerHTML = '<div class="text-center"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div><p>Generating KPI Dashboard...</p></div>';
|
||||||
|
this.disabled = true;
|
||||||
|
|
||||||
|
fetch(`generate_kpis.php?id=${profileId}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.error) {
|
||||||
|
kpiContainer.innerHTML = `<div class="alert alert-danger">${data.error}</div>`;
|
||||||
|
} else {
|
||||||
|
renderKpiDashboard(data.kpi_data);
|
||||||
|
this.classList.add('d-none');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error generating KPIs:', error);
|
||||||
|
kpiContainer.innerHTML = '<div class="alert alert-danger">An error occurred while generating the KPI dashboard.</div>';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
if(generateKpiBtn) generateKpiBtn.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const editKpiBtn = document.getElementById('edit-kpi-btn');
|
||||||
|
if (editKpiBtn) {
|
||||||
|
editKpiBtn.addEventListener('click', function() {
|
||||||
|
const kpiForm = document.getElementById('kpi-form');
|
||||||
|
const inputs = kpiForm.getElementsByTagName('input');
|
||||||
|
const isEditing = this.textContent === 'Save KPIs';
|
||||||
|
|
||||||
|
if (isEditing) {
|
||||||
|
// Save logic
|
||||||
|
const formData = new FormData(kpiForm);
|
||||||
|
const kpis = [];
|
||||||
|
const kpiData = <?php echo $profile['kpi_data'] ?? 'null'; ?>;
|
||||||
|
|
||||||
|
kpiData.kpis.forEach((kpi, index) => {
|
||||||
|
kpis.push({
|
||||||
|
name: kpi.name,
|
||||||
|
current: formData.get(`kpi_${index}_current`),
|
||||||
|
target: formData.get(`kpi_${index}_target`)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const updatedKpiData = { kpis: kpis, chartData: kpiData.chartData };
|
||||||
|
|
||||||
|
fetch('save_kpis.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
body: `id=${profileId}&kpi_data=${JSON.stringify(updatedKpiData)}`
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
// Re-render with new data
|
||||||
|
renderKpiDashboard(data.updated_kpi_data);
|
||||||
|
// Toggle back to edit mode
|
||||||
|
this.textContent = 'Edit KPIs';
|
||||||
|
for (let input of inputs) {
|
||||||
|
input.setAttribute('readonly', true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert('Error saving KPIs: ' + data.error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error saving KPIs:', error);
|
||||||
|
alert('An unexpected error occurred while saving KPIs.');
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Edit logic
|
||||||
|
this.textContent = 'Save KPIs';
|
||||||
|
for (let input of inputs) {
|
||||||
|
input.removeAttribute('readonly');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Load existing diagram on page load
|
||||||
|
const existingDiagram = <?php echo json_encode($profile['diagram_mermaid_text'] ?? null); ?>;
|
||||||
|
if (existingDiagram) {
|
||||||
|
renderDiagram(existingDiagram);
|
||||||
|
} else {
|
||||||
|
const sampleDiagram = `graph TD
|
||||||
|
subgraph "GTM Strategy Workflow"
|
||||||
|
A[Start] --> B[Input Market & Product Data];
|
||||||
|
B --> C{Generate GTM Strategy};
|
||||||
|
C --> D[Review Generated Plan];
|
||||||
|
D --> E{Is the Plan Approved?};
|
||||||
|
E -- Yes --> F[Launch GTM Campaign];
|
||||||
|
E -- No --> G[Refine Inputs & Regenerate];
|
||||||
|
G --> B;
|
||||||
|
F --> H[Monitor KPIs & Optimize];
|
||||||
|
H --> F;
|
||||||
|
end`;
|
||||||
|
renderDiagram(sampleDiagram, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate button click handler
|
||||||
|
if (generateBtn) {
|
||||||
|
generateBtn.addEventListener('click', function () {
|
||||||
|
diagramContainer.innerHTML = '<div class="text-center"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div><p>Generating diagram...</p></div>';
|
||||||
|
generateBtn.disabled = true;
|
||||||
|
editorContainer.style.display = 'none';
|
||||||
|
|
||||||
|
fetch(`generate_diagram.php?id=${profileId}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.error) {
|
||||||
|
diagramContainer.innerHTML = `<div class="alert alert-danger">${data.error}</div>`;
|
||||||
|
} else {
|
||||||
|
renderDiagram(data.diagram);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error generating diagram:', error);
|
||||||
|
diagramContainer.innerHTML = '<div class="alert alert-danger">An error occurred while generating the diagram.</div>';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
generateBtn.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Live update diagram from editor
|
||||||
|
let debounceTimer;
|
||||||
|
editor.addEventListener('input', () => {
|
||||||
|
clearTimeout(debounceTimer);
|
||||||
|
debounceTimer = setTimeout(() => {
|
||||||
|
renderDiagram(editor.value);
|
||||||
|
}, 500); // 500ms debounce
|
||||||
|
});
|
||||||
|
|
||||||
|
// Save button click handler
|
||||||
|
if (saveBtn) {
|
||||||
|
saveBtn.addEventListener('click', function () {
|
||||||
|
const diagramText = editor.value;
|
||||||
|
saveStatus.innerHTML = '<span class="text-info">Saving...</span>';
|
||||||
|
saveBtn.disabled = true;
|
||||||
|
|
||||||
|
fetch('save_diagram.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
profile_id: profileId,
|
||||||
|
diagram_text: diagramText
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
saveStatus.innerHTML = '<span class="text-success">Saved successfully!</span>';
|
||||||
|
} else {
|
||||||
|
saveStatus.innerHTML = `<span class="text-danger">Error: ${data.error || 'Could not save.'}</span>`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error saving diagram:', error);
|
||||||
|
saveStatus.innerHTML = '<span class="text-danger">An unexpected error occurred.</span>';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
saveBtn.disabled = false;
|
||||||
|
setTimeout(() => { saveStatus.innerHTML = ''; }, 3000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
44
save_diagram.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$response = ['success' => false, 'message' => 'An unknown error occurred.'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
throw new Exception('Invalid JSON received. ' . json_last_error_msg());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['profile_id']) && isset($data['diagram_text'])) {
|
||||||
|
$profileId = $data['profile_id'];
|
||||||
|
$diagramText = $data['diagram_text'];
|
||||||
|
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("UPDATE gtm_profiles SET diagram_mermaid_text = :diagram_text WHERE id = :profile_id");
|
||||||
|
|
||||||
|
$stmt->bindValue(':diagram_text', $diagramText, PDO::PARAM_STR);
|
||||||
|
$stmt->bindValue(':profile_id', $profileId, PDO::PARAM_INT);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$response['success'] = true;
|
||||||
|
$response['message'] = 'Diagram saved successfully.';
|
||||||
|
} else {
|
||||||
|
$errorInfo = $stmt->errorInfo();
|
||||||
|
$response['message'] = 'Failed to save diagram. DB Error: ' . ($errorInfo[2] ?? 'Unknown');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response['message'] = 'Invalid input.';
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$response['message'] = 'Error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
42
save_kpis.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$profile_id = $_POST['id'] ?? null;
|
||||||
|
$kpi_data_json = $_POST['kpi_data'] ?? null;
|
||||||
|
|
||||||
|
if (!$profile_id || !$kpi_data_json) {
|
||||||
|
echo json_encode(['error' => 'Profile ID or KPI data is missing.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$kpi_data = json_decode($kpi_data_json, true);
|
||||||
|
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
throw new Exception('Invalid JSON format for KPI data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch existing data to merge, preserving the chart data
|
||||||
|
$stmt = $pdo->prepare("SELECT kpi_data FROM gtm_profiles WHERE id = ?");
|
||||||
|
$stmt->execute([$profile_id]);
|
||||||
|
$existing_data_row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$existing_data = $existing_data_row ? json_decode($existing_data_row['kpi_data'], true) : [];
|
||||||
|
|
||||||
|
// We only want to update the 'kpis' part, not the chart data
|
||||||
|
$existing_data['kpis'] = $kpi_data['kpis'];
|
||||||
|
|
||||||
|
$updated_kpi_data_json = json_encode($existing_data);
|
||||||
|
|
||||||
|
$update_stmt = $pdo->prepare("UPDATE gtm_profiles SET kpi_data = ? WHERE id = ?");
|
||||||
|
$update_stmt->execute([$updated_kpi_data_json, $profile_id]);
|
||||||
|
|
||||||
|
echo json_encode(['success' => true, 'message' => 'KPIs updated successfully.', 'updated_kpi_data' => $existing_data]);
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log('KPI Save Error: ' . $e->getMessage());
|
||||||
|
echo json_encode(['error' => 'Error saving KPIs: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
173
start.php
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>GTM Maximizer</title>
|
||||||
|
<meta name="description" content="GTM Maximizer: Customize your B2B SaaS strategy and discover top AI tools for optimal market success.">
|
||||||
|
<meta name="keywords" content="GTM strategy, B2B SaaS, go-to-market, AI tools, sales strategy, marketing plan, revenue growth, customer acquisition, market analysis, business planning">
|
||||||
|
<meta property="og:title" content="GTM Maximizer">
|
||||||
|
<meta property="og:description" content="GTM Maximizer: Customize your B2B SaaS strategy and discover top AI tools for optimal market success.">
|
||||||
|
<meta property="og:image" content="https://project-screens.s3.amazonaws.com/screenshots/34602/app-hero-20251002-202548.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://project-screens.s3.amazonaws.com/screenshots/34602/app-hero-20251002-202548.png">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter&family=Lora:wght@700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">GTM Maximizer</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="profile.php">Profile</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
Tools
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<li><a class="dropdown-item" href="#">Design</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Diagram</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Integrations</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Settings</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Account</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<header class="hero text-center">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="display-4">Build Your GTM Strategy</h1>
|
||||||
|
<p class="lead">AI Powered Solutions Generating Profitable and Efficient Revenue and Customer Growth</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container my-5" id="form-container">
|
||||||
|
<div class="card p-4">
|
||||||
|
<div class="progress mb-4">
|
||||||
|
<div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form id="gtm-form" action="submit_profile.php" method="POST">
|
||||||
|
<!-- Step 1: Business Information -->
|
||||||
|
<div class="form-step active">
|
||||||
|
<h2 class="mb-4">Business Information</h2>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="business_name" class="form-label">Business Name</label>
|
||||||
|
<input type="text" class="form-control" id="business_name" name="business_name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="sells_what" class="form-label">What do you sell?</label>
|
||||||
|
<textarea class="form-control" id="sells_what" name="sells_what" rows="3" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="text-end">
|
||||||
|
<button type="button" class="btn btn-primary btn-next">Next</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Step 2: Market & Sales -->
|
||||||
|
<div class="form-step">
|
||||||
|
<h2 class="mb-4">Market & Sales</h2>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="icp" class="form-label">Who is your Ideal Customer Profile (ICP)?</label>
|
||||||
|
<textarea class="form-control" id="icp" name="icp" rows="3" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Market Size</label>
|
||||||
|
<select class="form-select" name="market_size" required>
|
||||||
|
<option value="smb">SMB</option>
|
||||||
|
<option value="mid-market">Mid-Market</option>
|
||||||
|
<option value="enterprise">Enterprise</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Existing Sales Motions</label>
|
||||||
|
<div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="checkbox" name="sales_motions[]" value="product-led" id="product-led">
|
||||||
|
<label class="form-check-label" for="product-led">Product Led</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="checkbox" name="sales_motions[]" value="sales-led" id="sales-led">
|
||||||
|
<label class="form-check-label" for="sales-led">Sales Led</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="checkbox" name="sales_motions[]" value="partner-led" id="partner-led">
|
||||||
|
<label class="form-check-label" for="partner-led">Partner Led</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<button type="button" class="btn btn-secondary btn-prev">Previous</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-next">Next</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Step 3: Team & Roles -->
|
||||||
|
<div class="form-step">
|
||||||
|
<h2 class="mb-4">Team & Roles</h2>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="org_size" class="form-label">Organization Size</label>
|
||||||
|
<select class="form-select" name="org_size" required>
|
||||||
|
<option value="1-10">1-10 employees</option>
|
||||||
|
<option value="11-50">11-50 employees</option>
|
||||||
|
<option value="51-200">51-200 employees</option>
|
||||||
|
<option value="201-1000">201-1000 employees</option>
|
||||||
|
<option value="1000+">1000+ employees</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Marketing and Sales Roles</label>
|
||||||
|
<input type="text" class="form-control" name="roles" placeholder="e.g., SDR, Enterprise Sales, Marketing Manager" required>
|
||||||
|
<div class="form-text">Enter roles separated by commas.</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<button type="button" class="btn btn-secondary btn-prev">Previous</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-next">Next</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Step 4: Goals -->
|
||||||
|
<div class="form-step">
|
||||||
|
<h2 class="mb-4">Goals</h2>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="goals" class="form-label">What are your growth goals (customer, revenue, AOV, GMV) and for what period?</label>
|
||||||
|
<textarea class="form-control" id="goals" name="goals" rows="4" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<button type="button" class="btn btn-secondary btn-prev">Previous</button>
|
||||||
|
<button type="submit" class="btn btn-success">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="text-center py-4">
|
||||||
|
<p>© <?php echo date("Y"); ?> GTM Maximizer. All Rights Reserved.</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
34
submit_profile.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Invalid request method.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO gtm_profiles (business_name, sells_what, icp, market_size, sales_motions, org_size, roles, goals) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|
||||||
|
$stmt->execute([
|
||||||
|
$_POST['business_name'] ?? '',
|
||||||
|
$_POST['sells_what'] ?? '',
|
||||||
|
$_POST['icp'] ?? '',
|
||||||
|
$_POST['market_size'] ?? '',
|
||||||
|
implode(', ', $_POST['sales_motions'] ?? []),
|
||||||
|
$_POST['org_size'] ?? '',
|
||||||
|
$_POST['roles'] ?? '',
|
||||||
|
$_POST['goals'] ?? ''
|
||||||
|
]);
|
||||||
|
|
||||||
|
$last_id = $pdo->lastInsertId();
|
||||||
|
|
||||||
|
echo json_encode(['success' => true, 'profile_id' => $last_id]);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// In a real app, you would log this error, not expose it to the user.
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Database error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
1
test_debug_20251005.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php echo "<h1>DEBUG TEST PAGE</h1>"; ?>
|
||||||