import{_ as C,C as P}from"./AppLayout.vue_vue_type_script_setup_true_lang-kdLGGf-_.js";import{_ as p}from"./AppLogoIcon.vue_vue_type_script_setup_true_lang-BbjSNLws.js";import{d as $,D as j,C as N,E as S,a as m,o as a,e as n,b as s,u as t,h as A,k as d,g,w as l,l as k,i as c,F as x,B,t as u,G as F}from"./app-D_cNhTOt.js";import{P as I}from"./plus-t56nvEYA.js";import{S as D}from"./square-pen-BCS_m9lo.js";import{T as E}from"./trash-fclxUZA-.js";import{C as T,_ as V}from"./_plugin-vue_export-helper-CPlzugi-.js";import"./useForwardExpose-4P0NPntM.js";import"./VisuallyHidden-V0BOAZdg.js";import"./RovingFocusGroup-Ciyu9vLm.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./index-Z7dItZLR.js";import"./createLucideIcon-1FJ9MNCd.js";const q={class:"p-6"},O={class:"flex justify-between"},U={class:"flex space-x-2"},L={class:"w-full border text-left"},R={class:"bg-gray-100 dark:bg-neutral-900"},G={key:0,class:"p-2 border"},W={class:"p-2 border"},H={class:"p-2 border"},J={class:"p-2 border"},K={class:"p-2 border"},M={key:0,class:"p-2 border"},Q={key:0},X={key:0,class:"mt-6 flex items-center justify-center space-x-4"},Y={class:"text-sm text-gray-700"},Z={key:1,class:"mt-4 text-center text-sm text-gray-600"},ee=$({layout:C,__name:"Index",props:{user_operations:{},breadcrumbs:{}},setup(r){const y=r,f=j().props.auth?.user?.role??"user",h=N({name:"",email:""}),b=S();console.log("User operations props:",y.user_operations);const v=i=>{const e=y.user_operations.meta?.current_page||1,o=y.user_operations.meta?.per_page||10;return(e-1)*o+i+1},w=i=>{const e=i.project?.id,o=i.user?.id;!e||!o||confirm(`Are you sure you want to delete ${i.user.name} from ${i.project.name}?`)&&h.delete(`/fuzzy-operations/${e}/${o}`,{onSuccess:()=>b.success("User operation deleted successfully!"),onError:()=>b.error("Failed to delete user operation.")})},_=i=>{i&&F.visit(i)};return(i,e)=>(a(),m(x,null,[n(t(A),{title:"Stakeholder Analysis"}),s("div",q,[s("div",O,[e[4]||(e[4]=s("h1",{class:"text-2xl font-bold mb-4"},"Stakeholder Analysis",-1)),s("div",U,[t(f)==="admin"?(a(),g(t(p),{key:0,variant:"secondary","as-child":""},{default:l(()=>[n(t(k),{href:"/fuzzy-operations/finals"},{default:l(()=>[...e[2]||(e[2]=[c(" Fuzzy Operations Details ",-1)])]),_:1})]),_:1})):d("",!0),t(f)==="admin"?(a(),g(t(p),{key:1,variant:"default","as-child":""},{default:l(()=>[n(t(k),{href:"/fuzzy-operations/add-operations"},{default:l(()=>[n(t(I),{class:"h-4 w-4"}),e[3]||(e[3]=c(" Add Operation ",-1))]),_:1})]),_:1})):d("",!0)])]),s("table",L,[s("thead",R,[s("tr",null,[e[5]||(e[5]=s("th",{class:"p-2 border"},"No",-1)),e[6]||(e[6]=s("th",{class:"p-2 border"},"Project",-1)),e[7]||(e[7]=s("th",{class:"p-2 border"},"Stakeholders",-1)),e[8]||(e[8]=s("th",{class:"p-2 border"},"Weightage",-1)),t(f)==="admin"?(a(),m("th",G,"Actions")):d("",!0)])]),s("tbody",null,[(a(!0),m(x,null,B(r.user_operations.data,(o,z)=>(a(),m("tr",{key:o.id},[s("td",W,u(v(z)),1),s("td",H,u(o.project?.name),1),s("td",J,u(o.user?.name),1),s("td",K,u(o.finals?.front_weight),1),t(f)==="admin"?(a(),m("td",M,[t(f)==="admin"&&o.project.status==="requirement change"?(a(),g(t(p),{key:0,variant:"link","as-child":""},{default:l(()=>[n(t(k),{href:`/fuzzy-operations/edit-operations/${o.id}`},{default:l(()=>[n(t(D),{class:"h-4 w-4"}),e[9]||(e[9]=c(" Edit ",-1))]),_:1},8,["href"])]),_:2},1024)):d("",!0),t(f)==="admin"&&o.project.status==="requirement change"?(a(),g(t(p),{key:1,variant:"link",onClick:se=>w(o)},{default:l(()=>[n(t(E),{class:"h-4 w-4"}),e[10]||(e[10]=c(" Delete ",-1))]),_:1},8,["onClick"])):d("",!0)])):d("",!0)]))),128)),r.user_operations.data.length===0?(a(),m("tr",Q,[...e[11]||(e[11]=[s("td",{colspan:"5",class:"p-4 border text-center text-gray-500"}," No user operations found. ",-1)])])):d("",!0)])]),r.user_operations.meta&&r.user_operations.meta.last_page>1?(a(),m("div",X,[n(t(p),{variant:"outline",size:"sm",disabled:!r.user_operations.links.prev,onClick:e[0]||(e[0]=o=>_(r.user_operations.links.prev))},{default:l(()=>[n(t(T),{class:"h-4 w-4"}),e[12]||(e[12]=c(" Previous ",-1))]),_:1},8,["disabled"]),s("span",Y," Page "+u(r.user_operations.meta.current_page)+" of "+u(r.user_operations.meta.last_page),1),n(t(p),{variant:"outline",size:"sm",disabled:!r.user_operations.links.next,onClick:e[1]||(e[1]=o=>_(r.user_operations.links.next))},{default:l(()=>[e[13]||(e[13]=c(" Next ",-1)),n(t(P),{class:"h-4 w-4"})]),_:1},8,["disabled"])])):d("",!0),r.user_operations.meta?(a(),m("div",Z," Showing "+u(r.user_operations.meta.from)+" to "+u(r.user_operations.meta.to)+" of "+u(r.user_operations.meta.total)+" results ",1)):d("",!0)])],64))}}),ye=V(ee,[["__scopeId","data-v-ed8cad6a"]]);export{ye as default};
