PageSourceSearch

https://driftgolf-qa.netlify.app/assets/FoodbevItemsPage-ffdd01a8.js

js driftgolf-qa.netlify.app collected 2026-10-03 10:40:25 UTC 6,895 bytes, 61 lines download raw bytes

1import{r as C,a as c,d as l,j as e,B as H}from"./index-4ce00ee7.js";import{g as m}from"./index-7de85521.js";import{n as G,P as Y,c as f}from"./not-found-a10d56df.js";import{S as d}from"./sweetalert2.all-2c1f30c7.js";import{d as z}from"./index-e629a575.js";import{t as b}from"./index-51f3a61d.js";import{t as J}from"./trash-03bc5dcd.js";import{u as w}from"./GolfClubHooks-443ca383.js";import{t as F,f as K}from"./formatters-cb9ccf71.js";import{F as W}from"./FoodbevItemForm-2270d093.js";const X=m`
2  mutation DeleteFoodbevItemMutation($id: String!) {
3    deleteFoodbevItem(id: $id) {
4      id
5    }
6  }
7`,Z=m`
8  mutation CreateFoodbevItemMutation($input: CreateFoodbevItemInput!) {
9    createFoodbevItem(input: $input) {
10      id
11    }
12  }
13`,ee=m`
14  mutation UpdateFoodbevItemMutation(
15    $id: String!
16    $input: UpdateFoodbevItemInput!
17  ) {
18    updateFoodbevItem(id: $id, input: $input) {
19      id
20      golfClubId
21      foodbevCategoryId
22      name
23      description
24      price
25      inStock
26      active
27      createdAt
28      updatedAt
29    }
30  }
31`,te=m`
32  mutation UpdateFoodbevItemMutation($id: String!, $input: Boolean!) {
33    updateFoodbevItem(id: $id, input: { inStock: $input }) {
34      id
35    }
36  }
37`,S=({foodbevItems:s,isEmpty:n,count:i})=>{const a=z.useForm(),p=w(),[N,h]=C.useState(""),[I,E]=C.useState("");let $=c.useLocation();const j=new URLSearchParams($.search),v=j.get("categoryName"),r=j.get("categoryId");let g=f.page,x=f.itemsPerPage;const[M]=l.useMutation(X,{onCompleted:()=>{d.fire({title:"Deleted!",text:"Item has been deleted successfully",icon:"success",timer:5e3})},onError:t=>{b.toast.error(t.message)},refetchQueries:[{query:u,variables:{golfClubId:p,categoryId:r,page:g,itemsPerPage:x}}],awaitRefetchQueries:!0}),[T,{loading:P,error:k}]=l.useMutation(Z,{onCompleted:()=>{d.fire({title:"Created!",text:"Item has been created successfully",icon:"success",timer:5e3}),a.reset(),h("")},onError:t=>{b.toast.error(t.message)},refetchQueries:[{query:u,variables:{golfClubId:p,categoryId:r,page:g,itemsPerPage:x}}],awaitRefetchQueries:!0}),[D]=l.useMutation(ee,{onCompleted:()=>{d.fire({title:"Updated!",text:"Item has been updated successfully",icon:"success",timer:5e3}),h(""),a.reset()},onError:t=>{b.toast.error(t.message)},refetchQueries:[{query:u,variables:{golfClubId:p,categoryId:r,page:g,itemsPerPage:x}}],awaitRefetchQueries:!0}),[O]=l.useMutation(te,{onCompleted:()=>{d.fire({icon:"success",title:"Updated!",text:"Item status has been updated successfully",timer:5e3})},onError:t=>{b.toast.error(t.message)},refetchQueries:[{query:u,variables:{golfClubId:p,categoryId:r,page:g,itemsPerPage:x}}],awaitRefetchQueries:!0}),B=({id:t,name:o})=>{d.fire({title:"Delete Item",html:"Do you want to delete <b>"+o+"</b>?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes",reverseButtons:!0}).then(V=>{V.isConfirmed&&M({variables:{id:t}})})},U=t=>{T({variables:{input:t}})},A=(t,o)=>{D({variables:{id:o,input:t}})},_=(t,o)=>{O({variables:{id:o,input:t}})},y=t=>{a.reset(),E(t),h(!0)},Q=()=>{h(""),a.reset()},R=t=>y(t),q=()=>y(),L=[{label:"Home",path:c.routes.dashboard()},{label:"Food & Beverage",path:c.routes.foodbevOrders()},{label:v,path:c.routes.foodbevCategories()},{label:"Items"}];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl sm:text-2xl lg:text-4xl font-bold",children:"Food & Beverage"}),e.jsx(H,{crumbs:L})]}),e.jsx("button",{onClick:()=>q(),className:"bg-primary-500 hover:bg-orange-600 text-white text-xs sm:text-base px-3 py-2 rounded-lg h-fit whitespace-nowrap",children:"Create New"})]}),e.jsx("div",{className:"custom-table",children:e.jsxs("table",{className:"rw-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Price"}),e.jsx("th",{children:"Description"}),e.jsx("th",{colSpan:2,children:"In Stock"})]})}),e.jsxs("tbody",{children:[s.map(t=>e.jsxs("tr",{onClick:()=>R(t),className:"cursor-pointer hovered-row",children:[e.jsx("td",{children:F(t.name)}),e.jsx("td",{children:K(t.price)}),e.jsx("td",{children:F(t.description)}),e.jsx("td",{children:e.jsx("button",{onClick:o=>o.stopPropagation(),children:e.jsxs("label",{className:"switch",children:[e.jsx("input",{type:"checkbox",className:"switch-input",defaultChecked:t.inStock,checked:t.inStock,onClick:()=>{_(!t.inStock,t.id)}}),e.jsx("span",{className:"switch-label","data-on":"On","data-off":"Off"}),e.jsx("span",{className:"switch-handle"})]})})}),e.jsx("td",{children:e.jsx("nav",{className:"flex justify-end relative",children:e.jsx("button",{className:"cursor-pointer",type:"button",onClick:o=>{o.stopPropagation(),B(t)},children:e.jsx("img",{src:J,alt:"delete icon"})})})})]},t.id)),n||(s==null?void 0:s.length)<1&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx("img",{src:G,alt:"not found",width:500,className:"mx-auto"})})}),e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(Y,{count:i,length:s==null?void 0:s.length,route:c.routes.foodbevItems,pageParams:{categoryId:r,categoryName:v}})})})]})]})}),e.jsx("div",{id:"modal",className:`${N!==""?"":"hidden"} fixed inset-0 bg-gray-900 bg-opacity-50 flex items-center justify-center z-[111] backdrop-blur-lg`,children:e.jsxs("div",{children:[e.jsxs("h2",{className:"text-center text-3xl font-bold mb-8",children:[I?"Edit":"Create"," Item"]}),e.jsx("div",{className:"bg-white p-12 rounded-lg w-[444px]",children:e.jsx(W,{onSave:I?A:U,modalHandler:Q,foodbevItem:I,formMethods:a,loading:P,error:k,categoryId:r})})]})})]})},u=m`
38  query FindFoodbevItems($golfClubId: String! $categoryId: String! $page: Int! $itemsPerPage: Int!) {
39    foodbevItemsPage(golfClubId: $golfClubId categoryId: $categoryId page: $page itemsPerPage: $itemsPerPage) {
40      foodbevItems {
41        id
42        golfClubId
43        foodbevCategoryId
44        name
45        description
46        price
47        inStock
48        active
49        createdAt
50        updatedAt
51        GolfClub {
52          name
53        }
54        FoodbevCategory {
55          name
56        }
57      }
58      count
59    }
60  }
61`,se=({page:s,categoryId:n,golfClubId:i,itemsPerPage:a})=>(s=s?parseInt(s,10):f.page,a=a?parseInt(a,10):f.itemsPerPage,{variables:{golfClubId:i,categoryId:n,page:s,itemsPerPage:a}}),ae=()=>e.jsx("div",{children:"Loading..."}),oe=({foodbevItemsPage:s})=>e.jsx(S,{foodbevItems:s.foodbevItems}),re=({error:s})=>e.jsx("div",{className:"rw-cell-error",children:s==null?void 0:s.message}),ne=({foodbevItemsPage:s})=>e.jsx(S,{foodbevItems:s.foodbevItems,count:s.count}),ie=l.createCell({QUERY:u,beforeQuery:se,Loading:ae,Empty:oe,Failure:re,Success:ne,displayName:"FoodbevItemsCell"}),fe=({categoryId:s,page:n=1,itemsPerPage:i=10})=>{const a=w();return e.jsx(ie,{categoryId:s,golfClubId:a,page:n,itemsPerPage:i})};export{fe 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.