ACCESS GRANTED
VETERANS
LEGACY VAULT
TAP THE VAULT TO OPEN
PROTECT YOUR STORY. PREPARE YOUR FAMILY.
PRESERVE YOUR LEGACY.
VETERANSLEGACY VAULT
WELCOME BACK

Veteran Profile

Your Legacy Matters.

Veteran Mode — Write AccessChoose how you are viewing the Vault
MY LEGACY VAULT
FAMILY ACCESS & LEGACY
TOOLS & PLANNING
CONTACTS & VETERAN SUPPORT
VAULT READINESS
Vault Health ScoreSee how much of your family-readiness information is complete.
0%
Veteran Bio
Profile & service identity
Veteran
Photo
Profile Picture
Upload a photo for your veteran profile.
Section
Financial & Household Bills
Household expenses, lenders, service providers & uploaded bills
Search Bills & Contacts
Search electric, mortgage, phone, cable, lender, insurance, provider, account manager, or notes.
Household Bills
These common categories stay on the page permanently. Tap any one to enter the company, contact information, account details, notes, and upload a current bill or statement.
Add Custom Bill
Use this for HOA dues, storage units, lawn service, boat or RV loans, hunting camp expenses, subscriptions, or anything else unique to your household.
Insurance & Brokers
Policies, agents, brokers & supporting documents
Search Insurance & Providers
Add Insurance / Broker Contact
Important Contacts
Friends, family & people who should be reachable
Search Important Contacts
Suggested Contacts to Add
Spouse/partner, children, siblings, close friends, neighbors, executor, attorney, CPA, financial advisor, insurance agent, banker, funeral home, clergy, doctors, Veteran Advocacy Group, county veterans office, and anyone else your family may need quickly.
Add Friend, Family Member, or Professional Contact
For My Family
Everything your family may need first
For My Family
The veteran can answer the questions below now so family members are not left guessing later. In Family Mode, the answers are displayed read-only in the same order.
Emergency Card
Critical information at a glance
Emergency Information Card
Keep the information a family member, first responder, or medical provider may need quickly. You can pull in information already stored elsewhere in your Vault, review the card, then print it or save it as a PDF.
Emergency Card Preview
This is the compact version intended for quick reference.
Medication Tracker
Medication, dose, prescriber, pharmacy & notes
Add Medication
Search Medications
Veteran Timeline
A chronological military service history
Military Service Timeline
The major milestones below stay on the page so the veteran can build a complete service history. Each item can include dates, location/unit, notes, and a supporting photo or document.
SERVICE MILESTONES & SUPPORTING RECORDS
Add Another Military Milestone
Family Photo Vault
Military, family, children, grandchildren & memories
Add Photo
Search Photos
Digital Account Access
Where account credentials and recovery instructions are safely stored
Security Note
For this demo, avoid entering real passwords, PINs, recovery codes, or banking credentials. The production app needs a separately protected encrypted credential vault.
Add Account Reference
Digital Inventory
Important property, valuables & intended recipients
Property & Valuables Inventory
The categories below stay on the page so important property is not overlooked. Record identifying information, value, location, intended recipient, and optionally upload a photo, receipt, appraisal, or supporting document.
Add Another Inventory Category
Veteran Bucket List
Places, reunions, goals & family experiences
Add Goal
Survivor Benefits Wizard
A guided family checklist
Build a Survivor Checklist
Secure Family Sharing
Who can see what
Add Trusted Person
Legacy Letter
A guided message for your family
Important Documents
Core records first, custom records below
Major Documents
These stay permanently listed so important records are easy to find.
Other Documents
Add any document type you want—family genealogy records, cemetery paperwork, adoption records, old military letters, family recipes, or anything else important.
Veteran Advocacy Group
VA Claims & Appeals Assistance
Need Help With Your VA Claim or Appeal?
Connect directly with Veteran Advocacy Group from inside Veterans Legacy Vault.
GET HELP
DOWNLOADS & EDUCATION
CONTACT
Veteran Advocacy Group

