PageSourceSearch

https://app.uetdskamu.com/assets/admin.mobile-version-Cq5HwZfj.js

js uetdskamu.com collected 2026-10-02 00:57:56 UTC 8,902 bytes, 1 lines download raw bytes

1import{r as s,ba as O,bb as $,bc as G,bd as R,be as Z,bf as Y,bg as q,j as e,aw as H,B as j,I as m,c as i}from"./index-XzWw1KPV.js";import{u as J,s as Q,F as W}from"./zod-CJ7tmwcf.js";import{I as h}from"./InputFormItem-3t6aupps.js";import{S as v}from"./SubmitButton-Bj9hJwib.js";const te=function(){const[c,b]=s.useState("package-settings"),{data:u,isPending:z}=O(),{mutate:U,isPending:k}=$(),{data:l,isPending:V}=G(),{mutate:A,isPending:N}=R(),[F,K]=s.useState("100"),[S,C]=s.useState("10"),{data:d,isPending:w}=Z(),{mutate:E,isPending:P}=Y(),[_,T]=s.useState([]),n=J({resolver:Q(q),defaultValues:{forceVersion:"",optionalVersion:"",iosStoreUrl:"",androidStoreUrl:""}});s.useEffect(()=>{u!=null&&u.data&&n.reset(u.data)},[u,n]),s.useEffect(()=>{l!=null&&l.data&&(K(String(l.data.monthlyIncludedTarget)),C(String(l.data.lessThanFourteenDaysIncludedTarget)))},[l==null?void 0:l.data]),s.useEffect(()=>{d!=null&&d.data&&T(d.data.map(a=>({code:a.code,name:a.name,isUnlimited:a.is_unlimited,maxVehicleCount:a.max_vehicle_count==null?"":String(a.max_vehicle_count),monthlyPriceTl:a.monthly_price_cents==null?"":String(a.monthly_price_cents/100),yearlyPriceTl:a.yearly_price_cents==null?"":String(a.yearly_price_cents/100),monthlyIncludedCredits:String(a.monthly_included_credits),currency:a.currency,displayOrder:a.display_order})))},[d==null?void 0:d.data]);const M=a=>{U(a,{onSuccess:()=>{i.success("Mobil uygulama surum ayarlari guncellendi")},onError:r=>{var t;i.error(((t=r.error)==null?void 0:t.message)||"Mobil uygulama surum ayarlari guncellenemedi")}})},I=s.useMemo(()=>[..._].sort((a,r)=>a.displayOrder-r.displayOrder),[_]),y=(a,r,t)=>{T(x=>x.map(o=>o.code===a?{...o,[r]:t}:o))},L=()=>{const a=[];for(const r of I){const t=r.name.trim();if(!t){i.error(`${r.code} için paket adı zorunludur.`);return}if(r.isUnlimited){const f=Number(r.monthlyIncludedCredits);if(!Number.isInteger(f)||f<0){i.error(`${r.code} için aylık ücretsiz kredi negatif olmayan bir tam sayı olmalıdır.`);return}a.push({code:r.code,name:t,max_vehicle_count:null,monthly_price_cents:null,yearly_price_cents:null,monthly_included_credits:f});continue}const x=Number(r.maxVehicleCount),o=Number(r.monthlyPriceTl),p=Number(r.yearlyPriceTl),g=Number(r.monthlyIncludedCredits);if(!Number.isInteger(x)||x<=0){i.error(`${r.code} için maksimum araç sayısı 0'dan büyük bir tam sayı olmalıdır.`);return}if(!Number.isInteger(o)||o<=0){i.error(`${r.code} için aylık fiyat (TL) 0'dan büyük bir tam sayı olmalıdır.`);return}if(!Number.isInteger(p)||p<=0){i.error(`${r.code} için yıllık fiyat (TL) 0'dan büyük bir tam sayı olmalıdır.`);return}if(!Number.isInteger(g)||g<0){i.error(`${r.code} için aylık ücretsiz kredi negatif olmayan bir tam sayı olmalıdır.`);return}a.push({code:r.code,name:t,max_vehicle_count:x,monthly_price_cents:o*100,yearly_price_cents:p*100,monthly_included_credits:g})}E({packages:a},{onSuccess:()=>{i.success("Paket ayarları güncellendi")},onError:r=>{var t;i.error(((t=r.error)==null?void 0:t.message)||"Paket ayarları güncellenemedi")}})},B=()=>{const a=Number(S);if(!Number.isInteger(a)||a<0){i.error("Son 14 gündeki firmaların kredi hedefi negatif olmayan bir tam sayı olmalıdır.");return}A({monthlyIncludedTarget:Number(F),lessThanFourteenDaysIncludedTarget:a},{onSuccess:()=>i.success("Kredi ayarları güncellendi"),onError:r=>{var t;return i.error(((t=r.error)==null?void 0:t.message)||"Kredi ayarları güncellenemedi")}})};return e.jsx(H,{routeId:"/_admin/admin/mobile-version",title:"Ayarlar",loading:{enabled:z||w||V},children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(j,{type:"button",variant:c==="package-settings"?"default":"outline",onClick:()=>b("package-settings"),children:"Paket Ayarları"}),e.jsx(j,{type:"button",variant:c==="mobile-version"?"default":"outline",onClick:()=>b("mobile-version"),children:"Mobil Versiyon"}),e.jsx(j,{type:"button",variant:c==="credit-settings"?"default":"outline",onClick:()=>b("credit-settings"),children:"Kredi Ayarları"})]}),c==="package-settings"?e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6",children:[e.jsx("p",{className:"mb-6 text-sm text-muted-foreground",children:"Paket adı, araç limiti, fiyatlar ve aylık ücretsiz kredi bu sekmeden düzenlenir. Fiyat alanları TL cinsindendir."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[900px] border-collapse text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-3 py-2 text-left",children:"Kod"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Paket Adı"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Maks. Araç"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Aylık Fiyat (TL)"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Yıllık Fiyat (TL)"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Aylık Ücretsiz Kredi"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Para Birimi"})]})}),e.jsx("tbody",{children:I.map(a=>e.jsxs("tr",{className:"border-b align-top",children:[e.jsx("td",{className:"px-3 py-2 font-medium",children:a.code}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(m,{value:a.name,onChange:r=>y(a.code,"name",r.target.value)})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(m,{type:"number",min:1,disabled:a.isUnlimited,value:a.isUnlimited?"":a.maxVehicleCount,onChange:r=>y(a.code,"maxVehicleCount",r.target.value),placeholder:a.isUnlimited?"Sınırsız":"Örn: 30"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(m,{type:"number",min:1,disabled:a.isUnlimited,value:a.isUnlimited?"":a.monthlyPriceTl,onChange:r=>y(a.code,"monthlyPriceTl",r.target.value),placeholder:a.isUnlimited?"Sınırsız":"Örn: 1990"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(m,{type:"number",min:1,disabled:a.isUnlimited,value:a.isUnlimited?"":a.yearlyPriceTl,onChange:r=>y(a.code,"yearlyPriceTl",r.target.value),placeholder:a.isUnlimited?"Sınırsız":"Örn: 19900"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(m,{type:"number",min:0,step:1,value:a.monthlyIncludedCredits,onChange:r=>y(a.code,"monthlyIncludedCredits",r.target.value),placeholder:"Örn: 125"})}),e.jsx("td",{className:"px-3 py-2",children:a.currency})]},a.code))})]})}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(v,{className:"w-48",disabled:P,loading:P,title:"Kaydet",onClick:L})})]}):null,c==="mobile-version"?e.jsxs("div",{className:"max-w-3xl rounded-2xl border border-border bg-card p-6",children:[e.jsx("p",{className:"mb-6 text-sm text-muted-foreground",children:"Zorunlu versiyon altindaki kullanicilar uygulamaya devam edemez. Istege bagli versiyon altindaki kullanicilar guncelleme uyarisi gorur ama daha sonra diyerek devam edebilir."}),e.jsx(W,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(M),className:"flex flex-col gap-4",children:[e.jsx(h,{form:n,formKey:"forceVersion",label:"Zorunlu Versiyon",type:"text",placeholder:"Orn: 1.0.5"}),e.jsx(h,{form:n,formKey:"optionalVersion",label:"Istege Bagli Versiyon",type:"text",placeholder:"Orn: 1.0.8"}),e.jsx(h,{form:n,formKey:"iosStoreUrl",label:"iOS Magaza Linki",type:"text",placeholder:"https://apps.apple.com/..."}),e.jsx(h,{form:n,formKey:"androidStoreUrl",label:"Android Magaza Linki",type:"text",placeholder:"https://play.google.com/store/apps/..."}
1),e.jsx(v,{className:"mt-2 w-48 self-end",disabled:k,loading:k,title:"Kaydet"})]})})]}):null,c==="credit-settings"?e.jsxs("div",{className:"max-w-3xl rounded-2xl border border-border bg-card p-6",children:[e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Normal aylık ücretsiz kredi hedefleri Paket Ayarları sekmesinde her araç paketi için ayrı yönetilir. Buradaki değer yalnızca yeni kayıtları ve paket süresinin bitmesine 14 gün veya daha az kalan şirketleri kapsar. Bu şirketlerin aylık kredi bakiyesi hedefe doğrudan ayarlanır; ekstra kredileri değişmez."}),e.jsx("div",{className:"flex max-w-md flex-col gap-5",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{htmlFor:"less-than-fourteen-days-included-credit-target",className:"text-sm font-medium",children:"14 gün veya daha az süresi kalan şirketler ve yeni kayıtlar"}),e.jsx(m,{id:"less-than-fourteen-days-included-credit-target",type:"number",min:0,step:1,value:S,onChange:a=>C(a.target.value)})]})}),e.jsx("p",{className:"mt-5 text-sm text-muted-foreground",children:"Aylık hedef şirket o ay ilk kez işlenirken kaydedilir. Ay içinde paket değiştiren bir şirketin kredisini şirket detayındaki “Aylık paket kredisi” işlemiyle manuel tamamlayabilirsiniz."}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx(v,{className:"w-48",disabled:N,loading:N,title:"Kaydet",onClick:B})})]}):null]})})};export{te as component};

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.