Skip to content
New issue

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

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

Already on GitHub? # to your account

change retrieve location option to uc and gates #77

Merged
merged 2 commits into from
May 27, 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
7 changes: 6 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ enum Location {
OTHER
}

enum RetrieveLocation {
CUC
GHC
}

enum Category {
CLOTHING
CHARGER
Expand Down Expand Up @@ -102,7 +107,7 @@ model Item {
color Color
value Value
identifiable Boolean
retrieveLocation Location
retrieveLocation RetrieveLocation
itemLocation String
longDescription String?
auditLogs AuditLog[]
Expand Down
7 changes: 4 additions & 3 deletions src/pages/manage/items/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Color,
ItemInteraction,
Location,
RetrieveLocation,
Value
} from '@prisma/client';
import MyListbox from 'components/Form/Listbox';
Expand All @@ -17,7 +18,7 @@ import { ItemCreateSchema } from 'lib/schemas';
import { useRouter } from 'next/router';
import { NextPageWithLayout } from 'pages/_app';
import { toast } from 'react-toastify';
import { Categories, Colors, Locations } from 'types';
import { Categories, Colors, Locations, RetrieveLocations } from 'types';
import { trpc } from 'utils/trpc';

const CreateItem: NextPageWithLayout = () => {
Expand Down Expand Up @@ -219,8 +220,8 @@ const CreateItem: NextPageWithLayout = () => {
</span>
</label>
<MyListbox
values={Object.values(Location)}
displayValue={(prop) => Locations[prop]}
values={Object.values(RetrieveLocation)}
displayValue={(prop) => RetrieveLocations[prop]}
keyValue={(prop) => prop}
name="retrieveLocation"
control={methods.control}
Expand Down
8 changes: 7 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Category, Color, Location } from '@prisma/client';
import { Category, Color, Location, RetrieveLocation } from '@prisma/client';

export const Locations: Record<Location, string> = {
AN: 'Ansys Hall',
Expand All @@ -23,6 +23,12 @@ export const Locations: Record<Location, string> = {
TEP: 'Tepper Quad',
OTHER: 'Other'
};

export const RetrieveLocations: Record<RetrieveLocation, string> = {
CUC: 'Cohon University Center',
GHC: 'Gates and Hillman Centers'
};

export const Colors: Record<Color, string> = {
BLACK: 'Black',
BLUE: 'Blue',
Expand Down
Loading