VA Accredited Claims Agent

Phone: (272) 257-1349

Email: claims@veteran-advocacy.com

Website:
www.veteran-advocacy-group.com

Veteran Resources
Federal, state, county, nonprofit & accredited assistance
Search Veteran Resources
Search OGC, VBA, Vet Centers, PACT Act, toxic exposure/TERA, Gulf War, GWOT, VSOs, county offices, nonprofits, and more.
Add Local or Personal Resource
`);w.document.close(); } localStorage.removeItem('vlv_demo_role');show('signin');} function switchHomeRole(r){role=r;localStorage.setItem('vlv_demo_role',role);renderHome();} function toggleRoleUI(){document.querySelectorAll('.veteranOnly').forEach(x=>x.classList.toggle('hidden',role!=='veteran'));} function renderAvatar(id){const data=localStorage.getItem('vlv_profile_photo');const el=document.getElementById(id);if(!el)return;if(data&&el.tagName!=='IMG')el.outerHTML=``;else if(data&&el.tagName==='IMG')el.src=data;} function savePhoto(e){if(role!=='veteran')return;const f=e.target.files[0];if(!f)return;const r=new FileReader();r.onload=()=>{localStorage.setItem('vlv_profile_photo',r.result);renderProfile();};r.readAsDataURL(f);} function renderHome(){role=localStorage.getItem('vlv_demo_role')||role;document.getElementById('modeText').textContent=role==='veteran'?'Veteran Mode — Write Access':'Family Mode — Read Only';document.getElementById('familyNotice').style.display=role==='family'?'block':'none';document.getElementById('homeName').textContent=localStorage.getItem('vlv_fullName')||'Veteran Profile';document.getElementById('homeVetRole').classList.toggle('active',role==='veteran');document.getElementById('homeFamRole').classList.toggle('active',role==='family');renderAvatar('homeAvatar');toggleRoleUI();renderVaultScore();} function renderProfile(){const w=document.getElementById('profileFields');w.innerHTML='';fields.profile.forEach(([l,k])=>w.appendChild(makeField(l,k)));renderAvatar('profileAvatar');toggleRoleUI();} function makeField(label,key){ const c=document.createElement('div');c.className='card';const v=localStorage.getItem('vlv_'+key)||''; c.innerHTML=``; if(role==='veteran'){const t=document.createElement(label.length>26?'textarea':'input');t.value=v;t.oninput=()=>localStorage.setItem('vlv_'+key,t.value);c.appendChild(t);} else{const d=document.createElement('div');d.className='readonly';d.textContent=v||'Not provided';c.appendChild(d);} if(attachmentLabels[key])c.appendChild(makeAttachmentArea('field:'+key,attachmentLabels[key])); return c; } function showSection(id){ document.getElementById('genericTitle').textContent=titles[id]; document.getElementById('genericSub').textContent=role==='family'?'Family read-only access':'Veteran write access'; const w=document.getElementById('genericContent');w.innerHTML=''; if(id==='familyinfo'){ const intro=document.createElement('div');intro.className='familyBanner'; intro.innerHTML='Family Instructions & Estate Documents
This section brings together final wishes, medical directives, estate documents, funeral information, and the instructions your family may need first.
'; w.appendChild(intro); } fields[id].forEach(([l,k])=>w.appendChild(makeField(l,k))); if(id==='familyinfo'){ w.appendChild(renderFamilyChecklist()); } document.getElementById('genericSave').style.display=role==='veteran'?'block':'none'; show('generic'); } const familyChecklistItems=[ 'Notify immediate family / trusted contacts', 'Locate DD Form 214', 'Contact funeral home', 'Contact Veteran Advocacy Group / accredited representative', 'Notify Department of Veterans Affairs', 'Apply for VA burial / memorial benefits', 'Notify Social Security Administration', 'Notify DFAS if applicable', 'Contact life insurance companies', 'Contact banks / financial institutions', 'Contact mortgage company / landlord', 'Review household bills and utilities', 'Review subscriptions and recurring payments', 'Locate Last Will & Testament', 'Locate DNR / Living Will / Advance Directive' ]; function renderFamilyChecklist(){ const box=document.createElement('div');box.className='card'; box.innerHTML='Immediate Family Action Checklist
A simple checklist your family can follow when these instructions are needed.
'; const saved=JSON.parse(localStorage.getItem('vlv_family_checklist')||'{}'); familyChecklistItems.forEach((item,i)=>{ const row=document.createElement('div'); row.style.cssText='display:flex;gap:10px;align-items:flex-start;padding:10px 0;border-bottom:1px solid #233c50'; if(role==='veteran'){ const cb=document.createElement('input'); cb.type='checkbox';cb.checked=!!saved[i];cb.style.cssText='width:auto;margin-top:3px'; cb.onchange=()=>{const s=JSON.parse(localStorage.getItem('vlv_family_checklist')||'{}');s[i]=cb.checked;localStorage.setItem('vlv_family_checklist',JSON.stringify(s));}; row.appendChild(cb); }else{ const mark=document.createElement('div');mark.textContent=saved[i]?'☑':'☐';mark.style.color='var(--gold)';row.appendChild(mark); } const t=document.createElement('div');t.textContent=item;t.style.flex='1';row.appendChild(t);box.appendChild(row); }); return box; } function saveData(){alert('Saved to this demo device.');} function initDB(){return new Promise((res,rej)=>{const q=indexedDB.open('VLV_DB_09',1);q.onupgradeneeded=e=>{const d=e.target.result;if(!d.objectStoreNames.contains('documents'))d.createObjectStore('documents',{keyPath:'key'});if(!d.objectStoreNames.contains('attachments'))d.createObjectStore('attachments',{keyPath:'key'});};q.onsuccess=e=>{db=e.target.result;res();};q.onerror=rej;});} function storeGet(store,key){return new Promise((res,rej)=>{const r=db.transaction(store,'readonly').objectStore(store).get(key);r.onsuccess=()=>res(r.result);r.onerror=rej;});} function storePut(store,obj){return new Promise((res,rej)=>{const r=db.transaction(store,'readwrite').objectStore(store).put(obj);r.onsuccess=()=>res();r.onerror=rej;});} function storeDel(store,key){return new Promise((res,rej)=>{const r=db.transaction(store,'readwrite').objectStore(store).delete(key);r.onsuccess=()=>res();r.onerror=rej;});} function storeAll(store){return new Promise((res,rej)=>{const r=db.transaction(store,'readonly').objectStore(store).getAll();r.onsuccess=()=>res(r.result||[]);r.onerror=rej;});} function makeAttachmentArea(key,label){ const box=document.createElement('div');box.className='attachment';box.dataset.attachKey=key; refreshAttachmentBox(box,key,label);return box; } async function refreshAttachmentBox(box,key,label){ if(!db)await initDB();const d=await storeGet('attachments',key);box.innerHTML=''; const title=document.createElement('div');title.className='attachName';title.textContent=d?d.fileName:'No file attached';box.appendChild(title); const btns=document.createElement('div');btns.className='attachBtns'; if(d){btns.innerHTML=`${role==='veteran'?``:''}`;} if(role==='veteran'){const id='att_'+Math.random().toString(36).slice(2);const lab=document.createElement('label');lab.className='secondary btnLabel';lab.style.display='inline-block';lab.style.width='auto';lab.style.padding='7px 9px';lab.style.margin='0';lab.textContent=d?'REPLACE FILE':label;lab.htmlFor=id;const inp=document.createElement('input');inp.id=id;inp.type='file';inp.accept='.pdf,.png,.jpg,.jpeg,.webp,.doc,.docx,.txt';inp.onchange=()=>uploadAttachment(key,inp,label);btns.appendChild(lab);btns.appendChild(inp);} box.appendChild(btns); } async function uploadAttachment(key,inp,label){const f=inp.files[0];if(!f)return;await storePut('attachments',{key,fileName:f.name,type:f.type||'application/octet-stream',size:f.size,dateAdded:new Date().toISOString(),blob:f});const box=document.querySelector(`[data-attach-key="${CSS.escape(key)}"]`);if(box)refreshAttachmentBox(box,key,label);} async function viewAttachment(key){const d=await storeGet('attachments',key);if(!d)return;openPreview(d);} async function printAttachment(key){const d=await storeGet('attachments',key);if(!d)return;const u=URL.createObjectURL(d.blob);const w=window.open(u,'_blank');if(w)setTimeout(()=>{try{w.print();}catch(e){}},900);} async function removeAttachment(key){await storeDel('attachments',key);const box=document.querySelector(`[data-attach-key="${CSS.escape(key)}"]`);if(box)refreshAttachmentBox(box,key,'UPLOAD FILE');} function openPreview(d){const u=URL.createObjectURL(d.blob);document.getElementById('previewTitle').textContent=d.fileName;const fr=document.getElementById('previewFrame');fr.src=u;fr.dataset.url=u;document.getElementById('previewModal').classList.add('open');} function forceCloseModal(){const fr=document.getElementById('previewFrame');if(fr.dataset.url)URL.revokeObjectURL(fr.dataset.url);fr.src='about:blank';fr.dataset.url='';document.getElementById('previewModal').classList.remove('open');} function closeModal(e){if(e.target.id==='previewModal')forceCloseModal();} /* DOCUMENTS PAGE — LOCKED BASELINE */ async function allDocs(){return storeAll('documents');} async function renderDocuments(){ if(!db)await initDB();role=localStorage.getItem('vlv_demo_role')||role;toggleRoleUI();document.getElementById('docFamilyNotice').style.display=role==='family'?'block':'none'; const docs=await allDocs();const fixedWrap=document.getElementById('fixedDocs');const customWrap=document.getElementById('customDocs');fixedWrap.innerHTML='';customWrap.innerHTML=''; for(const name of fixedDocs){const key='fixed:'+name;let d=docs.find(x=>x.key===key);if(role==='family'&&d&&!d.shared)d=null;fixedWrap.appendChild(renderDocRow(name,key,d,false));} const customNames=JSON.parse(localStorage.getItem('vlv_custom_doc_names')||'[]'); customNames.forEach(name=>{const key='custom:'+name;let d=docs.find(x=>x.key===key);if(role==='family'&&d&&!d.shared)return;customWrap.appendChild(renderDocRow(name,key,d,true));}); if(role==='family'&&!customWrap.children.length)customWrap.innerHTML='
No additional documents have been shared.
'; } function renderDocRow(name,key,d,isCustom){ const row=document.createElement('div');row.className='docRow'; row.innerHTML=`
${escapeHtml(name)}
${d?'UPLOADED':'NOT UPLOADED'}
${d?`
${escapeHtml(d.fileName)} • ${fmtSize(d.size)} • ${new Date(d.dateAdded).toLocaleString()}
`:''}`; const a=document.createElement('div');a.className='actions'; if(d){a.innerHTML=`${role==='veteran'?``:''}`;} if(role==='veteran'){const id='file_'+Math.random().toString(36).slice(2);const lab=document.createElement('label');lab.className='secondary btnLabel';lab.style.display='inline-block';lab.style.width='auto';lab.style.padding='8px 10px';lab.style.margin='0';lab.textContent=d?'REPLACE FILE':'UPLOAD FILE';lab.htmlFor=id;const inp=document.createElement('input');inp.type='file';inp.id=id;inp.accept='.pdf,.png,.jpg,.jpeg,.webp,.doc,.docx,.txt,.mp4,.mov,.m4v';inp.onchange=()=>uploadForKey(key,name,inp);a.appendChild(lab);a.appendChild(inp);if(isCustom){const del=document.createElement('button');del.textContent='DELETE DOCUMENT TYPE';del.onclick=()=>deleteCustomDocument(name,key);a.appendChild(del);}} row.appendChild(a);return row; } async function uploadForKey(key,name,inp){const f=inp.files[0];if(!f)return;const old=await storeGet('documents',key);await storePut('documents',{key,label:name,fileName:f.name,type:f.type||'application/octet-stream',size:f.size,dateAdded:new Date().toISOString(),blob:f,shared:old?.shared||false});inp.value='';renderDocuments();} function addCustomDocument(){if(role!=='veteran')return;const name=document.getElementById('customDocName').value.trim();if(!name)return alert('Enter a document name.');const arr=JSON.parse(localStorage.getItem('vlv_custom_doc_names')||'[]');if(!arr.includes(name))arr.push(name);localStorage.setItem('vlv_custom_doc_names',JSON.stringify(arr));document.getElementById('customDocName').value='';renderDocuments();} async function deleteCustomDocument(name,key){if(!confirm('Delete this custom document type and its uploaded file?'))return;await storeDel('documents',key);let arr=JSON.parse(localStorage.getItem('vlv_custom_doc_names')||'[]');arr=arr.filter(x=>x!==name);localStorage.setItem('vlv_custom_doc_names',JSON.stringify(arr));renderDocuments();} async function removeFile(key){if(!confirm('Remove the uploaded file but keep this document slot?'))return;await storeDel('documents',key);renderDocuments();} async function toggleShare(key){const d=await storeGet('documents',key);if(!d)return;d.shared=!d.shared;await storePut('documents',d);renderDocuments();} async function viewDoc(key){const d=await storeGet('documents',key);if(!d)return;if(role==='family'&&!d.shared)return;openPreview(d);} async function downloadDoc(key){const d=await storeGet('documents',key);if(!d)return;if(role==='family'&&!d.shared)return;const u=URL.createObjectURL(d.blob);const a=document.createElement('a');a.href=u;a.download=d.fileName;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(u),1000);} /* FINANCIAL BILLS */ const fixedBillCategories=[ 'Electric', 'Natural Gas', 'Heating Oil / Propane', 'Water / Sewer', 'Trash / Recycling', 'Cable / Internet', 'Cell Phone', 'Home Phone', 'Mortgage / Rent', 'Car Loan', 'Auto Insurance', 'Health Insurance', 'Homeowners / Renters Insurance', 'Credit Cards', 'Personal Loans', 'Streaming Services', 'Pet Insurance', 'Pharmacy', 'Medical Bills' ]; function fixedBillData(){ return JSON.parse(localStorage.getItem('vlv_fixed_bills')||'{}'); } function saveFixedBillData(obj){ localStorage.setItem('vlv_fixed_bills',JSON.stringify(obj)); } function customBills(){ return JSON.parse(localStorage.getItem('vlv_custom_bills')||'[]'); } function saveCustomBills(arr){ localStorage.setItem('vlv_custom_bills',JSON.stringify(arr)); } function billEditor(name,key,isCustom){ const all=fixedBillData(); let rec=isCustom ? customBills().find(x=>x.key===key) : (all[key]||{}); rec=rec||{}; const wrap=document.createElement('div'); wrap.className='docRow'; wrap.innerHTML=`
${escapeHtml(name)}
${(rec.company||rec.phone||rec.web||rec.account||rec.notes)?'INFO ADDED':'NOT COMPLETED'}
${role==='veteran' ? `` : `
${escapeHtml(rec.company||'Not provided')}
`} ${role==='veteran' ? `` : `
${escapeHtml(rec.account||'Not provided')}
`} ${role==='veteran' ? `` : `
${escapeHtml(rec.phone||'Not provided')}
`} ${role==='veteran' ? `` : `
${escapeHtml(rec.web||'Not provided')}
`} ${role==='veteran' ? `` : `
${escapeHtml(rec.contact||'Not provided')}
`} ${role==='veteran' ? `` : `
${escapeHtml(rec.due||'Not provided')}
`} ${role==='veteran' ? `` : `
${escapeHtml(rec.notes||'Not provided')}
`}
Checking for uploaded bill...
${role==='veteran' ? `` : ''} ${role==='veteran' && isCustom ? `` : ''} `; setTimeout(()=>refreshBillAttachment(key),0); return wrap; } async function refreshBillAttachment(key){ if(!db)await initDB(); const box=document.querySelector(`[data-bill-attachment="${CSS.escape(key)}"]`); if(!box)return; const d=await storeGet('attachments','billfixed:'+key); box.innerHTML=''; const title=document.createElement('div'); title.className='attachName'; title.textContent=d?d.fileName:'No bill uploaded'; box.appendChild(title); const btns=document.createElement('div'); btns.className='attachBtns'; if(d){ btns.innerHTML=``; if(role==='veteran'){ btns.innerHTML+=``; } } if(role==='veteran'){ const id='billup_'+Math.random().toString(36).slice(2); const lab=document.createElement('label'); lab.className='secondary btnLabel'; lab.style.display='inline-block'; lab.style.width='auto'; lab.style.padding='7px 9px'; lab.style.margin='0'; lab.textContent=d?'REPLACE BILL':'UPLOAD BILL'; lab.htmlFor=id; const inp=document.createElement('input'); inp.id=id; inp.type='file'; inp.accept='.pdf,.png,.jpg,.jpeg,.webp,.doc,.docx'; inp.onchange=()=>uploadBillAttachment(key,inp); btns.appendChild(lab); btns.appendChild(inp); } box.appendChild(btns); } async function uploadBillAttachment(key,inp){ const f=inp.files[0]; if(!f)return; await storePut('attachments',{ key:'billfixed:'+key, fileName:f.name, type:f.type||'application/octet-stream', size:f.size, dateAdded:new Date().toISOString(), blob:f }); inp.value=''; refreshBillAttachment(key); } async function removeBillAttachment(key){ await storeDel('attachments','billfixed:'+key); refreshBillAttachment(key); } function saveOneBill(key,isCustom){ const inputs=[...document.querySelectorAll(`[data-bill="${CSS.escape(key)}"]`)]; const rec={}; inputs.forEach(el=>rec[el.dataset.field]=el.value.trim()); if(isCustom){ const arr=customBills(); const idx=arr.findIndex(x=>x.key===key); if(idx>=0){ arr[idx]={...arr[idx],...rec}; saveCustomBills(arr); } }else{ const all=fixedBillData(); all[key]=rec; saveFixedBillData(all); } alert('Bill information saved.'); renderBills(); } function addCustomBill(){ if(role!=='veteran')return; const name=document.getElementById('customBillName').value.trim(); if(!name)return alert('Enter a bill name.'); const arr=customBills(); const key='custombill:'+Date.now(); arr.push({key,name,company:'',account:'',phone:'',web:'',contact:'',due:'',notes:''}); saveCustomBills(arr); document.getElementById('customBillName').value=''; renderBills(); } async function removeCustomBill(key){ if(!confirm('Delete this custom bill and any uploaded statement?'))return; saveCustomBills(customBills().filter(x=>x.key!==key)); await storeDel('attachments','billfixed:'+key); renderBills(); } function renderBills(){ role=localStorage.getItem('vlv_demo_role')||role; toggleRoleUI(); const search=(document.getElementById('billSearch')?.value||'').toLowerCase(); const fixedWrap=document.getElementById('fixedBillList'); const customWrap=document.getElementById('customBillList'); if(!fixedWrap||!customWrap)return; fixedWrap.innerHTML=''; customWrap.innerHTML=''; const all=fixedBillData(); fixedBillCategories.forEach((name,idx)=>{ const key='fixedbill:'+idx; const rec=all[key]||{}; const hay=[name,rec.company,rec.account,rec.phone,rec.web,rec.contact,rec.due,rec.notes].join(' ').toLowerCase(); if(search && !hay.includes(search))return; fixedWrap.appendChild(billEditor(name,key,false)); }); customBills().forEach(rec=>{ const hay=[rec.name,rec.company,rec.account,rec.phone,rec.web,rec.contact,rec.due,rec.notes].join(' ').toLowerCase(); if(search && !hay.includes(search))return; customWrap.appendChild(billEditor(rec.name,rec.key,true)); }); if(!fixedWrap.children.length && !customWrap.children.length){ fixedWrap.innerHTML='
No matching bills found.
'; } } /* INSURANCE */ function insurance(){return JSON.parse(localStorage.getItem('vlv_insurance')||'[]');} function saveInsurance(a){localStorage.setItem('vlv_insurance',JSON.stringify(a));} async function addInsurance(){ if(role!=='veteran')return;const rec={id:Date.now(),type:v('insType'),company:v('insCompany'),agent:v('insAgent'),policy:v('insPolicy'),phone:v('insPhone'),web:v('insWeb'),notes:v('insNotes')}; if(!rec.type&&!rec.company)return alert('Enter a policy type or company.'); const file=document.getElementById('insFile').files[0];saveInsurance([...insurance(),rec]); if(file)await storePut('attachments',{key:'ins:'+rec.id,fileName:file.name,type:file.type||'application/octet-stream',size:file.size,dateAdded:new Date().toISOString(),blob:file}); ['insType','insCompany','insAgent','insPolicy','insPhone','insWeb','insNotes'].forEach(id=>document.getElementById(id).value='');document.getElementById('insFile').value='';renderInsurance(); } async function renderInsurance(){ role=localStorage.getItem('vlv_demo_role')||role;toggleRoleUI();const q=(document.getElementById('insuranceSearch')?.value||'').toLowerCase();const w=document.getElementById('insuranceList');if(!w)return;w.innerHTML=''; for(const r of insurance().filter(x=>Object.values(x).join(' ').toLowerCase().includes(q))){ const d=await storeGet('attachments','ins:'+r.id);const c=document.createElement('div');c.className='listCard'; c.innerHTML=`
${escapeHtml(r.type||'Insurance')} — ${escapeHtml(r.company||'')}
Agent/Broker: ${escapeHtml(r.agent||'—')} ${r.policy?'• Policy '+escapeHtml(r.policy):''}
${escapeHtml(r.phone||'')} ${escapeHtml(r.web||'')}
${r.notes?`
${escapeHtml(r.notes)}
`:''}`; if(d)c.appendChild(makeExistingAttachmentButtons('ins:'+r.id,d)); if(role==='veteran'){const del=document.createElement('button');del.className='secondary danger';del.textContent='REMOVE INSURANCE ENTRY';del.onclick=()=>{saveInsurance(insurance().filter(x=>x.id!==r.id));storeDel('attachments','ins:'+r.id);renderInsurance();};c.appendChild(del);} w.appendChild(c); } if(!w.children.length)w.innerHTML='
No matching insurance or broker contacts saved yet.
'; } /* IMPORTANT CONTACTS */ function contacts(){return JSON.parse(localStorage.getItem('vlv_contacts')||'[]');} function saveContacts(a){localStorage.setItem('vlv_contacts',JSON.stringify(a));} function addContact(){ if(role!=='veteran')return;const rec={id:Date.now(),name:v('contactName'),relationship:v('contactRelationship'),phone:v('contactPhone'),alt:v('contactAltPhone'),email:v('contactEmail'),address:v('contactAddress'),notes:v('contactNotes')}; if(!rec.name)return alert('Enter a name.');saveContacts([...contacts(),rec]);['contactName','contactRelationship','contactPhone','contactAltPhone','contactEmail','contactAddress','contactNotes'].forEach(id=>document.getElementById(id).value='');renderContacts(); } function renderContacts(){ role=localStorage.getItem('vlv_demo_role')||role;toggleRoleUI();const q=(document.getElementById('contactSearch')?.value||'').toLowerCase();const w=document.getElementById('contactList');if(!w)return;w.innerHTML=''; contacts().filter(x=>Object.values(x).join(' ').toLowerCase().includes(q)).forEach(r=>{const c=document.createElement('div');c.className='listCard';c.innerHTML=`
${escapeHtml(r.name)}
${escapeHtml(r.relationship||'')}
${escapeHtml(r.phone||'')} ${r.alt?'• '+escapeHtml(r.alt):''}
${escapeHtml(r.email||'')}
${r.address?`
${escapeHtml(r.address)}
`:''}${r.notes?`
${escapeHtml(r.notes)}
`:''}`;if(role==='veteran'){const del=document.createElement('button');del.className='secondary danger';del.textContent='REMOVE CONTACT';del.onclick=()=>{saveContacts(contacts().filter(x=>x.id!==r.id));renderContacts();};c.appendChild(del);}w.appendChild(c);}); if(!w.children.length)w.innerHTML='
No matching contacts saved yet.
'; } /* RESOURCES */ function customResources(){return JSON.parse(localStorage.getItem('vlv_custom_resources')||'[]');} function saveCustomResources(a){localStorage.setItem('vlv_custom_resources',JSON.stringify(a));} function addResource(){ if(role!=='veteran')return;const rec={id:Date.now(),name:v('resName'),type:v('resType'),phone:v('resPhone'),website:v('resWeb'),notes:v('resNotes'),custom:true};if(!rec.name)return alert('Enter a resource name.');saveCustomResources([...customResources(),rec]);['resName','resType','resPhone','resWeb','resNotes'].forEach(id=>document.getElementById(id).value='');renderResources(); } function renderResources(){ role=localStorage.getItem('vlv_demo_role')||role;toggleRoleUI();const q=(document.getElementById('resourceSearch')?.value||'').toLowerCase();const all=[...builtInResources,...customResources()];const w=document.getElementById('resourceList');if(!w)return;w.innerHTML=''; all.filter(r=>Object.values(r).join(' ').toLowerCase().includes(q)).forEach(r=>{const c=document.createElement('div');c.className='card';c.innerHTML=`
${escapeHtml(r.name)}
${escapeHtml(r.type||'')}
${r.phone?`
Phone: ${escapeHtml(r.phone)}
`:''}${r.notes?`
${escapeHtml(r.notes)}
`:''}${r.website?`OPEN RESOURCE ↗`:''}`;if(r.custom&&role==='veteran'){const del=document.createElement('button');del.className='secondary danger';del.textContent='REMOVE CUSTOM RESOURCE';del.onclick=()=>{saveCustomResources(customResources().filter(x=>x.id!==r.id));renderResources();};c.appendChild(del);}w.appendChild(c);}); if(!w.children.length)w.innerHTML='
No matching resources found.
'; } function webSearchResource(){const q=v('resourceSearch');if(!q)return alert('Enter what you want to find.');window.open('https://www.google.com/search?q='+encodeURIComponent(q+' veteran resource'),'_blank');} function v(id){return document.getElementById(id)?.value.trim()||'';} function fmtSize(b){if(b<1024)return b+' B';if(b<1048576)return(b/1024).toFixed(1)+' KB';return(b/1048576).toFixed(1)+' MB';} function escapeHtml(s){return String(s??'').replace(/[&<>"']/g,m=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[m]));} function escKey(s){return s.replace(/\\/g,'\\\\').replace(/'/g,"\\'");} localStorage.removeItem('vlv_demo_role'); initDB();