Skip to content

Commit

Permalink
change retrieve location option to uc and gates (#77)
Browse files Browse the repository at this point in the history
* change retrieve location option to uc and gates

* fix retreive location database issues
  • Loading branch information
axgu authored May 27, 2024
1 parent b46c5d3 commit a7a9c5a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
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

0 comments on commit a7a9c5a

Please sign in to comment.