import{u as g,a as m,j as a,c2 as n,_ as x,Q as c,c_ as S,a0 as j,gQ as y}from"./bundle.CHKSNOJF.js";import{E as C,a as o,t as _,A as l}from"./transactions-F2lekek9.js";import{u as f}from"./useResolveCurrencySeparator-C_jvzuRW.js";function k(e){const[t]=g(),i=m();return a.jsxs(a.Fragment,{children:[e.page==="edit"&&a.jsx(n,{leftSide:t("status"),children:a.jsx(C,{transaction:e.transaction})}),a.jsx(n,{required:!0,leftSide:t("type"),children:a.jsx(x,{value:e.transaction.base_type===l.Credit?o.Deposit:o.Withdrawal,onValueChange:r=>e.handleChange("base_type",r===o.Deposit?l.Credit:l.Debit),errorMessage:e.errors?.errors.base_type,cypressRef:"transactionTypeSelector",style:{color:i.$3,colorScheme:i.$0},customSelector:!0,dismissable:!1,searchable:!1,children:Object.values(_).map(r=>a.jsx("option",{value:r,children:t(r)},r))})}),a.jsx(n,{leftSide:t("date"),children:a.jsx(c,{style:{color:i.$3,colorScheme:i.$0},type:"date",value:e.transaction.date,onValueChange:r=>e.handleChange("date",r),errorMessage:e.errors?.errors.date})}),a.jsx(n,{leftSide:t("amount"),children:a.jsx(S,{border:!0,precision:e.currencySeparators.precision,className:"auto",value:e.transaction.amount||"",onValueChange:r=>e.handleChange("amount",Number(r)),errorMessage:e.errors?.errors.amount})}),a.jsx(n,{required:!0,leftSide:t("currency"),children:a.jsx(j,{value:e.transaction.currency_id,onChange:r=>e.handleChange("currency_id",r),errorMessage:e.errors?.errors.currency_id})}),a.jsx(n,{required:!0,leftSide:t("bank_account"),children:a.jsx(y,{value:e.transaction.bank_integration_id,onChange:r=>e.handleChange("bank_integration_id",r.id),onClearButtonClick:()=>e.handleChange("bank_integration_id",""),errorMessage:e.errors?.errors.bank_integration_id})}),a.jsx(n,{leftSide:t("description"),children:a.jsx(c,{style:{color:i.$3,colorScheme:i.$0},element:"textarea",value:e.transaction.description,onValueChange:r=>e.handleChange("description",r),errorMessage:e.errors?.errors.description})}),e.page==="edit"&&a.jsxs(a.Fragment,{children:[e.transaction.participant&&a.jsx(n,{leftSide:t("participant"),children:a.jsx(c,{value:e.transaction.participant,readOnly:!0})}),e.transaction.participant_name&&a.jsx(n,{leftSide:t("participant_name"),children:a.jsx(c,{value:e.transaction.participant_name,readOnly:!0})})]})]})}function F(e){const t=f(),{setErrors:i,setCurrencySeparators:r,setTransaction:h}=e;return(d,u)=>{if(i(void 0),d==="currency_id"){const s=t(u.toString());s&&r(s)}h(s=>s&&{...s,[d]:u})}}export{k as T,F as u};
