import{c as V}from"./crud-wQladZ3o.js";import{_ as B,a6 as P,b as y,c as f,o as n,g as r,w as i,f as S,e as d,h as s,F as p,i as C,t as x,a as A,k as O,T as E}from"./app-D7zH3Nl5.js";import{U as F}from"./UserInfo-BWGkklre.js";import{f as N}from"./fields-B1gNADCa.js";import{c as z}from"./index-Cu62pBdq.js";import{A as R}from"./AppstoreOutlined-De50NR7n.js";import{D as j}from"./DeleteOutlined-DI2CK1gU.js";import{E as K}from"./EditOutlined-Corvrvzt.js";import{P as M}from"./index-BUzTR6QN.js";import{B as q}from"./useFlexGapSupport-CpBR-RD-.js";import{I as G}from"./index-BMHCCBzd.js";import{S as H}from"./index-_ApNSgqk.js";import{_ as J,a as L}from"./index-Cv7zOydE.js";import{_ as Q}from"./index-Bso6TOMG.js";const W={props:{selectable:{default:!1},isPageTableContent:{default:!0},tableSize:{default:"large"},bordered:{default:!1},filters:{default:{}},perPageItems:Number},emits:["onRowSelection"],components:{PlusOutlined:M,EditOutlined:K,DeleteOutlined:j,AppstoreOutlined:R,EyeOutlined:z,ExclamationCircleOutlined:P,UserInfo:F},setup(l,{emit:U}){const{initData:u,recordViewColumns:o,filterableColumns:k,hashableColumns:D,multiDimensalObjectColumns:_}=N(),{permsArray:b,formatDateTime:v,formatDate:w}=A(),m=O(!1),c=O(void 0),I=e=>{c.value=e.x_lent_to,m.value=!0},h=()=>{c.value=void 0,m.value=!1},a=V();E(()=>{a.crudUrl.value="remove-asset-user",a.langKey.value="asset",a.initData.value={...u},a.formData.value={...u},a.hashableColumns.value={...D},a.multiDimensalObjectColumns.value={..._},g()});const g=()=>{const e=l.filters;var t={};e.user_id&&(t.user_id=e.user_id),e.asset_id&&(t.asset_id=e.asset_id),a.tableUrl.value={url:"asset-users?fields=id,xid,lend_date,return_date,actual_return_date,notes,asset_id,x_asset_id,asset{id,xid,name},lent_to,x_lent_to,user{id,xid,name,profile_image,profile_image_url},lent_by,x_lent_by,lentBy{id,xid,name,profile_image,profile_image_url},return_by,x_return_by,returnBy{id,xid,name,profile_image,profile_image_url}",extraFilters:t},a.table.filterableColumns=k,a.fetch({page:1})};return{permsArray:b,recordViewColumns:o,...a,filterableColumns:k,formatDateTime:v,formatDate:w,setUrlData:g,userOpen:m,userId:c,openUserView:I,closeUser:h}}},X={class:"table-responsive"};function Y(l,U,u,o,k,D){const _=y("UserInfo"),b=q,v=G,w=y("DeleteOutlined"),m=H,c=Q,I=L,h=J,a=y("admin-page-table-content"),g=y("user-view-page");return n(),f(p,null,[r(a,{isPageTableContent:u.isPageTableContent},{default:i(()=>[r(h,null,{default:i(()=>[r(I,{span:24},{default:i(()=>[S("div",X,[r(c,{"row-selection":{selectedRowKeys:l.table.selectedRowKeys,onChange:l.onRowSelectChange,getCheckboxProps:e=>({disabled:!1,name:e.xid})},columns:o.recordViewColumns,"row-key":e=>e.xid,"data-source":l.table.data,pagination:l.table.pagination,loading:l.table.loading,onChange:l.handleTableChange,bordered:u.bordered,size:u.tableSize},{bodyCell:i(({column:e,record:t})=>[e.dataIndex==="name"?(n(),d(b,{key:0,type:"link",onClick:T=>o.openUserView(t)},{default:i(()=>[r(_,{user:t.user},null,8,["user"])]),_:2},1032,["onClick"])):s("",!0),e.dataIndex==="lend_date"?(n(),f(p,{key:1},[C(x(o.formatDate(t.lend_date)),1)],64)):s("",!0),e.dataIndex==="return_date"?(n(),f(p,{key:2},[C(x(o.formatDate(t.return_date)),1)],64)):s("",!0),e.dataIndex==="actual_return_date"?(n(),f(p,{key:3},[C(x(t.actual_return_date?o.formatDate(t.actual_return_date):"-"),1)],64)):s("",!0),e.dataIndex==="image"?(n(),d(v,{key:4,width:32,src:t.user.profile_image_url},null,8,["src"])):s("",!0),e.dataIndex==="lend_by"?(n(),d(_,{key:5,user:t.lent_by},null,8,["user"])):s("",!0),e.dataIndex==="return_by"?(n(),d(_,{key:6,user:t.return_by},null,8,["user"])):s("",!0),e.dataIndex==="actual_return_date"?(n(),f(p,{key:7},[C(x(t.actual_return_date?t.actual_return_date:"-"),1)],64)):s("",!0),e.dataIndex==="action"?(n(),d(m,{key:8},{default:i(()=>[t.actual_return_date==null?(n(),d(b,{key:0,type:"primary",onClick:T=>l.showDeleteConfirm(t.xid),style:{"margin-left":"4px"}},{icon:i(()=>[r(w)]),_:2},1032,["onClick"])):s("",!0)]),_:2},1024)):s("",!0)]),_:1},8,["row-selection","columns","row-key","data-source","pagination","loading","onChange","bordered","size"])])]),_:1})]),_:1})]),_:1},8,["isPageTableContent"]),r(g,{visible:o.userOpen,userId:o.userId,onClosed:o.closeUser},null,8,["visible","userId","onClosed"])],64)}const me=B(W,[["render",Y]]);export{me as A};
