klioso
Version:
Multi-Service Provider Management System for WordPress and Web Development with Enhanced Scanner
2 lines (1 loc) • 3.77 kB
JavaScript
import{u as s,j as a}from"./app-DZ07njAd.js";import{A as x}from"./AuthenticatedLayout-BKOGad_C.js";import{F as i}from"./Form-DWGkysrX.js";import{B as _}from"./Button-D6Jcp-tA.js";import{B as v}from"./BackButton-DWEPPwYa.js";import"./ApplicationLogo-GDc3W5ND.js";import"./transition-BCwV6od8.js";function C({clients:o,hostingProviders:l}){const{data:n,setData:d,post:r,errors:t}=s({domain_name:"",platform:"",client_id:"",hosting_provider_id:"",dns_provider_id:"",email_provider_id:"",domain_registrar_id:"",status:"active",notes:""}),m=(l==null?void 0:l.filter(e=>e.provides_hosting))||[],u=(l==null?void 0:l.filter(e=>e.provides_dns))||[],c=(l==null?void 0:l.filter(e=>e.provides_email))||[],p=(l==null?void 0:l.filter(e=>e.provides_domain_registration))||[];return a.jsx(x,{header:a.jsx("h1",{className:"text-2xl font-bold text-gray-800",children:"Add Website"}),children:a.jsxs("div",{className:"max-w-xl mx-auto bg-white rounded-lg shadow p-6 mt-8",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsx(v,{fallbackRoute:"/websites"}),a.jsx("h2",{className:"text-lg font-semibold",children:"New Website"})]}),a.jsxs(i,{onSubmit:e=>{e.preventDefault(),r("/websites")},children:[a.jsx(i.Input,{label:"Domain Name",value:n.domain_name,onChange:e=>d("domain_name",e.target.value),required:!0,placeholder:"example.com",error:t==null?void 0:t.domain_name}),a.jsx(i.Input,{label:"Platform",value:n.platform,onChange:e=>d("platform",e.target.value),required:!0,placeholder:"WordPress, Laravel, etc.",error:t==null?void 0:t.platform}),a.jsxs(i.Select,{label:"Client (Optional)",value:n.client_id,onChange:e=>d("client_id",e.target.value),error:t==null?void 0:t.client_id,children:[a.jsx("option",{value:"",children:"No client / Internal / Development"}),o==null?void 0:o.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]}),a.jsxs(i.Select,{label:"Hosting Provider (Optional)",value:n.hosting_provider_id,onChange:e=>d("hosting_provider_id",e.target.value),error:t==null?void 0:t.hosting_provider_id,children:[a.jsx("option",{value:"",children:"No hosting / TBD"}),m==null?void 0:m.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]}),a.jsxs(i.Select,{label:"DNS Provider (Optional)",value:n.dns_provider_id,onChange:e=>d("dns_provider_id",e.target.value),error:t==null?void 0:t.dns_provider_id,children:[a.jsx("option",{value:"",children:"No DNS provider / TBD"}),u==null?void 0:u.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]}),a.jsxs(i.Select,{label:"Email Provider (Optional)",value:n.email_provider_id,onChange:e=>d("email_provider_id",e.target.value),error:t==null?void 0:t.email_provider_id,children:[a.jsx("option",{value:"",children:"No email provider / TBD"}),c==null?void 0:c.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]}),a.jsxs(i.Select,{label:"Domain Registrar (Optional)",value:n.domain_registrar_id,onChange:e=>d("domain_registrar_id",e.target.value),error:t==null?void 0:t.domain_registrar_id,children:[a.jsx("option",{value:"",children:"No domain registrar / TBD"}),p==null?void 0:p.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]}),a.jsxs(i.Select,{label:"Status",value:n.status,onChange:e=>d("status",e.target.value),error:t==null?void 0:t.status,children:[a.jsx("option",{value:"active",children:"Active"}),a.jsx("option",{value:"inactive",children:"Inactive"}),a.jsx("option",{value:"maintenance",children:"Maintenance"}),a.jsx("option",{value:"development",children:"Development"})]}),a.jsx(i.Textarea,{label:"Notes",value:n.notes,onChange:e=>d("notes",e.target.value),error:t==null?void 0:t.notes}),a.jsx(_,{type:"submit",children:"Save"})]}),t&&a.jsx("div",{className:"mt-4 text-red-500 text-sm",children:Object.values(t).join(", ")})]})})}export{C as default};