Spaces:
Running
Running
Add public booking feed panel
Browse files- index.html +3 -1
index.html
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
<section class="hero"><h1>I'M GOING TO JAIL</h1><p>Press once before arrest and your prepared plan is activated, routed, and monitored. Verified 918 and BBT utility can unlock configured automation tiers.</p><button id="emergency" class="emergency" disabled>START<br>EMERGENCY<br>HELP</button><div id="ready" class="small" style="color:#ffe1e1">Complete setup below to enable the button.</div></section>
|
| 8 |
<div class="grid"><section class="card"><h2>One-time assisted setup</h2><p class="small">The setup assistant saves only the information needed to route your request. It cannot grant permissions without your approval.</p><form id="setup"><label for="name">Full legal name</label><input id="name" autocomplete="name" required><label for="dob">Date of birth</label><input id="dob" type="date" required><label for="phone">Your mobile phone</label><input id="phone" type="tel" autocomplete="tel" required><label for="county">County</label><select id="county"><option>Tulsa</option><option>Oklahoma</option><option>Rogers</option><option>Cleveland</option></select><label for="booking">Booking number, if already known</label><input id="booking" autocomplete="off"><label for="bondphone">Preferred bondsman phone</label><input id="bondphone" type="tel" placeholder="Optional, for one-tap calling"><label for="token918">918 token balance (1 token = $1,000 utility value)</label><input id="token918" type="number" min="0" placeholder="Preview until wallet verification is connected"><label for="bbt">BBT balance (1 BBT = $0.10 utility value)</label><input id="bbt" type="number" min="0" placeholder="Preview until wallet verification is connected"><label class="check"><input id="consent" type="checkbox" required><span>I consent to this information being sent to my selected bondsman and reviewed by a licensed bondsman.</span></label><button class="save" type="submit">Save emergency plan and prepare permissions</button></form><div id="setupstatus" class="status hidden"></div></section>
|
| 9 |
<aside class="card"><h2>Prepared plan</h2><div id="plan"><div class="step"><span class="dot">1</span><span>Save your identity and contact details.</span></div><div class="step"><span class="dot">2</span><span>Allow location if you want it attached to the request.</span></div><div class="step"><span class="dot">3</span><span>Allow notifications for status updates.</span></div><div class="step"><span class="dot">4</span><span>Press the emergency button before arrest.</span></div></div><button id="edit" class="secondary hidden" style="width:100%;margin-top:12px">Edit saved plan</button><p class="privacy">This tool prepares and routes information. It does not determine eligibility, identify a person automatically, contact a jail as an agent, or replace a licensed bondsman, attorney, emergency services, or legal advice.</p></aside></div>
|
|
|
|
| 10 |
<div id="result" class="card hidden" style="margin-top:18px"><h2>Emergency request</h2><div id="resulttext" class="status"></div><div id="calls" class="calls"></div></div>
|
| 11 |
</main><script>
|
| 12 |
const key='918_bail_emergency_profile_v1';const qs=s=>document.querySelector(s);const profile=()=>JSON.parse(localStorage.getItem(key)||'null');const configured=(window.BAILBONDS_API||((window.BAILBONDS_CONFIG||{}).apiBase)||new URLSearchParams(location.search).get('api')||'').replace(/\/$/,'');let timer;
|
|
@@ -17,5 +18,6 @@ qs('#setup').addEventListener('submit',async e=>{e.preventDefault();const data={
|
|
| 17 |
function showResult(text,kind=''){qs('#result').classList.remove('hidden');qs('#resulttext').className='status '+kind;qs('#resulttext').textContent=text;const p=profile();qs('#calls').innerHTML=p?.bondphone?'<a class="save" href="tel:'+encodeURIComponent(p.bondphone)+'">Call preferred bondsman</a>':''}
|
| 18 |
async function watch(id){clearInterval(timer);timer=setInterval(async()=>{try{const r=await fetch(configured+'/api/public/requests/'+encodeURIComponent(id),{cache:'no-store'});if(!r.ok)return;const d=await r.json();showResult('Reference: '+id+'\nLive status: '+d.status+'\nA licensed bondsman must review and respond.','good');if(['reviewed','closed'].includes(d.status))clearInterval(timer)}catch(_){}} ,5000)}
|
| 19 |
qs('#emergency').addEventListener('click',async()=>{const p=profile();if(!p||!p.consent)return;qs('#emergency').disabled=true;showResult('Preparing your emergency packet…');let coords={latitude:null,longitude:null};try{if(navigator.geolocation)coords=await new Promise(resolve=>navigator.geolocation.getCurrentPosition(x=>resolve({latitude:x.coords.latitude,longitude:x.coords.longitude}),()=>resolve(coords),{timeout:5000}))}catch(_){}const payload={full_name:p.name,date_of_birth:p.dob,phone:p.phone,county:p.county,booking_number:p.booking||'',consent:true,emergency:true,location:coords,token_918_balance:p.token918||0,bbt_balance:p.bbt||0,token_balances_verified:false,source:'918-pre-arrest-emergency-plan'};if(!configured){const id='offline_'+Date.now();localStorage.setItem('918_last_emergency',JSON.stringify({id,payload,createdAt:new Date().toISOString()}));showResult('Emergency packet prepared on this device. No live API is configured, so it could not be transmitted.\n\nCall your preferred bondsman now or connect the app to its API.','warn');qs('#emergency').disabled=false;return}try{const r=await fetch(configured+'/api/intake',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)});const d=await r.json();if(!r.ok)throw Error(d.error||'The live service rejected the request');showResult('Reference: '+d.request_id+'\nLive status: '+d.status+'\nYour prepared emergency plan is active.\nAutomation tier: '+(d.automation?.tier||'standard')+' — '+(d.automation?.label||'workflow request received')+'\nA licensed bondsman must review and respond.','good');watch(d.request_id)}catch(err){localStorage.setItem('918_last_emergency',JSON.stringify({payload,createdAt:new Date().toISOString()}));showResult('The live service could not be reached. Your emergency packet is saved locally for retry.\n\n'+err.message,'warn');qs('#emergency').disabled=false}});
|
| 20 |
-
|
|
|
|
| 21 |
</script></body></html>
|
|
|
|
| 7 |
<section class="hero"><h1>I'M GOING TO JAIL</h1><p>Press once before arrest and your prepared plan is activated, routed, and monitored. Verified 918 and BBT utility can unlock configured automation tiers.</p><button id="emergency" class="emergency" disabled>START<br>EMERGENCY<br>HELP</button><div id="ready" class="small" style="color:#ffe1e1">Complete setup below to enable the button.</div></section>
|
| 8 |
<div class="grid"><section class="card"><h2>One-time assisted setup</h2><p class="small">The setup assistant saves only the information needed to route your request. It cannot grant permissions without your approval.</p><form id="setup"><label for="name">Full legal name</label><input id="name" autocomplete="name" required><label for="dob">Date of birth</label><input id="dob" type="date" required><label for="phone">Your mobile phone</label><input id="phone" type="tel" autocomplete="tel" required><label for="county">County</label><select id="county"><option>Tulsa</option><option>Oklahoma</option><option>Rogers</option><option>Cleveland</option></select><label for="booking">Booking number, if already known</label><input id="booking" autocomplete="off"><label for="bondphone">Preferred bondsman phone</label><input id="bondphone" type="tel" placeholder="Optional, for one-tap calling"><label for="token918">918 token balance (1 token = $1,000 utility value)</label><input id="token918" type="number" min="0" placeholder="Preview until wallet verification is connected"><label for="bbt">BBT balance (1 BBT = $0.10 utility value)</label><input id="bbt" type="number" min="0" placeholder="Preview until wallet verification is connected"><label class="check"><input id="consent" type="checkbox" required><span>I consent to this information being sent to my selected bondsman and reviewed by a licensed bondsman.</span></label><button class="save" type="submit">Save emergency plan and prepare permissions</button></form><div id="setupstatus" class="status hidden"></div></section>
|
| 9 |
<aside class="card"><h2>Prepared plan</h2><div id="plan"><div class="step"><span class="dot">1</span><span>Save your identity and contact details.</span></div><div class="step"><span class="dot">2</span><span>Allow location if you want it attached to the request.</span></div><div class="step"><span class="dot">3</span><span>Allow notifications for status updates.</span></div><div class="step"><span class="dot">4</span><span>Press the emergency button before arrest.</span></div></div><button id="edit" class="secondary hidden" style="width:100%;margin-top:12px">Edit saved plan</button><p class="privacy">This tool prepares and routes information. It does not determine eligibility, identify a person automatically, contact a jail as an agent, or replace a licensed bondsman, attorney, emergency services, or legal advice.</p></aside></div>
|
| 10 |
+
<section class="card" style="margin-top:18px"><h2>Public Tulsa booking feed</h2><p class="small">Shows only fields the configured source permits for public display. Refreshes every 60 seconds; the source may cache reports for up to one hour.</p><div id="booking-feed" class="status">Checking booking feed…</div></section>
|
| 11 |
<div id="result" class="card hidden" style="margin-top:18px"><h2>Emergency request</h2><div id="resulttext" class="status"></div><div id="calls" class="calls"></div></div>
|
| 12 |
</main><script>
|
| 13 |
const key='918_bail_emergency_profile_v1';const qs=s=>document.querySelector(s);const profile=()=>JSON.parse(localStorage.getItem(key)||'null');const configured=(window.BAILBONDS_API||((window.BAILBONDS_CONFIG||{}).apiBase)||new URLSearchParams(location.search).get('api')||'').replace(/\/$/,'');let timer;
|
|
|
|
| 18 |
function showResult(text,kind=''){qs('#result').classList.remove('hidden');qs('#resulttext').className='status '+kind;qs('#resulttext').textContent=text;const p=profile();qs('#calls').innerHTML=p?.bondphone?'<a class="save" href="tel:'+encodeURIComponent(p.bondphone)+'">Call preferred bondsman</a>':''}
|
| 19 |
async function watch(id){clearInterval(timer);timer=setInterval(async()=>{try{const r=await fetch(configured+'/api/public/requests/'+encodeURIComponent(id),{cache:'no-store'});if(!r.ok)return;const d=await r.json();showResult('Reference: '+id+'\nLive status: '+d.status+'\nA licensed bondsman must review and respond.','good');if(['reviewed','closed'].includes(d.status))clearInterval(timer)}catch(_){}} ,5000)}
|
| 20 |
qs('#emergency').addEventListener('click',async()=>{const p=profile();if(!p||!p.consent)return;qs('#emergency').disabled=true;showResult('Preparing your emergency packet…');let coords={latitude:null,longitude:null};try{if(navigator.geolocation)coords=await new Promise(resolve=>navigator.geolocation.getCurrentPosition(x=>resolve({latitude:x.coords.latitude,longitude:x.coords.longitude}),()=>resolve(coords),{timeout:5000}))}catch(_){}const payload={full_name:p.name,date_of_birth:p.dob,phone:p.phone,county:p.county,booking_number:p.booking||'',consent:true,emergency:true,location:coords,token_918_balance:p.token918||0,bbt_balance:p.bbt||0,token_balances_verified:false,source:'918-pre-arrest-emergency-plan'};if(!configured){const id='offline_'+Date.now();localStorage.setItem('918_last_emergency',JSON.stringify({id,payload,createdAt:new Date().toISOString()}));showResult('Emergency packet prepared on this device. No live API is configured, so it could not be transmitted.\n\nCall your preferred bondsman now or connect the app to its API.','warn');qs('#emergency').disabled=false;return}try{const r=await fetch(configured+'/api/intake',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)});const d=await r.json();if(!r.ok)throw Error(d.error||'The live service rejected the request');showResult('Reference: '+d.request_id+'\nLive status: '+d.status+'\nYour prepared emergency plan is active.\nAutomation tier: '+(d.automation?.tier||'standard')+' — '+(d.automation?.label||'workflow request received')+'\nA licensed bondsman must review and respond.','good');watch(d.request_id)}catch(err){localStorage.setItem('918_last_emergency',JSON.stringify({payload,createdAt:new Date().toISOString()}));showResult('The live service could not be reached. Your emergency packet is saved locally for retry.\n\n'+err.message,'warn');qs('#emergency').disabled=false}});
|
| 21 |
+
async function refreshBookings(){const box=qs('#booking-feed');if(!configured){box.textContent='Booking feed is not connected on this static demo. Connect the live API to display authorized public records.';return}try{const r=await fetch(configured+'/api/public/bookings',{cache:'no-store'});const d=await r.json();if(d.status==='not_configured'){box.textContent='Booking source is not configured.';return}if(!d.records?.length){box.textContent=d.status==='source_unavailable'?'Booking source unavailable.':'No public booking records returned.';return}box.innerHTML='<strong>'+d.count+' records</strong> · fetched '+new Date(d.fetched_at).toLocaleString()+'<br><br>'+d.records.map(x=>'<div style="padding:8px 0;border-bottom:1px solid #dfe5ef"><strong>'+String(x.name||x.booking_id||'Booking record').replace(/[<>]/g,'')+'</strong> · '+String(x.status||'booked').replace(/[<>]/g,'')+'<br><span class="small">'+String(x.booked_at||'time unavailable').replace(/[<>]/g,'')+' · '+String(x.charges||'charges unavailable').replace(/[<>]/g,'')+'</span></div>').join('')}catch(_){box.textContent='Booking feed temporarily unavailable.'}}
|
| 22 |
+
refresh();refreshBookings();setInterval(refresh,5000);setInterval(refreshBookings,60000);
|
| 23 |
</script></body></html>
|