Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67d4d719a6 | ||
|
|
25ba3f2f78 | ||
|
|
cad70b3f6e | ||
|
|
6a72450df9 |
64
api/chat.php
Normal file
64
api/chat.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../ai/LocalAIApi.php';
|
||||
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
$message = $input['message'] ?? '';
|
||||
|
||||
if (empty($message)) {
|
||||
echo json_encode(['reply' => "I didn't catch that. Could you repeat?"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// 1. Fetch Knowledge Base (FAQs)
|
||||
$stmt = db()->query("SELECT keywords, answer FROM faqs");
|
||||
$faqs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$knowledgeBase = "Here is the knowledge base for this website:\n\n";
|
||||
foreach ($faqs as $faq) {
|
||||
$knowledgeBase .= "Q: " . $faq['keywords'] . "\nA: " . $faq['answer'] . "\n---\n";
|
||||
}
|
||||
|
||||
// 2. Construct Prompt for AI
|
||||
$systemPrompt = "You are a helpful, friendly AI assistant for this website. " .
|
||||
"Use the provided Knowledge Base to answer user questions accurately. " .
|
||||
"If the answer is found in the Knowledge Base, rephrase it naturally. " .
|
||||
"If the answer is NOT in the Knowledge Base, use your general knowledge to help, " .
|
||||
"but politely mention that you don't have specific information about that if it seems like a site-specific question. " .
|
||||
"Keep answers concise and professional.\n\n" .
|
||||
$knowledgeBase;
|
||||
|
||||
// 3. Call AI API
|
||||
$response = LocalAIApi::createResponse([
|
||||
'model' => 'gpt-4o-mini',
|
||||
'input' => [
|
||||
['role' => 'system', 'content' => $systemPrompt],
|
||||
['role' => 'user', 'content' => $message],
|
||||
]
|
||||
]);
|
||||
|
||||
if (!empty($response['success'])) {
|
||||
$aiReply = LocalAIApi::extractText($response);
|
||||
|
||||
// 4. Save to Database
|
||||
try {
|
||||
$stmt = db()->prepare("INSERT INTO messages (user_message, ai_response) VALUES (?, ?)");
|
||||
$stmt->execute([$message, $aiReply]);
|
||||
} catch (Exception $e) {
|
||||
error_log("DB Save Error: " . $e->getMessage());
|
||||
// Continue even if save fails, so the user still gets a reply
|
||||
}
|
||||
|
||||
echo json_encode(['reply' => $aiReply]);
|
||||
} else {
|
||||
// Fallback if AI fails
|
||||
error_log("AI Error: " . ($response['error'] ?? 'Unknown'));
|
||||
echo json_encode(['reply' => "I'm having trouble connecting to my brain right now. Please try again later."]);
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("Chat Error: " . $e->getMessage());
|
||||
echo json_encode(['reply' => "An internal error occurred."]);
|
||||
}
|
||||
216
api/generate_pdf.php
Normal file
216
api/generate_pdf.php
Normal file
@ -0,0 +1,216 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../fpdf/fpdf.php';
|
||||
|
||||
$lpa_id = isset($_GET['id']) ? (int)$_GET['id'] : null;
|
||||
|
||||
if (!$lpa_id) {
|
||||
die('LPA ID is required.');
|
||||
}
|
||||
|
||||
// Fetch LPA data
|
||||
$stmt = db()->prepare("SELECT * FROM lpa_applications WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
$lpa_data = $stmt->fetch();
|
||||
|
||||
if (!$lpa_data) {
|
||||
die('LPA not found.');
|
||||
}
|
||||
|
||||
// Fetch attorneys
|
||||
$stmt = db()->prepare("SELECT * FROM lpa_attorneys WHERE lpa_id = ? AND type = 'primary' ORDER BY id ASC");
|
||||
$stmt->execute([$lpa_id]);
|
||||
$primary_attorneys = $stmt->fetchAll();
|
||||
|
||||
$stmt = db()->prepare("SELECT * FROM lpa_attorneys WHERE lpa_id = ? AND type = 'replacement' ORDER BY id ASC");
|
||||
$stmt->execute([$lpa_id]);
|
||||
$replacement_attorneys = $stmt->fetchAll();
|
||||
|
||||
// Fetch notified persons
|
||||
$stmt = db()->prepare("SELECT * FROM lpa_notified_persons WHERE application_id = ? ORDER BY id ASC");
|
||||
$stmt->execute([$lpa_id]);
|
||||
$notified_persons = $stmt->fetchAll();
|
||||
|
||||
class LPAPDF extends FPDF {
|
||||
function Header() {
|
||||
$this->SetFont('Helvetica', 'B', 15);
|
||||
$this->Cell(0, 10, 'Health and Welfare Lasting Power of Attorney', 0, 1, 'C');
|
||||
$this->SetFont('Helvetica', 'I', 9);
|
||||
$this->Cell(0, 5, 'Summary Draft (Not a registered legal document)', 0, 1, 'C');
|
||||
$this->Ln(10);
|
||||
}
|
||||
|
||||
function Footer() {
|
||||
$this->SetY(-15);
|
||||
$this->SetFont('Helvetica', 'I', 8);
|
||||
$this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb} - Generated on ' . date('Y-m-d H:i'), 0, 0, 'C');
|
||||
}
|
||||
|
||||
function SectionTitle($title) {
|
||||
$this->SetFont('Helvetica', 'B', 12);
|
||||
$this->SetFillColor(230, 230, 230);
|
||||
$this->Cell(0, 8, $title, 0, 1, 'L', true);
|
||||
$this->Ln(2);
|
||||
}
|
||||
|
||||
function Field($label, $value) {
|
||||
$this->SetFont('Helvetica', 'B', 10);
|
||||
$this->Cell(50, 6, $label . ':', 0, 0);
|
||||
$this->SetFont('Helvetica', '', 10);
|
||||
$this->MultiCell(0, 6, $value ? $value : 'None', 0, 'L');
|
||||
}
|
||||
}
|
||||
|
||||
$pdf = new LPAPDF();
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
$pdf->SetAutoPageBreak(true, 15);
|
||||
|
||||
// 1. Donor
|
||||
$pdf->SectionTitle('1. The Donor');
|
||||
$pdf->Field('Full Name', $lpa_data['donor_name']);
|
||||
if (!empty($lpa_data['other_names'])) $pdf->Field('Other Names', $lpa_data['other_names']);
|
||||
$pdf->Field('Date of Birth', $lpa_data['donor_dob']);
|
||||
$pdf->Field('Email', $lpa_data['customer_email']);
|
||||
$donor_addr = $lpa_data['donor_address_line1'];
|
||||
if (!empty($lpa_data['donor_address_line2'])) $donor_addr .= ', ' . $lpa_data['donor_address_line2'];
|
||||
$donor_addr .= ', ' . $lpa_data['donor_town'] . ', ' . $lpa_data['donor_postcode'];
|
||||
$pdf->Field('Address', $donor_addr);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 2. Primary Attorneys
|
||||
$pdf->SectionTitle('2. The Attorneys');
|
||||
if (empty($primary_attorneys)) {
|
||||
$pdf->Field('Attorneys', 'No attorneys listed.');
|
||||
} else {
|
||||
foreach ($primary_attorneys as $idx => $att) {
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(0, 6, 'Attorney ' . ($idx + 1) . ':', 0, 1);
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$name = ($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name'];
|
||||
$pdf->Field('Name', $name);
|
||||
$pdf->Field('DOB', $att['dob']);
|
||||
$pdf->Field('Email', $att['email']);
|
||||
$addr = $att['address_line1'];
|
||||
if (!empty($att['address_line2'])) $addr .= ', ' . $att['address_line2'];
|
||||
$addr .= ', ' . $att['town'] . ', ' . $att['postcode'];
|
||||
$pdf->Field('Address', $addr);
|
||||
|
||||
// Witness
|
||||
if (!empty($att['witness_first_name'])) {
|
||||
$w_name = $att['witness_first_name'] . ' ' . $att['witness_last_name'];
|
||||
$w_addr = $att['witness_address_line1'] . ', ' . $att['witness_postcode'];
|
||||
$pdf->Field('Witness', $w_name . ' (' . $w_addr . ')');
|
||||
}
|
||||
$pdf->Ln(2);
|
||||
}
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 3. Decisions
|
||||
$pdf->SectionTitle('3. How should the attorneys make decisions?');
|
||||
$pdf->Field('Decision Type', $lpa_data['attorney_decision_type']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 4. Replacement Attorneys
|
||||
$pdf->SectionTitle('4. Replacement Attorneys');
|
||||
if (empty($replacement_attorneys)) {
|
||||
$pdf->Field('Replacements', 'No replacement attorneys listed.');
|
||||
} else {
|
||||
foreach ($replacement_attorneys as $idx => $att) {
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(0, 6, 'Replacement ' . ($idx + 1) . ':', 0, 1);
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$name = ($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name'];
|
||||
$pdf->Field('Name', $name);
|
||||
$addr = $att['address_line1'] . ', ' . $att['town'] . ', ' . $att['postcode'];
|
||||
$pdf->Field('Address', $addr);
|
||||
$pdf->Ln(2);
|
||||
}
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 5. Life Sustaining
|
||||
$pdf->SectionTitle('5. Life-Sustaining Treatment');
|
||||
$pdf->Field('Option', $lpa_data['life_sustaining_treatment']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 6. Witness Information
|
||||
$pdf->SectionTitle('6. Donor\'s Witness');
|
||||
$pdf->Field('Name', $lpa_data['witness_first_name'] . ' ' . $lpa_data['witness_last_name']);
|
||||
$pdf->Field('Address', $lpa_data['witness_address_line1'] . ', ' . $lpa_data['witness_postcode']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 7. People to Notify
|
||||
$pdf->SectionTitle('7. People to Notify');
|
||||
if (empty($notified_persons)) {
|
||||
$pdf->Field('Persons', 'None');
|
||||
} else {
|
||||
foreach ($notified_persons as $idx => $np) {
|
||||
$pdf->Field('Person ' . ($idx + 1), $np['first_name'] . ' ' . $np['last_name'] . ' (' . $np['postcode'] . ')');
|
||||
}
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 8. Preferences & Instructions
|
||||
$pdf->SectionTitle('8. Preferences and Instructions');
|
||||
$pdf->Field('Preferences', $lpa_data['preferences']);
|
||||
$pdf->Field('Instructions', $lpa_data['instructions']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 9. Certificate Provider
|
||||
$pdf->SectionTitle('9. Certificate Provider');
|
||||
$name = ($lpa_data['certificate_provider_title'] ? $lpa_data['certificate_provider_title'] . ' ' : '') . $lpa_data['certificate_provider_first_name'] . ' ' . $lpa_data['certificate_provider_last_name'];
|
||||
$pdf->Field('Name', $name);
|
||||
$pdf->Field('Address', $lpa_data['certificate_provider_address_line1'] . ', ' . $lpa_data['certificate_provider_postcode']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 10. Attorney Witnesses
|
||||
$pdf->SectionTitle('10. Attorney Witnesses');
|
||||
foreach ($primary_attorneys as $idx => $att) {
|
||||
if (!empty($att['witness_first_name'])) {
|
||||
$w_name = $att['witness_first_name'] . ' ' . $att['witness_last_name'];
|
||||
$pdf->Field('Witness for ' . $att['first_name'], $w_name);
|
||||
}
|
||||
}
|
||||
foreach ($replacement_attorneys as $idx => $att) {
|
||||
if (!empty($att['witness_first_name'])) {
|
||||
$w_name = $att['witness_first_name'] . ' ' . $att['witness_last_name'];
|
||||
$pdf->Field('Witness for ' . $att['first_name'], $w_name);
|
||||
}
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 11. Registration
|
||||
$pdf->SectionTitle('11. Registration');
|
||||
$pdf->Field('Who is registering', ucfirst($lpa_data['registration_who'] ?? ''));
|
||||
if (($lpa_data['registration_who'] ?? '') === 'attorneys') {
|
||||
$reg_ids = explode(',', $lpa_data['registering_attorneys_ids'] ?? '');
|
||||
$reg_names = [];
|
||||
foreach ($primary_attorneys as $att) {
|
||||
if (in_array($att['id'], $reg_ids)) {
|
||||
$reg_names[] = $att['first_name'] . ' ' . $att['last_name'];
|
||||
}
|
||||
}
|
||||
$pdf->Field('Attorneys', implode(', ', $reg_names));
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 12. Correspondence
|
||||
$pdf->SectionTitle('12. Correspondence');
|
||||
$pdf->Field('Recipient', $lpa_data['correspondence_who'] ?? '');
|
||||
if (($lpa_data['correspondence_who'] ?? '') !== 'Donor') {
|
||||
$pdf->Field('Name', ($lpa_data['correspondence_first_name'] ?? '') . ' ' . ($lpa_data['correspondence_last_name'] ?? ''));
|
||||
$pdf->Field('Address', ($lpa_data['correspondence_address_line1'] ?? '') . ', ' . ($lpa_data['correspondence_postcode'] ?? ''));
|
||||
$pdf->Field('Contact Preference', $lpa_data['correspondence_contact_preference'] ?? '');
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 13. Payment
|
||||
$pdf->SectionTitle('13. Payment & Fee');
|
||||
$pdf->Field('Payment Method', $lpa_data['payment_method'] ?? '');
|
||||
$pdf->Field('Reduced Fee Eligibility', $lpa_data['reduced_fee_eligibility'] ?? '');
|
||||
$pdf->Field('Repeat Application', ($lpa_data['is_repeat_application'] ?? false) ? 'Yes (Case: ' . ($lpa_data['repeat_case_number'] ?? '') . ')' : 'No');
|
||||
|
||||
$filename = 'LPA_' . str_replace(' ', '_', ($lpa_data['donor_name'] ?? 'Summary')) . '_' . date('Ymd') . '.pdf';
|
||||
$pdf->Output('D', $filename);
|
||||
499
api/save_lpa.php
Normal file
499
api/save_lpa.php
Normal file
@ -0,0 +1,499 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// Check for specific actions first
|
||||
if (isset($_POST['action'])) {
|
||||
if ($_POST['action'] === 'delete_attorney') {
|
||||
$attorney_id = isset($_POST['attorney_id']) ? (int)$_POST['attorney_id'] : null;
|
||||
$lpa_id = isset($_POST['lpa_id']) ? (int)$_POST['lpa_id'] : null;
|
||||
|
||||
if (!$attorney_id || !$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'Missing IDs for deletion.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$stmt = db()->prepare("DELETE FROM lpa_attorneys WHERE id = ? AND lpa_id = ?");
|
||||
$stmt->execute([$attorney_id, $lpa_id]);
|
||||
echo json_encode(['success' => true, 'message' => 'Attorney removed.']);
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode(['success' => false, 'error' => 'Database error: ' . $e->getMessage()]);
|
||||
}
|
||||
exit;
|
||||
} elseif ($_POST['action'] === 'delete_notified_person') {
|
||||
$person_id = isset($_POST['person_id']) ? (int)$_POST['person_id'] : null;
|
||||
$lpa_id = isset($_POST['lpa_id']) ? (int)$_POST['lpa_id'] : null;
|
||||
|
||||
if (!$person_id || !$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'Missing IDs for deletion.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$stmt = db()->prepare("DELETE FROM lpa_notified_persons WHERE id = ? AND application_id = ?");
|
||||
$stmt->execute([$person_id, $lpa_id]);
|
||||
echo json_encode(['success' => true, 'message' => 'Person removed.']);
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode(['success' => false, 'error' => 'Database error: ' . $e->getMessage()]);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$step = isset($_POST['step']) ? (int)$_POST['step'] : 1;
|
||||
$lpa_id = isset($_POST['lpa_id']) ? (int)$_POST['lpa_id'] : null;
|
||||
|
||||
try {
|
||||
if ($step === 1) {
|
||||
$lpa_type = $_POST['lpa_type'] ?? '';
|
||||
$donor_name = $_POST['donor_name'] ?? '';
|
||||
$other_names = $_POST['other_names'] ?? '';
|
||||
$donor_dob = $_POST['donor_dob'] ?? '';
|
||||
$customer_email = $_POST['customer_email'] ?? '';
|
||||
$address1 = $_POST['donor_address_line1'] ?? '';
|
||||
$address2 = $_POST['donor_address_line2'] ?? '';
|
||||
$town = $_POST['donor_town'] ?? '';
|
||||
$postcode = $_POST['donor_postcode'] ?? '';
|
||||
|
||||
if (empty($lpa_type) || empty($donor_name) || empty($donor_dob) || empty($customer_email) || empty($address1) || empty($town) || empty($postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'All fields are required for Step 1, including the address.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($lpa_id) {
|
||||
// Update existing
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET lpa_type = ?, donor_name = ?, other_names = ?, donor_dob = ?, customer_email = ?, donor_address_line1 = ?, donor_address_line2 = ?, donor_town = ?, donor_postcode = ?, step_reached = GREATEST(step_reached, 1) WHERE id = ?");
|
||||
$stmt->execute([$lpa_type, $donor_name, $other_names, $donor_dob, $customer_email, $address1, $address2, $town, $postcode, $lpa_id]);
|
||||
$id = $lpa_id;
|
||||
} else {
|
||||
// Create new
|
||||
$stmt = db()->prepare("INSERT INTO lpa_applications (practice_id, lpa_type, donor_name, other_names, donor_dob, customer_email, donor_address_line1, donor_address_line2, donor_town, donor_postcode, step_reached) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([1, $lpa_type, $donor_name, $other_names, $donor_dob, $customer_email, $address1, $address2, $town, $postcode, 1]);
|
||||
$id = db()->lastInsertId();
|
||||
}
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$id, 'next_step' => 2, 'message' => 'Step 1 saved successfully.']);
|
||||
|
||||
} elseif ($step === 2) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 2.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $_POST['title'] ?? '';
|
||||
$first_name = $_POST['first_name'] ?? '';
|
||||
$last_name = $_POST['last_name'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$dob = $_POST['dob'] ?? '';
|
||||
$address1 = $_POST['address_line1'] ?? '';
|
||||
$address2 = $_POST['address_line2'] ?? '';
|
||||
$address3 = $_POST['address_line3'] ?? '';
|
||||
$town = $_POST['town'] ?? '';
|
||||
$postcode = $_POST['postcode'] ?? '';
|
||||
$next_action = $_POST['next_action'] ?? 'add_another';
|
||||
|
||||
if (empty($first_name) || empty($last_name) || empty($email) || empty($dob) || empty($address1) || empty($town) || empty($postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'All fields are required to save an attorney.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("INSERT INTO lpa_attorneys (lpa_id, type, title, first_name, last_name, email, dob, address_line1, address_line2, address_line3, town, postcode) VALUES (?, 'primary', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$lpa_id, $title, $first_name, $last_name, $email, $dob, $address1, $address2, $address3, $town, $postcode]);
|
||||
|
||||
// Update step reached
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET step_reached = GREATEST(step_reached, 2) WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
|
||||
$next_step = ($next_action === 'next_step') ? 3 : 2;
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => $next_step, 'message' => 'Attorney saved successfully.']);
|
||||
} elseif ($step === 3) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 3.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$attorney_decision_type = $_POST['attorney_decision_type'] ?? '';
|
||||
|
||||
if (empty($attorney_decision_type)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please select how your attorneys should make decisions.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET attorney_decision_type = ?, step_reached = GREATEST(step_reached, 3) WHERE id = ?");
|
||||
$stmt->execute([$attorney_decision_type, $lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 4, 'message' => 'Decision-making preference saved.']);
|
||||
} elseif ($step === 4) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 4.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $_POST['title'] ?? '';
|
||||
$first_name = $_POST['first_name'] ?? '';
|
||||
$last_name = $_POST['last_name'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$dob = $_POST['dob'] ?? '';
|
||||
$address1 = $_POST['address_line1'] ?? '';
|
||||
$address2 = $_POST['address_line2'] ?? '';
|
||||
$address3 = $_POST['address_line3'] ?? '';
|
||||
$town = $_POST['town'] ?? '';
|
||||
$postcode = $_POST['postcode'] ?? '';
|
||||
$next_action = $_POST['next_action'] ?? 'add_another';
|
||||
|
||||
if (empty($first_name) || empty($last_name) || empty($email) || empty($dob) || empty($address1) || empty($town) || empty($postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'All fields are required to save a replacement attorney.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("INSERT INTO lpa_attorneys (lpa_id, type, title, first_name, last_name, email, dob, address_line1, address_line2, address_line3, town, postcode) VALUES (?, 'replacement', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$lpa_id, $title, $first_name, $last_name, $email, $dob, $address1, $address2, $address3, $town, $postcode]);
|
||||
|
||||
// Update step reached
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET step_reached = GREATEST(step_reached, 4) WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
|
||||
$next_step = ($next_action === 'next_step') ? 5 : 4;
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => $next_step, 'message' => 'Replacement attorney saved successfully.']);
|
||||
} elseif ($step === 5) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 5.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$life_sustaining_treatment = $_POST['life_sustaining_treatment'] ?? '';
|
||||
|
||||
if (empty($life_sustaining_treatment)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please select an option for life-sustaining treatment.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
life_sustaining_treatment = ?,
|
||||
step_reached = GREATEST(step_reached, 5)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$life_sustaining_treatment,
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 6, 'message' => 'Step 5 saved successfully.']);
|
||||
} elseif ($step === 6) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 6.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$witness_title = $_POST['witness_title'] ?? '';
|
||||
$witness_first_name = $_POST['witness_first_name'] ?? '';
|
||||
$witness_last_name = $_POST['witness_last_name'] ?? '';
|
||||
$witness_address_line1 = $_POST['witness_address_line1'] ?? '';
|
||||
$witness_address_line2 = $_POST['witness_address_line2'] ?? '';
|
||||
$witness_address_line3 = $_POST['witness_address_line3'] ?? '';
|
||||
$witness_postcode = $_POST['witness_postcode'] ?? '';
|
||||
|
||||
if (empty($witness_first_name) || empty($witness_last_name) || empty($witness_address_line1) || empty($witness_postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please fill in all required witness fields.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
witness_title = ?,
|
||||
witness_first_name = ?,
|
||||
witness_last_name = ?,
|
||||
witness_address_line1 = ?,
|
||||
witness_address_line2 = ?,
|
||||
witness_address_line3 = ?,
|
||||
witness_postcode = ?,
|
||||
step_reached = GREATEST(step_reached, 6)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$witness_title,
|
||||
$witness_first_name,
|
||||
$witness_last_name,
|
||||
$witness_address_line1,
|
||||
$witness_address_line2,
|
||||
$witness_address_line3,
|
||||
$witness_postcode,
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 7, 'message' => 'Step 6 saved successfully.']);
|
||||
} elseif ($step === 7) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 7.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $_POST['title'] ?? '';
|
||||
$first_name = $_POST['first_name'] ?? '';
|
||||
$last_name = $_POST['last_name'] ?? '';
|
||||
$address1 = $_POST['address_line1'] ?? '';
|
||||
$address2 = $_POST['address_line2'] ?? '';
|
||||
$address3 = $_POST['address_line3'] ?? '';
|
||||
$postcode = $_POST['postcode'] ?? '';
|
||||
$next_action = $_POST['next_action'] ?? 'add_another';
|
||||
|
||||
if (empty($first_name) || empty($last_name) || empty($address1) || empty($postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'All fields are required to save a person to notify.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("INSERT INTO lpa_notified_persons (application_id, title, first_name, last_name, address_line1, address_line2, address_line3, postcode) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$lpa_id, $title, $first_name, $last_name, $address1, $address2, $address3, $postcode]);
|
||||
|
||||
// Update step reached
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET step_reached = GREATEST(step_reached, 7) WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
|
||||
$next_step = ($next_action === 'next_step') ? 8 : 7;
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => $next_step, 'message' => 'Person to notify saved successfully.']);
|
||||
} elseif ($step === 8) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 8.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$preferences = $_POST['preferences'] ?? '';
|
||||
$instructions = $_POST['instructions'] ?? '';
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
preferences = ?,
|
||||
instructions = ?,
|
||||
step_reached = GREATEST(step_reached, 8)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$preferences, $instructions, $lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 9, 'message' => 'Step 8 saved successfully.']);
|
||||
} elseif ($step === 9) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 9.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $_POST['certificate_provider_title'] ?? '';
|
||||
$first_name = $_POST['certificate_provider_first_name'] ?? '';
|
||||
$last_name = $_POST['certificate_provider_last_name'] ?? '';
|
||||
$address1 = $_POST['certificate_provider_address_line1'] ?? '';
|
||||
$address2 = $_POST['certificate_provider_address_line2'] ?? '';
|
||||
$address3 = $_POST['certificate_provider_address_line3'] ?? '';
|
||||
$postcode = $_POST['certificate_provider_postcode'] ?? '';
|
||||
|
||||
if (empty($first_name) || empty($last_name) || empty($address1) || empty($postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please fill in all required fields for the certificate provider.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
certificate_provider_title = ?,
|
||||
certificate_provider_first_name = ?,
|
||||
certificate_provider_last_name = ?,
|
||||
certificate_provider_address_line1 = ?,
|
||||
certificate_provider_address_line2 = ?,
|
||||
certificate_provider_address_line3 = ?,
|
||||
certificate_provider_postcode = ?,
|
||||
step_reached = GREATEST(step_reached, 9)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$title, $first_name, $last_name, $address1, $address2, $address3, $postcode, $lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 10, 'message' => 'Step 9 saved successfully.']);
|
||||
} elseif ($step === 10) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 10.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$attorney_witnesses = $_POST['attorney_witness'] ?? [];
|
||||
|
||||
foreach ($attorney_witnesses as $attorney_id => $witness_data) {
|
||||
$selection = $witness_data['selection'] ?? '';
|
||||
|
||||
if ($selection === 'new') {
|
||||
$w_title = $witness_data['title'] ?? '';
|
||||
$w_first_name = $witness_data['first_name'] ?? '';
|
||||
$w_last_name = $witness_data['last_name'] ?? '';
|
||||
$w_address1 = $witness_data['address_line1'] ?? '';
|
||||
$w_address2 = $witness_data['address_line2'] ?? '';
|
||||
$w_address3 = $witness_data['address_line3'] ?? '';
|
||||
$w_postcode = $witness_data['postcode'] ?? '';
|
||||
} else {
|
||||
$pw = json_decode($selection, true);
|
||||
if ($pw) {
|
||||
$w_title = $pw['title'] ?? '';
|
||||
$w_first_name = $pw['first_name'] ?? '';
|
||||
$w_last_name = $pw['last_name'] ?? '';
|
||||
$w_address1 = $pw['address1'] ?? '';
|
||||
$w_address2 = $pw['address2'] ?? '';
|
||||
$w_address3 = $pw['address3'] ?? '';
|
||||
$w_postcode = $pw['postcode'] ?? '';
|
||||
} else {
|
||||
// Skip if nothing selected and not new
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_attorneys SET
|
||||
witness_title = ?,
|
||||
witness_first_name = ?,
|
||||
witness_last_name = ?,
|
||||
witness_address_line1 = ?,
|
||||
witness_address_line2 = ?,
|
||||
witness_address_line3 = ?,
|
||||
witness_postcode = ?
|
||||
WHERE id = ? AND lpa_id = ?");
|
||||
$stmt->execute([$w_title, $w_first_name, $w_last_name, $w_address1, $w_address2, $w_address3, $w_postcode, $attorney_id, $lpa_id]);
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET step_reached = GREATEST(step_reached, 10) WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 11, 'message' => 'Attorney witnesses saved successfully.']);
|
||||
} elseif ($step === 11) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 11.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$registration_who = $_POST['registration_who'] ?? 'donor';
|
||||
$registering_attorneys = $_POST['registering_attorneys'] ?? [];
|
||||
$registering_attorneys_ids = implode(',', $registering_attorneys);
|
||||
|
||||
if ($registration_who === 'attorneys' && empty($registering_attorneys)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please select at least one attorney if they are registering the LPA.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
registration_who = ?,
|
||||
registering_attorneys_ids = ?,
|
||||
step_reached = GREATEST(step_reached, 11)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$registration_who, $registering_attorneys_ids, $lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 12, 'message' => 'Registration choice saved successfully.']);
|
||||
} elseif ($step === 12) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 12.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$correspondence_who = $_POST['correspondence_who'] ?? 'Donor';
|
||||
$title = $_POST['correspondence_title'] ?? '';
|
||||
$first_name = $_POST['correspondence_first_name'] ?? '';
|
||||
$last_name = $_POST['correspondence_last_name'] ?? '';
|
||||
$company_name = $_POST['correspondence_company_name'] ?? '';
|
||||
$address1 = $_POST['correspondence_address_line1'] ?? '';
|
||||
$address2 = $_POST['correspondence_address_line2'] ?? '';
|
||||
$address3 = $_POST['correspondence_address_line3'] ?? '';
|
||||
$postcode = $_POST['correspondence_postcode'] ?? '';
|
||||
$contact_preference = $_POST['correspondence_contact_preference'] ?? 'Post';
|
||||
$phone = $_POST['correspondence_phone'] ?? '';
|
||||
$email = $_POST['correspondence_email'] ?? '';
|
||||
|
||||
if ($correspondence_who !== 'Donor') {
|
||||
if (empty($first_name) || empty($last_name) || empty($address1) || empty($postcode)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please fill in all required correspondence details.']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
correspondence_who = ?,
|
||||
correspondence_title = ?,
|
||||
correspondence_first_name = ?,
|
||||
correspondence_last_name = ?,
|
||||
correspondence_company_name = ?,
|
||||
correspondence_address_line1 = ?,
|
||||
correspondence_address_line2 = ?,
|
||||
correspondence_address_line3 = ?,
|
||||
correspondence_postcode = ?,
|
||||
correspondence_contact_preference = ?,
|
||||
correspondence_phone = ?,
|
||||
correspondence_email = ?,
|
||||
step_reached = GREATEST(step_reached, 12)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$correspondence_who,
|
||||
$title,
|
||||
$first_name,
|
||||
$last_name,
|
||||
$company_name,
|
||||
$address1,
|
||||
$address2,
|
||||
$address3,
|
||||
$postcode,
|
||||
$contact_preference,
|
||||
$phone,
|
||||
$email,
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 13, 'message' => 'Correspondence details saved successfully.']);
|
||||
} elseif ($step === 13) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 13.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$payment_method = $_POST['payment_method'] ?? 'Card';
|
||||
$payment_phone = $_POST['payment_phone'] ?? '';
|
||||
$reduced_fee_eligibility = $_POST['reduced_fee_eligibility'] ?? 'No';
|
||||
$is_repeat_application = isset($_POST['is_repeat_application']) ? 1 : 0;
|
||||
$repeat_case_number = $_POST['repeat_case_number'] ?? '';
|
||||
|
||||
if ($payment_method === 'Card' && empty($payment_phone)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please provide a phone number for card payment.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($is_repeat_application && empty($repeat_case_number)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Please provide the case number for your repeat application.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
payment_method = ?,
|
||||
payment_phone = ?,
|
||||
reduced_fee_eligibility = ?,
|
||||
is_repeat_application = ?,
|
||||
repeat_case_number = ?,
|
||||
step_reached = GREATEST(step_reached, 13)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$payment_method,
|
||||
$payment_phone,
|
||||
$reduced_fee_eligibility,
|
||||
$is_repeat_application,
|
||||
$repeat_case_number,
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'next_step' => 14, 'message' => 'Payment details saved successfully.']);
|
||||
} elseif ($step === 14) {
|
||||
if (!$lpa_id) {
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 14.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
step_reached = GREATEST(step_reached, 14),
|
||||
status = 'completed'
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => (int)$lpa_id, 'redirect' => 'dashboard.php', 'message' => 'Application submitted successfully.']);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => 'Invalid step provided.']);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
error_log($e->getMessage());
|
||||
echo json_encode(['success' => false, 'error' => 'Database error: ' . $e->getMessage()]);
|
||||
}
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => 'Invalid request method.']);
|
||||
}
|
||||
91
api/telegram_webhook.php
Normal file
91
api/telegram_webhook.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../ai/LocalAIApi.php';
|
||||
|
||||
// Get Telegram Update
|
||||
$content = file_get_contents("php://input");
|
||||
$update = json_decode($content, true);
|
||||
|
||||
if (!$update || !isset($update['message'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$message = $update['message'];
|
||||
$chatId = $message['chat']['id'];
|
||||
$text = $message['text'] ?? '';
|
||||
|
||||
if (empty($text)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get Telegram Token from DB
|
||||
$stmt = db()->query("SELECT setting_value FROM settings WHERE setting_key = 'telegram_token'");
|
||||
$token = $stmt->fetchColumn();
|
||||
|
||||
if (!$token) {
|
||||
error_log("Telegram Error: No bot token found in settings.");
|
||||
exit;
|
||||
}
|
||||
|
||||
function sendTelegramMessage($chatId, $text, $token) {
|
||||
$url = "https://api.telegram.org/bot$token/sendMessage";
|
||||
$data = [
|
||||
'chat_id' => $chatId,
|
||||
'text' => $text,
|
||||
'parse_mode' => 'Markdown'
|
||||
];
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => http_build_query($data),
|
||||
],
|
||||
];
|
||||
$context = stream_context_create($options);
|
||||
return file_get_contents($url, false, $context);
|
||||
}
|
||||
|
||||
// Process with AI (Similar logic to api/chat.php)
|
||||
try {
|
||||
// 1. Fetch Knowledge Base
|
||||
$stmt = db()->query("SELECT keywords, answer FROM faqs");
|
||||
$faqs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$knowledgeBase = "Here is the knowledge base for this website:\n\n";
|
||||
foreach ($faqs as $faq) {
|
||||
$knowledgeBase .= "Q: " . $faq['keywords'] . "\nA: " . $faq['answer'] . "\n---\n";
|
||||
}
|
||||
|
||||
$systemPrompt = "You are a helpful AI assistant integrated with Telegram. " .
|
||||
"Use the provided Knowledge Base to answer user questions. " .
|
||||
"Keep answers concise for mobile reading. Use Markdown for formatting.\n\n" .
|
||||
$knowledgeBase;
|
||||
|
||||
// 2. Call AI
|
||||
$response = LocalAIApi::createResponse([
|
||||
'model' => 'gpt-4o-mini',
|
||||
'input' => [
|
||||
['role' => 'system', 'content' => $systemPrompt],
|
||||
['role' => 'user', 'content' => $text],
|
||||
]
|
||||
]);
|
||||
|
||||
if (!empty($response['success'])) {
|
||||
$aiReply = LocalAIApi::extractText($response);
|
||||
|
||||
// 3. Save History
|
||||
try {
|
||||
$stmt = db()->prepare("INSERT INTO messages (user_message, ai_response) VALUES (?, ?)");
|
||||
$stmt->execute(["[Telegram] " . $text, $aiReply]);
|
||||
} catch (Exception $e) {}
|
||||
|
||||
// 4. Send back to Telegram
|
||||
sendTelegramMessage($chatId, $aiReply, $token);
|
||||
} else {
|
||||
sendTelegramMessage($chatId, "I'm sorry, I encountered an error processing your request.", $token);
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("Telegram Webhook Error: " . $e->getMessage());
|
||||
}
|
||||
@ -1,346 +1,114 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
||||
|
||||
:root {
|
||||
--color-bg: #ffffff;
|
||||
--color-text: #1a1a1a;
|
||||
--color-primary: #2563EB; /* Vibrant Blue */
|
||||
--color-secondary: #000000;
|
||||
--color-accent: #A3E635; /* Lime Green */
|
||||
--color-surface: #f8f9fa;
|
||||
--font-heading: 'Space Grotesk', sans-serif;
|
||||
--font-body: 'Inter', sans-serif;
|
||||
--border-width: 2px;
|
||||
--shadow-hard: 5px 5px 0px #000;
|
||||
--shadow-hover: 8px 8px 0px #000;
|
||||
--radius-pill: 50rem;
|
||||
--radius-card: 1rem;
|
||||
--primary: #0F172A;
|
||||
--secondary: #334155;
|
||||
--accent: #2563EB;
|
||||
--background: #F8FAFC;
|
||||
--surface: #FFFFFF;
|
||||
--border: #E2E8F0;
|
||||
--text-main: #1E293B;
|
||||
--text-muted: #64748B;
|
||||
--radius: 4px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--font-body);
|
||||
background-color: var(--color-bg);
|
||||
color: var(--color-text);
|
||||
overflow-x: hidden;
|
||||
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
background-color: var(--background);
|
||||
color: var(--text-main);
|
||||
line-height: 1.5;
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, .navbar-brand {
|
||||
font-family: var(--font-heading);
|
||||
letter-spacing: -0.03em;
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: var(--primary);
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.025em;
|
||||
}
|
||||
|
||||
/* Utilities */
|
||||
.text-primary { color: var(--color-primary) !important; }
|
||||
.bg-black { background-color: #000 !important; }
|
||||
.text-white { color: #fff !important; }
|
||||
.shadow-hard { box-shadow: var(--shadow-hard); }
|
||||
.border-2-black { border: var(--border-width) solid #000; }
|
||||
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
|
||||
|
||||
/* Navbar */
|
||||
.navbar {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(10px);
|
||||
border-bottom: var(--border-width) solid transparent;
|
||||
transition: all 0.3s;
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
background-color: var(--surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.navbar.scrolled {
|
||||
border-bottom-color: #000;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.brand-text {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
font-weight: 500;
|
||||
color: var(--color-text);
|
||||
margin-left: 1rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-link:hover, .nav-link.active {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
font-weight: 700;
|
||||
font-family: var(--font-heading);
|
||||
padding: 0.8rem 2rem;
|
||||
border-radius: var(--radius-pill);
|
||||
border: var(--border-width) solid #000;
|
||||
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
box-shadow: var(--shadow-hard);
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: translate(-2px, -2px);
|
||||
box-shadow: var(--shadow-hover);
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
transform: translate(2px, 2px);
|
||||
box-shadow: 0 0 0 #000;
|
||||
border-radius: var(--radius);
|
||||
font-weight: 500;
|
||||
padding: 0.5rem 1rem;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
border-color: #000;
|
||||
color: #fff;
|
||||
background-color: var(--primary);
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: #1d4ed8;
|
||||
border-color: #000;
|
||||
color: #fff;
|
||||
background-color: #1E293B;
|
||||
border-color: #1E293B;
|
||||
}
|
||||
|
||||
.btn-outline-dark {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
.card {
|
||||
background-color: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.btn-cta {
|
||||
background-color: var(--color-accent);
|
||||
color: #000;
|
||||
.form-control, .form-select {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 0.625rem;
|
||||
}
|
||||
|
||||
.btn-cta:hover {
|
||||
background-color: #8cc629;
|
||||
color: #000;
|
||||
.form-control:focus, .form-select:focus {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
/* Hero Section */
|
||||
.hero-section {
|
||||
min-height: 100vh;
|
||||
padding-top: 80px;
|
||||
.progress {
|
||||
height: 0.5rem;
|
||||
border-radius: 9999px;
|
||||
background-color: var(--border);
|
||||
}
|
||||
|
||||
.background-blob {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(80px);
|
||||
opacity: 0.6;
|
||||
z-index: 1;
|
||||
.progress-bar {
|
||||
background-color: var(--accent);
|
||||
}
|
||||
|
||||
.blob-1 {
|
||||
top: -10%;
|
||||
right: -10%;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: radial-gradient(circle, var(--color-accent), transparent);
|
||||
}
|
||||
|
||||
.blob-2 {
|
||||
bottom: 10%;
|
||||
left: -10%;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
background: radial-gradient(circle, var(--color-primary), transparent);
|
||||
}
|
||||
|
||||
.highlight-text {
|
||||
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 40%;
|
||||
background-position: 0 88%;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.dot { color: var(--color-primary); }
|
||||
|
||||
.badge-pill {
|
||||
display: inline-block;
|
||||
padding: 0.5rem 1rem;
|
||||
border: 2px solid #000;
|
||||
border-radius: 50px;
|
||||
font-weight: 700;
|
||||
background: #fff;
|
||||
box-shadow: 4px 4px 0 #000;
|
||||
font-family: var(--font-heading);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Marquee */
|
||||
.marquee-container {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
border-top: 2px solid #000;
|
||||
border-bottom: 2px solid #000;
|
||||
}
|
||||
|
||||
.rotate-divider {
|
||||
transform: rotate(-2deg) scale(1.05);
|
||||
z-index: 10;
|
||||
position: relative;
|
||||
margin-top: -50px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.marquee-content {
|
||||
display: inline-block;
|
||||
animation: marquee 20s linear infinite;
|
||||
font-family: var(--font-heading);
|
||||
font-weight: 700;
|
||||
font-size: 1.5rem;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
@keyframes marquee {
|
||||
0% { transform: translateX(0); }
|
||||
100% { transform: translateX(-50%); }
|
||||
}
|
||||
|
||||
/* Portfolio Cards */
|
||||
.project-card {
|
||||
border: 2px solid #000;
|
||||
border-radius: var(--radius-card);
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
transition: transform 0.3s ease;
|
||||
box-shadow: var(--shadow-hard);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.project-card:hover {
|
||||
transform: translateY(-10px);
|
||||
box-shadow: 8px 8px 0 #000;
|
||||
}
|
||||
|
||||
.card-img-holder {
|
||||
height: 250px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-bottom: 2px solid #000;
|
||||
position: relative;
|
||||
font-size: 4rem;
|
||||
}
|
||||
|
||||
.placeholder-art {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.project-card:hover .placeholder-art {
|
||||
transform: scale(1.2) rotate(10deg);
|
||||
}
|
||||
|
||||
.bg-soft-blue { background-color: #e0f2fe; }
|
||||
.bg-soft-green { background-color: #dcfce7; }
|
||||
.bg-soft-purple { background-color: #f3e8ff; }
|
||||
.bg-soft-yellow { background-color: #fef9c3; }
|
||||
|
||||
.category-tag {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
background: #000;
|
||||
color: #fff;
|
||||
padding: 5px 12px;
|
||||
border-radius: 20px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.card-body { padding: 1.5rem; }
|
||||
|
||||
.link-arrow {
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
.status-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
|
||||
.link-arrow:hover i { transform: translateX(5px); }
|
||||
.status-draft { background-color: #FEF3C7; color: #92400E; }
|
||||
.status-completed { background-color: #DCFCE7; color: #166534; }
|
||||
|
||||
/* About */
|
||||
.about-image-stack {
|
||||
position: relative;
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
.section-padding { padding: 4rem 0; }
|
||||
|
||||
/* Custom Step 3 Decision Styling */
|
||||
.btn-check:checked + .btn-outline-secondary {
|
||||
border-color: var(--accent);
|
||||
background-color: rgba(37, 99, 235, 0.05);
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.stack-card {
|
||||
position: absolute;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
border-radius: var(--radius-card);
|
||||
border: 2px solid #000;
|
||||
box-shadow: var(--shadow-hard);
|
||||
left: 10%;
|
||||
transform: rotate(-3deg);
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
.form-control {
|
||||
border: 2px solid #000;
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
font-weight: 500;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
box-shadow: 4px 4px 0 var(--color-primary);
|
||||
border-color: #000;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
.animate-up {
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
animation: fadeUp 0.8s ease forwards;
|
||||
}
|
||||
|
||||
.delay-100 { animation-delay: 0.1s; }
|
||||
.delay-200 { animation-delay: 0.2s; }
|
||||
|
||||
@keyframes fadeUp {
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Social */
|
||||
.social-links a {
|
||||
transition: transform 0.2s;
|
||||
.form-check-input-placeholder {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid var(--border);
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
.social-links a:hover {
|
||||
transform: scale(1.2) rotate(10deg);
|
||||
color: var(--color-accent) !important;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 991px) {
|
||||
.rotate-divider {
|
||||
transform: rotate(0);
|
||||
margin-top: 0;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.hero-section {
|
||||
padding-top: 120px;
|
||||
text-align: center;
|
||||
min-height: auto;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
.display-1 { font-size: 3.5rem; }
|
||||
|
||||
.blob-1 { width: 300px; height: 300px; right: -20%; }
|
||||
.blob-2 { width: 300px; height: 300px; left: -20%; }
|
||||
.btn-check:checked + .btn-outline-secondary .form-check-input-placeholder {
|
||||
border-color: var(--accent);
|
||||
background-color: var(--accent);
|
||||
box-shadow: inset 0 0 0 3px white;
|
||||
}
|
||||
|
||||
@ -1,73 +1,99 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Select all forms with the class lpa-form
|
||||
const lpaForms = document.querySelectorAll('.lpa-form');
|
||||
|
||||
// Smooth scrolling for navigation links
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
lpaForms.forEach(form => {
|
||||
form.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const targetId = this.getAttribute('href');
|
||||
if (targetId === '#') return;
|
||||
const submitBtn = document.activeElement && document.activeElement.type === 'submit' ? document.activeElement : form.querySelector('button[type="submit"]');
|
||||
const originalBtnText = submitBtn.innerText;
|
||||
const nextAction = document.activeElement && document.activeElement.name === 'next_action' ? document.activeElement.value : null;
|
||||
|
||||
const targetElement = document.querySelector(targetId);
|
||||
if (targetElement) {
|
||||
// Close mobile menu if open
|
||||
const navbarToggler = document.querySelector('.navbar-toggler');
|
||||
const navbarCollapse = document.querySelector('.navbar-collapse');
|
||||
if (navbarCollapse.classList.contains('show')) {
|
||||
navbarToggler.click();
|
||||
// Show loading state
|
||||
submitBtn.disabled = true;
|
||||
const originalHTML = submitBtn.innerHTML;
|
||||
submitBtn.innerHTML = '<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span> Saving...';
|
||||
|
||||
const formData = new FormData(form);
|
||||
|
||||
// If the button clicked was one of the buttons with next_action, ensure it's set
|
||||
if (nextAction) {
|
||||
formData.set('next_action', nextAction);
|
||||
}
|
||||
|
||||
// Scroll with offset
|
||||
const offset = 80;
|
||||
const elementPosition = targetElement.getBoundingClientRect().top;
|
||||
const offsetPosition = elementPosition + window.pageYOffset - offset;
|
||||
fetch('api/save_lpa.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log("Success:", data);
|
||||
// Show success state
|
||||
submitBtn.classList.remove('btn-primary', 'btn-secondary', 'btn-outline-primary');
|
||||
submitBtn.classList.add('btn-success');
|
||||
submitBtn.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2"><polyline points="20 6 9 17 4 12"></polyline></svg> Saved!';
|
||||
|
||||
window.scrollTo({
|
||||
top: offsetPosition,
|
||||
behavior: "smooth"
|
||||
});
|
||||
if (nextAction === 'add_another') {
|
||||
// Clear the form fields as requested
|
||||
form.reset();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Navbar scroll effect
|
||||
const navbar = document.querySelector('.navbar');
|
||||
window.addEventListener('scroll', () => {
|
||||
if (window.scrollY > 50) {
|
||||
navbar.classList.add('scrolled', 'shadow-sm', 'bg-white');
|
||||
navbar.classList.remove('bg-transparent');
|
||||
setTimeout(() => {
|
||||
if (data.redirect) {
|
||||
window.location.href = data.redirect;
|
||||
} else if (data.next_step) {
|
||||
const currentStep = parseInt(new URLSearchParams(window.location.search).get('step') || 1);
|
||||
if (data.next_step === currentStep) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
navbar.classList.remove('scrolled', 'shadow-sm', 'bg-white');
|
||||
navbar.classList.add('bg-transparent');
|
||||
window.location.href = 'apply.php?step=' + encodeURIComponent(data.next_step) + 'window.location.href = 'apply.php?step=' + data.next_step + '&id=' + data.id;id=' + encodeURIComponent(data.id);
|
||||
}
|
||||
}
|
||||
}, 800);
|
||||
} else {
|
||||
alert(data.error || 'An error occurred. Please try again.');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.innerHTML = originalHTML;
|
||||
submitBtn.classList.remove('btn-success');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("Data:", data); console.error('Error:', error);
|
||||
alert('Something went wrong. Please check your connection.');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.innerHTML = originalHTML;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Handle attorney deletion
|
||||
const deleteBtns = document.querySelectorAll('.btn-delete-attorney');
|
||||
deleteBtns.forEach(btn => {
|
||||
btn.addEventListener('click', function() {
|
||||
if (confirm('Are you sure you want to remove this attorney?')) {
|
||||
const attorneyId = btn.getAttribute('data-id');
|
||||
const lpaId = btn.getAttribute('data-lpa-id') || new URLSearchParams(window.location.search).get('id');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('action', 'delete_attorney');
|
||||
formData.append('attorney_id', attorneyId);
|
||||
formData.append('lpa_id', lpaId);
|
||||
|
||||
fetch('api/save_lpa.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log("Success:", data);
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.error || 'Failed to remove attorney.');
|
||||
}
|
||||
});
|
||||
|
||||
// Intersection Observer for fade-up animations
|
||||
const observerOptions = {
|
||||
threshold: 0.1,
|
||||
rootMargin: "0px 0px -50px 0px"
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('animate-up');
|
||||
entry.target.style.opacity = "1";
|
||||
observer.unobserve(entry.target); // Only animate once
|
||||
}
|
||||
});
|
||||
}, observerOptions);
|
||||
|
||||
// Select elements to animate (add a class 'reveal' to them in HTML if not already handled by CSS animation)
|
||||
// For now, let's just make sure the hero animations run.
|
||||
// If we want scroll animations, we'd add opacity: 0 to elements in CSS and reveal them here.
|
||||
// Given the request, the CSS animation I added runs on load for Hero.
|
||||
// Let's make the project cards animate in.
|
||||
|
||||
const projectCards = document.querySelectorAll('.project-card');
|
||||
projectCards.forEach((card, index) => {
|
||||
card.style.opacity = "0";
|
||||
card.style.animationDelay = `${index * 0.1}s`;
|
||||
observer.observe(card);
|
||||
});
|
||||
|
||||
});
|
||||
140
dashboard.php
Normal file
140
dashboard.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
require_once 'db/config.php';
|
||||
$project_name = $_SERVER['PROJECT_NAME'] ?? 'LPA Builder';
|
||||
|
||||
$lpas = [];
|
||||
try {
|
||||
$stmt = db()->prepare("SELECT * FROM lpa_applications ORDER BY created_at DESC");
|
||||
$stmt->execute();
|
||||
$lpas = $stmt->fetchAll();
|
||||
} 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>Customer Dashboard — <?php echo htmlspecialchars($project_name); ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<nav class="navbar navbar-expand-lg bg-white border-bottom shadow-sm">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center" href="/">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2 text-primary"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
|
||||
<span class="fw-bold"><?php echo htmlspecialchars($project_name); ?></span>
|
||||
</a>
|
||||
<div class="d-flex align-items-center">
|
||||
<span class="me-3 d-none d-md-inline text-muted small">Practice: Elite Estate Planning</span>
|
||||
<a href="/apply.php" class="btn btn-primary btn-sm px-3">Start New LPA</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container py-5">
|
||||
<div class="row align-items-center mb-5">
|
||||
<div class="col">
|
||||
<h1 class="h3 fw-bold mb-1">Your Applications</h1>
|
||||
<p class="text-muted small mb-0">Track and manage your Lasting Powers of Attorney progress.</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<?php if (count($lpas) > 0): ?>
|
||||
<a href="/apply.php" class="btn btn-outline-primary px-4">New Application</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['completed_step'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show border-0 shadow-sm mb-4" role="alert">
|
||||
<div class="d-flex align-items-center">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2"><polyline points="20 6 9 17 4 12"></polyline></svg>
|
||||
<span>Step <?php echo (int)$_GET['completed_step']; ?> saved successfully! You can continue where you left off.</span>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php elseif (isset($_GET['new_lpa'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show border-0 shadow-sm mb-4" role="alert">
|
||||
<div class="d-flex align-items-center">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2"><polyline points="20 6 9 17 4 12"></polyline></svg>
|
||||
<span>LPA application started successfully! Our practice has been notified of your progress.</span>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card border-0 shadow-sm overflow-hidden">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="bg-light">
|
||||
<tr class="small text-uppercase tracking-wider">
|
||||
<th class="ps-4 py-3 border-bottom-0">Type</th>
|
||||
<th class="py-3 border-bottom-0">Donor</th>
|
||||
<th class="py-3 border-bottom-0">Progress</th>
|
||||
<th class="py-3 border-bottom-0">Status</th>
|
||||
<th class="py-3 border-bottom-0 text-end pe-4">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($lpas) > 0): ?>
|
||||
<?php foreach ($lpas as $lpa): ?>
|
||||
<tr>
|
||||
<td class="ps-4 py-4">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="me-3 text-primary bg-primary-subtle p-2 rounded">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
|
||||
</div>
|
||||
<div>
|
||||
<div class="fw-bold text-dark mb-0"><?php echo htmlspecialchars($lpa['lpa_type']); ?></div>
|
||||
<div class="text-muted small">Started <?php echo date('M d, Y', strtotime($lpa['created_at'])); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="fw-medium text-dark"><?php echo htmlspecialchars($lpa['donor_name']); ?></div>
|
||||
<div class="text-muted small"><?php echo htmlspecialchars($lpa['customer_email']); ?></div>
|
||||
</td>
|
||||
<td style="width: 200px;">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="progress flex-grow-1 me-2" style="height: 6px;">
|
||||
<?php $percent = round(($lpa['step_reached'] / 14) * 100); ?>
|
||||
<div class="progress-bar bg-primary" role="progressbar" style="width: <?php echo $percent; ?>%" aria-valuenow="<?php echo $percent; ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
<span class="small text-muted"><?php echo $percent; ?>%</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="status-badge status-draft"><?php echo ucfirst($lpa['status']); ?></span>
|
||||
</td>
|
||||
<td class="text-end pe-4">
|
||||
<?php
|
||||
$next_step = ($lpa['step_reached'] < 14) ? $lpa['step_reached'] + 1 : 14;
|
||||
?>
|
||||
<a href="/apply.php?step=<?php echo $next_step; ?>&id=<?php echo $lpa['id']; ?>" class="btn btn-sm btn-outline-secondary px-3">Continue</a>
|
||||
<a href="api/generate_pdf.php?id=<?php echo $lpa['id']; ?>" class="btn btn-sm btn-outline-primary px-3 ms-2">Download PDF</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<td colspan="5" class="py-5 text-center">
|
||||
<div class="mb-3">
|
||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="text-muted"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>
|
||||
</div>
|
||||
<h5 class="fw-bold text-dark">No applications yet</h5>
|
||||
<p class="text-muted small mb-4">Start your first LPA application to secure your future.</p>
|
||||
<a href="/apply.php" class="btn btn-primary px-4">Start Application</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
7
fpdf.zip
Normal file
7
fpdf.zip
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
||||
<html><head>
|
||||
<title>404 Not Found</title>
|
||||
</head><body>
|
||||
<h1>Not Found</h1>
|
||||
<p>The requested URL was not found on this server.</p>
|
||||
</body></html>
|
||||
21
fpdf/font/helvetica.php
Normal file
21
fpdf/font/helvetica.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
|
||||
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
|
||||
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
||||
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
|
||||
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
fpdf/font/helveticab.php
Normal file
21
fpdf/font/helveticab.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-Bold';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
|
||||
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
|
||||
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
|
||||
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
fpdf/font/helveticabi.php
Normal file
21
fpdf/font/helveticabi.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-BoldOblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
|
||||
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
|
||||
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
|
||||
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
fpdf/font/helveticai.php
Normal file
21
fpdf/font/helveticai.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-Oblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
|
||||
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
|
||||
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
||||
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
|
||||
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
1934
fpdf/fpdf.php
Normal file
1934
fpdf/fpdf.php
Normal file
File diff suppressed because it is too large
Load Diff
241
index.php
241
index.php
@ -1,150 +1,113 @@
|
||||
<?php
|
||||
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');
|
||||
$project_name = $_SERVER['PROJECT_NAME'] ?? 'LPA Builder';
|
||||
$project_desc = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Create your UK Lasting Power of Attorney in minutes.';
|
||||
$project_img = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<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.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--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 {
|
||||
margin: 0;
|
||||
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 {
|
||||
content: '';
|
||||
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 {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
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>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo htmlspecialchars($project_name); ?> — Modern Estate Planning</title>
|
||||
<meta name="description" content="<?php echo htmlspecialchars($project_desc); ?>">
|
||||
|
||||
<!-- Open Graph / Twitter -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="<?php echo htmlspecialchars($project_name); ?>">
|
||||
<meta property="og:description" content="<?php echo htmlspecialchars($project_desc); ?>">
|
||||
<meta property="og:image" content="<?php echo htmlspecialchars($project_img); ?>">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="<?php echo htmlspecialchars($project_img); ?>">
|
||||
|
||||
<!-- Bootstrap 5 -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center" href="/">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="me-2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
|
||||
<span class="fw-bold"><?php echo htmlspecialchars($project_name); ?></span>
|
||||
</a>
|
||||
<div class="d-flex align-items-center">
|
||||
<a href="/dashboard.php" class="btn btn-link text-decoration-none text-muted me-3">Login</a>
|
||||
<a href="/apply.php" class="btn btn-primary px-4">Get Started</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<header class="section-padding bg-white border-bottom">
|
||||
<div class="container">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-6">
|
||||
<span class="badge bg-primary-subtle text-primary border border-primary-subtle mb-3">UK COMPLIANT</span>
|
||||
<h1 class="display-4 fw-bold mb-4">Lasting Power of Attorney, simplified.</h1>
|
||||
<p class="lead text-muted mb-5">Our staged questionnaire guides you through creating a legally compliant UK LPA in minutes. Trusted by professional estate planning practices.</p>
|
||||
<div class="d-flex flex-wrap gap-3">
|
||||
<a href="/apply.php" class="btn btn-primary btn-lg px-5">Start Application</a>
|
||||
<a href="#how-it-works" class="btn btn-outline-secondary btn-lg">How it works</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 offset-lg-1 mt-5 mt-lg-0">
|
||||
<div class="card p-2 border-0 shadow-sm">
|
||||
<img src="<?php echo htmlspecialchars($project_img ?: 'https://images.unsplash.com/photo-1589829545856-d10d557cf95f?auto=format&fit=crop&q=80&w=1000'); ?>" class="img-fluid rounded" alt="LPA Service">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section id="how-it-works" class="section-padding">
|
||||
<div class="container">
|
||||
<div class="row text-center mb-5">
|
||||
<div class="col-lg-8 mx-auto">
|
||||
<h2 class="fw-bold">Seamless Document Creation</h2>
|
||||
<p class="text-muted">A structured path to protecting your future, managed by your professional advisor.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 p-4 border-0">
|
||||
<div class="mb-3 text-primary">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>
|
||||
</div>
|
||||
<h5 class="fw-bold">1. Digital Questionnaire</h5>
|
||||
<p class="text-muted small mb-0">Complete a simple, staged online form at your own pace. Save your progress anytime.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 p-4 border-0">
|
||||
<div class="mb-3 text-primary">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
|
||||
</div>
|
||||
<h5 class="fw-bold">2. Professional Review</h5>
|
||||
<p class="text-muted small mb-0">Your estate planning practice reviews the information for accuracy and compliance.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 p-4 border-0">
|
||||
<div class="mb-3 text-primary">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
|
||||
</div>
|
||||
<h5 class="fw-bold">3. Secure Generation</h5>
|
||||
<p class="text-muted small mb-0">Instantly generate and download your legally-formatted OPG documents ready for signing.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="py-5 border-top bg-white">
|
||||
<div class="container text-center text-muted">
|
||||
<p class="small">© <?php echo date('Y'); ?> <?php echo htmlspecialchars($project_name); ?>. All rights reserved.</p>
|
||||
<div class="d-flex justify-content-center gap-3">
|
||||
<a href="#" class="text-decoration-none text-muted small">Terms</a>
|
||||
<a href="#" class="text-decoration-none text-muted small">Privacy</a>
|
||||
</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>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user