PageSourceSearch

https://ticaretyolu.ziraatbank.com.tr/assets/ScheduledTransactionCreate.js

js ziraatbank.com.tr collected 2026-09-24 09:22:49 UTC 6,038 bytes, 1 lines download raw bytes

1import{u as e,f as a,h as t,i as s,r,a2 as l,a3 as n,bd as o,j as c,G as i,n as d,H as m,B as u,Q as h,U as x,a as j,a4 as p,d as g,b9 as y,O as C}from"./index.js";import{B as b}from"./Box.js";import{P as v}from"./Page.js";import{B as _}from"./Breadcrumb.js";import{S as f}from"./Select.js";import{D as S}from"./Datepicker.js";import{A}from"./Alert.js";import{C as N}from"./CurrencyInput.js";import{C as k}from"./constants.js";import{g as D,c as z,e as L}from"./scheduledTransaction.js";import{s as I}from"./ScheduledTransactionCreate.module.js";const B=()=>{const{t:B}=e(),{isBankStaff:Y}=a(),{setModal:w,closeModal:M}=t(),E=s(),[T,F]=r.useState(""),[H,O]=r.useState(!1),{data:R,isLoading:V}=D(),{mutate:P,isLoading:U}=z(),{control:W,handleSubmit:G,formState:{errors:K,isValid:Q},watch:q,setValue:J}=l({resolver:n(L(B)),mode:"onChange"}),X=q("category"),Z=q("subCategory"),$=q("detail"),ee=q("amount"),ae=q("currency"),te=q("transactionDate"),se=q("type");r.useEffect((()=>{X?(F(X),J("subCategory",""),J("detail","")):F("")}),[X,J]);const re=r.useMemo((()=>R&&Array.isArray(R)?R.filter((e=>{var a,t;return"planlanan"!==(null==(a=e.name)?void 0:a.toLowerCase())&&"planlanan"!==(null==(t=e.key)?void 0:t.toLowerCase())})).map((e=>({value:e.key,label:e.name}))):[]),[R]),le=()=>{var e;if(!T||!R)return[];const a=R.find((e=>e.key===T));return(null==(e=null==a?void 0:a.subCategories)?void 0:e.length)?a.subCategories.map((e=>({value:e.key,label:e.name}))):[]},ne=()=>{var e,a;if(!Z||!R)return[];const t=R.find((e=>e.key===T)),s=null==(e=null==t?void 0:t.subCategories)?void 0:e.find((e=>e.key===Z));return(null==(a=null==s?void 0:s.subCategories)?void 0:a.length)?s.subCategories.map((e=>({value:e.key,label:e.name}))):[]},oe=ne(),ce=oe.length>0,ie=r.useMemo((()=>{const e="string"==typeof ee?o(ee):ee;return!!X&&!!Z&&(!ce||!!$)&&!!e&&e>0&&!!ae&&!!te&&!!se&&Q}),[X,Z,$,ce,ee,ae,te,se,Q]);return H?c.jsx(v,{children:c.jsxs(b,{children:[c.jsx(i,{className:"mb-5",children:c.jsxs(d,{children:[c.jsx(m,{level:1,children:B("title.scheduled_transaction_create_title")}),c.jsx(_,{})]})}),c.jsx(i,{children:c.jsx(d,{size:12,children:c.jsx(A,{appearance:u.SUCCESS,icon:"tick-2",direction:"horizontal",children:B("text.scheduled_transaction_create_success")})})}),c.jsxs(i,{className:"mt-4",children:[c.jsx(d,{size:12,md:6,lg:6,className:"mb-3 mb-md-0",children:c.jsx(h,{appearance:x.INK,isBlock:!0,onClick:()=>E.push(j.FINANCIAL_ANALYSIS_CASHFLOW_SCHEDULED_TRANSACTIONS),children:B("text.scheduled_transactions_title")})}),c.jsx(d,{size:12,md:6,lg:6,children:c.jsx(h,{appearance:x.CTA,isBlock:!0,onClick:()=>E.push(j.FINANCIAL_ANALYSIS_CASHFLOW),children:B("text.cash_flow_analysis")})})]})]})}):V?null:c.jsx(v,{children:c.jsxs(b,{children:[c.jsx(i,{className:"mb-5",children:c.jsxs(d,{children:[c.jsx(m,{level:1,children:B("title.scheduled_transaction_create_title")}),c.jsx(_,{})]})}),c.jsx(i,{className:"mb-4",children:c.jsx(d,{size:12,children:c.jsx("p",{children:B("text.cash_flow_management_description")})})}),c.jsxs("form",{onSubmit:G((e=>{const a="string"==typeof e.amount?o(e.amount):e.amount,t=e.transactionDate&&g(e.transactionDate).isValid()?g(e.transactionDate).format("YYYY-MM-DD"):"",s=ne().length>0;P({category:s?e.subCategory:e.category,subCategory:s?e.detail:e.subCategory,amount:a,currency:e.currency,transactionDate:t,type:e.type},{onSuccess:()=>{O(!0)},onError:e=>{y(e)||w({content:C(e),noCloseIcon:!0,approveButtonText:"btn.ok",onApprove:()=>{M()}})}})})),children:[c.jsxs(i,{className:"mb-4 ".concat(I.formRow),children:[c.jsx(d,{lg:ce?4:6,md:ce?4:6,size:12,children:c.jsx(p,{name:"category",control:W,render:({onChange:e,value:a,...t})=>c.jsx(f,{...t,value:a,onChange:a=>{e(a.value)},label:B("text.category"),items:re,placeholder:B("text.category_placeholder"),error:K.category})})}),c.jsx(d,{lg:ce?4:6,md:ce?4:6,size:12,children:c.jsx(p,{name:"subCategory",control:W,render:({onChange:e,value:a,...t})=>c.jsx(f,{...t,value:a,onChange:a=>{e(a.value),J("detail","")},label:B("text.sub_category_label"),items:le(),placeholder:B("text.sub_category_placeholder"),isDisabled:!T||0===le().length,hasEmpty:!0,error:K.subCategory})})}),ce&&c.jsx(d,{lg:4,md:4,size:12,children:c.jsx(p,{name:"detail",control:W,render:({onChange:e,value:a,...t})=>r.createElement(f,{...t,key:"detail-".concat(Z||"nosub"),value:a,onChange:a=>e(a.value),label:B("text.detail"),items:oe,placeholder:B("text.detail_placeholder"),error:K.detail})})})]}),c.jsxs(i,{className:"mb-4 ".concat(I.formRow),children:[c.jsx(d,{lg:6,md:6,size:12,children:c.jsx(p,{name:"amount",control:W,render:({onChange:e,value:a,...t})=>c.jsx(N,{...t,label:B("text.amount"),placeholder:B("text.amount_placeholder"),value:a,onChange:a=>{e(a)},error:K.amount,maxLength:20,hideIncreased:!0})})}),c.jsx(d,{lg:6,md:6,size:12,children:c.jsx(p,{name:"currency",control:W,render:({onChange:e,value:a,...t})=>c.jsx(f,{...t,value:a,onChange:a=>e(a.value),label:B("text.currency"),items:k,placeholder:B("text.currency_placeholder"),error:K.currency})})})]}),c.jsxs(i,{className:"mb-4 ".concat(I.formRow),children:[c.jsx(d,{lg:6,md:6,size:12,children:c.jsx(p,{name:"transactionDate",control:W,render:({onChange:e,value:a,...t})=>{const s=a&&g(a).isValid()?g(a).format("YYYY-MM-DD"):"";return c.jsx(S,{...t,label:B("text.transaction_date"),placeholder:B("text.transaction_date_placeholder"),mode:"single",value:s,onChange:a=>{a.start&&e(a.start)},error:K.transactionDate})}})}),c.jsx(d,{lg:6,md:6,size:12,children:c.jsx(p,{name:"type",control:W,render:({onChange:e,value:a,...t})=>c.jsx(f,{...t,value:a,onChange:a=>e(a.value),label:B("text.collection_payment_type"),items:[{value:"Payment",label:B("text.payment")},{value:"Collection",label:B("text.collection")}],placeholder:B("text.collection_payment_type_placeholder"),error:K.type})})})]}),c.jsxs(i,{className:"mt-4",children:[c.jsx(d,{size:6,md:6,lg:6,children:null}),c.jsx(d,{size:12,md:6,lg:6,children:c.jsx(h,{type:"submit",appearance:x.CTA,isBlock:!0,isDisabled:!ie||U||Y,children:B("text.add")})})]})]})]})})};export{B as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.