1428 lines
109 KiB
PHP
1428 lines
109 KiB
PHP
<?php
|
||
session_start();
|
||
if (!isset($_SESSION["user_id"])) {
|
||
header("Location: login.php");
|
||
exit;
|
||
}
|
||
require_once 'db/config.php';
|
||
|
||
$user_id = $_SESSION["user_id"];
|
||
$project_name = $_SERVER['PROJECT_NAME'] ?? 'LPA Online';
|
||
|
||
$step = isset($_GET['step']) ? (int)$_GET['step'] : 1;
|
||
$lpa_id = isset($_GET['id']) ? (int)$_GET['id'] : null;
|
||
|
||
// If starting a NEW LPA (Step 1, no ID), check for credits
|
||
if ($step === 1 && !$lpa_id) {
|
||
$credits_stmt = db()->prepare("SELECT credits FROM users WHERE id = ?");
|
||
$credits_stmt->execute([$user_id]);
|
||
$credits = (int)$credits_stmt->fetchColumn();
|
||
|
||
if ($credits < 1) {
|
||
// Redirect back to dashboard with error
|
||
header("Location: dashboard.php?error=no_credits");
|
||
exit;
|
||
}
|
||
}
|
||
|
||
$lpa_data = null;
|
||
if ($lpa_id) {
|
||
$stmt = db()->prepare("SELECT * FROM lpa_applications WHERE id = ?");
|
||
$stmt->execute([$lpa_id]);
|
||
$lpa_data = $stmt->fetch();
|
||
|
||
if (!$lpa_data) {
|
||
header("Location: dashboard.php");
|
||
exit;
|
||
}
|
||
|
||
// Authorization check
|
||
if ($lpa_data['user_id'] != $user_id && ($_SESSION['user_role'] ?? '') !== 'Super User') {
|
||
header("Location: dashboard.php");
|
||
exit;
|
||
}
|
||
}
|
||
|
||
// Redirect to step 1 if no ID but step > 1
|
||
if ($step > 1 && !$lpa_id) {
|
||
header("Location: apply.php?step=1");
|
||
exit;
|
||
}
|
||
|
||
$attorneys = [];
|
||
$replacement_attorneys = [];
|
||
$notified_persons = [];
|
||
if ($lpa_id) {
|
||
$stmt = db()->prepare("SELECT * FROM lpa_attorneys WHERE lpa_id = ? AND type = 'replacement'");
|
||
$stmt->execute([$lpa_id]);
|
||
$replacement_attorneys = $stmt->fetchAll();
|
||
|
||
$stmt = db()->prepare("SELECT * FROM lpa_attorneys WHERE lpa_id = ? AND type = 'primary'");
|
||
$stmt->execute([$lpa_id]);
|
||
$attorneys = $stmt->fetchAll();
|
||
|
||
$stmt = db()->prepare("SELECT * FROM lpa_notified_persons WHERE application_id = ?");
|
||
$stmt->execute([$lpa_id]);
|
||
$notified_persons = $stmt->fetchAll();
|
||
}
|
||
|
||
$num_attorneys = count($attorneys); // This is now count of primary attorneys
|
||
$num_replacements = count($replacement_attorneys);
|
||
|
||
$all_attorneys = array_merge($attorneys, $replacement_attorneys);
|
||
|
||
$potential_witnesses = [];
|
||
if ($lpa_data) {
|
||
if (!empty($lpa_data["witness_first_name"])) {
|
||
$potential_witnesses[] = [
|
||
"type" => "Donor Witness",
|
||
"title" => $lpa_data["witness_title"],
|
||
"first_name" => $lpa_data["witness_first_name"],
|
||
"last_name" => $lpa_data["witness_last_name"],
|
||
"address1" => $lpa_data["witness_address_line1"],
|
||
"address2" => $lpa_data["witness_address_line2"],
|
||
"address3" => $lpa_data["witness_address_line3"],
|
||
"postcode" => $lpa_data["witness_postcode"]
|
||
];
|
||
}
|
||
if (!empty($lpa_data["certificate_provider_first_name"])) {
|
||
$potential_witnesses[] = [
|
||
"type" => "Certificate Provider",
|
||
"title" => $lpa_data["certificate_provider_title"],
|
||
"first_name" => $lpa_data["certificate_provider_first_name"],
|
||
"last_name" => $lpa_data["certificate_provider_last_name"],
|
||
"address1" => $lpa_data["certificate_provider_address_line1"],
|
||
"address2" => $lpa_data["certificate_provider_address_line2"],
|
||
"address3" => $lpa_data["certificate_provider_address_line3"],
|
||
"postcode" => $lpa_data["certificate_provider_postcode"]
|
||
];
|
||
}
|
||
}
|
||
foreach ($notified_persons as $np) {
|
||
$potential_witnesses[] = [
|
||
"type" => "Notified Person",
|
||
"title" => $np["title"],
|
||
"first_name" => $np["first_name"],
|
||
"last_name" => $np["last_name"],
|
||
"address1" => $np["address_line1"],
|
||
"address2" => $np["address_line2"],
|
||
"address3" => $np["address_line3"],
|
||
"postcode" => $np["postcode"]
|
||
];
|
||
}
|
||
|
||
?>
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Start Application — <?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?v=<?php echo time(); ?>" rel="stylesheet">
|
||
<style>
|
||
.summary-section {
|
||
border-bottom: 1px solid #eee;
|
||
padding-bottom: 1.5rem;
|
||
margin-bottom: 1.5rem;
|
||
}
|
||
.summary-section:last-child {
|
||
border-bottom: none;
|
||
}
|
||
.summary-label {
|
||
font-weight: 600;
|
||
color: #666;
|
||
font-size: 0.85rem;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.025em;
|
||
}
|
||
.summary-value {
|
||
color: #111;
|
||
}
|
||
.edit-link {
|
||
font-size: 0.8rem;
|
||
text-decoration: none;
|
||
}
|
||
.extra-small {
|
||
font-size: 0.75rem;
|
||
}
|
||
</style>
|
||
</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="/">
|
||
<img src="assets/pasted-20260228-235417-eedda424.png" alt="<?php echo htmlspecialchars($project_name); ?>" height="40">
|
||
</a>
|
||
<div class="d-flex align-items-center">
|
||
<span class="me-3 d-none d-md-inline text-muted small">Logged in as: <?php echo htmlspecialchars($_SESSION['user_name'] ?? $_SESSION['user_email']); ?></span>
|
||
<a href="/dashboard.php" class="btn btn-sm btn-link text-decoration-none text-muted me-2">Back to Dashboard</a>
|
||
<a href="/logout.php" class="btn btn-sm btn-outline-secondary rounded-pill">Logout</a>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<div class="container py-5">
|
||
<div class="row justify-content-center">
|
||
<div class="col-lg-10">
|
||
<div class="mb-5">
|
||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||
<span class="small fw-semibold text-muted text-uppercase tracking-wider">Step <?php echo $step; ?> of 14</span>
|
||
<span class="small fw-semibold text-primary">
|
||
<?php
|
||
switch($step) {
|
||
case 1: echo "Donor Information & Address"; break;
|
||
case 2: echo "Attorneys"; break;
|
||
case 3: echo "How decisions are made"; break;
|
||
case 4: echo "Replacement Attorneys"; break;
|
||
case 5: echo "Life-sustaining treatment"; break;
|
||
case 6: echo "Witness Information"; break;
|
||
case 7: echo "People to notify"; break;
|
||
case 8: echo "Preferences and instructions"; break;
|
||
case 9: echo "Certificate Provider"; break;
|
||
case 10: echo "Attorney Witnesses"; break;
|
||
case 11: echo "Who is registering the LPA?"; break;
|
||
case 12: echo "Who should receive the LPA?"; break;
|
||
case 13: echo "Application fee"; break;
|
||
case 14: echo "Review Summary"; break;
|
||
}
|
||
?>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card p-4 p-md-5">
|
||
<?php if ($step === 1): ?>
|
||
<h2 class="h4 fw-bold mb-4">Let's get started.</h2>
|
||
<p class="text-muted mb-5">Please select the type of LPA and provide the donor's details and address. You can save your progress and return later.</p>
|
||
|
||
<form id="lpaFormStep1" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="1">
|
||
<?php if ($lpa_id): ?><input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>"><?php endif; ?>
|
||
|
||
<div class="mb-4">
|
||
<label class="form-label fw-semibold">Type of LPA</label>
|
||
<div class="row g-3">
|
||
<div class="col-md-6">
|
||
<input type="radio" class="btn-check" name="lpa_type" id="type_hw" value="Health & Welfare" <?php echo ($lpa_data && $lpa_data['lpa_type'] === 'Health & Welfare') ? 'checked' : 'checked'; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start h-100" for="type_hw">
|
||
<div class="fw-bold text-dark mb-1">Health & Welfare</div>
|
||
<div class="small text-muted">Decisions about medical care, moving into care, and daily routine.</div>
|
||
</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" class="btn-check" name="lpa_type" id="type_pf" value="Property & Financial" <?php echo ($lpa_data && $lpa_data['lpa_type'] === 'Property & Financial') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start h-100" for="type_pf">
|
||
<div class="fw-bold text-dark mb-1">Property & Financial</div>
|
||
<div class="small text-muted">Managing bank accounts, paying bills, and selling property.</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<hr class="my-5 text-muted opacity-25">
|
||
|
||
<div class="row g-4">
|
||
<div class="col-12">
|
||
<h3 class="h6 fw-bold text-uppercase tracking-wider text-muted mb-3">Basic Information</h3>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="donor_name" class="form-label fw-semibold">Donor Full Name</label>
|
||
<input type="text" class="form-control" id="donor_name" name="donor_name" placeholder="As shown on official ID" value="<?php echo htmlspecialchars($lpa_data['donor_name'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="other_names" class="form-label fw-semibold">Other names (Optional)</label>
|
||
<input type="text" class="form-control" id="other_names" name="other_names" placeholder="Any other names you are or have been known by" value="<?php echo htmlspecialchars($lpa_data['other_names'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label for="donor_dob" class="form-label fw-semibold">Date of Birth</label>
|
||
<input type="date" class="form-control" id="donor_dob" name="donor_dob" value="<?php echo $lpa_data['donor_dob'] ?? ''; ?>" required>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label for="customer_email" class="form-label fw-semibold">Your Email Address</label>
|
||
<input type="email" class="form-control" id="customer_email" name="customer_email" placeholder="To track your progress" value="<?php echo htmlspecialchars($lpa_data['customer_email'] ?? ''); ?>" required>
|
||
</div>
|
||
|
||
<div class="col-12 mt-5">
|
||
<h3 class="h6 fw-bold text-uppercase tracking-wider text-muted mb-3">Donor Address</h3>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="donor_address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="donor_address_line1" name="donor_address_line1" placeholder="House number and street" value="<?php echo htmlspecialchars($lpa_data['donor_address_line1'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="donor_address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="donor_address_line2" name="donor_address_line2" placeholder="Apartment, suite, unit, etc." value="<?php echo htmlspecialchars($lpa_data['donor_address_line2'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label for="donor_town" class="form-label fw-semibold">Town / City</label>
|
||
<input type="text" class="form-control" id="donor_town" name="donor_town" value="<?php echo htmlspecialchars($lpa_data['donor_town'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="donor_postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="donor_postcode" name="donor_postcode" value="<?php echo htmlspecialchars($lpa_data['donor_postcode'] ?? ''); ?>" required>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="/dashboard.php" class="btn btn-link text-decoration-none text-muted p-0">Cancel</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 2</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 2): ?>
|
||
<h2 class="h4 fw-bold mb-4">Attorneys</h2>
|
||
<p class="text-muted mb-5">Add the people who will make decisions for you. You can add multiple attorneys. They must be over 18 and have mental capacity.</p>
|
||
|
||
<?php if (!empty($attorneys)): ?>
|
||
<div class="mb-5">
|
||
<h3 class="h6 fw-bold text-uppercase tracking-wider text-muted mb-3">Currently Added Attorneys</h3>
|
||
<div class="list-group shadow-sm">
|
||
<?php foreach ($attorneys as $attorney): ?>
|
||
<div class="list-group-item p-3 d-flex justify-content-between align-items-center">
|
||
<div>
|
||
<div class="fw-bold"><?php echo htmlspecialchars(($attorney['title'] ? $attorney['title'] . ' ' : '') . $attorney['first_name'] . ' ' . $attorney['last_name']); ?></div>
|
||
<div class="small text-muted"><?php echo htmlspecialchars($attorney['email']); ?> • <?php echo htmlspecialchars($attorney['postcode']); ?></div>
|
||
</div>
|
||
<button type="button" class="btn btn-sm btn-outline-danger border-0 btn-delete-attorney" data-id="<?php echo $attorney['id']; ?>" data-lpa-id="<?php echo $lpa_id; ?>">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
|
||
</button>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="card bg-light border-0 p-4 mb-4">
|
||
<h3 class="h6 fw-bold mb-4">Add an Attorney</h3>
|
||
<form id="lpaFormStep2" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="2">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="row g-3">
|
||
<div class="col-md-2">
|
||
<label for="title" class="form-label fw-semibold">Title</label>
|
||
<input type="text" class="form-control" id="title" name="title" placeholder="Mr/Ms" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="first_name" class="form-label fw-semibold">First Name</label>
|
||
<input type="text" class="form-control" id="first_name" name="first_name" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="last_name" class="form-label fw-semibold">Last Name</label>
|
||
<input type="text" class="form-control" id="last_name" name="last_name" required>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label for="email" class="form-label fw-semibold">Email Address</label>
|
||
<input type="email" class="form-control" id="email" name="email" required>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label for="dob" class="form-label fw-semibold">Date of Birth</label>
|
||
<input type="date" class="form-control" id="dob" name="dob" required>
|
||
</div>
|
||
|
||
<div class="col-12 mt-4">
|
||
<label class="form-label fw-bold small text-uppercase">Attorney Address</label>
|
||
</div>
|
||
|
||
<div class="col-12">
|
||
<label for="address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="address_line1" name="address_line1" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="address_line2" name="address_line2">
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="address_line3" class="form-label fw-semibold">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control" id="address_line3" name="address_line3">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label for="town" class="form-label fw-semibold">Town / City</label>
|
||
<input type="text" class="form-control" id="town" name="town" required>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="postcode" name="postcode" required>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-4 d-flex gap-3">
|
||
<button type="submit" name="next_action" value="add_another" class="btn btn-outline-primary w-100">Add Another Attorney</button>
|
||
<button type="submit" name="next_action" value="next_step" class="btn btn-primary w-100">Save & Continue to Step 3</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=1&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 1</a>
|
||
<?php if (!empty($attorneys)): ?>
|
||
<a href="apply.php?step=3&id=<?php echo $lpa_id; ?>" class="btn btn-primary btn-lg px-5">Continue to Step 3</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php elseif ($step === 3): ?>
|
||
<h2 class="h4 fw-bold mb-4">How should your attorneys make decisions?</h2>
|
||
<p class="text-muted mb-5">Specify how you want your attorneys to work together when making decisions on your behalf.</p>
|
||
|
||
<form id="lpaFormStep3" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="3">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="row g-3">
|
||
<div class="col-12">
|
||
<div class="form-check p-0 mb-3">
|
||
<input type="radio" class="btn-check" name="attorney_decision_type" id="dec_one" value="I only appointed one attorney"
|
||
<?php echo ($num_attorneys === 1) ? 'checked' : ''; ?>
|
||
<?php echo ($num_attorneys > 1) ? 'disabled' : ''; ?> required>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start h-100 d-flex align-items-center <?php echo ($num_attorneys > 1) ? 'opacity-50' : ''; ?>" for="dec_one">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">I only appointed one attorney</div>
|
||
<div class="small text-muted">Select this if you only have one person acting as your attorney.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form-check p-0 mb-3">
|
||
<input type="radio" class="btn-check" name="attorney_decision_type" id="dec_js" value="Jointly and severally"
|
||
<?php echo ($lpa_data && $lpa_data['attorney_decision_type'] === 'Jointly and severally') ? 'checked' : ''; ?>
|
||
<?php echo ($num_attorneys === 1) ? 'disabled' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start h-100 d-flex align-items-center <?php echo ($num_attorneys === 1) ? 'opacity-50' : ''; ?>" for="dec_js">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Jointly and severally</div>
|
||
<div class="small text-muted">Attorneys can make decisions together or on their own.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form-check p-0 mb-3">
|
||
<input type="radio" class="btn-check" name="attorney_decision_type" id="dec_j" value="Jointly"
|
||
<?php echo ($lpa_data && $lpa_data['attorney_decision_type'] === 'Jointly') ? 'checked' : ''; ?>
|
||
<?php echo ($num_attorneys === 1) ? 'disabled' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start h-100 d-flex align-items-center <?php echo ($num_attorneys === 1) ? 'opacity-50' : ''; ?>" for="dec_j">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Jointly</div>
|
||
<div class="small text-muted">Attorneys must agree on all decisions together.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form-check p-0 mb-3">
|
||
<input type="radio" class="btn-check" name="attorney_decision_type" id="dec_some" value="Jointly for some decisions, jointly and severally for other decisions"
|
||
<?php echo ($lpa_data && $lpa_data['attorney_decision_type'] === 'Jointly for some decisions, jointly and severally for other decisions') ? 'checked' : ''; ?>
|
||
<?php echo ($num_attorneys === 1) ? 'disabled' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start h-100 d-flex align-items-center <?php echo ($num_attorneys === 1) ? 'opacity-50' : ''; ?>" for="dec_some">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Jointly for some decisions, jointly and severally for other decisions</div>
|
||
<div class="small text-muted">You can specify which decisions must be made together.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ($num_attorneys === 1): ?>
|
||
<input type="hidden" name="attorney_decision_type" value="I only appointed one attorney">
|
||
<?php endif; ?>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=2&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 2</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 4</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 4): ?>
|
||
<h2 class="h4 fw-bold mb-4">Replacement Attorneys</h2>
|
||
<p class="text-muted mb-5">You can choose to appoint replacement attorneys who can step in if your original attorneys are no longer able to act for you.</p>
|
||
|
||
<?php if (!empty($replacement_attorneys)): ?>
|
||
<div class="mb-4">
|
||
<h3 class="h6 fw-bold mb-3 text-uppercase tracking-wider">Added Replacement Attorneys</h3>
|
||
<div class="list-group shadow-sm">
|
||
<?php foreach ($replacement_attorneys as $ra): ?>
|
||
<div class="list-group-item list-group-item-action d-flex justify-content-between align-items-center p-3 border-0 border-bottom">
|
||
<div>
|
||
<div class="fw-bold text-dark"><?php echo htmlspecialchars($ra['title'] . ' ' . $ra['first_name'] . ' ' . $ra['last_name']); ?></div>
|
||
<div class="small text-muted"><?php echo htmlspecialchars($ra['postcode']); ?></div>
|
||
</div>
|
||
<button type="button" class="btn btn-sm btn-outline-danger border-0 btn-delete-attorney" data-id="<?php echo $ra['id']; ?>" data-lpa-id="<?php echo $lpa_id; ?>">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
|
||
</button>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="card bg-light border-0 p-4 mb-4">
|
||
<h3 class="h6 fw-bold mb-4">Add a Replacement Attorney</h3>
|
||
<form id="lpaFormStep4" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="4">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="row g-3">
|
||
<div class="col-md-2">
|
||
<label for="title" class="form-label fw-semibold">Title</label>
|
||
<input type="text" class="form-control" id="title" name="title" placeholder="Mr/Ms" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="first_name" class="form-label fw-semibold">First Name</label>
|
||
<input type="text" class="form-control" id="first_name" name="first_name" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="last_name" class="form-label fw-semibold">Last Name</label>
|
||
<input type="text" class="form-control" id="last_name" name="last_name" required>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label for="email" class="form-label fw-semibold">Email Address</label>
|
||
<input type="email" class="form-control" id="email" name="email" required>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label for="dob" class="form-label fw-semibold">Date of Birth</label>
|
||
<input type="date" class="form-control" id="dob" name="dob" required>
|
||
</div>
|
||
|
||
<div class="col-12 mt-4">
|
||
<label class="form-label fw-bold small text-uppercase">Replacement Attorney Address</label>
|
||
</div>
|
||
|
||
<div class="col-12">
|
||
<label for="address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="address_line1" name="address_line1" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="address_line2" name="address_line2">
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="address_line3" class="form-label fw-semibold">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control" id="address_line3" name="address_line3">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label for="town" class="form-label fw-semibold">Town / City</label>
|
||
<input type="text" class="form-control" id="town" name="town" required>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="postcode" name="postcode" required>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-4 d-flex gap-3">
|
||
<button type="submit" name="next_action" value="add_another" class="btn btn-outline-primary w-100">Add Another Replacement</button>
|
||
<button type="submit" name="next_action" value="next_step" class="btn btn-primary w-100">Save & Continue to Step 5</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=3&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 3</a>
|
||
<a href="apply.php?step=5&id=<?php echo $lpa_id; ?>" class="btn btn-outline-secondary btn-lg px-4">Skip to Step 5</a>
|
||
</div>
|
||
<?php elseif ($step === 5): ?>
|
||
<h2 class="h4 fw-bold mb-4">Life-sustaining treatment</h2>
|
||
<p class="text-muted mb-5">Specify whether your attorneys have authority to give or refuse consent to life-sustaining treatment.</p>
|
||
|
||
<form id="lpaFormStep5" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="5">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mb-5">
|
||
<div class="row g-3">
|
||
<div class="col-12">
|
||
<input type="radio" class="btn-check" name="life_sustaining_treatment" id="lst_a" value="Option A" <?php echo ($lpa_data && $lpa_data['life_sustaining_treatment'] === 'Option A') ? 'checked' : ''; ?> required>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 mb-3 d-flex align-items-center" for="lst_a">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Option A</div>
|
||
<div class="text-muted small">I give my attorneys authority to give or refuse consent to life-sustaining treatment on my behalf.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
|
||
<input type="radio" class="btn-check" name="life_sustaining_treatment" id="lst_b" value="Option B" <?php echo ($lpa_data && $lpa_data['life_sustaining_treatment'] === 'Option B') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="lst_b">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Option B</div>
|
||
<div class="text-muted small">I do not give my attorneys authority to give or refuse consent to life-sustaining treatment on my behalf.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=4&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 4</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 6</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 6): ?>
|
||
<h2 class="h4 fw-bold mb-4">Witness Information</h2>
|
||
<p class="text-muted mb-5">Provide the details of the person who will witness the donor's signature.</p>
|
||
|
||
<form id="lpaFormStep6" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="6">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mb-5">
|
||
<div class="row g-4">
|
||
<div class="col-md-2">
|
||
<label for="witness_title" class="form-label fw-semibold">Title</label>
|
||
<input type="text" class="form-control" id="witness_title" name="witness_title" placeholder="Mr/Ms" value="<?php echo htmlspecialchars($lpa_data['witness_title'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="witness_first_name" class="form-label fw-semibold">First Name</label>
|
||
<input type="text" class="form-control" id="witness_first_name" name="witness_first_name" value="<?php echo htmlspecialchars($lpa_data['witness_first_name'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="witness_last_name" class="form-label fw-semibold">Last Name</label>
|
||
<input type="text" class="form-control" id="witness_last_name" name="witness_last_name" value="<?php echo htmlspecialchars($lpa_data['witness_last_name'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="witness_address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="witness_address_line1" name="witness_address_line1" value="<?php echo htmlspecialchars($lpa_data['witness_address_line1'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="witness_address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="witness_address_line2" name="witness_address_line2" value="<?php echo htmlspecialchars($lpa_data['witness_address_line2'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label for="witness_address_line3" class="form-label fw-semibold">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control" id="witness_address_line3" name="witness_address_line3" value="<?php echo htmlspecialchars($lpa_data['witness_address_line3'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="witness_postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="witness_postcode" name="witness_postcode" value="<?php echo htmlspecialchars($lpa_data['witness_postcode'] ?? ''); ?>" required>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=5&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 5</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 7</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 7): ?>
|
||
<h2 class="h4 fw-bold mb-4">People to notify</h2>
|
||
<p class="text-muted mb-5">Do you wish to notify anyone else when the LPA is registered?</p>
|
||
|
||
<div id="notifyQuestionSection" class="mb-5 <?php echo !empty($notified_persons) ? 'd-none' : ''; ?>">
|
||
<div class="d-flex gap-3">
|
||
<button type="button" class="btn btn-outline-primary btn-lg px-5" onclick="document.getElementById('notifyFormSection').classList.remove('d-none'); document.getElementById('notifyQuestionSection').classList.add('d-none');">Yes</button>
|
||
<a href="apply.php?step=8&id=<?php echo $lpa_id; ?>" class="btn btn-outline-secondary btn-lg px-5">No</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="notifyFormSection" class="<?php echo !empty($notified_persons) ? '' : 'd-none'; ?>">
|
||
<?php if (!empty($notified_persons)): ?>
|
||
<div class="mb-4">
|
||
<h3 class="h6 fw-bold mb-3 text-uppercase tracking-wider">Currently Notified Persons</h3>
|
||
<div class="list-group shadow-sm mb-4">
|
||
<?php foreach ($notified_persons as $np): ?>
|
||
<div class="list-group-item d-flex justify-content-between align-items-center p-3">
|
||
<div>
|
||
<div class="fw-bold"><?php echo htmlspecialchars($np['title'] . ' ' . $np['first_name'] . ' ' . $np['last_name']); ?></div>
|
||
<div class="small text-muted"><?php echo htmlspecialchars($np['postcode']); ?></div>
|
||
</div>
|
||
<button type="button" class="btn btn-sm btn-outline-danger border-0 btn-delete-notified" data-id="<?php echo $np['id']; ?>" data-lpa-id="<?php echo $lpa_id; ?>">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
|
||
</button>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="card bg-light border-0 p-4 mb-4">
|
||
<h3 class="h6 fw-bold mb-4">Add a Person to Notify</h3>
|
||
<form id="lpaFormStep7" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="7">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="row g-3">
|
||
<div class="col-md-2">
|
||
<label for="title" class="form-label fw-semibold">Title</label>
|
||
<input type="text" class="form-control" id="title" name="title" placeholder="Mr/Ms" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="first_name" class="form-label fw-semibold">First Name</label>
|
||
<input type="text" class="form-control" id="first_name" name="first_name" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="last_name" class="form-label fw-semibold">Last Name</label>
|
||
<input type="text" class="form-control" id="last_name" name="last_name" required>
|
||
</div>
|
||
|
||
<div class="col-12 mt-4">
|
||
<label class="form-label fw-bold small text-uppercase">Address</label>
|
||
</div>
|
||
|
||
<div class="col-12">
|
||
<label for="address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="address_line1" name="address_line1" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="address_line2" name="address_line2">
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="address_line3" class="form-label fw-semibold">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control" id="address_line3" name="address_line3">
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="postcode" name="postcode" required>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-4 d-flex gap-3">
|
||
<button type="submit" name="next_action" value="add_another" class="btn btn-outline-primary w-100">Notify another person</button>
|
||
<button type="submit" name="next_action" value="next_step" class="btn btn-primary w-100">Step 8</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=6&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 6</a>
|
||
</div>
|
||
</div>
|
||
<?php elseif ($step === 8): ?>
|
||
<h2 class="h4 fw-bold mb-4">Preferences and instructions</h2>
|
||
<p class="text-muted mb-5">Provide any specific preferences or instructions for your attorneys.</p>
|
||
|
||
<form id="lpaFormStep8" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="8">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mb-5">
|
||
<h3 class="h5 fw-bold mb-3">Preferences</h3>
|
||
<p class="mb-2">Your attorneys don’t have to follow your preferences but they should keep them in mind. For examples of preferences, see the Guide, part A7.</p>
|
||
<p class="mb-3 text-muted small">Preferences – use words like ‘prefer’ and ‘would like’</p>
|
||
<textarea class="form-control" name="preferences" rows="6" placeholder="Enter your preferences here..."><?php echo htmlspecialchars($lpa_data['preferences'] ?? ''); ?></textarea>
|
||
</div>
|
||
|
||
<div class="mb-5">
|
||
<h3 class="h5 fw-bold mb-3">Instructions</h3>
|
||
<p class="mb-2">Your attorneys will have to follow your instructions exactly. For examples of instructions, see the Guide, part A7.</p>
|
||
<p class="mb-2 text-danger small fw-semibold">Be careful – if you give instructions that are not legally correct they would have to be removed before your LPA could be registered.</p>
|
||
<p class="mb-3 text-muted small">Instructions – use words like ‘must’ and ‘have to’</p>
|
||
<textarea class="form-control" name="instructions" rows="6" placeholder="Enter your instructions here..."><?php echo htmlspecialchars($lpa_data['instructions'] ?? ''); ?></textarea>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=7&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 7</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Step 9</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 9): ?>
|
||
<h2 class="h4 fw-bold mb-4">Certificate Provider</h2>
|
||
<p class="text-muted mb-5">Please provide the details of the person who will be your certificate provider.</p>
|
||
|
||
<form id="lpaFormStep9" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="9">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="row g-4">
|
||
<div class="col-md-2">
|
||
<label for="certificate_provider_title" class="form-label fw-semibold">Title</label>
|
||
<input type="text" class="form-control" id="certificate_provider_title" name="certificate_provider_title" placeholder="Mr/Ms" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_title'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="certificate_provider_first_name" class="form-label fw-semibold">First Name</label>
|
||
<input type="text" class="form-control" id="certificate_provider_first_name" name="certificate_provider_first_name" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_first_name'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="certificate_provider_last_name" class="form-label fw-semibold">Last Name</label>
|
||
<input type="text" class="form-control" id="certificate_provider_last_name" name="certificate_provider_last_name" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_last_name'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="certificate_provider_address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="certificate_provider_address_line1" name="certificate_provider_address_line1" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_address_line1'] ?? ''); ?>" required>
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="certificate_provider_address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="certificate_provider_address_line2" name="certificate_provider_address_line2" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_address_line2'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label for="certificate_provider_address_line3" class="form-label fw-semibold">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control" id="certificate_provider_address_line3" name="certificate_provider_address_line3" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_address_line3'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="certificate_provider_postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="certificate_provider_postcode" name="certificate_provider_postcode" value="<?php echo htmlspecialchars($lpa_data['certificate_provider_postcode'] ?? ''); ?>" required>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=8&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 8</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Step 10</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 10): ?>
|
||
<h2 class="h4 fw-bold mb-4">Attorney Witnesses</h2>
|
||
<p class="text-muted mb-5">Select a witness for each attorney's signature. You can use an existing person or add a new witness.</p>
|
||
|
||
<form id="lpaFormStep10" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="10">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<?php foreach ($all_attorneys as $index => $attorney): ?>
|
||
<div class="card bg-light border-0 p-4 mb-4">
|
||
<h3 class="h6 fw-bold mb-3">Witness for <?php echo htmlspecialchars($attorney['first_name'] . ' ' . $attorney['last_name']); ?></h3>
|
||
|
||
<div class="mb-3">
|
||
<label class="form-label fw-semibold">Select Witness</label>
|
||
<select name="attorney_witness[<?php echo $attorney['id']; ?>][selection]" class="form-select witness-selector" data-attorney-id="<?php echo $attorney['id']; ?>" required>
|
||
<option value="">Select a witness...</option>
|
||
<?php foreach ($potential_witnesses as $pw): ?>
|
||
<?php
|
||
$pw_json = json_encode($pw);
|
||
$selected = '';
|
||
if ($attorney['witness_first_name'] === $pw['first_name'] && $attorney['witness_last_name'] === $pw['last_name']) {
|
||
$selected = 'selected';
|
||
}
|
||
?>
|
||
<option value='<?php echo htmlspecialchars($pw_json); ?>' <?php echo $selected; ?>>
|
||
<?php echo htmlspecialchars($pw['first_name'] . ' ' . $pw['last_name'] . ' (' . $pw['type'] . ')'); ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
<option value="new" <?php echo ($attorney['witness_first_name'] && !empty($attorney['witness_address_line1']) && empty($selected)) ? 'selected' : ''; ?>>Enter a new witness...</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div id="new_witness_fields_<?php echo $attorney['id']; ?>" class="<?php echo ($attorney['witness_first_name'] && !empty($attorney['witness_address_line1']) && empty($selected)) ? '' : 'd-none'; ?> mt-4 border-top pt-4">
|
||
<div class="row g-3">
|
||
<div class="col-md-2">
|
||
<label class="form-label fw-semibold small">Title</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][title]" value="<?php echo htmlspecialchars($attorney['witness_title'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label class="form-label fw-semibold small">First Name</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][first_name]" value="<?php echo htmlspecialchars($attorney['witness_first_name'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label class="form-label fw-semibold small">Last Name</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][last_name]" value="<?php echo htmlspecialchars($attorney['witness_last_name'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-12">
|
||
<label class="form-label fw-semibold small">Address Line 1</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][address_line1]" value="<?php echo htmlspecialchars($attorney['witness_address_line1'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-12">
|
||
<label class="form-label fw-semibold small">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][address_line2]" value="<?php echo htmlspecialchars($attorney['witness_address_line2'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label class="form-label fw-semibold small">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][address_line3]" value="<?php echo htmlspecialchars($attorney['witness_address_line3'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label class="form-label fw-semibold small">Postcode</label>
|
||
<input type="text" class="form-control form-control-sm" name="attorney_witness[<?php echo $attorney['id']; ?>][postcode]" value="<?php echo htmlspecialchars($attorney['witness_postcode'] ?? ''); ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=9&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 9</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Step 11</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 11): ?>
|
||
<h2 class="h4 fw-bold mb-4">Who is registering the LPA?</h2>
|
||
<p class="text-muted mb-5">Select whether the donor or the attorney(s) will register this lasting power of attorney.</p>
|
||
|
||
<form id="lpaFormStep11" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="11">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mb-5">
|
||
<div class="form-check p-0 mb-4">
|
||
<input type="radio" class="btn-check" name="registration_who" id="reg_donor" value="donor"
|
||
<?php echo ($lpa_data && $lpa_data['registration_who'] === 'donor') ? 'checked' : 'checked'; ?> required>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="reg_donor" onclick="document.getElementById('attorney_selection').classList.add('d-none')">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">The donor</div>
|
||
<div class="small text-muted">The person who is making the LPA.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form-check p-0 mb-4">
|
||
<input type="radio" class="btn-check" name="registration_who" id="reg_attorneys" value="attorneys"
|
||
<?php echo ($lpa_data && $lpa_data['registration_who'] === 'attorneys') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="reg_attorneys" onclick="document.getElementById('attorney_selection').classList.remove('d-none')">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">The attorney(s)</div>
|
||
<div class="small text-muted">One or more of the attorneys appointed in this LPA.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="attorney_selection" class="<?php echo ($lpa_data && $lpa_data['registration_who'] === 'attorneys') ? '' : 'd-none'; ?> mb-5 animate-fade-in">
|
||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Select the registering attorneys</h3>
|
||
<div class="list-group shadow-sm">
|
||
<?php
|
||
$selected_attorneys = !empty($lpa_data['registering_attorneys_ids']) ? explode(',', $lpa_data['registering_attorneys_ids']) : [];
|
||
foreach ($attorneys as $attorney):
|
||
$is_checked = in_array($attorney['id'], $selected_attorneys) ? 'checked' : '';
|
||
?>
|
||
<label class="list-group-item p-3 d-flex align-items-center">
|
||
<input class="form-check-input me-3" type="checkbox" name="registering_attorneys[]" value="<?php echo $attorney['id']; ?>" <?php echo $is_checked; ?>>
|
||
<div>
|
||
<div class="fw-bold"><?php echo htmlspecialchars($attorney['first_name'] . ' ' . $attorney['last_name']); ?></div>
|
||
<div class="small text-muted"><?php echo htmlspecialchars($attorney['email']); ?></div>
|
||
</div>
|
||
</label>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<p class="small text-muted mt-3">If you appointed attorneys jointly, they must all register the LPA together.</p>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=10&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 10</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 12</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 12): ?>
|
||
<h2 class="h4 fw-bold mb-4">Who should receive the LPA?</h2>
|
||
<p class="text-muted mb-5">Nominate the person who should receive the registered LPA document.</p>
|
||
|
||
<form id="lpaFormStep12" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="12">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mb-5">
|
||
<div class="form-check p-0 mb-4">
|
||
<input type="radio" class="btn-check" name="correspondence_who" id="corr_donor" value="Donor"
|
||
<?php echo ($lpa_data && $lpa_data['correspondence_who'] === 'Donor') ? 'checked' : 'checked'; ?> required>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="corr_donor">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">The donor</div>
|
||
<div class="small text-muted">Send the registered LPA to the donor's address.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form-check p-0 mb-4">
|
||
<input type="radio" class="btn-check" name="correspondence_who" id="corr_attorney" value="Attorney"
|
||
<?php echo ($lpa_data && $lpa_data['correspondence_who'] === 'Attorney') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="corr_attorney">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">An Attorney</div>
|
||
<div class="small text-muted">Send the registered LPA to one of the attorneys.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form-check p-0 mb-4">
|
||
<input type="radio" class="btn-check" name="correspondence_who" id="corr_other" value="Other"
|
||
<?php echo ($lpa_data && $lpa_data['correspondence_who'] === 'Other') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="corr_other">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Other</div>
|
||
<div class="small text-muted">Send the registered LPA to another person or company.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="correspondence_details" class="<?php echo ($lpa_data && in_array($lpa_data['correspondence_who'], ['Attorney', 'Other'])) ? '' : 'd-none'; ?> mb-5 animate-fade-in">
|
||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Correspondence Details</h3>
|
||
<div class="row g-4">
|
||
<div class="col-md-2">
|
||
<label for="correspondence_title" class="form-label fw-semibold">Title</label>
|
||
<input type="text" class="form-control" id="correspondence_title" name="correspondence_title" placeholder="Mr/Ms" value="<?php echo htmlspecialchars($lpa_data['correspondence_title'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="correspondence_first_name" class="form-label fw-semibold">First Name(s)</label>
|
||
<input type="text" class="form-control" id="correspondence_first_name" name="correspondence_first_name" value="<?php echo htmlspecialchars($lpa_data['correspondence_first_name'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-5">
|
||
<label for="correspondence_last_name" class="form-label fw-semibold">Last Name</label>
|
||
<input type="text" class="form-control" id="correspondence_last_name" name="correspondence_last_name" value="<?php echo htmlspecialchars($lpa_data['correspondence_last_name'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="correspondence_company_name" class="form-label fw-semibold">Company Name (Optional)</label>
|
||
<input type="text" class="form-control" id="correspondence_company_name" name="correspondence_company_name" value="<?php echo htmlspecialchars($lpa_data['correspondence_company_name'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="correspondence_address_line1" class="form-label fw-semibold">Address Line 1</label>
|
||
<input type="text" class="form-control" id="correspondence_address_line1" name="correspondence_address_line1" value="<?php echo htmlspecialchars($lpa_data['correspondence_address_line1'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-12">
|
||
<label for="correspondence_address_line2" class="form-label fw-semibold">Address Line 2 (Optional)</label>
|
||
<input type="text" class="form-control" id="correspondence_address_line2" name="correspondence_address_line2" value="<?php echo htmlspecialchars($lpa_data['correspondence_address_line2'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-8">
|
||
<label for="correspondence_address_line3" class="form-label fw-semibold">Address Line 3 (Optional)</label>
|
||
<input type="text" class="form-control" id="correspondence_address_line3" name="correspondence_address_line3" value="<?php echo htmlspecialchars($lpa_data['correspondence_address_line3'] ?? ''); ?>">
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label for="correspondence_postcode" class="form-label fw-semibold">Postcode</label>
|
||
<input type="text" class="form-control" id="correspondence_postcode" name="correspondence_postcode" value="<?php echo htmlspecialchars($lpa_data['correspondence_postcode'] ?? ''); ?>">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5">
|
||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">How would the person above prefer to be contacted?</h3>
|
||
<div class="row g-3">
|
||
<?php
|
||
$pref = $lpa_data['correspondence_contact_preference'] ?? 'Post';
|
||
?>
|
||
<div class="col-6 col-md-3">
|
||
<input type="radio" class="btn-check contact-pref-check" name="correspondence_contact_preference" id="pref_post" value="Post" <?php echo ($pref === 'Post') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 py-3" for="pref_post">Post</label>
|
||
</div>
|
||
<div class="col-6 col-md-3">
|
||
<input type="radio" class="btn-check contact-pref-check" name="correspondence_contact_preference" id="pref_phone" value="Phone" <?php echo ($pref === 'Phone') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 py-3" for="pref_phone">Phone</label>
|
||
</div>
|
||
<div class="col-6 col-md-3">
|
||
<input type="radio" class="btn-check contact-pref-check" name="correspondence_contact_preference" id="pref_email" value="Email" <?php echo ($pref === 'Email') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 py-3" for="pref_email">Email</label>
|
||
</div>
|
||
<div class="col-6 col-md-3">
|
||
<input type="radio" class="btn-check contact-pref-check" name="correspondence_contact_preference" id="pref_welsh" value="Welsh" <?php echo ($pref === 'Welsh') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 py-3" for="pref_welsh">Welsh</label>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="phone_input_box" class="<?php echo ($pref === 'Phone') ? '' : 'd-none'; ?> mt-4">
|
||
<label for="correspondence_phone" class="form-label fw-semibold">Phone Number</label>
|
||
<input type="text" class="form-control" id="correspondence_phone" name="correspondence_phone" value="<?php echo htmlspecialchars($lpa_data['correspondence_phone'] ?? ''); ?>">
|
||
</div>
|
||
|
||
<div id="email_input_box" class="<?php echo ($pref === 'Email') ? '' : 'd-none'; ?> mt-4">
|
||
<label for="correspondence_email" class="form-label fw-semibold">Email Address</label>
|
||
<input type="email" class="form-control" id="correspondence_email" name="correspondence_email" value="<?php echo htmlspecialchars($lpa_data['correspondence_email'] ?? ''); ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=11&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 11</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 12</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 13): ?>
|
||
<h2 class="h4 fw-bold mb-4">Application fee</h2>
|
||
<p class="text-muted mb-5">Specify how you wish to pay the application fee and if you are eligible for any reductions.</p>
|
||
|
||
<form id="lpaFormStep13" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="13">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mb-5">
|
||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Payment Method</h3>
|
||
<div class="row g-3">
|
||
<div class="col-md-6">
|
||
<input type="radio" class="btn-check" name="payment_method" id="pay_card" value="Card" <?php echo ($lpa_data && $lpa_data['payment_method'] === 'Card') ? 'checked' : 'checked'; ?> required>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="pay_card" onclick="document.getElementById('payment_phone_box').classList.remove('d-none')">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Credit or debit card</div>
|
||
<div class="small text-muted">We will contact you to take payment.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" class="btn-check" name="payment_method" id="pay_cheque" value="Cheque" <?php echo ($lpa_data && $lpa_data['payment_method'] === 'Cheque') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-4 text-start h-100 d-flex align-items-center" for="pay_cheque" onclick="document.getElementById('payment_phone_box').classList.add('d-none')">
|
||
<div class="flex-grow-1">
|
||
<div class="fw-bold text-dark mb-1">Cheque</div>
|
||
<div class="small text-muted">Send a cheque for £82 made payable to 'Office of the Public Guardian'.</div>
|
||
</div>
|
||
<div class="ms-3">
|
||
<div class="form-check-input-placeholder"></div>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="payment_phone_box" class="<?php echo ($lpa_data && $lpa_data['payment_method'] === 'Cheque') ? 'd-none' : ''; ?> mt-4">
|
||
<label for="payment_phone" class="form-label fw-semibold">Phone number for payment</label>
|
||
<input type="text" class="form-control" id="payment_phone" name="payment_phone" placeholder="Best number to reach you" value="<?php echo htmlspecialchars($lpa_data['payment_phone'] ?? ''); ?>">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mb-5">
|
||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Reduced Fees</h3>
|
||
<p class="mb-4 text-muted small">The donor might not have to pay the full fee or any fee at all if they have a low income or receive certain benefits.</p>
|
||
<div class="row g-3">
|
||
<div class="col-12">
|
||
<input type="radio" class="btn-check" name="reduced_fee_eligibility" id="fee_no" value="No" <?php echo ($lpa_data && $lpa_data['reduced_fee_eligibility'] === 'No') ? 'checked' : 'checked'; ?> required>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start mb-3" for="fee_no">
|
||
<div class="fw-bold text-dark">No, the donor will pay the full £82 fee</div>
|
||
</label>
|
||
|
||
<input type="radio" class="btn-check" name="reduced_fee_eligibility" id="fee_yes" value="Yes" <?php echo ($lpa_data && $lpa_data['reduced_fee_eligibility'] === 'Yes') ? 'checked' : ''; ?>>
|
||
<label class="btn btn-outline-secondary w-100 p-3 text-start" for="fee_yes">
|
||
<div class="fw-bold text-dark">Yes, the donor wants to apply for a reduced fee</div>
|
||
<div class="small text-muted">We will send you the reduction form (LPA120).</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mb-5 border-top pt-5">
|
||
<div class="form-check">
|
||
<input class="form-check-input" type="checkbox" name="is_repeat_application" id="is_repeat" <?php echo ($lpa_data && $lpa_data['is_repeat_application']) ? 'checked' : ''; ?> onclick="document.getElementById('repeat_case_box').classList.toggle('d-none')">
|
||
<label class="form-check-label fw-semibold" for="is_repeat">
|
||
Is this a repeat application?
|
||
</label>
|
||
<p class="small text-muted">Select this if the Office of the Public Guardian has told you the LPA can't be registered and you're applying again within 3 months.</p>
|
||
</div>
|
||
<div id="repeat_case_box" class="<?php echo ($lpa_data && $lpa_data['is_repeat_application']) ? '' : 'd-none'; ?> mt-3">
|
||
<label for="repeat_case_number" class="form-label fw-semibold">Original Case Number</label>
|
||
<input type="text" class="form-control" id="repeat_case_number" name="repeat_case_number" value="<?php echo htmlspecialchars($lpa_data['repeat_case_number'] ?? ''); ?>">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=12&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 12</a>
|
||
<button type="submit" class="btn btn-primary btn-lg px-5">Continue to Step 14</button>
|
||
</div>
|
||
</form>
|
||
<?php elseif ($step === 14): ?>
|
||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||
<h2 class="h4 fw-bold mb-0">Review Summary</h2>
|
||
<div class="badge bg-primary px-3 py-2">Step 14 of 14</div>
|
||
</div>
|
||
<p class="text-muted mb-5">Please review all your details carefully before submitting your application. You can edit any section if you find any errors.</p>
|
||
|
||
<!-- Step 1: Donor -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">1. Donor Information</h3>
|
||
<a href="apply.php?step=1&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-md-6">
|
||
<div class="summary-label">Full Name</div>
|
||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['donor_name'] ?? ''); ?></div>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<div class="summary-label">Date of Birth</div>
|
||
<div class="summary-value"><?php echo !empty($lpa_data['donor_dob']) ? date('d/m/Y', strtotime($lpa_data['donor_dob'])) : ''; ?></div>
|
||
</div>
|
||
<div class="col-12">
|
||
<div class="summary-label">Address</div>
|
||
<div class="summary-value">
|
||
<?php echo htmlspecialchars($lpa_data['donor_address_line1'] ?? ''); ?>,
|
||
<?php echo !empty($lpa_data['donor_address_line2']) ? htmlspecialchars($lpa_data['donor_address_line2']) . ', ' : ''; ?>
|
||
<?php echo htmlspecialchars($lpa_data['donor_town'] ?? ''); ?>,
|
||
<?php echo htmlspecialchars($lpa_data['donor_postcode'] ?? ''); ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 2: Attorneys -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">2. Attorneys</h3>
|
||
<a href="apply.php?step=2&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<?php foreach ($attorneys as $att): ?>
|
||
<div class="col-md-4">
|
||
<div class="p-2 bg-light rounded">
|
||
<div class="fw-bold small"><?php echo htmlspecialchars($att['first_name'] . ' ' . $att['last_name']); ?></div>
|
||
<div class="text-muted extra-small"><?php echo htmlspecialchars($att['email']); ?></div>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 3: Decisions -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">3. Decision Making</h3>
|
||
<a href="apply.php?step=3&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['attorney_decision_type'] ?? ''); ?></div>
|
||
</div>
|
||
|
||
<!-- Step 4: Replacements -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">4. Replacement Attorneys</h3>
|
||
<a href="apply.php?step=4&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<?php if (empty($replacement_attorneys)): ?>
|
||
<div class="text-muted">None appointed.</div>
|
||
<?php else: ?>
|
||
<div class="row g-3">
|
||
<?php foreach ($replacement_attorneys as $ra): ?>
|
||
<div class="col-md-4">
|
||
<div class="p-2 bg-light rounded">
|
||
<div class="fw-bold small"><?php echo htmlspecialchars($ra['first_name'] . ' ' . $ra['last_name']); ?></div>
|
||
<div class="text-muted extra-small"><?php echo htmlspecialchars($ra['postcode']); ?></div>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<!-- Step 5: Life Sustaining -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">5. Life-sustaining treatment</h3>
|
||
<a href="apply.php?step=5&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-12">
|
||
<div class="summary-label">Life-sustaining Treatment Preference</div>
|
||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['life_sustaining_treatment'] ?? ''); ?></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 6: Witness -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">6. Donor's Witness</h3>
|
||
<a href="apply.php?step=6&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-12">
|
||
<div class="summary-label">Witness Name</div>
|
||
<div class="summary-value">
|
||
<?php
|
||
echo htmlspecialchars(($lpa_data['witness_first_name'] ?? '') . ' ' . ($lpa_data['witness_last_name'] ?? ''));
|
||
if (!empty($lpa_data['witness_postcode'])) echo ' (' . htmlspecialchars($lpa_data['witness_postcode']) . ')';
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 7: Notified Persons -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">7. People to Notify</h3>
|
||
<a href="apply.php?step=7&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<?php if (empty($notified_persons)): ?>
|
||
<div class="text-muted">No people to notify.</div>
|
||
<?php else: ?>
|
||
<div class="row g-3">
|
||
<?php foreach ($notified_persons as $np): ?>
|
||
<div class="col-md-4">
|
||
<div class="p-2 bg-light rounded">
|
||
<div class="fw-bold small"><?php echo htmlspecialchars($np['first_name'] . ' ' . $np['last_name']); ?></div>
|
||
<div class="text-muted extra-small"><?php echo htmlspecialchars($np['postcode']); ?></div>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<!-- Step 8: Preferences & Instructions -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">8. Preferences and Instructions</h3>
|
||
<a href="apply.php?step=8&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-12">
|
||
<div class="summary-label">Preferences</div>
|
||
<div class="summary-value small"><?php echo !empty($lpa_data['preferences']) ? nl2br(htmlspecialchars($lpa_data['preferences'])) : 'None provided'; ?></div>
|
||
</div>
|
||
<div class="col-12">
|
||
<div class="summary-label">Instructions</div>
|
||
<div class="summary-value small"><?php echo !empty($lpa_data['instructions']) ? nl2br(htmlspecialchars($lpa_data['instructions'])) : 'None provided'; ?></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 9: Certificate Provider -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">9. Certificate Provider</h3>
|
||
<a href="apply.php?step=9&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="summary-value">
|
||
<?php
|
||
echo htmlspecialchars(($lpa_data['certificate_provider_title'] ? $lpa_data['certificate_provider_title'] . ' ' : '') . ($lpa_data['certificate_provider_first_name'] ?? '') . ' ' . ($lpa_data['certificate_provider_last_name'] ?? ''));
|
||
if (!empty($lpa_data['certificate_provider_postcode'])) echo ', ' . htmlspecialchars($lpa_data['certificate_provider_postcode']);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 10: Attorney Witnesses -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">10. Attorney Witnesses</h3>
|
||
<a href="apply.php?step=10&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<?php foreach ($all_attorneys as $att): ?>
|
||
<div class="col-md-6">
|
||
<div class="summary-label">Witness for <?php echo htmlspecialchars($att['first_name']); ?></div>
|
||
<div class="summary-value small">
|
||
<?php
|
||
if (!empty($att['witness_first_name'])) {
|
||
echo htmlspecialchars($att['witness_first_name'] . ' ' . $att['witness_last_name']);
|
||
echo ' (' . htmlspecialchars($att['witness_postcode']) . ')';
|
||
} else {
|
||
echo '<span class="text-danger">Not specified</span>';
|
||
}
|
||
?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 11: Registration -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">11. Registration</h3>
|
||
<a href="apply.php?step=11&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-md-6">
|
||
<div class="summary-label">Who is registering?</div>
|
||
<div class="summary-value"><?php echo ucfirst(htmlspecialchars($lpa_data['registration_who'] ?? '')); ?></div>
|
||
</div>
|
||
<?php if ($lpa_data['registration_who'] === 'attorneys'): ?>
|
||
<div class="col-md-6">
|
||
<div class="summary-label">Registering Attorneys</div>
|
||
<div class="summary-value small">
|
||
<?php
|
||
$reg_ids = !empty($lpa_data['registering_attorneys_ids']) ? explode(',', $lpa_data['registering_attorneys_ids']) : [];
|
||
$reg_names = [];
|
||
foreach ($attorneys as $att) {
|
||
if (in_array($att['id'], $reg_ids)) {
|
||
$reg_names[] = htmlspecialchars($att['first_name'] . ' ' . $att['last_name']);
|
||
}
|
||
}
|
||
echo !empty($reg_names) ? implode(', ', $reg_names) : 'None selected';
|
||
?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 12: Correspondence -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">12. Correspondence</h3>
|
||
<a href="apply.php?step=12&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-md-4">
|
||
<div class="summary-label">Recipient</div>
|
||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['correspondence_who'] ?? ''); ?></div>
|
||
</div>
|
||
<?php if ($lpa_data['correspondence_who'] !== 'Donor'): ?>
|
||
<div class="col-md-4">
|
||
<div class="summary-label">Name</div>
|
||
<div class="summary-value"><?php echo htmlspecialchars(($lpa_data['correspondence_first_name'] ?? '') . ' ' . ($lpa_data['correspondence_last_name'] ?? '')); ?></div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<div class="summary-label">Contact Method</div>
|
||
<div class="summary-value">
|
||
<?php
|
||
echo htmlspecialchars($lpa_data['correspondence_contact_preference'] ?? '');
|
||
if ($lpa_data['correspondence_contact_preference'] === 'Phone') echo ': ' . htmlspecialchars($lpa_data['correspondence_phone'] ?? '');
|
||
if ($lpa_data['correspondence_contact_preference'] === 'Email') echo ': ' . htmlspecialchars($lpa_data['correspondence_email'] ?? '');
|
||
?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 13: Payment -->
|
||
<div class="summary-section">
|
||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
<h3 class="h5 fw-bold mb-0">13. Payment & Fee</h3>
|
||
<a href="apply.php?step=13&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||
</div>
|
||
<div class="row g-3">
|
||
<div class="col-md-4">
|
||
<div class="summary-label">Payment Method</div>
|
||
<div class="summary-value">
|
||
<?php
|
||
echo htmlspecialchars($lpa_data['payment_method'] ?? '');
|
||
if ($lpa_data['payment_method'] === 'Card') echo ' (' . htmlspecialchars($lpa_data['payment_phone'] ?? '') . ')';
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<div class="summary-label">Reduced Fee Eligibility</div>
|
||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['reduced_fee_eligibility'] ?? ''); ?></div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<div class="summary-label">Repeat Application</div>
|
||
<div class="summary-value">
|
||
<?php
|
||
echo (!empty($lpa_data['is_repeat_application'])) ? 'Yes (Case: ' . htmlspecialchars($lpa_data['repeat_case_number'] ?? '') . ')' : 'No';
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<form id="lpaFormStep14" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||
<input type="hidden" name="step" value="14">
|
||
<input type="hidden" name="lpa_id" value="<?php echo $lpa_id; ?>">
|
||
|
||
<div class="mt-5 d-flex justify-content-between align-items-center">
|
||
<a href="apply.php?step=13&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 13</a>
|
||
<div class="d-flex gap-2">
|
||
<a href="api/generate_pdf.php?id=<?php echo $lpa_id; ?>" target="_blank" class="btn btn-outline-primary btn-lg px-4">Download Summary PDF</a>
|
||
<button type="submit" class="btn btn-success btn-lg px-5">Confirm & Submit Application</button>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||
</body>
|
||
</html>
|