Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/scanner #286

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions components/admin/lists/filterable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ export const filterItems = (items, filters) => {
} else if (filter.field == 'passes') {
const matches = person[filter.field].map((pass) => pass.toLowerCase()).join(', ').includes(filterValue.toLowerCase())
excludePerson = excludePerson || (invertFilter ? matches : !matches)
} else if (filter.field == 'signed_in') {
excludePerson = excludePerson || (filterValue == true && !person[filter.field]) || (person[filter.field] && format(new Date(person[filter.field]), 'eee') != filterValue)
} else if (filter.field == 'checkin_at') {
excludePerson = excludePerson
|| (true == filterValue && false == person[filter.field]) // Exclude anyone who hasn't checked in
|| (false == filterValue && false != person[filter.field]) // Exclude anyone who has checked in
|| (!invertFilter && ![true,false].includes(filterValue) && (person[filter.field] == false || format(new Date(person[filter.field]), 'eee').toLowerCase() != filterValue.toLowerCase())) // Exlude anyone if we're not search for true or false and the day matches
|| (invertFilter && ![true,false].includes(filterValue) && (person[filter.field] == false || format(new Date(person[filter.field]), 'eee').toLowerCase() == filterValue.toLowerCase())) // Exlude anyonee if we're not search for true or false and the day DOESNT matche and we've inverted the filter
if(['2212652493','5060423521'].includes(person.ticket_number)) {
console.log("FILTER",person.name,filter.field,filterValue,person[filter.field],excludePerson,format(new Date(person[filter.field]), 'eee'))
}
} else if (filter.field == 'active') {
excludePerson = excludePerson || person[filter.field] != filterValue
} else {
Expand Down
8 changes: 4 additions & 4 deletions components/admin/scan/ScanSuccessDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ const accessToWristbands = (accesCode: number[], line_items: line_item[]) => {
const classPass = line_items.filter((li) => { return /Class\sPass/.test(li.description)}).length > 0 || (accesCode[1] > 0 && accesCode[4] > 0) && !fullPassLike
const saturdayPass = line_items.filter((li) => { return /Saturday\sPass/.test(li.description) }).length > 0 || (accesCode[1] > 0 && accesCode[3] > 0) && !fullPassLike
const sundayPass = line_items.filter((li) => { return /Sunday\sPass/.test(li.description) }).length > 0 || (accesCode[4] > 0 && accesCode[5] > 0) && !fullPassLike
const saturdayClass = line_items.filter((li) => { return /Saturday\s-\sClass/.test(li.description) }).length > 0 || (accesCode[1] > 0 && !saturdayPass) && !fullPassLike
const saturdayParty = line_items.filter((li) => { return /Saturday\s-\sParty/.test(li.description) || /Dine\sand\sDance\sPass/.test(li.description) }).length > 0 || (accesCode[3] > 0 && !saturdayPass) && !fullPassLike
const sundayClass = line_items.filter((li) => { return /Sunday\s-\sClass/.test(li.description) }).length > 0 || (accesCode[4] > 0 && !sundayPass) && !fullPassLike
const sundayParty = line_items.filter((li) => { return /Sunday\s-\sParty/.test(li.description) }).length > 0 || (accesCode[5] > 0 && !sundayPass) && !fullPassLike
const saturdayClass = line_items.filter((li) => { return /Saturday\s-\sClass/.test(li.description) }).length > 0 || (accesCode[1] > 0 && !saturdayPass && !classPass) && !fullPassLike
const saturdayParty = line_items.filter((li) => { return /Saturday\s-\sParty/.test(li.description) || /Dine\sand\sDance\sPass/.test(li.description) }).length > 0 || (accesCode[3] > 0 && !saturdayPass && !partyPass) && !fullPassLike
const sundayClass = line_items.filter((li) => { return /Sunday\s-\sClass/.test(li.description) }).length > 0 || (accesCode[4] > 0 && !sundayPass && !classPass) && !fullPassLike
const sundayParty = line_items.filter((li) => { return /Sunday\s-\sParty/.test(li.description) }).length > 0 || (accesCode[5] > 0 && !sundayPass && !partyPass) && !fullPassLike

if(meal) { wristBands.push({
colour: "bg-white text-black",
Expand Down
4 changes: 2 additions & 2 deletions components/admin/ticketList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ export default function TicketList() {
</th>
<th scope="col" className={`${headerClassNames} sm:rounded-r-lg max-w-24 flex-grow-0`}>
<span className={headerContainerClassNames}>
<FilterLabel fieldname={"signed_in"} addFilterFunction={addFilter}>
<FilterLabel fieldname={"checkin_at"} addFilterFunction={addFilter}>
<span className={`${labelClassNames} text-nowrap`}>Check-in?</span>
</FilterLabel>
{ sortFieldToggler('signed_in') }
{ sortFieldToggler('checkin_at') }
</span>
</th>
<th scope="col" className={`${headerClassNames} relative py-3.5 pl-3 pr-4 sm:pr-0 min-w-20 hidden sm:table-cell`}>
Expand Down
19 changes: 12 additions & 7 deletions components/admin/till.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ const Till = ({fullPassFunction,scrollToElement}:{fullPassFunction?:Function,scr
const [payments,setPayments] = useState([] as any[])
const [ticket,setTicket] = useState(false as any)
const [selectedAccessArray, setSelectedAccessArray] = useState([])


const tillColours = {
TILL1: "bg-chillired-500 text-white",
TILL2: "bg-blue-400 text-white",
TILL3: "bg-gold-400 text-black",
}

// const router = useRouter()

Expand Down Expand Up @@ -216,7 +221,7 @@ const Till = ({fullPassFunction,scrollToElement}:{fullPassFunction?:Function,scr
md:grid-cols-4 md:pt-12 md:mx-3 md:text-base
">
{ ticket ? <div className='fixed z-50 w-full'><ScanSuccessDialog scan={ticket} onClick={()=>{setTicket(false); console.log("Checkin")}}/></div> : null }
<h1 className='col-span-3 md:col-span-full block font-bold text-xl'>{till}</h1>
<h1 className={`${tillColours[till]} col-span-3 md:col-span-full block font-bold text-xl p-3 mt-2 rounded-lg`}>{till}</h1>
<div className='col-span-1'>
<PassCards
currentSelectedOptions={selectedOptions}
Expand Down Expand Up @@ -311,11 +316,11 @@ const Till = ({fullPassFunction,scrollToElement}:{fullPassFunction?:Function,scr

</div>
) : <div>
<h2 className='text-xl'>Select Till</h2>
<div className='flex gap-3'>
<button onClick={()=>{ changeTill('TILL1')}} className='rounded-md bg-chillired-500 px-6 py-3'>Till 1</button>
<button onClick={()=>{ changeTill('TILL2')}} className='rounded-md bg-chillired-500 px-6 py-3'>Till 2</button>
<button onClick={()=>{ changeTill('TILL3')}} className='rounded-md bg-chillired-500 px-6 py-3'>Till 3</button>
<h2 className='text-xl flex justify-center'>Select Till</h2>
<div className='flex justify-center flex-wrap gap-3 mx-auto'>
<button onClick={()=>{ changeTill('TILL1')}} className={`${tillColours['TILL1']} text-5xl rounded-md px-6 py-3`}>Till 1</button>
<button onClick={()=>{ changeTill('TILL2')}} className={`${tillColours['TILL2']} text-5xl rounded-md px-6 py-3`}>Till 2</button>
<button onClick={()=>{ changeTill('TILL3')}} className={`${tillColours['TILL3']} text-5xl rounded-md px-6 py-3`}>Till 3</button>
{/* <button onClick={()=>{ changeTill('purchase')}} className='rounded-md bg-chillired-500 px-6 py-3'>All Purchases</button> */}
</div>

Expand Down
Loading