LPA Health V2
This commit is contained in:
parent
25ba3f2f78
commit
67d4d719a6
@ -135,8 +135,8 @@ $pdf->SectionTitle('5. Life-Sustaining Treatment');
|
||||
$pdf->Field('Option', $lpa_data['life_sustaining_treatment']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 6. Witness for Donor
|
||||
$pdf->SectionTitle('6. Witness for Donor');
|
||||
// 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);
|
||||
@ -165,10 +165,26 @@ $pdf->Field('Name', $name);
|
||||
$pdf->Field('Address', $lpa_data['certificate_provider_address_line1'] . ', ' . $lpa_data['certificate_provider_postcode']);
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 10. Registration
|
||||
$pdf->SectionTitle('10. Registration');
|
||||
$pdf->Field('Who is registering', ucfirst($lpa_data['registration_who']));
|
||||
if ($lpa_data['registration_who'] === 'attorneys') {
|
||||
// 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) {
|
||||
@ -180,21 +196,21 @@ if ($lpa_data['registration_who'] === 'attorneys') {
|
||||
}
|
||||
$pdf->Ln(5);
|
||||
|
||||
// 11. Correspondence
|
||||
$pdf->SectionTitle('11. 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']);
|
||||
// 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);
|
||||
|
||||
// 12. Payment
|
||||
$pdf->SectionTitle('12. 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'] ? 'Yes (Case: ' . $lpa_data['repeat_case_number'] . ')' : 'No');
|
||||
// 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']) . '_' . date('Ymd') . '.pdf';
|
||||
$pdf->Output('D', $filename);
|
||||
$filename = 'LPA_' . str_replace(' ', '_', ($lpa_data['donor_name'] ?? 'Summary')) . '_' . date('Ymd') . '.pdf';
|
||||
$pdf->Output('D', $filename);
|
||||
106
api/save_lpa.php
106
api/save_lpa.php
@ -74,7 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$id = db()->lastInsertId();
|
||||
}
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $id, 'next_step' => 2, 'message' => 'Step 1 saved successfully.']);
|
||||
echo json_encode(['success' => true, 'id' => (int)$id, 'next_step' => 2, 'message' => 'Step 1 saved successfully.']);
|
||||
|
||||
} elseif ($step === 2) {
|
||||
if (!$lpa_id) {
|
||||
@ -108,7 +108,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$next_step = ($next_action === 'next_step') ? 3 : 2;
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => $next_step, 'message' => 'Attorney saved successfully.']);
|
||||
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.']);
|
||||
@ -125,7 +125,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$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' => $lpa_id, 'next_step' => 4, 'message' => 'Decision-making preference saved.']);
|
||||
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.']);
|
||||
@ -158,7 +158,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$next_step = ($next_action === 'next_step') ? 5 : 4;
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => $next_step, 'message' => 'Replacement attorney saved successfully.']);
|
||||
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.']);
|
||||
@ -166,6 +166,28 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
|
||||
$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'] ?? '';
|
||||
@ -174,13 +196,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$witness_address_line3 = $_POST['witness_address_line3'] ?? '';
|
||||
$witness_postcode = $_POST['witness_postcode'] ?? '';
|
||||
|
||||
if (empty($life_sustaining_treatment) || 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 fields.']);
|
||||
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
|
||||
life_sustaining_treatment = ?,
|
||||
witness_title = ?,
|
||||
witness_first_name = ?,
|
||||
witness_last_name = ?,
|
||||
@ -188,10 +209,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
witness_address_line2 = ?,
|
||||
witness_address_line3 = ?,
|
||||
witness_postcode = ?,
|
||||
step_reached = GREATEST(step_reached, 5)
|
||||
step_reached = GREATEST(step_reached, 6)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$life_sustaining_treatment,
|
||||
$witness_title,
|
||||
$witness_first_name,
|
||||
$witness_last_name,
|
||||
@ -202,10 +222,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => 6, 'message' => 'Step 5 saved successfully.']);
|
||||
} elseif ($step === 6) {
|
||||
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 6.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 7.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -227,15 +247,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$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, 6) WHERE id = ?");
|
||||
$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') ? 7 : 6;
|
||||
$next_step = ($next_action === 'next_step') ? 8 : 7;
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => $next_step, 'message' => 'Person to notify saved successfully.']);
|
||||
} elseif ($step === 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 7.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 8.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -245,14 +265,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
preferences = ?,
|
||||
instructions = ?,
|
||||
step_reached = GREATEST(step_reached, 7)
|
||||
step_reached = GREATEST(step_reached, 8)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$preferences, $instructions, $lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => 8, 'message' => 'Step 7 saved successfully.']);
|
||||
} elseif ($step === 8) {
|
||||
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 8.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 9.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -277,14 +297,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
certificate_provider_address_line2 = ?,
|
||||
certificate_provider_address_line3 = ?,
|
||||
certificate_provider_postcode = ?,
|
||||
step_reached = GREATEST(step_reached, 8)
|
||||
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' => $lpa_id, 'next_step' => 9, 'message' => 'Step 8 saved successfully.']);
|
||||
} elseif ($step === 9) {
|
||||
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 9.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 10.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -329,13 +349,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$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, 9) WHERE 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' => $lpa_id, 'next_step' => 10, 'message' => 'Attorney witnesses saved successfully.']);
|
||||
} elseif ($step === 10) {
|
||||
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 10.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 11.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -351,14 +371,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$stmt = db()->prepare("UPDATE lpa_applications SET
|
||||
registration_who = ?,
|
||||
registering_attorneys_ids = ?,
|
||||
step_reached = GREATEST(step_reached, 10)
|
||||
step_reached = GREATEST(step_reached, 11)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$registration_who, $registering_attorneys_ids, $lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => 11, 'message' => 'Registration choice saved successfully.']);
|
||||
} elseif ($step === 11) {
|
||||
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 11.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 12.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -395,7 +415,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
correspondence_contact_preference = ?,
|
||||
correspondence_phone = ?,
|
||||
correspondence_email = ?,
|
||||
step_reached = GREATEST(step_reached, 11)
|
||||
step_reached = GREATEST(step_reached, 12)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$correspondence_who,
|
||||
@ -413,10 +433,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => 12, 'message' => 'Correspondence details saved successfully.']);
|
||||
} elseif ($step === 12) {
|
||||
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 12.']);
|
||||
echo json_encode(['success' => false, 'error' => 'LPA ID is required for Step 13.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -442,7 +462,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
reduced_fee_eligibility = ?,
|
||||
is_repeat_application = ?,
|
||||
repeat_case_number = ?,
|
||||
step_reached = GREATEST(step_reached, 12)
|
||||
step_reached = GREATEST(step_reached, 13)
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$payment_method,
|
||||
@ -453,20 +473,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$lpa_id
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'next_step' => 13, 'message' => 'Payment details saved successfully.']);
|
||||
} elseif ($step === 13) {
|
||||
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 13.']);
|
||||
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, 13),
|
||||
step_reached = GREATEST(step_reached, 14),
|
||||
status = 'completed'
|
||||
WHERE id = ?");
|
||||
$stmt->execute([$lpa_id]);
|
||||
|
||||
echo json_encode(['success' => true, 'id' => $lpa_id, 'redirect' => 'dashboard.php', 'message' => 'Application submitted successfully.']);
|
||||
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.']);
|
||||
}
|
||||
|
||||
488
apply.php
488
apply.php
@ -88,7 +88,7 @@ foreach ($notified_persons as $np) {
|
||||
<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" rel="stylesheet">
|
||||
<link href="assets/css/custom.css?v=<?php echo time(); ?>" rel="stylesheet">
|
||||
<style>
|
||||
.summary-section {
|
||||
border-bottom: 1px solid #eee;
|
||||
@ -133,7 +133,7 @@ foreach ($notified_persons as $np) {
|
||||
<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 13</span>
|
||||
<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) {
|
||||
@ -141,15 +141,16 @@ foreach ($notified_persons as $np) {
|
||||
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 & Witness"; break;
|
||||
case 6: echo "People to notify"; break;
|
||||
case 7: echo "Preferences and instructions"; break;
|
||||
case 8: echo "Certificate Provider"; break;
|
||||
case 9: echo "Attorney Witnesses"; break;
|
||||
case 10: echo "Who is registering the LPA?"; break;
|
||||
case 11: echo "Who should receive the LPA?"; break;
|
||||
case 12: echo "Application fee"; break;
|
||||
case 13: echo "Review Summary"; 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>
|
||||
@ -494,15 +495,14 @@ foreach ($notified_persons as $np) {
|
||||
<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 & Witness</h2>
|
||||
<p class="text-muted mb-5">Provide final details regarding life-sustaining treatment and witness information.</p>
|
||||
<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">
|
||||
<h3 class="h5 fw-bold mb-4">Life-sustaining treatment</h3>
|
||||
<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>
|
||||
@ -530,10 +530,20 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-5 text-muted opacity-25">
|
||||
<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">
|
||||
<h3 class="h5 fw-bold mb-4">Witness Information</h3>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-2">
|
||||
<label for="witness_title" class="form-label fw-semibold">Title</label>
|
||||
@ -567,18 +577,18 @@ foreach ($notified_persons as $np) {
|
||||
</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>
|
||||
<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 === 6): ?>
|
||||
<?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=7&id=<?php echo $lpa_id; ?>" class="btn btn-outline-secondary btn-lg px-5">No</a>
|
||||
<a href="apply.php?step=8&id=<?php echo $lpa_id; ?>" class="btn btn-outline-secondary btn-lg px-5">No</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -604,8 +614,8 @@ foreach ($notified_persons as $np) {
|
||||
|
||||
<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="lpaFormStep6" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="6">
|
||||
<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">
|
||||
@ -646,21 +656,21 @@ foreach ($notified_persons as $np) {
|
||||
|
||||
<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 7</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=5&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 5</a>
|
||||
<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 === 7): ?>
|
||||
<?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="lpaFormStep7" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="7">
|
||||
<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">
|
||||
@ -679,16 +689,16 @@ foreach ($notified_persons as $np) {
|
||||
</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>
|
||||
<button type="submit" class="btn btn-primary btn-lg px-5">Step 8</button>
|
||||
<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 === 8): ?>
|
||||
<?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="lpaFormStep8" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="8">
|
||||
<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">
|
||||
@ -723,16 +733,16 @@ foreach ($notified_persons as $np) {
|
||||
</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>
|
||||
<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 === 9): ?>
|
||||
<?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="lpaFormStep9" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="9">
|
||||
<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): ?>
|
||||
@ -795,16 +805,16 @@ foreach ($notified_persons as $np) {
|
||||
<?php endforeach; ?>
|
||||
|
||||
<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>
|
||||
<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 === 10): ?>
|
||||
<?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="lpaFormStep10" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="10">
|
||||
<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">
|
||||
@ -858,16 +868,16 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
|
||||
<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">Continue to Step 11</button>
|
||||
<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 === 11): ?>
|
||||
<?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="lpaFormStep11" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="11">
|
||||
<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">
|
||||
@ -988,28 +998,27 @@ foreach ($notified_persons as $np) {
|
||||
</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>
|
||||
<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 13</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php elseif ($step === 12): ?>
|
||||
<?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="lpaFormStep12" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="12">
|
||||
<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; ?>">
|
||||
|
||||
<!-- Section 1: Payment Method -->
|
||||
<div class="mb-5">
|
||||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Section 1: How do you want to pay?</h3>
|
||||
<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">
|
||||
<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">Card</div>
|
||||
<div class="small text-muted">Pay securely over the phone.</div>
|
||||
<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>
|
||||
@ -1018,10 +1027,10 @@ foreach ($notified_persons as $np) {
|
||||
</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">
|
||||
<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 by post.</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>
|
||||
@ -1031,89 +1040,78 @@ foreach ($notified_persons as $np) {
|
||||
</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 card payment</label>
|
||||
<input type="text" class="form-control" id="payment_phone" name="payment_phone" value="<?php echo htmlspecialchars($lpa_data['payment_phone'] ?? ''); ?>" placeholder="Enter phone number">
|
||||
<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>
|
||||
|
||||
<hr class="my-5 text-muted opacity-25">
|
||||
|
||||
<!-- Section 2: Reduced Fee -->
|
||||
<div class="mb-5">
|
||||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Section 2: Reduced fee eligibility</h3>
|
||||
<p class="text-muted small mb-4">Are you eligible to pay a reduced fee or no fee at all? (e.g., due to low income or receiving certain benefits)</p>
|
||||
<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-md-6">
|
||||
<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' : ''; ?> required>
|
||||
<label class="btn btn-outline-secondary w-100 p-3 text-center" for="fee_yes">Yes, I am eligible</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<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'; ?>>
|
||||
<label class="btn btn-outline-secondary w-100 p-3 text-center" for="fee_no">No, I am not eligible</label>
|
||||
<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>
|
||||
|
||||
<hr class="my-5 text-muted opacity-25">
|
||||
|
||||
<!-- Section 3: Repeat Application -->
|
||||
<div class="mb-5">
|
||||
<h3 class="h6 fw-bold mb-4 text-uppercase tracking-wider text-muted">Section 3: Repeat application</h3>
|
||||
<div class="form-check mb-4">
|
||||
<input class="form-check-input" type="checkbox" name="is_repeat_application" id="is_repeat_application" value="1" <?php echo ($lpa_data && $lpa_data['is_repeat_application']) ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label fw-semibold" for="is_repeat_application">
|
||||
This is a repeat application
|
||||
<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="text-muted small mt-1">Check this box if you are resubmitting an application that was previously returned or rejected.</p>
|
||||
<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'; ?>">
|
||||
<label for="repeat_case_number" class="form-label fw-semibold">Case number (from previous application)</label>
|
||||
<input type="text" class="form-control" id="repeat_case_number" name="repeat_case_number" value="<?php echo htmlspecialchars($lpa_data['repeat_case_number'] ?? ''); ?>" placeholder="Enter case number">
|
||||
<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=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 13</button>
|
||||
<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 === 13): ?>
|
||||
<h2 class="h4 fw-bold mb-4">Review Summary</h2>
|
||||
<p class="text-muted mb-5">Please review all your details before final submission.</p>
|
||||
<?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 Details</h3>
|
||||
<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-4">
|
||||
<div class="summary-label">LPA Type</div>
|
||||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['lpa_type'] ?? ''); ?></div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="summary-label">Donor Name</div>
|
||||
<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-4">
|
||||
<div class="col-md-6">
|
||||
<div class="summary-label">Date of Birth</div>
|
||||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['donor_dob'] ?? ''); ?></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-md-4">
|
||||
<div class="summary-label">Email</div>
|
||||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['customer_email'] ?? ''); ?></div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="col-12">
|
||||
<div class="summary-label">Address</div>
|
||||
<div class="summary-value">
|
||||
<?php
|
||||
echo htmlspecialchars($lpa_data['donor_address_line1'] ?? '');
|
||||
if (!empty($lpa_data['donor_address_line2'])) echo ', ' . htmlspecialchars($lpa_data['donor_address_line2']);
|
||||
echo ', ' . htmlspecialchars($lpa_data['donor_town'] ?? '');
|
||||
echo ', ' . htmlspecialchars($lpa_data['donor_postcode'] ?? '');
|
||||
?>
|
||||
<?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>
|
||||
@ -1125,28 +1123,16 @@ foreach ($notified_persons as $np) {
|
||||
<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>
|
||||
<?php if (empty($attorneys)): ?>
|
||||
<div class="text-muted">No attorneys added.</div>
|
||||
<?php else: ?>
|
||||
<div class="row g-4">
|
||||
<?php foreach ($attorneys as $idx => $att): ?>
|
||||
<div class="col-md-6">
|
||||
<div class="p-3 bg-light rounded-3 h-100">
|
||||
<div class="fw-bold mb-1"><?php echo htmlspecialchars(($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name']); ?></div>
|
||||
<div class="small text-muted mb-2"><?php echo htmlspecialchars($att['email']); ?> • <?php echo htmlspecialchars($att['dob']); ?></div>
|
||||
<div class="small text-dark">
|
||||
<?php
|
||||
echo htmlspecialchars($att['address_line1']);
|
||||
if (!empty($att['address_line2'])) echo ', ' . htmlspecialchars($att['address_line2']);
|
||||
echo ', ' . htmlspecialchars($att['town']);
|
||||
echo ', ' . htmlspecialchars($att['postcode']);
|
||||
?>
|
||||
</div>
|
||||
</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>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 3: Decisions -->
|
||||
@ -1155,32 +1141,24 @@ foreach ($notified_persons as $np) {
|
||||
<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'] ?? 'Not specified'); ?></div>
|
||||
<div class="summary-value"><?php echo htmlspecialchars($lpa_data['attorney_decision_type'] ?? ''); ?></div>
|
||||
</div>
|
||||
|
||||
<!-- Step 4: Replacement Attorneys -->
|
||||
<!-- 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">No replacement attorneys added.</div>
|
||||
<div class="text-muted">None appointed.</div>
|
||||
<?php else: ?>
|
||||
<div class="row g-4">
|
||||
<?php foreach ($replacement_attorneys as $idx => $att): ?>
|
||||
<div class="col-md-6">
|
||||
<div class="p-3 bg-light rounded-3 h-100">
|
||||
<div class="fw-bold mb-1"><?php echo htmlspecialchars(($att['title'] ? $att['title'] . ' ' : '') . $att['first_name'] . ' ' . $att['last_name']); ?></div>
|
||||
<div class="small text-muted mb-2"><?php echo htmlspecialchars($att['email']); ?> • <?php echo htmlspecialchars($att['dob']); ?></div>
|
||||
<div class="small text-dark">
|
||||
<?php
|
||||
echo htmlspecialchars($att['address_line1']);
|
||||
if (!empty($att['address_line2'])) echo ', ' . htmlspecialchars($att['address_line2']);
|
||||
echo ', ' . htmlspecialchars($att['town']);
|
||||
echo ', ' . htmlspecialchars($att['postcode']);
|
||||
?>
|
||||
</div>
|
||||
<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; ?>
|
||||
@ -1188,19 +1166,29 @@ foreach ($notified_persons as $np) {
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Step 5: Life Sustaining & Witness -->
|
||||
<!-- 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 & Witness</h3>
|
||||
<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-md-6">
|
||||
<div class="summary-label">Life-sustaining Treatment</div>
|
||||
<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 class="col-md-6">
|
||||
<div class="summary-label">Donor's Witness</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'] ?? ''));
|
||||
@ -1211,11 +1199,11 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 6: Notified Persons -->
|
||||
<!-- 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">6. People to Notify</h3>
|
||||
<a href="apply.php?step=6&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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>
|
||||
@ -1233,11 +1221,11 @@ foreach ($notified_persons as $np) {
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Step 7: Preferences & Instructions -->
|
||||
<!-- 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">7. Preferences and Instructions</h3>
|
||||
<a href="apply.php?step=7&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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">
|
||||
@ -1251,11 +1239,11 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 8: Certificate Provider -->
|
||||
<!-- 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">8. Certificate Provider</h3>
|
||||
<a href="apply.php?step=8&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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
|
||||
@ -1265,11 +1253,11 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 9: Attorney Witnesses -->
|
||||
<!-- 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">9. Attorney Witnesses</h3>
|
||||
<a href="apply.php?step=9&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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): ?>
|
||||
@ -1290,11 +1278,11 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 10: Registration -->
|
||||
<!-- 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">10. Registration</h3>
|
||||
<a href="apply.php?step=10&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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">
|
||||
@ -1321,11 +1309,11 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 11: Correspondence -->
|
||||
<!-- 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">11. Correspondence</h3>
|
||||
<a href="apply.php?step=11&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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">
|
||||
@ -1351,11 +1339,11 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 12: Payment -->
|
||||
<!-- 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">12. Payment & Fee</h3>
|
||||
<a href="apply.php?step=12&id=<?php echo $lpa_id; ?>" class="edit-link text-primary">Edit Section</a>
|
||||
<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">
|
||||
@ -1382,14 +1370,16 @@ foreach ($notified_persons as $np) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="lpaFormStep13" class="lpa-form" method="POST" action="api/save_lpa.php">
|
||||
<input type="hidden" name="step" value="13">
|
||||
<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=12&id=<?php echo $lpa_id; ?>" class="btn btn-link text-decoration-none text-muted p-0">Back to Step 12</a>
|
||||
<a href="api/generate_pdf.php?id=<?php echo $lpa_id; ?>" class="btn btn-outline-primary btn-lg px-4 me-3"><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"><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> Download Summary PDF</a>
|
||||
<button type="submit" class="btn btn-primary btn-lg px-5">Confirm & Submit Application</button>
|
||||
<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; ?>
|
||||
@ -1398,139 +1388,7 @@ foreach ($notified_persons as $np) {
|
||||
</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>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Witness selector logic
|
||||
const witnessSelectors = document.querySelectorAll('.witness-selector');
|
||||
witnessSelectors.forEach(selector => {
|
||||
selector.addEventListener('change', function() {
|
||||
const attorneyId = this.getAttribute('data-attorney-id');
|
||||
const newFields = document.getElementById('new_witness_fields_' + attorneyId);
|
||||
|
||||
if (this.value === 'new') {
|
||||
if (newFields) {
|
||||
newFields.classList.remove('d-none');
|
||||
newFields.querySelectorAll('input').forEach(input => input.setAttribute('required', 'required'));
|
||||
}
|
||||
} else {
|
||||
if (newFields) {
|
||||
newFields.classList.add('d-none');
|
||||
newFields.querySelectorAll('input').forEach(input => input.removeAttribute('required'));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Correspondence logic
|
||||
const corrRadios = document.querySelectorAll('input[name="correspondence_who"]');
|
||||
const corrDetails = document.getElementById('correspondence_details');
|
||||
corrRadios.forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
if (this.value === 'Donor') {
|
||||
if (corrDetails) {
|
||||
corrDetails.classList.add('d-none');
|
||||
corrDetails.querySelectorAll('input').forEach(input => input.removeAttribute('required'));
|
||||
}
|
||||
} else {
|
||||
if (corrDetails) {
|
||||
corrDetails.classList.remove('d-none');
|
||||
const addr1 = document.getElementById('correspondence_address_line1');
|
||||
const pc = document.getElementById('correspondence_postcode');
|
||||
const fn = document.getElementById('correspondence_first_name');
|
||||
const ln = document.getElementById('correspondence_last_name');
|
||||
if (addr1) addr1.setAttribute('required', 'required');
|
||||
if (pc) pc.setAttribute('required', 'required');
|
||||
if (fn) fn.setAttribute('required', 'required');
|
||||
if (ln) ln.setAttribute('required', 'required');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Contact preference logic
|
||||
const prefRadios = document.querySelectorAll('.contact-pref-check');
|
||||
const phoneBox = document.getElementById('phone_input_box');
|
||||
const emailBox = document.getElementById('email_input_box');
|
||||
prefRadios.forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
if (phoneBox) phoneBox.classList.add('d-none');
|
||||
if (emailBox) emailBox.classList.add('d-none');
|
||||
const phoneInput = document.getElementById('correspondence_phone');
|
||||
const emailInput = document.getElementById('correspondence_email');
|
||||
if (phoneInput) phoneInput.removeAttribute('required');
|
||||
if (emailInput) emailInput.removeAttribute('required');
|
||||
|
||||
if (this.value === 'Phone') {
|
||||
if (phoneBox) phoneBox.classList.remove('d-none');
|
||||
if (phoneInput) phoneInput.setAttribute('required', 'required');
|
||||
} else if (this.value === 'Email') {
|
||||
if (emailBox) emailBox.classList.remove('d-none');
|
||||
if (emailInput) emailInput.setAttribute('required', 'required');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Payment method logic (Step 12)
|
||||
const payMethodRadios = document.querySelectorAll('input[name="payment_method"]');
|
||||
const paymentPhoneBox = document.getElementById('payment_phone_box');
|
||||
payMethodRadios.forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
const payPhone = document.getElementById('payment_phone');
|
||||
if (this.value === 'Card') {
|
||||
if (paymentPhoneBox) paymentPhoneBox.classList.remove('d-none');
|
||||
if (payPhone) payPhone.setAttribute('required', 'required');
|
||||
} else {
|
||||
if (paymentPhoneBox) paymentPhoneBox.classList.add('d-none');
|
||||
if (payPhone) payPhone.removeAttribute('required');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Repeat application logic (Step 12)
|
||||
const repeatCheck = document.getElementById('is_repeat_application');
|
||||
const repeatBox = document.getElementById('repeat_case_box');
|
||||
if (repeatCheck) {
|
||||
repeatCheck.addEventListener('change', function() {
|
||||
const repeatCase = document.getElementById('repeat_case_number');
|
||||
if (this.checked) {
|
||||
if (repeatBox) repeatBox.classList.remove('d-none');
|
||||
if (repeatCase) repeatCase.setAttribute('required', 'required');
|
||||
} else {
|
||||
if (repeatBox) repeatBox.classList.add('d-none');
|
||||
if (repeatCase) repeatCase.removeAttribute('required');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const deleteNotifiedBtns = document.querySelectorAll('.btn-delete-notified');
|
||||
deleteNotifiedBtns.forEach(btn => {
|
||||
btn.addEventListener('click', function() {
|
||||
if (confirm('Are you sure you want to remove this person?')) {
|
||||
const personId = btn.getAttribute('data-id');
|
||||
const lpaId = btn.getAttribute('data-lpa-id');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('action', 'delete_notified_person');
|
||||
formData.append('person_id', personId);
|
||||
formData.append('lpa_id', lpaId);
|
||||
|
||||
fetch('api/save_lpa.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.error || 'Failed to remove person.');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -7,6 +7,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
e.preventDefault();
|
||||
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;
|
||||
|
||||
// Show loading state
|
||||
submitBtn.disabled = true;
|
||||
@ -16,8 +17,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const formData = new FormData(form);
|
||||
|
||||
// If the button clicked was one of the buttons with next_action, ensure it's set
|
||||
if (document.activeElement && document.activeElement.name === 'next_action') {
|
||||
formData.set('next_action', document.activeElement.value);
|
||||
if (nextAction) {
|
||||
formData.set('next_action', nextAction);
|
||||
}
|
||||
|
||||
fetch('api/save_lpa.php', {
|
||||
@ -27,18 +28,26 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
.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!';
|
||||
|
||||
if (nextAction === 'add_another') {
|
||||
// Clear the form fields as requested
|
||||
form.reset();
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (data.redirect) {
|
||||
window.location.href = data.redirect;
|
||||
} else if (data.next_step) {
|
||||
window.location.href = 'apply.php?step=' + data.next_step + '&id=' + data.id;
|
||||
if (data.next_step === parseInt(new URLSearchParams(window.location.search).get('step'))) {
|
||||
const currentStep = parseInt(new URLSearchParams(window.location.search).get('step') || 1);
|
||||
if (data.next_step === currentStep) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
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);
|
||||
@ -50,7 +59,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
console.log("Data:", data); console.error('Error:', error);
|
||||
alert('Something went wrong. Please check your connection.');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.innerHTML = originalHTML;
|
||||
@ -78,6 +87,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log("Success:", data);
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.error || 'Failed to remove attorney.');
|
||||
@ -86,4 +96,4 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -99,7 +99,7 @@ try {
|
||||
<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'] / 13) * 100); ?>
|
||||
<?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>
|
||||
@ -110,7 +110,7 @@ try {
|
||||
</td>
|
||||
<td class="text-end pe-4">
|
||||
<?php
|
||||
$next_step = ($lpa['step_reached'] < 13) ? $lpa['step_reached'] + 1 : 13;
|
||||
$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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user