PageSourceSearch

https://carmainty.com/build/assets/EditCar_old-CPUUeb63.js

js carmainty.com collected 2026-09-24 14:40:22 UTC 14,393 bytes, 1 lines download raw bytes

1import{r as t,j as e,y as ue}from"./app-D8UIjF_9.js";import{D as he}from"./Dashboard-DT61cewG.js";import{A as ge}from"./ActiveToggle-GvQ2HHaA.js";import{F as xe,a as fe}from"./PhotoIcon-CPK8UC6L.js";/* empty css            */import"./Dropdown-_g-YAazs.js";import"./transition-Ca0IhWA_.js";import"./use-server-handoff-complete-C0avEQry.js";import"./use-is-mounted-8-rFA6wX.js";import"./dialog-BX-ecmYl.js";import"./use-tab-direction-j7XnGtiV.js";import"./LogoutButton-DjsFtCtB.js";import"./floating-872aDP9c.js";import"./SeoNoIndex-C7z_oAWU.js";import"./form-fields-Csz83cRn.js";function Ee({auth:Y,years:B,fuels:m,odometers:x,user_cars:s,errors:a}){var A,R;const N=s[0].id,w=[];for(let l=0;l<s[0].attachments.length;l++)w.push(s[0].attachments[l]);const[_,O]=t.useState(s[0].vehicle_active),[c,z]=t.useState(s[0].year),[u,k]=t.useState(s[0].make),[h,S]=t.useState(s[0].model),[F,C]=t.useState(s[0].vehicle_fuel_unit),[M,G]=t.useState(s[0].vehicle_fuel_type),[V,f]=t.useState(s[0].vehicle_fuel_unit_consumption),[U,$]=t.useState(s[0].vehicle_odometer_unit),[p,I]=t.useState(s[0].vehicle_name),[v,J]=t.useState(s[0].vehicle_vin),[j,W]=t.useState(s[0].vehicle_license_plate),[E,H]=t.useState(s[0].vehicle_notes),[K,L]=t.useState(!1),[Q,q]=t.useState([]),[D,P]=t.useState(w),[X,Z]=t.useState([]);s[0].vehicle_fuel_type;const[d,ee]=t.useState([]);let y=m.filter(l=>l.id==s[0].vehicle_fuel_type);const le=y[0].fuel_units.findIndex(l=>l.id==s[0].vehicle_fuel_unit),[g,ie]=t.useState(y[0].fuel_units),[b,te]=t.useState(y[0].fuel_units[le].fuel_unit_consumptions);t.useState(null);const se=l=>{let i=m.filter(n=>n.id==l.target.value);G(l.target.value),C(""),f(""),ie(i[0].fuel_units)},ne=l=>{let i=g.filter(n=>n.id==l.target.value);C(l.target.value),f(""),te(i[0].fuel_unit_consumptions)},ae=l=>{const i=l.target.value;z(i),k("")},oe=l=>{const i=l.target.value;k(i),S("")},ce=l=>{const i=l.target.value;S(i),I("My "+c+" "+i)},re=l=>{const i=l.target.files,n=[],r=[];for(let o=0;o<i.length;o++){const T=crypto.randomUUID();n.push({id:"nxp"+T,file:i[o]}),r.push({cloud_path:null,file_name:i[o].name,file_size:i[o].size,cloud_url:URL.createObjectURL(i[o]),id:"nxp"+T,service_id:null})}q(o=>[...o,...n]),P(o=>[...o,...r])},de=l=>{const i=l.id.toString();i.substring(0,3)!=="nxp"&&Z(n=>[...n,l]),i.substring(0,3)==="nxp"&&q(n=>n.filter((r,o)=>r.id!==l.id)),P(n=>n.filter((r,o)=>r.id!==l.id))},me=l=>{l.preventDefault();const n={methodtype:{_method:"put"},vehicleActive:_,vehicleYear:c,vehicleMake:u,vehicleModel:h,vehicleName:p,vehicleVin:v,vehicleLicensePlate:j,vehicleFuelUnit:F,vehicleFuelType:M,vehicleFuelUnitConsumption:V,vehicleOdometerUnit:U,vehicleNotes:E,files:Q,carId:N,removedFiles:X};ue.post("/edit-car/"+N,{_method:"put",data:n},{replace:!1,preserveState:!0,preserveScroll:!1,errorBag:null,forceFormData:!1,onError:r=>{L(!0)}})};return t.useEffect(()=>{c&&axios.get(`/getmake?year=${c}&make=${u}&model=${h}`).then(l=>l.data).then(l=>{ee(l)}).catch(l=>{console.error("Error fetching data:",l)})},[c,u,h]),e.jsx(he,{auth:Y,children:e.jsx("div",{className:"bg-white shadow sm:rounded-lg",children:e.jsxs("div",{className:"px-4 py-5 sm:p-6",children:[e.jsxs("div",{className:K?"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative":"hidden",role:"alert",children:[e.jsxs("span",{className:"block sm:inline",children:[a.error,(a==null?void 0:a.vehicleYear)&&e.jsx("div",{children:a==null?void 0:a.vehicleYear}),a.vehicleMake&&e.jsx("div",{children:a.vehicleMake}),a.vehicleModel&&e.jsx("div",{children:a.vehicleModel}),a.vehicleName&&e.jsx("div",{children:a.vehicleName})]}),e.jsx("span",{className:"absolute top-0 bottom-0 right-0 px-4 py-3",children:e.jsx("button",{onClick:()=>L(!1),children:e.jsxs("svg",{className:"fill-current h-6 w-6 text-red-500",role:"button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:[e.jsx("title",{children:"Close"}),e.jsx("path",{d:"M14.348 14.849a1.2 1.2 0 0 1-1.697 0L10 11.819l-2.651 3.029a1.2 1.2 0 1 1-1.697-1.697l2.758-3.15-2.759-3.152a1.2 1.2 0 1 1 1.697-1.697L10 8.183l2.651-3.031a1.2 1.2 0 1 1 1.697 1.697l-2.758 3.152 2.758 3.15a1.2 1.2 0 0 1 0 1.698z"})]})})})]}),e.jsx("div",{className:"pr-10 ",children:e.jsxs("form",{onSubmit:me,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-base font-semibold leading-7 text-gray-900",children:"Add a vehicle"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-600",children:"Enter your vehicle information"}),e.jsx("div",{className:"flex grid-cols-1 gap-y-4 gap-x-6",children:e.jsx("div",{className:"flex-1",children:e.jsx(ge,{toggleText:"Active Vehicle?",enabled:_,setEnabled:O})})}),e.jsxs("div",{className:"flex grid-cols-1 gap-y-4 gap-x-6",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"year",className:"block text-sm font-medium leading-6 text-gray-900",children:"Year"}),e.jsx("div",{children:e.jsxs("select",{id:"year",name:"year",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:max-w-xs sm:text-sm sm:leading-6",value:c,onChange:ae,required:!0,children:[e.jsx("option",{value:"",children:"Select Year"}),B.map((l,i)=>e.jsx("option",{children:l.year},i))]})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"make",className:"block text-sm font-medium leading-6 text-gray-900",children:"Make"}),e.jsx("div",{children:e.jsxs("select",{id:"make",name:"make",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:max-w-xs sm:text-sm sm:leading-6",onChange:oe,value:u,disabled:c==="",required:!0,children:[e.jsx("option",{value:"",children:"Select Make"}),(A=d==null?void 0:d.makes)==null?void 0:A.map((l,i)=>e.jsx("option",{children:l.make},i))]})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"model",className:"block text-sm font-medium leading-6 text-gray-900",children:"Model"}),e.jsx("div",{children:e.jsxs("select",{id:"model",name:"model",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:max-w-xs sm:text-sm sm:leading-6",onChange:ce,value:h,disabled:u==="",required:!0,children:[e.jsx("option",{value:"",children:"Select Make"}),(R=d==null?void 0:d.models)==null?void 0:R.map((l,i)=>e.jsx("option",{children:l.model},i))]})})]})]}),e.jsxs("div",{className:"flex grid-cols-1 gap-y-4 gap-x-6",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"vehicle-name",className:"block text-sm font-medium leading-6 text-gray-900",children:"Vehicle Name"}),e.jsx("div",{children:e.jsx("input",{type:"vehicle-name",name:"vehicle-name",id:"vehicle-name",placeholder:"My Vehicle",value:p??"",onChange:l=>I(l.target.value),className:"block w-full rounded-md border-0 py-1.5 px-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",required:!0})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"vin",className:"block text-sm font-medium leading-6 text-gray-900",children:"VIN # (optional)"}),e.jsx("div",{children:e.jsx("input",{type:"vin",name:"vin",id:"vin",className:"block w-full rounded-md border-0 py-1.5 px-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Enter a VIN#",onChange:l=>J(l.target.value),value:v??""})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"license-plate",className:"block text-sm font-medium leading-6 text-gray-900",children:"License Plate (
1optional)"}),e.jsx("div",{children:e.jsx("input",{type:"license-plate",name:"license-plate",id:"license-plate",className:"block w-full rounded-md border-0 py-1.5 px-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Enter a License Plate",onChange:l=>W(l.target.value),value:j??""})})]})]}),e.jsxs("div",{className:"flex grid-cols-1 gap-y-4 gap-x-6",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"year",className:"block text-sm font-medium leading-6 text-gray-900",children:"Select Fuel Type:"}),e.jsx("div",{children:e.jsxs("select",{id:"vehicle_name",name:"vehicle_name",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600  sm:text-sm sm:leading-6",value:M,onChange:l=>se(l),required:!0,children:[e.jsx("option",{value:"",children:"Select Fuel Type"}),m==null?void 0:m.map(l=>e.jsx("option",{value:l.id,label:l.fuel_type},l.id))]})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"year",className:"block text-sm font-medium leading-6 text-gray-900",children:"Select Unit of Measure:"}),e.jsx("div",{children:e.jsxs("select",{id:"vehicle_fuel_unit",name:"vehicle_fuel_unit",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600  sm:text-sm sm:leading-6",value:F,onChange:l=>ne(l),required:!0,children:[e.jsx("option",{value:"",children:"Select Unit of Measure (Liters, Gallons..)"}),g==null?void 0:g.map(l=>e.jsx("option",{fuelid:l.fuel_type_id,value:l.id,label:l.fuel_unit},l.id))]})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"year",className:"block text-sm font-medium leading-6 text-gray-900",children:"Select Consumption Measure:"}),e.jsx("div",{children:e.jsxs("select",{id:"vehicle_fuel_consumption",name:"vehicle_fuel_consumption",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600  sm:text-sm sm:leading-6",onChange:l=>f(l.target.value),value:V,required:!0,children:[e.jsx("option",{value:"",children:"Select Consumption Measure"}),b==null?void 0:b.map(l=>e.jsx("option",{value:l.id,label:l.fuel_unit_consumption},l.id))]})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"year",className:"block text-sm font-medium leading-6 text-gray-900",children:"Odometer Unit:"}),e.jsx("div",{children:e.jsxs("select",{id:"vehicle-odometer",name:"vehicle-odometer",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600  sm:text-sm sm:leading-6",onChange:l=>$(l.target.value),value:U,required:!0,children:[e.jsx("option",{value:"",children:"Select Odometer Unit (km, mi)"}),x==null?void 0:x.map(l=>e.jsx("option",{value:l.id,label:l.odometer_unit},l.id))]})})]})]}),e.jsxs("div",{className:"mt-10 grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6",children:[e.jsxs("div",{className:"col-span-full",children:[e.jsx("label",{htmlFor:"about",className:"block text-sm font-medium leading-6 text-gray-900",children:"Notes (optional)"}),e.jsx("div",{className:"mt-2",children:e.jsx("textarea",{id:"notes",name:"notes",rows:3,className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Write any notes about the vehicle",value:E||"",onChange:l=>H(l.target.value)})})]}),e.jsxs("div",{className:"col-span-full",children:[e.jsx("label",{htmlFor:"cover-photo",className:"block text-sm font-medium leading-6 text-gray-900",children:"Upload a File"}),e.jsx("div",{className:"mt-2 flex justify-center rounded-lg border border-dashed border-gray-900/25 px-6 py-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(xe,{className:"mx-auto h-12 w-12 text-gray-300","aria-hidden":"true"}),e.jsxs("div",{className:"mt-4 flex text-sm leading-6 text-gray-600",children:[e.jsxs("label",{htmlFor:"file-upload",className:"relative cursor-pointer rounded-md bg-white font-semibold text-indigo-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-indigo-600 focus-within:ring-offset-2 hover:text-indigo-500",children:[e.jsx("span",{children:"Upload a file"}),e.jsx("input",{multiple:!0,id:"file-upload",name:"files[]",type:"file",accept:"image/*,application/pdf",onChange:re,onClick:l=>{l.target.value=null},className:"sr-only"})]}),e.jsx("p",{className:"pl-1",children:"or drag and drop"})]}),e.jsx("p",{className:"text-xs leading-5 text-gray-600",children:"PNG, JPG, GIF up to 10MB"})]})})]}),e.jsx("div",{className:"col-span-full",children:D?e.jsx("div",{className:"gap-y-8",children:e.jsx("ul",{role:"list",className:"grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 sm:gap-x-6 lg:grid-cols-4 xl:gap-x-8",children:D.map((l,i)=>e.jsxs("li",{children:[e.jsxs("div",{className:"group relative flex-col  aspect-h-7 aspect-w-10 block w-full overflow-hidden rounded-lg bg-gray-100 focus-within:ring-2 focus-within:ring-indigo-500 focus-within:ring-offset-2 focus-within:ring-offset-gray-100",children:[e.jsx("img",{src:l.cloud_url,alt:"",className:" w-full h-48 pointer-events-none object-cover  "},l.id),e.jsx("div",{className:"absolute top-0 right-0",children:e.jsx("button",{type:"button",className:"p-1 rounded-full bg-red-600  text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",onClick:()=>de(l),children:e.jsx(fe,{className:"h-5 w-5","aria-hidden":"true"})})})]}),e.jsx("p",{className:"pointer-events-none mt-2 block truncate text-sm font-medium text-gray-900",children:l.file_name}),e.jsx("p",{className:"pointer-events-none block text-sm font-medium text-gray-500",children:Math.round(l.file_size/(1024*1024)*100)/100+" MB"})]}))})}):null})]})]}),e.jsx("div",{className:"mt-6 flex items-center justify-end gap-x-6",children:e.jsx("button",{type:"submit",className:"rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",children:"Save"})})]})})]})})})}export{Ee 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.