PageSourceSearch

https://uttarakhandtourism.gov.in/build/assets/addAdventureActivity-Cfh0zT2I.js

js uttarakhandtourism.gov.in collected 2026-10-02 06:29:00 UTC 14,663 bytes, 1 lines download raw bytes

1import{r as n,G as W,j as e,S as J,x,R as K}from"./app-Ha4X7SlF.js";import{I as d}from"./InputError-Do4kQPnM.js";import{I as m}from"./InputLabel-D410np7F.js";import{M as Q}from"./MediaModal-DTWNCtfU.js";import{P as X}from"./PrimaryButton-Bjn3n3t2.js";import{T as u}from"./TextInput-YH4SiJD7.js";import{A as Y}from"./AuthenticatedLayout-BZKUhDrh.js";import Z from"./MediaPreview-D7BGVdAv.js";import{T as w,S as ee}from"./constants-gejEprHZ.js";import{s as se,h as te,a as ie,c as le,b as ae,v as re}from"./helpers-C3Ubf4D0.js";import{d as ne}from"./index-f3GnAQgI.js";import"./index-BCTjt6el.js";import"./index-DFCUUP5-.js";import"./transition-DszwGdUG.js";import"./Sidebar-BmBFQuN7.js";import"./SvgSwitcher-DH9r9e5c.js";import"./ToastNotification-BhTNdAie.js";import"./moment-C5S46NFB.js";function $e({auth:p,adventureActivity:o,medias:_,adventures:k,adventureModes:oe,areaRegions:de}){const[ce,C]=n.useState(""),[me,he]=n.useState(""),[xe,ue]=n.useState(""),[ge,pe]=n.useState(""),S=window.location.origin,[T,v]=n.useState(!1),[f,D]=n.useState(null),[fe,je]=n.useState(""),{data:r,setData:l,post:q,processing:A,errors:c,setError:i}=W({title:"",slug:"",short_description:"",status:1,parent_id:"",created_by:p.user.id,title_hi:"",short_description_hi:"",media_id:"",adventure_id:""}),N=()=>{v(!1)};o=se(o);const I=s=>{var t;s&&(l("media_id",(t=s[0])==null?void 0:t.id),D(s)),N()},M=s=>{if(s.length>0){const t=s.slice(0,w);ie(t)&&(l("title",t),i("slug",""))}else l("title",s),i("title","Category name is required.")},E=()=>{v(!0)},L=s=>{if(s){if(i("title",""),s.length<=90){const t=s.slice(0,60);l(b=>({...b,title:s,slug:le(t)})),i("slug","")}}else i("title","Category name is required."),l(t=>({...t,title:s,slug:s}))},B=s=>{if(s.length>0){const t=s.slice(0,w);ae(t)&&l("title_hi",t)}else l("title_hi",s),i("title_hi","Category name in hindi is required.")},R=s=>{(!r.slug||r.slug=="")&&(s?(i("title_hi",""),s.length<=90&&l(t=>({...t,title_hi:s}))):(i("title_hi","Category name in hindi is required."),l(t=>({...t,title_hi:s,slug:s}))))},P=s=>{if(s.length>0){const t=s.slice(0,ee);re(t)&&(i("slug",""),l("slug",t))}else l("slug",s),i("slug","The slug field is required.")},F=s=>{l("adventure_id",s),console.log("Selected Adventure ID:",s)},z=()=>{let s=!0;return r.title.length==0?(i("title","Category name is required."),s=!1):i("title",""),r.slug.length==0?(i("slug","The slug field is required."),s=!1):i("slug",""),r.short_description.length==0?(i("short_description","The description field is required."),s=!1):i("short_description",""),s},H=s=>{s.preventDefault(),z()&&q(route("adventure-activities.store"),{onFinish:()=>
1{l({title:"",slug:"",short_description:"",status:1,parent_id:"",created_by:p.user.id,title_hi:"",short_description_hi:"",adventure_id:"",media_id:""}),C("")}})},[a,$]=n.useState(1),h=10,g=Math.ceil(o.length/h),V=o.slice((a-1)*h,a*h),j=s=>{$(s)},y=s=>{confirm("Are you sure you want to delete this areaRegion?")&&ne.Inertia.delete(`/userpanel/adventure-activities/${s}`,{onSuccess:()=>alert("Post deleted successfully")})},[G,be]=n.useState(new Set);o.length>0&&(G.size,o.length);const[ve,Ne]=n.useState(""),[ye,we]=n.useState(""),O=s=>{i("short_description",s?"":"The Short Description field is required."),l("short_description",s)},U=s=>{i("short_description_hi",s?"":"The Short Description in hindi field is required."),l("short_description_hi",s)};return e.jsxs(Y,{user:p.user,header:e.jsx("h2",{className:"font-semibold text-xl text-gray-800 leading-tight",children:"Adventure Activity"}),children:[e.jsx(J,{title:"Adventure Activity"}),e.jsx("div",{className:"py-4",children:e.jsxs("div",{className:"main-wrapper space-y-5",children:[e.jsx("h3",{className:"text-lg font-semibold py-2",children:"Add Adventure Activity"}),e.jsxs(x,{className:"shadow inline-flex items-center hover:bgThemeDark focus:bgThemeDark focus:shadow-outline text-white font-semibold py-2 px-4 rounded-lg bgTheme mx-1",href:"/userpanel/adventure/create",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"mr-2 w-5 h-5",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"0",y:"0",width:"24",height:"24",stroke:"none"}),e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Adventure"]}),e.jsxs(x,{className:"shadow inline-flex items-center hover:bgThemeDark focus:bgThemeDark focus:shadow-outline text-white font-semibold py-2 px-4 rounded-lg bgTheme mx-1",href:"/userpanel/adventure-modes",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"mr-2 w-5 h-5",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"0",y:"0",width:"24",height:"24",stroke:"none"}),e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Adventure Mode"]}),e.jsxs(x,{className:"shadow inline-flex items-center hover:bgThemeDark focus:bgThemeDark focus:shadow-outline text-white font-semibold py-2 px-4 rounded-lg bgTheme mx-1",href:"/userpanel/area-region",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"mr-2 w-5 h-5",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"0",y:"0",width:"24",height:"24",stroke:"none"}),e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Area Region"]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-x-0  lg:gap-x-4 gap-y-4  lg:gap-y-0 items-start",children:[e.jsx("div",{className:"left-adventureActivity-tab p-2 bg-white shadow sm:rounded-lg ",children:e.jsx("div",{className:"space-y-12",children:e.jsxs("div",{className:"pb-8",children:[e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"mt-4",children:[e.jsx(m,{htmlFor:"title",className:"req-star block text-sm font-medium leading-6 text-gray-900",value:"Name"}),e.jsx(u,{id:"title",name:"name",value:r.title,className:"border-gray-300 rounded-md shadow-sm mt-1 block w-full  bg-gray-100",autoComplete:"title",onChange:s=>M(s.target.value),onBlur:s=>L(s.target.value),required:!0}),e.jsx(d,{message:c.title,className:"mt-2"})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(m,{htmlFor:"title_hi",className:"req-star block text-sm font-medium leading-6 text-gray-900",value:"Name in Hindi"}),e.jsx(u,{id:"title_hi",name:"title_hi",value:r.title_hi,className:"border-gray-300 mt-1 block w-full bg-gray-100",autoComplete:"title",onChange:s=>B(s.target.value),onBlur:s=>R(s.target.value),required:!0}),e.jsx(d,{message:c.title_hi,className:"mt-2"})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(m,{htmlFor:"slug",value:"Slug",className:"req-star"}),e.jsxs("div",{children:[e.jsx(u,{id:"slug",name:"slug",value:r.slug,className:"border-gray-300 rounded-md shadow-sm mt-1 block w-full bg-gray-100",autoComplete:"slug",onChange:s=>P(s.target.value),required:!0}),e.jsx(d,{message:c.slug,className:"mt-2"})]})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(m,{htmlFor:"adventure",value:"Adventure",className:"req-star"}),e.jsxs("select",{className:"border-gray-300 rounded-md shadow-sm mt-1 block w-full bg-gray-100",value:r.adventure_id,onChange:s=>F(s.target.value),children:[e.jsx("option",{value:"",disabled:!0,children:"Select an adventure"}),k.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]}),e.jsx(d,{message:"",className:"mt-2"}),e.jsx("p",{className:"mt-1 text-xs leading-tight text-gray-600 italic",children:'For add new Adventure type go to the adventures module in "Explore".'})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(m,{htmlFor:"short_description",value:"Short Description"}),e.jsx(u,{id:"short_description",name:"short_description",value:r.short_description,className:"mt-1 block w-full focus:border-black rounded-sm bg-gray-100",autoComplete:"title",onCh
1ange:s=>O(s.target.value),required:!0}),e.jsx(d,{message:c.short_description,className:"mt-2"})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(m,{htmlFor:"short_description_hi",value:"Short Description in hindi"}),e.jsx(u,{id:"short_description_hi",name:"short_description_hi",value:r.short_description_hi,className:"mt-1 block w-full focus:border-black rounded-sm bg-gray-100",autoComplete:"short_description_hi",onChange:s=>U(s.target.value),required:!0}),e.jsx(d,{message:c.short_description_hi,className:"mt-2"})]}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"w-full p-4 sm:p-8 bg-white shadow sm:rounded-lg",children:[e.jsx("h3",{children:"Banner Images"}),e.jsx("button",{onClick:E,className:"text-blue-500 text-sm underline",children:"Upload Banner Image"}),e.jsx(Q,{imageOnly:!0,isOpen:T,onClose:N,onFileSelect:I,medias:_}),f==null?void 0:f.map((s,t)=>e.jsx(Z,{item:{file_path:s.file_path,file_name:s.file_name,format:s.format||"",title:""},baseUrl:S,handleDocumentClick:te,componentType:0})),e.jsx(d,{message:c.media_id,className:"mt-2"})]})})]}),e.jsxs("div",{className:"flex items-center justify-end mt-12",children:[e.jsx("form",{onSubmit:H,children:e.jsx(X,{className:"rounded-md bg-blue-700  mx-5  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 bgTheme",disabled:A,children:"Create"})}),"   "]})]})})}),e.jsxs("div",{className:"right-adventureActivity-tab  xl:col-span-2 p-2 bg-white shadow sm:rounded-lg",children:[e.jsx("div",{className:"table-top-filters flex justify-between md:flex-wrap sm:flex-wrap xs:flex-wrap table-top-block "}),e.jsx("div",{className:"flex flex-col",children:e.jsx("div",{className:"overflow-x-auto pb-4",children:e.jsx("div",{className:"min-w-full inline-block align-middle",children:e.jsx("div",{className:"overflow-hidden border rounded-lg border-gray-300",children:e.jsxs("table",{className:"table-auto min-w-full rounded-xl blog-list-table",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bgThemeLight",children:[e.jsx("th",{scope:"col",className:"p-1 text-left whitespace-nowrap text-sm leading-6 font-semibold text-gray-900 capitalize",children:"Name"}),e.jsx("th",{scope:"col",className:"p-1 text-left whitespace-nowrap text-sm leading-6 font-semibold text-gray-900 capitalize",children:"Description"}),e.jsx("th",{scope:"col",className:"p-1 text-left whitespace-nowrap text-sm leading-6 font-semibold text-gray-900 capitalize",children:"Slug"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-300",children:V.map(s=>!s.parent_id&&e.jsxs(K.Fragment,{children:[e.jsxs("tr",{className:"bg-white transition-all duration-500 hover:bg-gray-50 h-2",children:[e.jsxs("td",{className:"p-1 whitespace-nowrap text-sm leading-6 font-medium text-gray-900 align-top",children:[e.jsx("strong",{children:e.jsx("a",{href:"#",children:s.title})}),e.jsx("br",{}),e.jsxs("span",{className:"edit text-blue-600",children:[e.jsx(x,{href:`/userpanel/adventure-activities/${s.id}/edit`,"aria-label":"Edit",children:"Edit"})," |"]}),e.jsx("span",{className:"delete",children:e.jsx("button",{type:"button",onClick:()=>y(s.id),className:"button-link editinline text-red-600 ms-1",children:"Delete"})})]}),e.jsx("td",{className:"p-1 align-top",children:s.short_description}),e.jsx("td",{className:"px-1 py-1 align-top",children:s.slug})]}),o.filter(t=>t.parent_id===s.id).map(t=>e.jsxs("tr",{className:"bg-gray-50 transition-all duration-500 h-2",children:[e.jsx("td",{}),e.jsxs("td",{className:"p-1 whitespace-nowrap text-sm leading-6 font-medium text-gray-900",children:[e.jsxs("span",{className:"text-gray-600",children:["- ",t.title]}),e.jsx("br",{}),e.jsxs("span",{className:"edit",children:[e.jsx(x,{href:`/blogs/adventureActivity/${t.id}/edit`,"aria-label":"Edit",className:"text-blue-600",children:"Edit"})," |"]}),e.jsx("span",{className:"delete",children:e.jsx("button",{type:"button",onClick:()=>y(t.id),className:"button-link editinline text-red-600 ms-1",children:"Delete"})})]}),e.jsx("td",{className:"p-1 align-top",children:t.short_description}),e.jsx("td",{className:"px-1 py-1 align-top",children:t.slug}),e.jsx("td",{className:"flex p-4 items-center gap-0.5 align-top",children:"--"})]},`child-${t.id}`))]},s.id))})]})})})})}),o.length>10&&e.jsx("div",{className:"flex items-center justify-between border-t border-gray-200 bg-white py-5 px-4",children:e.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-700",children:["Showing",e.jsxs("span",{className:"font-medium mx-1",children:[" ",(a-1)*h+1," "]}),"to",e.jsxs("span",{className:"font-medium  mx-1",children:[" ",Math.min(a*h,o.length)," "]}),"of",e.jsxs("span",{className:"font-medium  mx-1",children:[" ",o.length," "]}),"results"]})}),e.jsx("div",{children:e.jsxs("nav",{className:"isolate inline-flex -space-x-px rounded-md shadow-sm","aria-label":"Pagination",children:[e.jsxs("a",{href:"#",onClick:s=>{s.preventDefault(),a>1&&j(a-1)},className:`relative inline-flex items-center rounded-l-md px-2 py-2 ${a===1?"text-gray-300":"text-gray-400 hover:bg-gray-50"} ring-1 ring-inset ring-gray-300 focus:z-20 focus:outline-offset-0`,"aria-disabled":a===1,children:[e.jsx("span",{className:"sr-only",children:"Previous"}),e.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})})]}),Array.from({length:g},(s,t)=>e.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),j(t+1)},className:`relative inline-flex items-center px-4 py-2 text-sm font-semibold ${a===t+1?"z-10 bgTheme text-white":"border border-gray-300 text-gray-700 hover:bg-gray-50"} ring-1 ring-inset ring-gray-300`,children:t+1},t+1)),e.jsxs("a",{href:"#",onClick:s=>{s.preventDefault(),a<g&&j(a+1)},className:`relative inline-flex items-center rounded-r-md px-2 py-2 ${a===g?"text-gray-300":"text-gray-400 hover:bg-gray-50"} ring-1 ring-inset ring-gray-300 focus:z-20 focus:outline-offset-0`,"aria-disabled":a===g,children:[e.jsx("span",{className:"sr-only",children:"Next"}),e.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M7.21 5.23a.75.75 0 00.02 1.06L11.168 10l-3.938 3.71a.75.75 0 001.04 1.08l4.5-4.25a.75.75 0 000-1.08l-4.5-4.25a.75.75 0 00-1.06.02z",clipRule:"evenodd"})})]})]})})]})})]})]})]})})]})}export{$e 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.