40090-vm/partnership.php
Flatlogic Bot d6311a3a5e 1.0
2026-05-26 10:05:49 +00:00

273 lines
16 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/app.php';
$pageTitle = 'Partnership';
$pageDescription = 'Strategic partnership intake for curated programs, ecosystem collaboration, and customized experience briefs.';
$activePage = 'partnership';
$formData = [
'inquiry_type' => trim((string) ($_GET['route'] ?? '')),
'interest_area' => trim((string) ($_GET['interest'] ?? '')),
'contact_name' => '',
'organization_name' => '',
'email' => '',
'phone' => '',
'target_date' => '',
'event_scale' => '',
'preferred_location' => '',
'notes' => '',
];
$errors = [];
$confirmation = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$submittedData = [
'inquiry_type' => trim((string) ($_POST['inquiry_type'] ?? '')),
'interest_area' => trim((string) ($_POST['interest_area'] ?? '')),
'contact_name' => trim((string) ($_POST['contact_name'] ?? '')),
'organization_name' => trim((string) ($_POST['organization_name'] ?? '')),
'email' => trim((string) ($_POST['email'] ?? '')),
'phone' => trim((string) ($_POST['phone'] ?? '')),
'target_date' => trim((string) ($_POST['target_date'] ?? '')),
'event_scale' => trim((string) ($_POST['event_scale'] ?? '')),
'preferred_location' => trim((string) ($_POST['preferred_location'] ?? '')),
'notes' => trim((string) ($_POST['notes'] ?? '')),
];
$formData = $submittedData;
if (!verify_csrf_token($_POST['csrf_token'] ?? null)) {
$errors['form'] = 'Your session expired. Please refresh and submit the inquiry again.';
} else {
$result = save_inquiry($_POST);
if (!empty($result['success'])) {
if (!empty($result['warning'])) {
flash_set('warning', $result['warning']);
} else {
flash_set('success', 'Inquiry submitted. The preview desk now has a new review item.');
}
header('Location: ' . page_url('partnership.php', ['reference' => $result['inquiry']['reference_code']]));
exit;
}
$errors = $result['errors'] ?? ['form' => 'Something went wrong while saving the inquiry.'];
$formData = $result['data'] ?? $formData;
}
}
$reference = trim((string) ($_GET['reference'] ?? ''));
if ($reference !== '') {
$confirmation = find_inquiry(null, $reference);
if (!$confirmation) {
$errors['lookup'] = 'That reference could not be located yet. Try submitting a fresh inquiry.';
}
}
$previewMode = using_preview_storage();
$interestGroups = interest_groups();
require __DIR__ . '/includes/header.php';
?>
<section class="page-section pt-4 pt-lg-5">
<div class="container">
<div class="hero-shell page-intro">
<div class="row g-4 align-items-center">
<div class="col-lg-8">
<span class="section-kicker">Strategic inquiry desk</span>
<h1 class="page-title">Capture a qualified partnership or experience brief in one clean flow.</h1>
<p class="lead-copy mb-0">The form collects just enough detail to feel operational: collaboration route, selected package or partner lane, timing, scale, and a narrative brief.</p>
</div>
<div class="col-lg-4">
<div class="surface-card hero-panel h-100">
<span class="signal-chip signal-chip--primary mb-3">What happens next</span>
<ul class="value-list mb-0">
<li>Submit the structured brief.</li>
<li>Receive a reference code and confirmation summary.</li>
<li>Open the preview desk to review the saved inquiry.</li>
</ul>
</div>
</div>
</div>
</div>
<?php if ($previewMode): ?>
<div class="notice-banner notice-banner--warning mb-4">
<strong>Preview mode:</strong> database connectivity is currently unavailable, so new inquiries are stored only for this browser session while the workflow is being validated.
</div>
<?php endif; ?>
<?php if (!empty($errors['form']) || !empty($errors['lookup'])): ?>
<div class="inline-alert notice-banner--warning mb-4">
<?= h($errors['form'] ?? $errors['lookup']) ?>
</div>
<?php endif; ?>
<?php if ($confirmation): ?>
<div class="surface-card mb-4 anchor-offset">
<div class="d-flex flex-column flex-lg-row justify-content-between gap-3 align-items-lg-start">
<div>
<span class="section-kicker">Confirmation</span>
<h2 class="section-title mb-2">Inquiry received and routed.</h2>
<p class="section-copy mb-0">Use the reference below for follow-up and internal review.</p>
</div>
<div class="copy-inline">
<span class="signal-chip signal-chip--gold" id="referenceCode"><?= h($confirmation['reference_code']) ?></span>
<button class="btn btn-subtle btn-sm" type="button" data-copy-target="#referenceCode">Copy reference</button>
</div>
</div>
<div class="detail-meta mt-4">
<div class="meta-block">
<span class="meta-label">Inquiry type</span>
<strong><?= h($confirmation['inquiry_type']) ?></strong>
</div>
<div class="meta-block">
<span class="meta-label">Selected interest</span>
<strong><?= h($confirmation['interest_area']) ?></strong>
</div>
<div class="meta-block">
<span class="meta-label">Organization</span>
<strong><?= h($confirmation['organization_name']) ?></strong>
</div>
<div class="meta-block">
<span class="meta-label">Preferred date</span>
<strong><?= h(format_date_label($confirmation['target_date'] ?? '')) ?></strong>
</div>
</div>
<div class="d-flex flex-wrap gap-2 mt-4 inline-actions">
<a class="btn btn-brand" href="<?= h(page_url('admin.php', ['reference' => $confirmation['reference_code']])) ?>">Open preview desk</a>
<a class="btn btn-outline-brand" href="partnership.php">Submit another inquiry</a>
</div>
</div>
<?php endif; ?>
<div class="row g-4 align-items-start">
<div class="col-lg-7">
<div class="form-panel">
<div class="d-flex justify-content-between gap-3 align-items-start mb-3">
<div>
<span class="section-kicker">Brief form</span>
<h2 class="section-title">Create inquiry</h2>
</div>
<span class="signal-chip">Step 1 of 1</span>
</div>
<form method="post" novalidate>
<input type="hidden" name="csrf_token" value="<?= h(csrf_token()) ?>">
<div class="row g-3">
<div class="col-md-6">
<label class="form-label" for="inquiry_type">Inquiry type</label>
<select class="form-select <?= !empty($errors['inquiry_type']) ? 'is-invalid' : '' ?>" id="inquiry_type" name="inquiry_type">
<option value="">Select route</option>
<?php foreach (inquiry_type_options() as $option): ?>
<option value="<?= h($option) ?>" <?= is_selected($option, old_value($formData, 'inquiry_type')) ?>><?= h($option) ?></option>
<?php endforeach; ?>
</select>
<div class="invalid-feedback"><?= h($errors['inquiry_type'] ?? '') ?></div>
</div>
<div class="col-md-6">
<label class="form-label" for="interest_area">Interest area</label>
<select class="form-select <?= !empty($errors['interest_area']) ? 'is-invalid' : '' ?>" id="interest_area" name="interest_area">
<option value="">Choose package or partner lane</option>
<?php foreach ($interestGroups as $label => $options): ?>
<optgroup label="<?= h($label) ?>">
<?php foreach ($options as $option): ?>
<option value="<?= h($option) ?>" <?= is_selected($option, old_value($formData, 'interest_area')) ?>><?= h($option) ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
<div class="invalid-feedback"><?= h($errors['interest_area'] ?? '') ?></div>
</div>
<div class="col-md-6">
<label class="form-label" for="contact_name">Primary contact</label>
<input class="form-control <?= !empty($errors['contact_name']) ? 'is-invalid' : '' ?>" id="contact_name" name="contact_name" value="<?= h(old_value($formData, 'contact_name')) ?>" maxlength="120" placeholder="Full name">
<div class="invalid-feedback"><?= h($errors['contact_name'] ?? '') ?></div>
</div>
<div class="col-md-6">
<label class="form-label" for="organization_name">Company / organization</label>
<input class="form-control <?= !empty($errors['organization_name']) ? 'is-invalid' : '' ?>" id="organization_name" name="organization_name" value="<?= h(old_value($formData, 'organization_name')) ?>" maxlength="160" placeholder="Organization name">
<div class="invalid-feedback"><?= h($errors['organization_name'] ?? '') ?></div>
</div>
<div class="col-md-6">
<label class="form-label" for="email">Work email</label>
<input class="form-control <?= !empty($errors['email']) ? 'is-invalid' : '' ?>" id="email" name="email" type="email" value="<?= h(old_value($formData, 'email')) ?>" maxlength="160" placeholder="name@company.com">
<div class="invalid-feedback"><?= h($errors['email'] ?? '') ?></div>
</div>
<div class="col-md-6">
<label class="form-label" for="phone">Phone / WhatsApp</label>
<input class="form-control <?= !empty($errors['phone']) ? 'is-invalid' : '' ?>" id="phone" name="phone" value="<?= h(old_value($formData, 'phone')) ?>" maxlength="40" placeholder="Optional">
<div class="invalid-feedback"><?= h($errors['phone'] ?? '') ?></div>
</div>
<div class="col-md-4">
<label class="form-label" for="target_date">Preferred date</label>
<input class="form-control <?= !empty($errors['target_date']) ? 'is-invalid' : '' ?>" id="target_date" name="target_date" type="date" value="<?= h(old_value($formData, 'target_date')) ?>">
<div class="invalid-feedback"><?= h($errors['target_date'] ?? '') ?></div>
</div>
<div class="col-md-4">
<label class="form-label" for="event_scale">Scale</label>
<select class="form-select" id="event_scale" name="event_scale">
<option value="">Select scale</option>
<?php foreach (scale_options() as $option): ?>
<option value="<?= h($option) ?>" <?= is_selected($option, old_value($formData, 'event_scale')) ?>><?= h($option) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-4">
<label class="form-label" for="preferred_location">Preferred location</label>
<select class="form-select" id="preferred_location" name="preferred_location">
<option value="">Select location</option>
<?php foreach (location_options() as $option): ?>
<option value="<?= h($option) ?>" <?= is_selected($option, old_value($formData, 'preferred_location')) ?>><?= h($option) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-12">
<div class="d-flex justify-content-between gap-3 align-items-center mb-1">
<label class="form-label mb-0" for="notes">Brief description</label>
<span class="form-counter" id="notesCounter">0 / 900</span>
</div>
<textarea class="form-control <?= !empty($errors['notes']) ? 'is-invalid' : '' ?>" id="notes" name="notes" maxlength="900" placeholder="Outline the program goal, audience, desired outcome, and any operational constraints." data-char-count data-char-count="#notesCounter"><?= h(old_value($formData, 'notes')) ?></textarea>
<div class="invalid-feedback"><?= h($errors['notes'] ?? '') ?></div>
<div class="form-text">This first intake is intentionally lightweight. A more detailed scoping conversation can follow after review.</div>
</div>
</div>
<div class="d-flex flex-wrap gap-2 mt-4 inline-actions">
<button class="btn btn-brand" type="submit">Submit Strategic Inquiry</button>
<a class="btn btn-outline-brand" href="admin.php">Open preview desk</a>
</div>
</form>
</div>
</div>
<div class="col-lg-5">
<div class="surface-card h-100">
<span class="section-kicker">Review-ready behavior</span>
<h2 class="section-title">Why this thin slice matters.</h2>
<ul class="value-list mt-3">
<li>Visitors can move from service discovery to inquiry without leaving the branded environment.</li>
<li>The confirmation layer adds confidence by showing a saved reference and structured summary.</li>
<li>The preview desk gives the team an immediate operational touchpoint for follow-up.</li>
</ul>
<div class="divider"></div>
<span class="section-kicker section-kicker--muted">Channel guidance</span>
<div class="contact-grid mt-2">
<article class="surface-card">
<h3 class="card-title">WhatsApp coordination</h3>
<p class="card-copy mb-0">Use the phone field to nominate the best coordination channel for follow-up.</p>
</article>
<article class="surface-card">
<h3 class="card-title">Email desk</h3>
<p class="card-copy mb-0">The work email anchors the formal response lane for proposals and next steps.</p>
</article>
<article class="surface-card">
<h3 class="card-title">Location planning</h3>
<p class="card-copy mb-0">The location and target date fields make the first review more actionable.</p>
</article>
</div>
</div>
</div>
</div>
</div>
</section>
<?php require __DIR__ . '/includes/footer.php'; ?>