Heaven-Sent Casework Center
Heaven-Sent Community Services & Veterans Assistance Client Casework Center
One master page for disaster relief, homelessness and HUD casework, VA support, food and basic needs,
peer support, document upload, direct staff contact, RingCentral phone and video, and client authorization to talk.
Disaster
HUD / Homeless
VA
Food
Peer Support
Housing
Benefits
Case Management
Direct Staff Contacts
Click to call or email staff directly from the casework page.
Live Client Contact Actions
Use these links to join the RingCentral room or notify staff that a client is on the page now.
Email Staff That a Client Is Here
Use the direct buttons below, or use the all-staff button to include the live client information from the form.
Email All Staff About This Client
RingCentral Communication Center
Use this area for phone, video, text, and screen sharing with clients through RingCentral.
Start Intake Call
Open Screen Share Notes
Flag Urgent Case
Screen Share Notes
Use this area to note what you want to show the client while sharing your screen.
'
);
printWindow.document.close();
printWindow.onload = function () {
printWindow.focus();
printWindow.print();
};
};
window.downloadClientPdf = async function(areaId, filename) {
var target = document.getElementById(areaId);
if (!target) return;
var clone = cloneFilledArea(target);
var wrapper = document.createElement('div');
wrapper.style.position = 'fixed';
wrapper.style.left = '-99999px';
wrapper.style.top = '0';
wrapper.style.width = '900px';
wrapper.style.background = '#ffffff';
wrapper.style.color = '#000000';
wrapper.style.padding = '20px';
wrapper.style.zIndex = '-1';
wrapper.innerHTML =
'
' +
'
' +
'
Heaven-Sent Community Services & Veterans Assistance ' +
'
Generated from the casework form with current filled form data.
' +
'
' +
clone.outerHTML +
'
';
document.body.appendChild(wrapper);
try {
var canvas = await html2canvas(wrapper, {
scale: 2,
useCORS: true,
backgroundColor: '#ffffff'
});
var imgData = canvas.toDataURL('image/png');
var jsPDFRef = window.jspdf.jsPDF;
var pdf = new jsPDFRef('p', 'mm', 'a4');
var pageWidth = 210;
var pageHeight = 297;
var imgWidth = pageWidth;
var imgHeight = (canvas.height * imgWidth) / canvas.width;
var heightLeft = imgHeight;
var position = 0;
pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight);
heightLeft -= pageHeight;
while (heightLeft > 0) {
position = heightLeft - imgHeight;
pdf.addPage();
pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight);
heightLeft -= pageHeight;
}
pdf.save(filename || 'casework-form.pdf');
} catch (err) {
alert('PDF generation failed on this device or browser. Try the Print / Save PDF option.');
} finally {
document.body.removeChild(wrapper);
}
};
function loadSecondPanel() {
var target = document.getElementById('hs-dynamic-panel-target');
if (!target) return;
var existing = document.getElementById('hs-second-panel');
if (existing) {
existing.scrollIntoView({ behavior: 'smooth' });
return;
}
var panelHtml =
'
' +
'
' +
'
Second Intake Panel ' +
'
Use this panel for a second screening, reassessment, quiz, or follow-up review.
' +
'
' +
'
' +
'
' +
'
Follow-Up Screening ' +
'
Use this section for reassessment after intake, housing placement, disaster response, or peer support follow-up.
' +
'
' +
'
' +
'Current follow-up status ' +
'' +
'Select one ' +
'Open ' +
'Pending documents ' +
'Waiting on agency response ' +
'Stabilized ' +
'Closed ' +
' ' +
'
' +
'
' +
'Current needs level ' +
'' +
'Select one ' +
'Low ' +
'Moderate ' +
'High ' +
'Critical ' +
' ' +
'
' +
'
' +
'Follow-up review notes ' +
' ' +
'
' +
'
' +
'Staff scoring / review summary ' +
' ' +
'
' +
'
' +
'
' +
'
' +
'
';
target.insertAdjacentHTML('beforeend', panelHtml);
var added = document.getElementById('hs-second-panel');
if (added) added.scrollIntoView({ behavior: 'smooth' });
}
bindCustomValidation();
var printButtons = document.querySelectorAll('[data-print-area]');
printButtons.forEach(function(btn){
btn.addEventListener('click', function(e){
e.preventDefault();
window.printConsentForm(btn.getAttribute('data-print-area'), btn.getAttribute('data-print-title') || 'Printable Form');
});
});
var pdfButtons = document.querySelectorAll('[data-pdf-area]');
pdfButtons.forEach(function(btn){
btn.addEventListener('click', function(e){
e.preventDefault();
window.downloadClientPdf(btn.getAttribute('data-pdf-area'), btn.getAttribute('data-pdf-file') || 'casework-form.pdf');
});
});
var fullPrintBtn = document.getElementById('hs-print-full-btn');
if (fullPrintBtn) {
fullPrintBtn.addEventListener('click', function(e){
e.preventDefault();
window.printConsentForm('hs-master-casework-form', 'Heaven-Sent Full Casework Form');
});
}
var fullPdfBtn = document.getElementById('hs-download-full-pdf-btn');
if (fullPdfBtn) {
fullPdfBtn.addEventListener('click', function(e){
e.preventDefault();
window.downloadClientPdf('hs-master-casework-form', 'Heaven-Sent-Full-Casework.pdf');
});
}
form.addEventListener('reset', function(){
if (successBox) successBox.classList.remove('show');
if (submitBtn) submitBtn.textContent = 'Save Full Casework Form';
});
var emailCaseworkBtn = document.getElementById('hs-email-casework-btn');
if (submitBtn) {
submitBtn.addEventListener('click', function(e) {
e.preventDefault();
var fields = form.querySelectorAll('input, select, textarea');
fields.forEach(function (field) {
setFieldMessage(field);
});
var clientConsentValid = validateRequiredCheckboxes(
['client_consent_contact', 'client_consent_document'],
'client-consent-error',
'Please review the client consent section and check the required consent boxes.'
);
var authorizationConsentValid = validateRequiredCheckboxes(
['ack_understand', 'ack_voluntary', 'ack_revocation'],
'authorization-consent-error',
'Please complete the authorization acknowledgment checkboxes before saving.'
);
var valid = form.reportValidity();
if (!valid || !clientConsentValid || !authorizationConsentValid) {
if (successBox) successBox.classList.remove('show');
return;
}
downloadFormData();
if (submitBtn) {
submitBtn.textContent = 'Saved To Computer';
}
if (successBox) {
successBox.textContent = 'Casework form saved to your computer as a JSON file.';
successBox.classList.add('show');
}
setTimeout(function(){
if (submitBtn) submitBtn.textContent = 'Save Full Casework Form';
}, 2200);
});
}
if (emailCaseworkBtn) {
emailCaseworkBtn.addEventListener('click', function() {
var fields = form.querySelectorAll('input, select, textarea');
fields.forEach(function (field) {
setFieldMessage(field);
});
var clientConsentValid = validateRequiredCheckboxes(
['client_consent_contact', 'client_consent_document'],
'client-consent-error',
'Please review the client consent section and check the required consent boxes.'
);
var authorizationConsentValid = validateRequiredCheckboxes(
['ack_understand', 'ack_voluntary', 'ack_revocation'],
'authorization-consent-error',
'Please complete the authorization acknowledgment checkboxes before emailing.'
);
var valid = form.reportValidity();
if (!valid || !clientConsentValid || !authorizationConsentValid) {
if (successBox) successBox.classList.remove('show');
return;
}
var obj = getFormObject();
var subject = 'Heaven-Sent Full Casework Form - ' + ((obj.client_name || 'Client Record').trim());
var body = buildEmailBodyFromObject(obj);
var to = [
'joepres@heaven-sent-veterans-outreach.org',
'timdisasterrelief1@heaven-sent-veterans-outreach.org',
'commandercorner@heaven-sent-veterans-outreach.org',
'teresawdirectoroffaithpastor@heaven-sent-veterans-outreach.org'
].join(',');
window.location.href = 'mailto:' + to + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);
if (successBox) {
successBox.textContent = 'Email draft opened in your mail app with the full casework details.';
successBox.classList.add('show');
}
});
}
var secondPanelBtn = document.getElementById('hs-load-second-panel');
if (secondPanelBtn) {
secondPanelBtn.addEventListener('click', loadSecondPanel);
}
var emailBtn = document.getElementById('hs-email-all-staff-btn');
if (emailBtn) {
emailBtn.addEventListener('click', function() {
var clientNameField = document.getElementById('client_name');
var clientPhoneField = document.getElementById('client_phone');
var clientLocationField = document.getElementById('current_location');
var clientName = clientNameField ? clientNameField.value.trim() : '';
var clientPhone = clientPhoneField ? clientPhoneField.value.trim() : '';
var clientLocation = clientLocationField ? clientLocationField.value.trim() : '';
var subject = 'Client is on the casework page';
var body =
'Hello Team,\r\n\r\n' +
'A client is currently on the Heaven-Sent casework page.\r\n\r\n' +
'Client name: ' + (clientName || 'Not entered') + '\r\n' +
'Client phone: ' + (clientPhone || 'Not entered') + '\r\n' +
'Current location: ' + (clientLocation || 'Not entered') + '\r\n\r\n' +
'Please follow up as soon as possible.\r\n\r\n' +
'Thank you.';
var mailto =
'mailto:' +
'joepres@heaven-sent-veterans-outreach.org,' +
'timdisasterrelief1@heaven-sent-veterans-outreach.org,' +
'commandercorner@heaven-sent-veterans-outreach.org,' +
'teresawdirectoroffaithpastor@heaven-sent-veterans-outreach.org' +
'?subject=' + encodeURIComponent(subject) +
'&body=' + encodeURIComponent(body);
window.location.href = mailto;
});
}
function getFormObject(){
var fd = new FormData(form);
var obj = {};
for (var pair of fd.entries()) {
var key = pair[0], val = pair[1];
if (val instanceof File) {
if (!obj[key]) obj[key] = [];
obj[key].push(val && val.name ? val.name : '');
} else if (key.endsWith('[]')) {
if (!obj[key]) obj[key] = [];
obj[key].push(val);
} else if (obj[key] !== undefined) {
if (!Array.isArray(obj[key])) obj[key] = [obj[key]];
obj[key].push(val);
} else {
obj[key] = val;
}
}
obj.exported_at = new Date().toISOString();
obj.note = 'Front-end export. File uploads are listed by filename only when saved or emailed from the browser.';
return obj;
}
function buildEmailBodyFromObject(obj){
var lines = [
'Heaven-Sent Full Casework Form',
'',
'Client name: ' + (obj.client_name || 'Not entered'),
'Preferred name / pronouns: ' + (obj.preferred_name || 'Not entered'),
'Best phone number: ' + (obj.client_phone || 'Not entered'),
'Email: ' + (obj.client_email || 'Not entered'),
'Date of birth: ' + (obj.dob || 'Not entered'),
'Current address / shelter / location: ' + (obj.current_location || 'Not entered'),
'Disaster / event / crisis: ' + (obj.disaster_event || 'Not entered'),
'Case priority: ' + (obj.case_priority || 'Not entered'),
'Current housing status: ' + (obj.housing_status || 'Not entered'),
'',
'Program areas needed: ' + ((obj['program_areas[]'] || []).join(', ') || 'None selected'),
'Client type / support needs: ' + ((obj['client_flags[]'] || []).join(', ') || 'None selected'),
'Information allowed to be discussed: ' + ((obj['info_types[]'] || []).join(', ') || 'None selected'),
'Authorization purpose: ' + ((obj['purpose[]'] || []).join(', ') || 'None selected'),
'',
'Client story / presenting problem:',
obj.client_story || 'Not entered',
'',
'Immediate unmet needs:',
obj.immediate_needs || 'Not entered',
'',
'Case plan / next steps:',
obj.case_plan || 'Not entered',
'',
'Referrals made / agencies contacted:',
obj.referrals_made || 'Not entered',
'',
'VA-related needs:',
obj.va_needs || 'Not entered',
'',
'Authorized person / organization:',
(obj.authorized_party_name || 'Not entered') + ' | ' + (obj.authorized_party_role || 'No role entered'),
'Authorized party phone: ' + (obj.authorized_party_phone || 'Not entered'),
'Authorized party email: ' + (obj.authorized_party_email || 'Not entered'),
'Effective date: ' + (obj.effective_date || 'Not entered'),
'Expiration date: ' + (obj.expiration_date || 'Not entered'),
'',
'Release limitations:',
obj.release_limitations || 'Not entered',
'',
'Supporting document filenames:',
((obj['supporting_documents[]'] || []).join(', ') || 'No files listed'),
'',
'Supporting document notes:',
obj.supporting_document_notes || 'Not entered',
'',
'Assigned caseworker: ' + (obj.assigned_caseworker || 'Not entered'),
'Next follow-up date: ' + (obj.followup_date || 'Not entered'),
'',
'Follow-up notes:',
obj.followup_notes || 'Not entered',
'',
'Exported at: ' + (obj.exported_at || ''),
obj.note || ''
];
return lines.join('\r\n');
}
function downloadFormData(){
var obj = getFormObject();
var blob = new Blob([JSON.stringify(obj, null, 2)], {type:'application/json'});
var a = document.createElement('a');
var safeName = (obj.client_name || 'casework-record').toString().trim().replace(/[^a-z0-9]+/gi,'-').replace(/^-+|-+$/g,'').toLowerCase() || 'casework-record';
a.href = URL.createObjectURL(blob);
a.download = safeName + '.json';
document.body.appendChild(a);
a.click();
setTimeout(function(){ URL.revokeObjectURL(a.href); a.remove(); }, 250);
}
form.addEventListener('submit', function (e) {
e.preventDefault();
var fields = form.querySelectorAll('input, select, textarea');
fields.forEach(function (field) {
setFieldMessage(field);
});
var clientConsentValid = validateRequiredCheckboxes(
['client_consent_contact', 'client_consent_document'],
'client-consent-error',
'Please review the client consent section and check the required consent boxes.'
);
var authorizationConsentValid = validateRequiredCheckboxes(
['ack_understand', 'ack_voluntary', 'ack_revocation'],
'authorization-consent-error',
'Please complete the authorization acknowledgment checkboxes before submitting.'
);
var valid = form.reportValidity();
if (!valid || !clientConsentValid || !authorizationConsentValid) {
if (successBox) successBox.classList.remove('show');
return;
}
if (submitBtn) {
submitBtn.classList.remove('hs-submit-animate');
submitBtn.classList.add('hs-submit-success');
submitBtn.textContent = 'Validated - Sending';
}
if (successBox) {
successBox.textContent = 'Form validated and ready to submit.';
successBox.classList.add('show');
}
downloadFormData();
if (submitBtn) {
submitBtn.textContent = 'Saved To Computer';
}
});
})();
});