PageSourceSearch

https://app.ethicog.ai/_nuxt/Db_72qDO.js

js ethicog.ai collected 2026-10-05 15:34:12 UTC 4,763 bytes, 1 lines download raw bytes

1import{_ as P}from"./CiOIIpu6.js";import{_ as R}from"./B3FytjbN.js";import{a4 as M,a2 as G,S as H,r as S,w as Z,c as w,d as q,g as h,h as z,i as l,Z as e,k as m,$ as J,F as K,e as p,p as _,a0 as Q,a5 as V}from"./9h935L-y.js";import{_ as W}from"./M-1EgL-0.js";import{_ as X}from"./wR52EOm_.js";import{_ as Y}from"./D6PF6Rvr.js";import{_ as ee}from"./C73ufj0m.js";import{_ as oe}from"./DEyu9955.js";import{_ as te}from"./De0ffHPU.js";import{g as ae}from"./BCOlBF-O.js";import{u as se,a as le,b as ne}from"./BpUbMxDc.js";import{T as re}from"./_Rpeq1Iu.js";import"./DbDqPIt5.js";import{u as ie}from"./DoERKxhI.js";import"./7PtWc7Km.js";import"./DmZq9Sap.js";import"./CrMijtuD.js";import"./Dsi2VH74.js";import"./TAgu7HZC.js";import"./DlDJFx8X.js";import"./Db764XlN.js";import"./hVCpGeW3.js";import"./UccViGix.js";import"./BpXJftin.js";const ce={class:"flex justify-between"},de={class:"flex gap-2"},ue={class:"flex flex-col gap-4"},me={class:"flex justify-between gap-4"},pe={class:"flex items-center gap-2"},Oe={__name:"[slug]",setup(_e){const L=M().params.slug,d=G(),U=se(),y=le(),c=H({}),u=S(!1),b=S(null),g=re,{data:r,isLoading:x,refetch:T}=ne({where:{slug:L}});Z(r,t=>{if(!(typeof t>"u"))if(t){const a=g.shape,n=Object.keys(a).reduce((s,o)=>{if(o in t)s[o]=t[o];else{const i=a[o].defaultValue;i!==void 0&&(s[o]=i)}return s},{});Object.assign(c,n)}else V("/admin/tool-categories")});const j=ie(r,c,g),D=w(()=>{var a;return[{icon:"i-heroicons-folder-open",label:"Catégories d'outils",to:"/admin/tool-categories"},{label:(a=r.value)==null?void 0:a.name}]}),f=w(()=>U.isPending.value||x.value||y.isPending.value),F=t=>{const a=Object.keys(g.shape).reduce((n,s)=>(["id","createdAt","updatedAt"].includes(s)||s in t.data&&(n[s]=t.data[s]),n),{});U.mutateAsync({data:a,where:{id:r.value.id}}).then(()=>{d.add({title:"Succès",description:"La catégorie d'outils a été modifiée avec succès.",color:"green"})}).catch(()=>{d.add({title:"Erreur",description:"Une erreur est survenue lors de la modification de la catégorie d'outils.",color:"red"})}).finally(()=>{T()})},$=()=>{u.value=!0},B=()=>{u.value=!1},E=()=>{y.mutateAsync({where:{id:r.value.id}}).then(()=>{d.add({title:"Succès",description:"La catégorie d'outils a été supprimée avec succès.",color:"green"}),V("/admin/tools")}).catch(()=>{d.add({title:"Erreur",description:"Une erreur est survenue lors de la suppression de la catégorie d'outils.",color:"red"})}).finally(()=>{u.value=!1})},I=async t=>{const a="tool-category",n=r.value.slug,s=t[0],o=new FormData;if(o.append("file",s),o.append("type",a),o.append("slug",n),s){b.value=URL.createObjectURL(s);try{await $fetch("/api/blob",{method:"PUT",body:o}),d.add({title:"Succès",description:"L'image a été mise à jour avec succès.",color:"green"})}catch(i){console.error("Erreur lors de l'upload:",i),d.add({title:"Erreur",description:i.data.message||"Une erreur est survenue lors de l'upload de l'image.",color:"red"})}}};return(t,a)=>{const n=P,s=R,o=Q,i=W,C=X,k=Y,A=ee,N=oe,O=te;return p(),q(K,null,[e(x)?(p(),h(n,{key:0,class:"w-full h-full"})):e(r)?(p(),h(N,{key:1,state:e(c),schema:e(g),onSubmit:F},{default:m(()=>[l(A,null,{header:m(()=>[_("div",ce,[l(s,{divider:"/",links:e(D)},null,8,["links"]),_("div",de,[l(o,{color:"red",label:"Supprimer",icon:"i-heroicons-trash",onClick:$}),l(o,{color:"primary",label:"Enregistrer",icon:"i-heroicons-check",type:"submit",disabled:!e(j)},null,8,["disabled"])])])]),default:m(()=>[_("div",ue,[_("div",me,[l(C,{label:"Nom",name:"name"},{default:m(()=>[l(i,{modelValue:e(c).name,"onUpdate:modelValue":a[0]||(a[0]=v=>e(c).name=v),class:"max-w-xs",loading:e(f),disabled:e(f)},null,8,["modelValue","loading","disabled"])]),_:1})]),l(C,{label:"Image",name:"thumbnail"},{default:m(()=>[_("div",pe,[e(b)?(p(),h(k,{key:0,src:e(b),placeholder:"/images/placeholder.png",alt:e(c).name,class:"rounded-md h-24"},null,8,["src","alt"])):(p(),h(k,{key:1,src:("getThumbnailUrl"in t?t.getThumbnailUrl:e(ae))("tool-category",e(r).slug),placeholder:"/images/placeholder.png",alt:e(c).name,class:"rounded-md h-24"},null,8,["src","alt"])),l(i,{type:"file",accept:"image/jpeg, image/png",onCh
1ange:I,loading:e(f),disabled:e(f),class:"max-w-xs"},null,8,["loading","disabled"])])]),_:1})])]),_:1})]),_:1},8,["state","schema"])):z("",!0),l(O,{modelValue:e(u),"onUpdate:modelValue":a[1]||(a[1]=v=>J(u)?u.value=v:null),title:"Supprimer",description:"Êtes-vous sûr de vouloir supprimer cette catégorie d'outils ?",icon:"i-heroicons-exclamation-circle",ui:{icon:{base:"text-red-500 dark:text-red-400"},footer:{base:"ml-16"}}},{footer:m(()=>[l(o,{color:"white",label:"Annuler",onClick:B}),l(o,{color:"red",label:"Supprimer",loading:t.loading,onClick:E},null,8,["loading"])]),_:1},8,["modelValue"])],64)}}};export{Oe 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.