import{w,j as l}from"./index-d895656a.js";import{D as Y,P as g,a as e,b as I,V as i,T as s,c as M}from"./index-8076412e.js";const S=x=>{const y=Math.ceil(x.length/2);return[x.slice(0,y),x.slice(y)]};function z({stockTransferOutData:x,companyData:y,locationData:H,authorizationData:n}){var c,o,C;const v=[{label:"Doc No:",value:x==null?void 0:x.code},{label:"Date:",value:w(x==null?void 0:x.date).format("DD-MM-YYYY")},{label:"From Location:",value:(c=x==null?void 0:x.from_location)==null?void 0:c.name},{label:"To Location:",value:(o=x==null?void 0:x.to_location)==null?void 0:o.name},{label:"Remarks:",value:x==null?void 0:x.description}],[R,_]=S(v);return l.jsx(Y,{children:l.jsxs(g,{size:"A4",style:e.body,children:[l.jsx(I,{companyData:y,locationData:H}),l.jsx(i,{style:[e.bid,{marginTop:30}],children:l.jsx(s,{style:e.content,children:"Stock Transfer Out"})}),l.jsx(i,{style:e.tablefeilds,children:l.jsxs(i,{style:e.tableRow,children:[l.jsx(i,{style:e.column,children:R.map((d,h)=>l.jsxs(i,{style:e.itemRow,children:[l.jsx(s,{style:e.labelCell,children:d.label}),l.jsx(s,{style:e.valueCell,children:d.value})]},`left-${h}`))}),l.jsx(i,{style:e.column,children:_.map((d,h)=>l.jsxs(i,{style:e.itemRow,children:[l.jsx(s,{style:e.labelCell,children:d.label}),l.jsx(s,{style:e.valueCell,children:d.value})]},`right-${h}`))})]})}),l.jsxs(i,{style:e.table,children:[l.jsxs(i,{style:e.tableRow,children:[l.jsx(s,{style:[e.tableCellHeader,{flex:.5}],children:"SI No"}),l.jsx(s,{style:[e.tableCellHeader,{flex:2}],children:"Item"}),l.jsx(s,{style:[e.tableCellHeader,{flex:2}],children:"Quantity"}),l.jsx(s,{style:[e.tableCellHeader,{flex:1}],children:"Unit"}),l.jsx(s,{style:[e.tableCellHeader,{flex:2}],children:"Warehouse"})]}),(C=x==null?void 0:x.soitems)==null?void 0:C.map((d,h)=>{var j,r,p,m;return console.log("pi_code :",(j=d==null?void 0:d.peipiis)==null?void 0:j.map(b=>{var t;return(t=b==null?void 0:b.p_indent)==null?void 0:t.code})),console.log("pi items:",d==null?void 0:d.peipiis),l.jsxs(i,{style:e.tableRow,wrap:!1,children:[l.jsx(s,{style:[e.tableCell,{flex:.5}],children:h+1},h),l.jsx(s,{style:[e.tableCell,{flex:2}],children:(r=d.item)==null?void 0:r.name},h),l.jsx(s,{style:[e.tableCell,{flex:2}],children:parseInt(d.qty)},h),l.jsx(s,{style:[e.tableCell,{flex:1}],children:(p=d.unit)==null?void 0:p.name},h),l.jsxs(s,{style:[e.tableCell,{flex:2}],children:["  ",(m=d==null?void 0:d.warehouse)==null?void 0:m.name]},h)]})})]}),l.jsxs(i,{style:e.table,children:[l.jsxs(i,{style:e.tableRow,children:[l.jsx(s,{style:[e.tableCellHeader,{flex:.5}],children:"SI No"}),l.jsx(s,{style:[e.tableCellHeader,{flex:.5}],children:"Level"}),l.jsx(s,{style:[e.tableCellHeader,{flex:2}],children:"Authorization By"}),l.jsx(s,{style:[e.tableCellHeader,{flex:2}],children:"Status"}),l.jsx(s,{style:[e.tableCellHeader,{flex:2}],children:"Authorized On"})]}),n==null?void 0:n.map((d,h)=>{var j;return l.jsxs(i,{style:e.tableRow,wrap:!1,children:[l.jsx(s,{style:[e.tableCell,{flex:.5}],children:h+1},h),l.jsx(s,{style:[e.tableCell,{flex:.5}],children:d.authorized_level},h),l.jsx(s,{style:[e.tableCell,{flex:2}],children:(j=d.authorized_by)==null?void 0:j.username},h),l.jsx(s,{style:[e.tableCell,{flex:2}],children:d.authorized_status_name},h),l.jsxs(s,{style:[e.tableCell,{flex:2}],children:[" ",w(d.authorized_on).format("DD-MM-YYYY - HH:mm:ss")]},h)]})})]}),l.jsx(M,{companyData:y,selectedData:x})]})})}export{z as S};
