import{_ as N,a as H,r as j,aR as q,aX as z,E as F,d as M,G as R,e as c,o as f,g as x,c as t,w as e,F as C,i as s,t as l,j as G,f as J,J as v,az as L,aD as U,aE as W,n as X,v as K,A as O,aL as Q,bi as Y,av as Z,ah as tt,bj as et,aw as at}from"./app-DGDivIsO.js";import{P as ot}from"./ProductSearchInput-DOAaszRn.js";import{d as nt}from"./datatable-Cnt5bvOi.js";import{E as st,f as lt}from"./ExportTable-DVHni2a8.js";import{A as rt}from"./AdminPageHeader-ff2SFNbk.js";import"./filter-_TPdNMe8.js";import"./FilePdfOutlined-sFW7F47J.js";import"./PrinterOutlined-zjsA7tiW.js";import"./fields-DMP5eaRW.js";import"./FileExcelOutlined-Cuxlntse.js";import"./index-C2QBqMxH.js";const _t={components:{ProductSearchInput:ot,AdminPageHeader:rt,ExprotTable:st},setup(){const{permsArray:a,selectedWarehouse:m,willSubscriptionModuleVisible:w,formatAmountCurrency:_}=H(),{url:$,stockAlertColumns:T,stockAlertHashableColumns:b}=lt(),p=j(void 0),g=q(),o=nt();z(()=>{(!(a.value.includes("products_view")||a.value.includes("admin"))||!w("reports"))&&g.push("admin.dashboard.index")}),F(()=>{d()});const d=()=>{o.tableUrl.value={url:$,filters:{"products.id":p.value},extraFilters:{fetch_stock_alert:!0}},o.hashable.value=[...b],o.exportDetails.value={allowExport:!0,exportType:"stock_alert_reports"},o.fetch({page:1})},h=M(()=>{let n=0;return o.table.data.forEach(i=>{n+=i.details.current_stock}),{totalCurrentStock:n}});return R(m,(n,i)=>{d()}),{stockAlertColumns:T,...o,searchProductId:p,getTableData:d,permsArray:a,totals:h,formatAmountCurrency:_}}},ut={class:"table-responsive"};function ct(a,m,w,_,$,T){const b=c("ExprotTable"),p=L,g=c("router-link"),o=U,d=W,h=c("AdminPageHeader"),n=X,i=c("ProductSearchInput"),k=K,E=c("admin-page-filters"),P=O,S=Q,y=Y,A=Z,V=tt,I=et,B=at,D=c("admin-page-table-content");return f(),x(C,null,[t(h,null,{header:e(()=>[t(p,{title:a.$t("menu.stock_alert"),class:"p-0"},{extra:e(()=>[t(b,{exportType:"stock_alert_reports",tableName:"stock-alert-reports-table",title:`${a.$t("menu.stock_alert")} ${a.$t("menu.reports")}`},null,8,["title"])]),_:1},8,["title"])]),breadcrumb:e(()=>[t(d,{separator:"-",style:{"font-size":"12px"}},{default:e(()=>[t(o,null,{default:e(()=>[t(g,{to:{name:"admin.dashboard.index"}},{default:e(()=>[s(l(a.$t("menu.dashboard")),1)]),_:1})]),_:1}),t(o,null,{default:e(()=>[s(l(a.$t("menu.reports")),1)]),_:1}),t(o,null,{default:e(()=>[s(l(a.$t("menu.stock_alert")),1)]),_:1})]),_:1})]),_:1}),t(E,null,{default:e(()=>[t(k,{gutter:[16,16]},{default:e(()=>[t(n,{xs:24,sm:24,md:12,lg:10,xl:10}),t(n,{xs:24,sm:24,md:12,lg:14,xl:14},{default:e(()=>[t(k,{gutter:[16,16],justify:"end"},{default:e(()=>[t(n,{xs:24,sm:24,md:12,lg:10,xl:6},{default:e(()=>[t(i,{onValueChanged:m[0]||(m[0]=r=>{_.searchProductId=r,_.getTableData()})})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(D,null,{default:e(()=>[t(k,null,{default:e(()=>[t(n,{span:24},{default:e(()=>[G("div",ut,[t(B,{columns:_.stockAlertColumns,"row-key":r=>r.xid,"data-source":a.table.data,pagination:a.table.pagination,loading:a.table.loading,onChange:a.handleTableChange,id:"stock-alert-reports-table",bordered:"",size:"middle"},{bodyCell:e(({column:r,record:u})=>[r.dataIndex==="name"?(f(),J(S,{key:0},{default:e(()=>[t(P,{shape:"square",src:u.image_url},null,8,["src"]),s(" "+l(u.name),1)]),_:2},1024)):v("",!0),r.dataIndex==="current_stock"?(f(),x(C,{key:1},[s(l(`${u.details.current_stock} ${u.unit.short_name}`),1)],64)):v("",!0),r.dataIndex==="stock_quantitiy_alert"?(f(),x(C,{key:2},[s(l(`${u.details.stock_quantitiy_alert} ${u.unit.short_name}`),1)],64)):v("",!0)]),summary:e(()=>[t(I,null,{default:e(()=>[t(y,{"col-span":1}),t(y,{"col-span":1},{default:e(()=>[t(A,{strong:""},{default:e(()=>[s(l(a.$t("common.total")),1)]),_:1})]),_:1}),t(y,{"col-span":1},{default:e(()=>[t(A,{strong:""},{default:e(()=>[t(V,null,{default:e(()=>[s(l(_.totals.totalCurrentStock),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["columns","row-key","data-source","pagination","loading","onChange"])])]),_:1})]),_:1})]),_:1})],64)}const Ct=N(_t,[["render",ct]]);export{Ct as default};
