diff --git a/src/App.tsx b/src/App.tsx index 1d724b23..6f2d3496 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -55,6 +55,11 @@ export default function App() { path="/animal/:id" component={React.lazy(() => import('./pages/AnimalDetailsPage'))} /> + import('./pages/OrganizationTasksPage'))} + /> + + + {task.title} + + } + subheader={{task.description}} + /> + + + {task.isDone ? DONE : TODO} + + + + + ); +} + +const useStyles = makeStyles((theme: Theme) => ({ + root: { + width: '100%', + }, + headerText: { + maxWidth: 150, + [theme.breakpoints.up('md')]: { + maxWidth: 350, + }, + [theme.breakpoints.up('lg')]: { + maxWidth: 600, + }, + fontSize: 20, + lineHeight: '24px', + fontWeight: 600, + }, + done: { + color: theme.palette.success.contrastText, + backgroundColor: theme.palette.success.main, + }, + todo: { + backgroundColor: theme.palette.error.light, + color: theme.palette.error.contrastText, + }, + subHeaderText: { + color: theme.palette.grey['600'], + }, +})); + +interface TaskCardProps { + task: OrganizationTask; +} diff --git a/src/components/task/TaskList.tsx b/src/components/task/TaskList.tsx new file mode 100644 index 00000000..657dbde1 --- /dev/null +++ b/src/components/task/TaskList.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +import { Box } from '@material-ui/core'; +import { OrganizationTask } from '../../graphql/types'; +import TaskCard from './TaskCard'; + +interface TaskListProps { + tasks: OrganizationTask[]; +} + +export default function TaskList({ tasks }: TaskListProps) { + return ( + + {tasks.map(task => ( + + ))} + + ); +} diff --git a/src/components/task/TaskListContainer.tsx b/src/components/task/TaskListContainer.tsx new file mode 100644 index 00000000..c15b521a --- /dev/null +++ b/src/components/task/TaskListContainer.tsx @@ -0,0 +1,28 @@ +import { loader } from 'graphql.macro'; +import React from 'react'; + +import { useQuery } from '@apollo/client'; +import { Skeleton } from '@material-ui/lab'; +import TaskList from './TaskList'; + +const GET_ORGANIZATION_TASKS_QUERY = loader('src/graphql/queries/organization-tasks.graphql'); + +export default function TaskListContainer() { + const { loading, data, error } = useQuery(GET_ORGANIZATION_TASKS_QUERY); + + if (loading) { + return ; + } + + if (error) { + // TODO: replace with proper UI elements + return

Error!

; + } + + if (!data?.organizationTasks?.length) { + // TODO: replace with proper UI elements + return

No data!

; + } + + return ; +} diff --git a/src/graphql/queries/organization-tasks.graphql b/src/graphql/queries/organization-tasks.graphql new file mode 100644 index 00000000..f1e7abcd --- /dev/null +++ b/src/graphql/queries/organization-tasks.graphql @@ -0,0 +1,8 @@ +query getOrganizationTasks { + organizationTasks { + id, + title, + description, + isDone + } +} diff --git a/src/graphql/types.ts b/src/graphql/types.ts index f7e551d7..6118eae9 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -4,672 +4,795 @@ export type MakeOptional = Omit & { [SubKey in K]?: export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: string; - String: string; - Boolean: boolean; - Int: number; - Float: number; + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + /** The `Upload` scalar type represents a file upload. */ + Upload: any; }; -export type Query = { - __typename?: 'Query'; - /** - * Lookup an animal. - * - * Examples: - * - * animal(id: 1) - */ - animal?: Maybe; - /** - * Get all animals. - * - * Examples: - * - * animals - */ - animals?: Maybe>>; - /** - * Get all breeds. - * - * Examples: - * - * breeds(species: "2", language: "lt") - */ - breeds?: Maybe>>; - /** - * Get all colors. - * - * Examples: - * - * colors(language: "lt") - */ - colors?: Maybe>>; - /** - * Get all events and types - * - * Example: - * events(language: "lt") - */ - events?: Maybe>>; - /** - * Get all genders. - * - * Examples: - * - * genders(language: "lt") - */ - genders?: Maybe>>; - /** - * Lookup an organization. - * - * Examples: - * - * organization(id: 1) - */ - organization?: Maybe; - /** - * Get all organizations. - * - * Examples: - * - * organizations - */ - organizations?: Maybe>>; - _empty?: Maybe; - /** - * Get all species. - * - * Examples: - * - * species(language: "lt") - */ - species?: Maybe>>; - /** - * Get all statuses. - * - * Examples: - * - * statuses(language: "lt") - */ - statuses?: Maybe>>; - /** - * Lookup an user. - * - * Examples: - * - * user(id: 1) - */ - user?: Maybe; - /** - * Get all users. - * - * Examples: - * - * users - */ - users?: Maybe>>; +/** Represents an animal. */ +export type Animal = { + __typename?: 'Animal'; + /** Animal id, for example 2 */ + id: Scalars['Int']; + /** Animal name */ + name?: Maybe; + /** Organization id */ + organization: Scalars['Int']; + /** + * Animal status by language. + * Examples: status(language: "en") or just status - will return default language ("lt") translation + */ + status?: Maybe; + /** Image URL */ + imageUrl?: Maybe; + /** Comments */ + comments?: Maybe; + /** Modification time */ + modTime?: Maybe; + /** Animal active registration info */ + registration?: Maybe; + /** Animal implanted microchip info */ + microchip?: Maybe; + /** Animal details */ + details?: Maybe; }; -export type QueryAnimalArgs = { - id: Scalars['Int']; + +/** Represents an animal. */ +export type AnimalStatusArgs = { + language?: Maybe; }; -export type QueryBreedsArgs = { - species: Scalars['String']; - language: Scalars['String']; +/** Represents an animal details. */ +export type AnimalDetails = { + __typename?: 'AnimalDetails'; + /** Animal id, for example 2 */ + animalId: Scalars['Int']; + /** + * Animal breed by language. + * Examples: breed(language: "en") or just breed - will return default language ("lt") translation + */ + breed?: Maybe; + /** + * Animal species by language + * Examples: species(language: "en") or just species - will return default language ("lt") translation + */ + species?: Maybe; + /** + * Animal gender by language. + * Examples: gender(language: "en") or just gender - will return default language ("lt") translation + */ + gender?: Maybe; + /** + * Animal color by language + * Examples: color(language: "en") or just color - will return default language ("lt") translation + */ + color?: Maybe; + /** Animal date of birth */ + birthDate?: Maybe; + /** Animal weight (kg) */ + weight?: Maybe; + /** Animal allergy */ + allergy?: Maybe; + /** Animal food */ + food?: Maybe; }; -export type QueryColorsArgs = { - language: Scalars['String']; + +/** Represents an animal details. */ +export type AnimalDetailsBreedArgs = { + language?: Maybe; }; -export type QueryEventsArgs = { - language: Scalars['String']; + +/** Represents an animal details. */ +export type AnimalDetailsSpeciesArgs = { + language?: Maybe; }; -export type QueryGendersArgs = { - language: Scalars['String']; + +/** Represents an animal details. */ +export type AnimalDetailsGenderArgs = { + language?: Maybe; }; -export type QueryOrganizationArgs = { - id: Scalars['Int']; + +/** Represents an animal details. */ +export type AnimalDetailsColorArgs = { + language?: Maybe; }; -export type QuerySpeciesArgs = { - language: Scalars['String']; +export type AnimalDetailsInput = { + /** Animal breed id (any value from 'breeds' query) */ + breedId?: Maybe; + /** Animal gender (any value from 'genders' query) */ + genderId?: Maybe; + /** Animal color (any value from 'colors' query) */ + colorId?: Maybe; + /** Animal date of birth (year) */ + birthDate?: Maybe; + /** Animal weight (kg) */ + weight?: Maybe; + /** Animal allergy */ + allergy?: Maybe; + /** Animal food */ + food?: Maybe; }; -export type QueryStatusesArgs = { - language: Scalars['String']; +/** Represents an animal microchip. */ +export type AnimalMicrochip = { + __typename?: 'AnimalMicrochip'; + /** Animal id, for example 2 */ + animalId: Scalars['Int']; + /** Microchip id */ + microchipId: Scalars['String']; + /** Chip company code */ + chipCompanyCode: Scalars['Int']; + /** Microchip install date */ + installDate?: Maybe; + /** Microchip install place */ + installPlace: Scalars['Int']; + /** + * Microchip status ('Implanted' or 'Removed') translation + * Examples: status(language: "en") or just status - will return default language ("lt") translation + */ + status?: Maybe; }; -export type QueryUserArgs = { - id: Scalars['String']; + +/** Represents an animal microchip. */ +export type AnimalMicrochipStatusArgs = { + language?: Maybe; }; -/** Represents an animal. */ -export type Animal = { - __typename?: 'Animal'; - /** Animal id, for example 2 */ - id: Scalars['Int']; - /** Animal name */ - name?: Maybe; - /** Organization id */ - organization: Scalars['Int']; - /** - * Animal status by language. - * Examples: status(language: "en") or just status - will return default language ("lt") translation - */ - status?: Maybe; - /** Image URL */ - imageUrl?: Maybe; - /** Comments */ - comments?: Maybe; - /** Modification time */ - modTime?: Maybe; - /** Animal active registration info */ - registration?: Maybe; - /** Animal implanted microchip info */ - microchip?: Maybe; - /** Animal details */ - details?: Maybe; +/** Represents animal registration */ +export type AnimalRegistration = { + __typename?: 'AnimalRegistration'; + /** Registration number */ + registrationNo: Scalars['String']; + /** Registration date */ + registrationDate?: Maybe; + /** + * Registration status ('Active' or 'Inactive') translation + * Examples: status(language: "en") or just status - will return default language ("lt") translation + */ + status?: Maybe; }; -/** Represents an animal. */ -export type AnimalStatusArgs = { - language?: Maybe; + +/** Represents animal registration */ +export type AnimalRegistrationStatusArgs = { + language?: Maybe; }; -export type Mutation = { - __typename?: 'Mutation'; - /** Created animal */ - createAnimal?: Maybe; - /** Updated animal */ - updateAnimal?: Maybe; - /** Deleted animal */ - deleteAnimal?: Maybe; - /** Delete animal details */ - deleteAnimalDetails?: Maybe; - /** Deleted microchip */ - deleteAnimalMicrochip?: Maybe; - /** Delete animal registration */ - deleteAnimalRegistration?: Maybe; - _empty?: Maybe; - /** Created organization */ - createOrganization?: Maybe; - /** Updated organization */ - updateOrganization?: Maybe; - /** Deleted organization */ - deleteOrganization?: Maybe; - /** Created user */ - createUser?: Maybe; - /** Updated user */ - updateUser?: Maybe; - /** Deleted user */ - deleteUser?: Maybe; +export type AnimalRegistrationInput = { + /** Registration number (255 characters max) */ + registrationNo: Scalars['String']; + /** Registration date (UTC timestamp) */ + registrationDate?: Maybe; + /** Registration status ('Active' or 'Inactive') */ + status?: Maybe; }; -export type MutationCreateAnimalArgs = { - input: CreateAnimalInput; +export enum AnimalStatus { + Healthy = 'healthy', + Vaccinated = 'vaccinated', + Sick = 'sick', + Adopted = 'adopted' +} + +/** Represents a breed. */ +export type Breed = { + __typename?: 'Breed'; + /** Breed id */ + id: Scalars['Int']; + /** Breed abbreviation */ + abbreviation: Scalars['String']; + /** Breed name */ + value: Scalars['String']; }; -export type MutationUpdateAnimalArgs = { - input: UpdateAnimalInput; +export enum Category { + General = 'GENERAL', + Medical = 'MEDICAL' +} + +/** Represents a chip company. */ +export type ChipCompany = { + __typename?: 'ChipCompany'; + /** Chip company id */ + id: Scalars['String']; + /** Chip company value */ + value: Scalars['String']; }; -export type MutationDeleteAnimalArgs = { - input: DeleteAnimalInput; +/** Represents a color. */ +export type Color = { + __typename?: 'Color'; + /** Color id */ + id: Scalars['Int']; + /** Color name */ + value: Scalars['String']; }; -export type MutationDeleteAnimalDetailsArgs = { - id: Scalars['Int']; +export type CreateAnimalInput = { + /** Animal name (128 characters max) */ + name?: Maybe; + /** Organization id */ + organization: Scalars['Int']; + /** Status */ + status?: Maybe; + /** Image File */ + image?: Maybe; + /** Comments */ + comments?: Maybe; + /** AnimalRegistration */ + registration: AnimalRegistrationInput; + /** AnimalDetails */ + details?: Maybe; + /** AnimalMicrochip */ + microchip?: Maybe; }; -export type MutationDeleteAnimalMicrochipArgs = { - animalId: Scalars['Int']; - microchipId: Scalars['String']; +export type CreateAnimalMicrochipInput = { + /** Microchip id (255 characters max) */ + microchipId: Scalars['String']; + /** Chip company code */ + chipCompanyCode: Scalars['Int']; + /** Install date (UTC timestamp) */ + installDate?: Maybe; + /** Install place */ + installPlace: Scalars['Int']; + /** Microchip status ('Implanted' or 'Removed') */ + status: MicrochipStatus; }; -export type MutationDeleteAnimalRegistrationArgs = { - id: Scalars['Int']; +export type CreateOrganisationInput = { + /** Organization name (255 characters max) */ + name: Scalars['String']; + /** Country (128 characters max) */ + country?: Maybe; + /** City (128 characters max) */ + city?: Maybe; + /** Street address (255 characters max) */ + streetAddress?: Maybe; + /** Phone (64 characters max) */ + phone?: Maybe; }; -export type MutationCreateOrganizationArgs = { - input: CreateOrganisationInput; +export type DeleteAnimalInput = { + /** Animal id, for example 2 */ + id: Scalars['Int']; }; -export type MutationUpdateOrganizationArgs = { - input: UpdateOrganizationInput; +/** Represents event */ +export type Event = { + __typename?: 'Event'; + /** Event id */ + id: Scalars['Int']; + /** Animal id */ + animal: Scalars['Int']; + /** Event type */ + type?: Maybe; + /** Event expenses */ + expenses?: Maybe; + /** Event date */ + dateTime?: Maybe; + /** Event comments */ + comments?: Maybe; + /** Event category */ + category?: Maybe; }; -export type MutationDeleteOrganizationArgs = { - id: Scalars['Int']; +/** Represents event type */ +export type EventType = { + __typename?: 'EventType'; + /** Event type id */ + id: Scalars['Int']; + /** Event type */ + type: Scalars['String']; }; -export type MutationCreateUserArgs = { - input: UserInput; +/** Represents events types */ +export type Events = { + __typename?: 'Events'; + /** All events */ + all?: Maybe>>; + /** All animal events */ + animalAll?: Maybe>>; + /** All general events */ + general?: Maybe>>; + /** Animal general events */ + animalGeneral?: Maybe>>; + /** All medical events */ + medical?: Maybe>>; + /** Animal medical events */ + animalMedical?: Maybe>>; + /** All event types */ + types?: Maybe>>; }; -export type MutationUpdateUserArgs = { - input: UserInput; + +/** Represents events types */ +export type EventsAnimalAllArgs = { + animalId: Scalars['Int']; }; -export type MutationDeleteUserArgs = { - id: Scalars['String']; + +/** Represents events types */ +export type EventsAnimalGeneralArgs = { + animalId: Scalars['Int']; }; -export enum AnimalStatus { - Healthy = 'healthy', - Vaccinated = 'vaccinated', - Sick = 'sick', - Adopted = 'adopted', + +/** Represents events types */ +export type EventsAnimalMedicalArgs = { + animalId: Scalars['Int']; +}; + +/** Represents a former animal owner. */ +export type FormerAnimalOwner = { + __typename?: 'FormerAnimalOwner'; + /** Former animal owner ID, e.g., 1 */ + id: Scalars['Int']; + /** Former animal owner name */ + name: Scalars['String']; + /** Former animal owner surname */ + surname?: Maybe; + /** Former animal owner phone number */ + phone?: Maybe; +}; + +/** Represents a gender. */ +export type Gender = { + __typename?: 'Gender'; + /** Gender id */ + id: Scalars['String']; + /** Gender name */ + value: Scalars['String']; +}; + +export enum MicrochipStatus { + Implanted = 'Implanted', + Removed = 'Removed' } -export type CreateAnimalInput = { - /** Animal name (128 characters max) */ - name?: Maybe; - /** Organization id */ - organization: Scalars['Int']; - /** Status */ - status?: Maybe; - /** Image URL */ - image_url?: Maybe; - /** Comments */ - comments?: Maybe; - /** AnimalRegistration */ - registration: AnimalRegistrationInput; - /** AnimalDetails */ - details?: Maybe; - /** AnimalMicrochip */ - microchip?: Maybe; +export type Mutation = { + __typename?: 'Mutation'; + /** Created animal */ + createAnimal?: Maybe; + /** Updated animal */ + updateAnimal?: Maybe; + /** Deleted animal */ + deleteAnimal?: Maybe; + /** Delete animal details */ + deleteAnimalDetails?: Maybe; + /** Deleted microchip */ + deleteAnimalMicrochip?: Maybe; + /** Delete animal registration */ + deleteAnimalRegistration?: Maybe; + _empty?: Maybe; + /** Created organization */ + createOrganization?: Maybe; + /** Updated organization */ + updateOrganization?: Maybe; + /** Deleted organization */ + deleteOrganization?: Maybe; + /** Created user */ + createUser?: Maybe; + /** Updated user */ + updateUser?: Maybe; + /** Deleted user */ + deleteUser?: Maybe; }; -export type UpdateAnimalInput = { - /** Animal id, for example 2 */ - id: Scalars['Int']; - /** Animal name (128 characters max) */ - name?: Maybe; - /** Organization id */ - organization?: Maybe; - /** Status */ - status?: Maybe; - /** Image URL */ - image_url?: Maybe; - /** Comments */ - comments?: Maybe; - /** AnimalRegistration */ - registration?: Maybe; - /** AnimalDetails */ - details?: Maybe; - /** AnimalMicrochip */ - microchip?: Maybe; + +export type MutationCreateAnimalArgs = { + input: CreateAnimalInput; }; -export type DeleteAnimalInput = { - /** Animal id, for example 2 */ - id: Scalars['Int']; + +export type MutationUpdateAnimalArgs = { + input: UpdateAnimalInput; }; -/** Represents an animal details. */ -export type AnimalDetails = { - __typename?: 'AnimalDetails'; - /** Animal id, for example 2 */ - animalId: Scalars['Int']; - /** - * Animal breed by language. - * Examples: breed(language: "en") or just breed - will return default language ("lt") translation - */ - breed?: Maybe; - /** - * Animal species by language - * Examples: species(language: "en") or just species - will return default language ("lt") translation - */ - species?: Maybe; - /** - * Animal gender by language. - * Examples: gender(language: "en") or just gender - will return default language ("lt") translation - */ - gender?: Maybe; - /** - * Animal color by language - * Examples: color(language: "en") or just color - will return default language ("lt") translation - */ - color?: Maybe; - /** Animal date of birth */ - birthDate?: Maybe; - /** Animal weight (kg) */ - weight?: Maybe; - /** Animal allergy */ - allergy?: Maybe; - /** Animal food */ - food?: Maybe; + +export type MutationDeleteAnimalArgs = { + input: DeleteAnimalInput; }; -/** Represents an animal details. */ -export type AnimalDetailsBreedArgs = { - language?: Maybe; + +export type MutationDeleteAnimalDetailsArgs = { + id: Scalars['Int']; }; -/** Represents an animal details. */ -export type AnimalDetailsSpeciesArgs = { - language?: Maybe; + +export type MutationDeleteAnimalMicrochipArgs = { + animalId: Scalars['Int']; + microchipId: Scalars['String']; }; -/** Represents an animal details. */ -export type AnimalDetailsGenderArgs = { - language?: Maybe; + +export type MutationDeleteAnimalRegistrationArgs = { + id: Scalars['Int']; }; -/** Represents an animal details. */ -export type AnimalDetailsColorArgs = { - language?: Maybe; + +export type MutationCreateOrganizationArgs = { + input: CreateOrganisationInput; }; -export type AnimalDetailsInput = { - /** Animal breed id (any value from 'breeds' query) */ - breedId?: Maybe; - /** Animal gender (any value from 'genders' query) */ - genderId?: Maybe; - /** Animal color (any value from 'colors' query) */ - colorId?: Maybe; - /** Animal date of birth (year) */ - birthDate?: Maybe; - /** Animal weight (kg) */ - weight?: Maybe; - /** Animal allergy */ - allergy?: Maybe; - /** Animal food */ - food?: Maybe; + +export type MutationUpdateOrganizationArgs = { + input: UpdateOrganizationInput; }; -export enum MicrochipStatus { - Implanted = 'Implanted', - Removed = 'Removed', -} -/** Represents an animal microchip. */ -export type AnimalMicrochip = { - __typename?: 'AnimalMicrochip'; - /** Animal id, for example 2 */ - animalId: Scalars['Int']; - /** Microchip id */ - microchipId: Scalars['String']; - /** Chip company code */ - chipCompanyCode: Scalars['Int']; - /** Microchip install date */ - installDate?: Maybe; - /** Microchip install place */ - installPlace: Scalars['Int']; - /** - * Microchip status ('Implanted' or 'Removed') translation - * Examples: status(language: "en") or just status - will return default language ("lt") translation - */ - status?: Maybe; +export type MutationDeleteOrganizationArgs = { + id: Scalars['Int']; }; -/** Represents an animal microchip. */ -export type AnimalMicrochipStatusArgs = { - language?: Maybe; + +export type MutationCreateUserArgs = { + input: UserInput; }; -export type CreateAnimalMicrochipInput = { - /** Microchip id (255 characters max) */ - microchipId: Scalars['String']; - /** Chip company code */ - chipCompanyCode: Scalars['Int']; - /** Install date (UTC timestamp) */ - installDate?: Maybe; - /** Install place */ - installPlace: Scalars['Int']; - /** Microchip status ('Implanted' or 'Removed') */ - status: MicrochipStatus; + +export type MutationUpdateUserArgs = { + input: UserInput; }; -export type UpdateAnimalMicrochipInput = { - /** Chip company code (255 characters max) */ - chipCompanyCode?: Maybe; - /** Install date */ - installDate?: Maybe; - /** Install place */ - installPlace?: Maybe; - /** Microchip status ('Implanted' or 'Removed') */ - status?: Maybe; + +export type MutationDeleteUserArgs = { + id: Scalars['String']; }; -export enum RegistrationStatus { - Active = 'Active', - Inactive = 'Inactive', -} +/** Represents an organization. */ +export type Organization = { + __typename?: 'Organization'; + /** Organization id, for example 2 */ + id: Scalars['Int']; + /** Organization name */ + name?: Maybe; + /** Country */ + country?: Maybe; + /** City */ + city?: Maybe; + /** Comments */ + streetAddress?: Maybe; + /** Phone */ + phone?: Maybe; + /** Modification time */ + modTime: Scalars['String']; + /** Delete time */ + deleteTime?: Maybe; +}; + +export type OrganizationTask = { + __typename?: 'OrganizationTask'; + id: Scalars['Int']; + title?: Maybe; + description?: Maybe; + organization: Scalars['Int']; + isDone?: Maybe; +}; -/** Represents animal registration */ -export type AnimalRegistration = { - __typename?: 'AnimalRegistration'; - /** Registration number */ - registrationNo: Scalars['String']; - /** Registration date */ - registrationDate?: Maybe; - /** - * Registration status ('Active' or 'Inactive') translation - * Examples: status(language: "en") or just status - will return default language ("lt") translation - */ - status?: Maybe; +export type Query = { + __typename?: 'Query'; + /** + * Lookup an animal. + * + * Examples: + * + * animal(id: 1) + */ + animal?: Maybe; + /** + * Get all animals. + * + * Examples: + * + * animals + */ + animals?: Maybe>>; + /** + * Get all breeds. + * + * Examples: + * + * breeds(species: "2", language: "lt") + */ + breeds?: Maybe>>; + /** + * Get all chipCompanies. + * + * Examples: + * + * chipCompanies(language: "lt") + */ + chipCompanies?: Maybe>>; + /** + * Get all colors. + * + * Examples: + * + * colors(language: "lt") + */ + colors?: Maybe>>; + /** + * Get all events and types + * + * Example: + * events(language: "lt") + */ + events?: Maybe>>; + /** + * Get all former animal owners. + * + * Examples: + * + * formerAnimalOwners + */ + formerAnimalOwners?: Maybe>>; + /** + * Get a former animal owner with a specific ID. + * + * Examples: + * + * formerAnimalOwner(id: 1) + */ + formerAnimalOwner?: Maybe; + /** + * Get all genders. + * + * Examples: + * + * genders(language: "lt") + */ + genders?: Maybe>>; + municipalities?: Maybe>>; + /** + * Lookup an organization. + * + * Examples: + * + * organization(id: 1) + */ + organization?: Maybe; + /** + * Get all organizations. + * + * Examples: + * + * organizations + */ + organizations?: Maybe>>; + organizationTasks?: Maybe>>; + organizationTask?: Maybe; + _empty?: Maybe; + /** + * Get all species. + * + * Examples: + * + * species(language: "lt") + */ + species?: Maybe>>; + /** + * Get all statuses. + * + * Examples: + * + * statuses(language: "lt") + */ + statuses?: Maybe>>; + /** + * Lookup an user. + * + * Examples: + * + * user(id: 1) + */ + user?: Maybe; + /** + * Get all users. + * + * Examples: + * + * users + */ + users?: Maybe>>; }; -/** Represents animal registration */ -export type AnimalRegistrationStatusArgs = { - language?: Maybe; + +export type QueryAnimalArgs = { + id: Scalars['Int']; }; -export type AnimalRegistrationInput = { - /** Registration number (255 characters max) */ - registrationNo: Scalars['String']; - /** Registration date (UTC timestamp) */ - registrationDate?: Maybe; - /** Registration status ('Active' or 'Inactive') */ - status?: Maybe; + +export type QueryAnimalsArgs = { + ids?: Maybe>; }; -/** Represents a breed. */ -export type Breed = { - __typename?: 'Breed'; - /** Breed id */ - id: Scalars['Int']; - /** Breed abbreviation */ - abbreviation: Scalars['String']; - /** Breed name */ - value: Scalars['String']; + +export type QueryBreedsArgs = { + species: Scalars['String']; + language: Scalars['String']; }; -/** Represents a color. */ -export type Color = { - __typename?: 'Color'; - /** Color id */ - id: Scalars['Int']; - /** Color name */ - value: Scalars['String']; + +export type QueryChipCompaniesArgs = { + language: Scalars['String']; }; -export enum Category { - General = 'GENERAL', - Medical = 'MEDICAL', -} -/** Represents event */ -export type Event = { - __typename?: 'Event'; - /** Event id */ - id: Scalars['Int']; - /** Animal id */ - animal: Scalars['Int']; - /** Event type */ - type?: Maybe; - /** Event expenses */ - expenses?: Maybe; - /** Event date */ - dateTime?: Maybe; - /** Event comments */ - comments?: Maybe; - /** Event category */ - category?: Maybe; +export type QueryColorsArgs = { + language: Scalars['String']; }; -/** Represents event type */ -export type EventType = { - __typename?: 'EventType'; - /** Event type id */ - id: Scalars['Int']; - /** Event type */ - type: Scalars['String']; + +export type QueryEventsArgs = { + language: Scalars['String']; }; -/** Represents events types */ -export type Events = { - __typename?: 'Events'; - /** All events */ - all?: Maybe>>; - /** All animal events */ - animalAll?: Maybe>>; - /** All general events */ - general?: Maybe>>; - /** Animal general events */ - animalGeneral?: Maybe>>; - /** All medical events */ - medical?: Maybe>>; - /** Animal medical events */ - animalMedical?: Maybe>>; - /** All event types */ - types?: Maybe>>; + +export type QueryFormerAnimalOwnerArgs = { + id: Scalars['Int']; }; -/** Represents events types */ -export type EventsAnimalAllArgs = { - animalId: Scalars['Int']; + +export type QueryGendersArgs = { + language: Scalars['String']; }; -/** Represents events types */ -export type EventsAnimalGeneralArgs = { - animalId: Scalars['Int']; + +export type QueryOrganizationArgs = { + id: Scalars['Int']; }; -/** Represents events types */ -export type EventsAnimalMedicalArgs = { - animalId: Scalars['Int']; + +export type QueryOrganizationTaskArgs = { + id?: Maybe; }; -/** Represents a gender. */ -export type Gender = { - __typename?: 'Gender'; - /** Gender id */ - id: Scalars['String']; - /** Gender name */ - value: Scalars['String']; + +export type QuerySpeciesArgs = { + language: Scalars['String']; }; -/** Represents an organization. */ -export type Organization = { - __typename?: 'Organization'; - /** Organization id, for example 2 */ - id: Scalars['Int']; - /** Organization name */ - name?: Maybe; - /** Country */ - country?: Maybe; - /** City */ - city?: Maybe; - /** Comments */ - streetAddress?: Maybe; - /** Phone */ - phone?: Maybe; - /** Modification time */ - modTime: Scalars['String']; - /** Delete time */ - deleteTime?: Maybe; + +export type QueryStatusesArgs = { + language: Scalars['String']; }; -export type CreateOrganisationInput = { - /** Organization name (255 characters max) */ - name: Scalars['String']; - /** Country (128 characters max) */ - country?: Maybe; - /** City (128 characters max) */ - city?: Maybe; - /** Street address (255 characters max) */ - streetAddress?: Maybe; - /** Phone (64 characters max) */ - phone?: Maybe; + +export type QueryUserArgs = { + id: Scalars['String']; }; -export type UpdateOrganizationInput = { - /** Organization id, for example 2 */ - id: Scalars['Int']; - /** Organization name (255 characters max) */ - name?: Maybe; - /** Country (128 characters max) */ - country?: Maybe; - /** City (128 characters max) */ - city?: Maybe; - /** Street address (255 characters max) */ - streetAddress?: Maybe; - /** Phone (64 characters max) */ - phone?: Maybe; +export enum RegistrationStatus { + Active = 'Active', + Inactive = 'Inactive' +} + +/** Represents an user role. */ +export type Role = { + __typename?: 'Role'; + /** Organization id */ + organizationId: Scalars['Int']; + /** User role in organization */ + roleType?: Maybe; }; /** Represents a breed. */ export type Species = { - __typename?: 'Species'; - /** Species id */ - id: Scalars['String']; - /** Species name */ - value: Scalars['String']; + __typename?: 'Species'; + /** Species id */ + id: Scalars['String']; + /** Species name */ + value: Scalars['String']; }; /** Represents a status. */ export type Status = { - __typename?: 'Status'; - /** Status id */ - id: Scalars['String']; - /** Status name */ - value: Scalars['String']; + __typename?: 'Status'; + /** Status id */ + id: Scalars['String']; + /** Status name */ + value: Scalars['String']; }; -/** Represents an user. */ -export type User = { - __typename?: 'User'; - /** User id, for example 2 */ - id: Scalars['String']; - /** User username */ - username: Scalars['String']; - /** User name */ - name?: Maybe; - /** User surname */ - surname?: Maybe; - /** User email */ - email?: Maybe; - /** User roles */ - roles?: Maybe>>; - /** Modification time */ - modTime?: Maybe; +export type Subscription = { + __typename?: 'Subscription'; + organizationCreated?: Maybe; }; -/** Represents an user role. */ -export type Role = { - __typename?: 'Role'; - /** Organization id */ - organizationId: Scalars['Int']; - /** User role in organization */ - roleType?: Maybe; +export type UpdateAnimalInput = { + /** Animal id, for example 2 */ + id: Scalars['Int']; + /** Animal name (128 characters max) */ + name?: Maybe; + /** Organization id */ + organization?: Maybe; + /** Status */ + status?: Maybe; + /** Image File */ + image?: Maybe; + /** Comments */ + comments?: Maybe; + /** AnimalRegistration */ + registration?: Maybe; + /** AnimalDetails */ + details?: Maybe; + /** AnimalMicrochip */ + microchip?: Maybe; +}; + +export type UpdateAnimalMicrochipInput = { + /** Chip company code (255 characters max) */ + chipCompanyCode?: Maybe; + /** Install date */ + installDate?: Maybe; + /** Install place */ + installPlace?: Maybe; + /** Microchip status ('Implanted' or 'Removed') */ + status?: Maybe; +}; + +export type UpdateOrganizationInput = { + /** Organization id, for example 2 */ + id: Scalars['Int']; + /** Organization name (255 characters max) */ + name?: Maybe; + /** Country (128 characters max) */ + country?: Maybe; + /** City (128 characters max) */ + city?: Maybe; + /** Street address (255 characters max) */ + streetAddress?: Maybe; + /** Phone (64 characters max) */ + phone?: Maybe; +}; + + +/** Represents an user. */ +export type User = { + __typename?: 'User'; + /** User id, for example 2 */ + id: Scalars['String']; + /** User username */ + username: Scalars['String']; + /** User name */ + name?: Maybe; + /** User surname */ + surname?: Maybe; + /** User email */ + email?: Maybe; + /** User roles */ + roles?: Maybe>>; + /** Modification time */ + modTime?: Maybe; }; export type UserInput = { - /** User id (255 characters max) */ - id: Scalars['String']; - /** User username (128 characters max) */ - username?: Maybe; - /** User name (255 characters max) */ - name?: Maybe; - /** User surname (255 characters max) */ - surname?: Maybe; - /** User email (255 characters max) */ - email?: Maybe; + /** User id (255 characters max) */ + id: Scalars['String']; + /** User username (128 characters max) */ + username?: Maybe; + /** User name (255 characters max) */ + name?: Maybe; + /** User surname (255 characters max) */ + surname?: Maybe; + /** User email (255 characters max) */ + email?: Maybe; +}; + +export type Municipality = { + __typename?: 'municipality'; + id: Scalars['Int']; + name: Scalars['String']; }; diff --git a/src/navigation.ts b/src/navigation.ts index 5bf4ae6f..3d4daf70 100644 --- a/src/navigation.ts +++ b/src/navigation.ts @@ -11,6 +11,7 @@ const navigation: Array = [ { authRequired: true, title: 'Animals', to: '/animal-list', pageTitle: 'Animal list' }, { authRequired: true, title: 'Favourites', to: '/favourites', pageTitle: 'Favourites' }, { authRequired: true, title: 'Reports', to: '/reports', pageTitle: 'Reports' }, + { authRequired: true, title: 'Organization Tasks', to: '/organization-tasks', pageTitle: 'Organization Tasks' }, ]; export { navigation }; diff --git a/src/pages/OrganizationTasksPage.test.tsx b/src/pages/OrganizationTasksPage.test.tsx new file mode 100644 index 00000000..1a899a83 --- /dev/null +++ b/src/pages/OrganizationTasksPage.test.tsx @@ -0,0 +1,45 @@ +import { loader } from 'graphql.macro'; +import React from 'react'; +import { act } from 'react-dom/test-utils'; + +import { screen } from '@testing-library/react'; +import { renderWithMockProvider } from '../test-utils/render-mock-provider'; +import OrganizationTasksPage from './OrganizationTasksPage'; + +jest.mock('@material-ui/lab/Skeleton', () => () =>
Loading...
); + +const GET_ORGANIZATION_TASKS_QUERY = loader('src/graphql/queries/organization-tasks.graphql'); + +test('should have loading state', () => { + renderWithMockProvider(, { query: GET_ORGANIZATION_TASKS_QUERY }); + expect(screen.getByText(/Loading.../i)).toBeInTheDocument(); +}); + +test('should handle error state', async () => { + renderWithMockProvider(, { + query: GET_ORGANIZATION_TASKS_QUERY, + error: new Error('Something went wrong'), + }); + // Wait for the application to update + await act(async () => new Promise(resolve => setTimeout(resolve, 0))); + expect(screen.getByText(/Error!/i)).toBeInTheDocument(); +}); + +test('should load organization task list', async () => { + renderWithMockProvider(, { + query: GET_ORGANIZATION_TASKS_QUERY, + data: { + organizationTasks: [ + { + id: 1, + title: 'Vet for MurkÄ—', + description: 'Place: Kaunakiemio g. 15a', + isDone: false, + }, + ], + }, + }); + // Wait for the application to update + await act(async () => new Promise(resolve => setTimeout(resolve, 0))); + expect(screen.getByText(/Organization Tasks/i)).toBeInTheDocument(); +}); diff --git a/src/pages/OrganizationTasksPage.tsx b/src/pages/OrganizationTasksPage.tsx new file mode 100644 index 00000000..cfddc41e --- /dev/null +++ b/src/pages/OrganizationTasksPage.tsx @@ -0,0 +1,14 @@ +import React from 'react'; + +import TaskListContainer from '../components/task/TaskListContainer'; +import Page from './Page'; + +function OrganizationTasksPage() { + return ( + + + + ); +} + +export default OrganizationTasksPage;