1import{_ as x}from"./BOTbgVa7.js";import{_ as z}from"./DEJwBMoO.js";import{_ as k}from"./CcJgpBVX.js";import{d as V,m as E,a6 as U,A,aU as B,o as c,c as i,g as u,b as p,F as C,r as N,a as T,D as F,E as L,H as D,L as v,aI as R}from"./Cg_qdefa.js";import"./BHbHFFDQ.js";import"./Cn4RZxmQ.js";import"./DlAUqK2U.js";import"./DIinTs-4.js";import"./B8u5AL1p.js";const Z={class:"row gap-6 my-4 relative"},$={class:"row justify-content-center mt-2 mb-6"},O=V({__name:"index",async setup(j){let n,m;const _=E(),{data:r,error:q,status:d,refresh:y}=([n,m]=U(()=>R("/api/user/agreements","$rw_Brv-GmS")),n=await n,m(),n),l=v([]);d.value==="success"&&r.value&&f();const t=v(!1);A(d,e=>{t.value=e==="pending"});function f(){r.value&&(l.value=[],r.value.data.forEach(e=>{const s=[];e.options.forEach(a=>{typeof a=="boolean"?s.push({key:a,value:a?"Tak":"Nie"}):s.push({key:a,value:a})}),l.value.push({name:e.name,label:e.label,value:e.value,options:s})}))}async function h(){try{const e={};l.value.forEach(a=>{e[a.name]=a.value}),(await $fetch("/api/user/agreements",{method:"PUT",body:{data:e}})).success&&(_.success("Zgody zostaÅy zapisane"),await y())}catch{_.error("WystÄ
piÅ bÅÄ
d podczas zapisywania zgód",{timeout:2500})}}return B(()=>{f()}),(e,s)=>{const a=x,b=z,w=k;return c(),i("div",Z,[u(a,{show:p(t)},null,8,["show"]),(c(!0),i(C,null,N(p(l),o=>(c(),i("div",{class:"col-12",key:o.label},[u(b,{label:o.label,options:o.options,modelValue:o.value,"onUpdate:modelValue":g=>o.value=g},null,8,["label","options","modelValue","onUpdate:modelValue"])]))),128)),T("div",$,[u(w,{type:"button",loading:p(t),"onUpdate:loading":s[0]||(s[0]=o=>D(t)?t.value=o:null),"without-icon":"",onClick:h,class:"col-6 col-sm-3 col-md-2"},{default:F(()=>[...s[1]||(s[1]=[L("Zapisz zgody",-1)])]),_:1},8,["loading"])])])}}});export{O as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.