function decryptPII(customerId){var reason=document.getElementById("decrypt-reason").value;if(!reason){alert("Reason required");return;}var csrf=document.querySelector("meta[name=csrf-token]").content;fetch("index.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"system_action=verify&action=decrypt_pii&data[customer_id]="+customerId+"&data[reason]="+encodeURIComponent(reason)+"&_csrf="+csrf}).then(r=>r.json()).then(d=>{if(d.success){var el=document.getElementById("pii-result");el.innerHTML="<pre>"+JSON.stringify(d.data,null,2)+"</pre><p class=\"warning\">View-once -- this data will not be shown again.</p>";}else alert(d.error);});}
function resetCustomerPW(id){if(!confirm("Reset this customer password?"))return;var csrf=document.querySelector("meta[name=csrf-token]").content;fetch("index.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"system_action=modify&entity=customer&id="+id+"&data[password_reset]=1&_csrf="+csrf}).then(r=>r.json()).then(d=>alert(d.success?"Password reset":"Failed"));}
