1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[84533],{16485:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(71847).A)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},20508:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(71847).A)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},24009:(e,a,t)=>{t.d(a,{I:()=>l});var r=t(95155),n=t(17751),s=t(17002);function l(e){let{module:a,canDelete:t,...l}=e,{hasPermission:i}=(0,s.J)();return(0,r.jsx)(n.I,{...l,module:a,canDelete:null!=t?t:i(a,"Delete")})}},26983:(e,a,t)=>{t.d(a,{A:()=>r});let r=(0,t(71847).A)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},30729:(e,a,t)=>{t.d(a,{q:()=>d});var r=t(95155),n=t(83209),s=t(16485),l=t(26983),i=t(20508);let o=e=>{if(!e)return"-";try{let a=new Date(e);if(isNaN(a.getTime()))return"-";let t=a.getDate().toString().padStart(2,"0"),r=(a.getMonth()+1).toString().padStart(2,"0"),n=a.getFullYear(),s=a.getHours().toString().padStart(2,"0"),l=a.getMinutes().toString().padStart(2,"0");return"".concat(t,".").concat(r,".").concat(n," ").concat(s,":").concat(l)}catch(e){return"-"}};function d(e){let{createdAt:a,updatedAt:t,updatedBy:d,className:c,isEdit:u=!1}=e;return u?(0,r.jsx)(n.Zp,{className:c,children:(0,r.jsxs)(n.Wu,{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md bg-gray-200 flex items-center justify-center",children:(0,r.jsx)(s.A,{className:"h-4 w-4 text-gray-900"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"OluÅturulma Tarihi"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:o(a)})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md bg-gray-200 flex items-center justify-center",children:(0,r.jsx)(l.A,{className:"h-4 w-4 text-gray-900"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"G\xfcncellenme Tarihi"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:o(t)})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md bg-gray-200 flex items-center justify-center",children:(0,r.jsx)(i.A,{className:"h-4 w-4 text-gray-900"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Son D\xfczenleyen"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:(null==d?void 0:d.trim())||"Hen\xfcz kayıtlı deÄil"})]})]})]})}):null}},33789:(e,a,t)=>{t.d(a,{p:()=>l});var r=t(95155),n=t(12115),s=t(25016);let l=n.forwardRef((e,a)=>{let{className:t,type:n,...l}=e;return(0,r.jsx)("input",{type:n,autoComplete:"off",className:(0,s.cn)("flex h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 transition-colors",t),ref:a,...l})});l.displayName="Input"},65663:(e,a,t)=>{t.d(a,{g:()=>d});var r=t(18720),n=t(12115),s=t(38620),l=t(23700);let i=async()=>{await (0,s.d)()};async function o(e,a,t,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{onSuccess:o,onError:d,successMessage:c,errorMessage:u="İÅlem sırasında bir hata oluÅtu",errorMessagesByStatus:m,suppressErrorStatuses:p,headers:x}=s;try{let t={Accept:l.n2,...x||{}};void 0!==n&&(t["Content-Type"]="application/json");let s=await fetch(e,{method:a,headers:t,...void 0!==n&&{body:JSON.stringify(n)}});if(204===s.status){c&&r.toast.success(c),null==o||o();return}let d=await (0,l.j)(s,{signOut:i});return c&&r.toast.success(c),null==o||o(),d}catch(a){if(a instanceof l.fp&&401===a.status)throw a;console.error("API Hatası:",a);let e=a instanceof l.fp?null==m?void 0:m[a.status]:void 0;throw a instanceof l.fp&&(null==p?void 0:p.includes(a.status))===!0||r.toast.error(e||(null==a?void 0:a.message)||u),null==d||d(a),a}}function d(){return(0,n.useMemo)(()=>({create:(e,a,t,r)=>o("/api/proxy".concat(e),"POST",a,t,{successMessage:"İÅlem baÅarıyla tamamlandı",...r}),update:(e,a,t,r)=>o("/api/proxy".concat(e),"PATCH",a,t,{successMessage:"İÅlem baÅarıyla tamamlandı",...r}),remove:(e,a,t)=>o("/api/proxy".concat(e),"DELETE",a,void 0,{successMessage:"İÅlem baÅarıyla tamamlandı",...t}),get:(e,a,t)=>o("/api/proxy".concat(e),"GET",a,void 0,t),post:(e,a,t,r)=>o("/api/proxy".concat(e),"POST",a,t,{successMessage:"İÅlem baÅarıyla tamamlandı",...r}),put:(e,a,t,r)=>o("/api/proxy".concat(e),"PUT",a,t,{successMessage:"İÅlem baÅarıyla tamamlandı",...r})}),[])}},66350:(e,a,t)=>{t.d(a,{S:()=>l});var r=t(95155),n=t(4509),s=t(33789);function l(e){let{form:a,name:t,label:l,placeholder:i,type:o="text",disabled:d}=e;return(0,r.jsx)(n.zB,{control:a.control,name:t,render:e=>{let{field:a,fieldState:t}=e;return(0,r.jsxs)(n.eI,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between min-h-[20px]",children:[(0,r.jsx)(n.lR,{className:"text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:l}),t.error&&(0,r.jsx)(n.C5,{className:"text-xs font-medium text-destructive m-0"})]}),(0,r.jsx)(n.MJ,{children:(0,r.jsx)(s.p,{type:o,placeholder:i,...a,className:t.error?"border-destructive":"",disabled:d})})]})}})}},83209:(e,a,t)=>{t.d(a,{BT:()=>u,Wu:()=>m,ZB:()=>c,Zp:()=>o,aR:()=>d,wL:()=>p});var r=t(95155),n=t(12115),s=t(25016),l=t(82180),i=t(80021);let o=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)("div",{ref:a,className:(0,s.cn)("rounded-lg border bg-card text-card-foreground shadow-custom",t),...n})});
1o.displayName="Card";let d=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)("div",{ref:a,className:(0,s.cn)("flex flex-col space-y-1.5 py-2 px-4 border-b ",t),...n})});d.displayName="CardHeader";let c=n.forwardRef((e,a)=>{let{className:t,tooltip:n,children:o,...d}=e;return(0,r.jsxs)("div",{ref:a,className:(0,s.cn)("text-[16px] lg:h-[40px] lg:!leading-[40px] text-[#111827] font-semibold tracking-tight flex items-center gap-2",t),...d,children:[(0,r.jsx)("span",{children:o}),n&&(0,r.jsx)(l.Bc,{delayDuration:0,children:(0,r.jsxs)(l.m_,{children:[(0,r.jsx)(l.k$,{asChild:!0,children:(0,r.jsx)("span",{className:"ml-1 align-middle cursor-pointer flex items-center",onMouseDown:e=>e.preventDefault(),onTouchStart:e=>e.preventDefault(),children:(0,r.jsx)(i.A,{className:"inline h-4 w-4 text-muted-foreground"})})}),(0,r.jsxs)(l.ZI,{sideOffset:8,side:"top",align:"center",className:"text-[13px] leading-[14px] border-none shadow-none -mt-4 bg-black text-white max-w-[200px]",children:[(0,r.jsx)(l.PR,{className:"fill-black -mt-[1px]"}),n]})]})})]})});c.displayName="CardTitle";let u=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)("div",{ref:a,className:(0,s.cn)("text-sm text-muted-foreground",t),...n})});u.displayName="CardDescription";let m=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)("div",{ref:a,className:(0,s.cn)("p-4 ",t),...n})});m.displayName="CardContent";let p=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)("div",{ref:a,className:(0,s.cn)("flex items-center p-4 md:p-6 pt-0",t),...n})});p.displayName="CardFooter"},84533:(e,a,t)=>{t.r(a),t.d(a,{default:()=>C});var r=t(95155),n=t(20063),s=t(22544),l=t(66942),i=t(5440),o=t(4509),d=t(33789),c=t(83209),u=t(24009),m=t(19355),p=t(12115),x=t(64868),h=t(30729),g=t(65663),y=t(66350),f=t(17002),v=t(20779),j=t(10719);let _=i.Ik({country_code:i.Yj().min(2),currency:i.Yj().optional(),price:i.ai().min(0,"Kargo \xfccreti negatif olamaz"),free_over_amount:i.ai().min(0,"\xdccretsiz kargo eÅiÄi negatif olamaz").nullable().optional(),enabled:i.zM()}),b=i.Ik({name:i.Yj().min(1,"Ad alanı zorunludur"),days_to_deliver:i.ai().min(1,"Teslim s\xfcresi en az 1 g\xfcn olmalıdır"),price:i.ai().min(0,"Kargo \xfccreti negatif olamaz"),free_over_amount:i.ai().min(0,"\xdccretsiz kargo eÅiÄi negatif olamaz").nullable().optional(),market_rates:i.YO(_),is_active:i.zM()});function N(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=Number(e);return Number.isFinite(t)&&t>=0?t:a}function k(e){if(null==e||""===e)return null;let a=Number(e);return Number.isFinite(a)&&a>=0?a:null}function w(e,a,t,r){let n=new Map((Array.isArray(e)?e:[]).map(e=>[(0,j.Vm)(null==e?void 0:e.country_code),e]).filter(e=>{let[a]=e;return!!a}));return a.map(e=>{let a=n.get(e.code),s=k(null==a?void 0:a.free_over_amount);return{country_code:e.code,currency:String((null==a?void 0:a.currency)||e.currency||"").toUpperCase(),price:N(null==a?void 0:a.price,t),free_over_amount:a?s:r,enabled:!!a&&!1!==a.enabled}})}function C(e){var a;let{accessToken:t,id:i,shippingMethod:_}=e,C=!!i,S=(0,n.useRouter)(),M=(0,g.g)(),[z,A]=(0,p.useState)(!1),{hasPermission:T}=(0,f.J)(),R=(0,v.E)(),D=R.options,B=T(m.n.ShippingMethods,"Update"),V=T(m.n.ShippingMethods,"Create"),I=T(m.n.ShippingMethods,"Get"),O=!B&&I,E=Number((null==_?void 0:_.price)||0),K=(null==_?void 0:_.free_over_amount)==null?null:Number(_.free_over_amount),J=(0,s.mN)({resolver:(0,l.u)(b),defaultValues:{name:(null==_?void 0:_.name)||"",days_to_deliver:Number((null==_?void 0:_.days_to_deliver)||1),price:E,free_over_amount:K,market_rates:w(null==_?void 0:_.market_rates,D,E,K),is_active:null==(a=null==_?void 0:_.is_active)||a}}),F=J.watch("market_rates")||[];(0,p.useEffect)(()=>{if(_){var e;let a=Number(_.price||0),t=null==_.free_over_amount?null:Number(_.free_over_amount);J.reset({name:_.name||"",days_to_deliver:Number(_.days_to_deliver||1),price:a,free_over_amount:t,market_rates:w(_.market_rates,D,a,t),is_active:null==(e=_.is_active)||e})}},[_,J,D]),(0,p.useEffect)(()=>{if(_)return;let e=J.getValues("market_rates")||[],a=new Set(e.map(e=>
1(0,j.Vm)(e.country_code)).filter(Boolean)),t=D.map(e=>e.code);(e.length!==D.length||t.some(e=>!a.has(e)))&&J.setValue("market_rates",w(e,D,N(J.getValues("price")),k(J.getValues("free_over_amount"))),{shouldDirty:!1,shouldValidate:!1})},[_,J,D]);let P=(e,a)=>{let t=F.map((t,r)=>r===e?{...t,...a}:t);J.setValue("market_rates",t,{shouldDirty:!0,shouldValidate:!0})},Z=async e=>{try{var a,r;A(!0);let n={name:e.name,days_to_deliver:e.days_to_deliver,price:e.price,free_over_amount:null==e.free_over_amount?null:e.free_over_amount,market_rates:e.market_rates.filter(e=>e.enabled&&(0,j.Vm)(e.country_code)).map(e=>({country_code:(0,j.Vm)(e.country_code),currency:String(e.currency||"").toUpperCase(),price:N(e.price),free_over_amount:null==e.free_over_amount?null:N(e.free_over_amount),enabled:!0})),is_active:e.is_active,translations:{tr:{name:e.name},en:{name:(null==_||null==(r=_.translations)||null==(a=r.en)?void 0:a.name)||e.name}}};C?(await M.update("/shipping-methods/".concat(i),t,n,{successMessage:"Kargo y\xf6ntemi baÅarıyla g\xfcncellendi",errorMessage:"Kargo y\xf6ntemi g\xfcncellenirken bir hata oluÅtu"}),await fetch("/api/revalidate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:"shipping-method-".concat(i)})}),await fetch("/api/revalidate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:"shipping-methods"})}),(0,x.j)(e=>Array.isArray(e)&&"string"==typeof e[0]&&e[0].startsWith("/api/proxy/shipping-methods"),void 0,{revalidate:!0})):(await M.create("/shipping-methods",t,n,{successMessage:"Kargo y\xf6ntemi baÅarıyla oluÅturuldu",errorMessage:"Kargo y\xf6ntemi oluÅturulurken bir hata oluÅtu"}),await fetch("/api/revalidate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:"shipping-methods"})}),(0,x.j)(e=>Array.isArray(e)&&"string"==typeof e[0]&&e[0].startsWith("/api/proxy/shipping-methods"),void 0,{revalidate:!0})),S.push("/shipping-methods")}catch(e){console.error("Form g\xf6nderme hatası:",e)}finally{A(!1)}},H=async()=>{if(i)try{A(!0),await M.remove("/shipping-methods/".concat(i),t,{successMessage:"Kargo y\xf6ntemi baÅarıyla silindi",errorMessage:"Kargo y\xf6ntemi silinirken bir hata oluÅtu",onSuccess:()=>{S.push("/shipping-methods")}})}catch(e){console.error("Silme hatası:",e)}finally{A(!1)}};return(0,r.jsx)(o.lV,{...J,children:(0,r.jsx)("form",{onSubmit:J.handleSubmit(Z),autoComplete:"off",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-4 pb-20",children:[(0,r.jsxs)("div",{className:"col-span-1 md:col-span-3 grid gap-4",children:[(0,r.jsxs)(c.Zp,{children:[(0,r.jsx)(c.aR,{children:(0,r.jsx)(c.ZB,{children:"Detay"})}),(0,r.jsx)(c.Wu,{children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsx)(y.S,{form:J,name:"name",label:"Ad",placeholder:"Kargo y\xf6ntemi adı",disabled:O}),(0,r.jsx)(o.zB,{control:J.control,name:"days_to_deliver",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.eI,{children:[(0,r.jsx)(o.lR,{children:"Teslim S\xfcresi (G\xfcn)"}),(0,r.jsx)(o.MJ,{children:(0,r.jsx)(d.p,{type:"number",placeholder:"Teslim s\xfcresi",...a,onChange:e=>a.onChange(parseInt(e.target.value)||0),disabled:O})}),(0,r.jsx)(o.C5,{})]})}}),(0,r.jsx)(o.zB,{control:J.control,name:"price",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.eI,{children:[(0,r.jsx)(o.lR,{children:"Varsayılan Kargo \xdccreti"}),(0,r.jsx)(o.MJ,{children:(0,r.jsx)(d.p,{type:"number",step:"0.01",min:"0",placeholder:"0.00",...a,onChange:e=>a.onChange(parseFloat(e.target.value)||0),disabled:O})}),(0,r.jsx)(o.C5,{})]})}}),(0,r.jsx)(o.zB,{control:J.control,name:"free_over_amount",render:e=>{var a;let{field:t}=e;return(0,r.jsxs)(o.eI,{children:[(0,r.jsx)(o.lR,{children:"Varsayılan \xdccretsiz Kargo EÅiÄi"}),(0,r.jsx)(o.MJ,{children:(0,r.jsx)(d.p,{type:"number",step:"0.01",min:"0",placeholder:"BoÅ bırakılırsa uygulanmaz",value:null!=(a=t.value)?a:"",onChange:e=>t.onChange(""===e.target.value?null:parseFloat(e.target.value)||0),disabled:O})}),(0,r.jsx)(o.C5,{})]})}}),(0,r.jsx)(o.zB,{control:J.control,name:"is_active",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.eI,{className:"md:col-span-2",children:[(0,r.jsx)(o.lR,{children:"Durum"}),(0,r.jsxs)("label",{className:"flex items-center gap-2 rounded-md border border-zinc-200 px-3 py-3 text-sm",children:[(0,r.jsx)("input",{type:"checkbox",checked:!!a.value,onChange:e=>a.onChange(e.target.checked),disabled:O}),(0,r.jsx)("span",{children:"Kargo y\xf6ntemi aktif"})]}),(0,r.jsx)(o.C5,{})]})}})]})})]}),(0,r.jsxs)(c.Zp,{children:[(0,r.jsx)(c.aR,{children:(0,r.jsx)(c.ZB,{children:"\xdclke Bazlı \xdccretler"})}),(0,r.jsxs)(c.Wu,{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-sm text-zinc-500",children:["Bir market i\xe7in \xf6zel \xfccret a\xe7ılmazsa yukarıdaki varsayılan \xfccret kullanılır.",R.isLoading?" Market listesi y\xfckleniyor...":""]}),(0,r.jsx)("div",{className:"space-y-3",children:F.map((e,a)=>{var t;let n=D.find(a=>a.code===e.country_code),s=e.currency||(null==n?void 0:n.currency)||"";return(0,r.jsxs)("div",{className:"grid gap-3 rounded-md border border-zinc-200 p-3 md:grid-cols-[minmax(180px,1fr)_160px_190px]",children:[(0,r.jsxs)("label",{className:"flex items-center gap-3 text-sm font-medium text-zinc-900",children:[(0,r.jsx)("input",{type:"checkbox",checked:!!e.enabled,onChange:e=>P(a,{enabled:e.target.checked}),disabled:O}),(0,r.jsxs)("span",{children:[(null==n?void 0:n.label)||e.country_code,(0,r.jsxs)("span",{className:"ml-1 text-xs font-normal text-zinc-500",children:["(",e.country_code," \xb7 ",s||"-",")"]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(o.lR,{className:"text-xs text-zinc-500",children:"\xdccret"}),(0,r.jsx)(d.p,{type:"number",step:"0.01",min:"0",value:e.price,onChange:e=>P(a,{price:parseFloat(e.target.value)||0}),disabled:O||!e.enabled})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(o.lR,{className:"text-xs text-zinc-500",children:"\xdccretsiz eÅik"}),(0,r.jsx)(d.p,{type:"number",step:"0.01",min:"0",placeholder:"Yok",value:null!=(t=e.free_over_amount)?t:"",onChange:e=>P(a,{free_over_amount:""===e.target.value?null:parseFloat(e.target.value)||0}),disabled:O||!e.enabled})]})]},e.country_code)})}),(0,r.jsx)(u.I,{loading:z,isEdit:C,disabled:z||O||!B&&!V,onSubmit:J.handleSubmit(Z),onDelete:H,module:m.n.ShippingMethods})]})]})]}),(0,r.jsx)("div",{className:"col-span-1 md:col-span-1 space-y-4",children:(0,r.jsx)(h.q,{createdAt:null==_?void 0:_.created_at,updatedAt:null==_?void 0:_.updated_at,updatedBy:null==_?void 0:_.updated_by,isEdit:C})})]})})})}}}]);
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.