From 6bdcb6032f4106b31e2aac0b5655d1bb1b6dca01 Mon Sep 17 00:00:00 2001 From: Ieva Sinkeviciute Date: Mon, 26 Apr 2021 21:26:43 +0300 Subject: [PATCH 1/2] add OrganizationTasksPage --- src/App.tsx | 5 + .../queries/organizations-tasks.graphql | 9 + src/graphql/types.ts | 1173 +++++++++-------- src/navigation.ts | 1 + src/pages/OrganizationTasksPage.tsx | 72 + 5 files changed, 717 insertions(+), 543 deletions(-) create mode 100644 src/graphql/queries/organizations-tasks.graphql create mode 100644 src/pages/OrganizationTasksPage.tsx diff --git a/src/App.tsx b/src/App.tsx index 1d724b23..e3ca9f0c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -66,6 +66,11 @@ export default function App() { path="/logout" component={React.lazy(() => import('./pages/PageNotImplemented'))} /> + import('./pages/OrganizationTasksPage'))} + /> import('./pages/Home'))} /> diff --git a/src/graphql/queries/organizations-tasks.graphql b/src/graphql/queries/organizations-tasks.graphql new file mode 100644 index 00000000..ba0b4f07 --- /dev/null +++ b/src/graphql/queries/organizations-tasks.graphql @@ -0,0 +1,9 @@ +query GetOrganizaionTasks { + organizationTasks { + id, + title, + description, + organization, + isDone + } +} diff --git a/src/graphql/types.ts b/src/graphql/types.ts index f7e551d7..55b87fa7 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -4,672 +4,759 @@ 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']; +}; -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; +/** 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; }; -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; +/** Represents a gender. */ +export type Gender = { + __typename?: 'Gender'; + /** Gender id */ + id: Scalars['String']; + /** Gender name */ + value: Scalars['String']; }; -export type DeleteAnimalInput = { - /** Animal id, for example 2 */ - id: Scalars['Int']; +export enum MicrochipStatus { + Implanted = 'Implanted', + Removed = 'Removed', +} + +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; }; -/** 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 MutationCreateAnimalArgs = { + input: CreateAnimalInput; }; -/** Represents an animal details. */ -export type AnimalDetailsBreedArgs = { - language?: Maybe; +export type MutationUpdateAnimalArgs = { + input: UpdateAnimalInput; }; -/** Represents an animal details. */ -export type AnimalDetailsSpeciesArgs = { - language?: Maybe; +export type MutationDeleteAnimalArgs = { + input: DeleteAnimalInput; }; -/** Represents an animal details. */ -export type AnimalDetailsGenderArgs = { - language?: Maybe; +export type MutationDeleteAnimalDetailsArgs = { + id: Scalars['Int']; }; -/** Represents an animal details. */ -export type AnimalDetailsColorArgs = { - language?: Maybe; +export type MutationDeleteAnimalMicrochipArgs = { + animalId: Scalars['Int']; + microchipId: 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 MutationDeleteAnimalRegistrationArgs = { + id: Scalars['Int']; }; -export enum MicrochipStatus { - Implanted = 'Implanted', - Removed = 'Removed', -} +export type MutationCreateOrganizationArgs = { + input: CreateOrganisationInput; +}; -/** 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 MutationUpdateOrganizationArgs = { + input: UpdateOrganizationInput; }; -/** Represents an animal microchip. */ -export type AnimalMicrochipStatusArgs = { - language?: Maybe; +export type MutationDeleteOrganizationArgs = { + id: Scalars['Int']; }; -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 MutationCreateUserArgs = { + 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 MutationUpdateUserArgs = { + input: UserInput; }; -export enum RegistrationStatus { - Active = 'Active', - Inactive = 'Inactive', -} +export type MutationDeleteUserArgs = { + id: Scalars['String']; +}; -/** 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 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 AnimalRegistrationStatusArgs = { - language?: 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>>; }; -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 QueryAnimalArgs = { + id: Scalars['Int']; }; -/** 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 QueryAnimalsArgs = { + ids?: Maybe>; }; -/** Represents a color. */ -export type Color = { - __typename?: 'Color'; - /** Color id */ - id: Scalars['Int']; - /** Color name */ - value: Scalars['String']; +export type QueryBreedsArgs = { + species: Scalars['String']; + language: Scalars['String']; }; -export enum Category { - General = 'GENERAL', - Medical = 'MEDICAL', -} +export type QueryChipCompaniesArgs = { + language: Scalars['String']; +}; -/** 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.tsx b/src/pages/OrganizationTasksPage.tsx new file mode 100644 index 00000000..e74b37d2 --- /dev/null +++ b/src/pages/OrganizationTasksPage.tsx @@ -0,0 +1,72 @@ +import { loader } from 'graphql.macro'; +import React from 'react'; + +import { useQuery } from '@apollo/client'; +import { Card, CardActions, CardContent, Typography } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; +import { Skeleton } from '@material-ui/lab'; +import Page from './Page'; + +const GET_ORGANIZATION_TASKS_QUERY = loader('../graphql/queries/organizations-tasks.graphql'); + +export default function OrganizationTasksPage() { + const classes = useStyles(); + const { loading, data, error } = useQuery(GET_ORGANIZATION_TASKS_QUERY); + + if (loading) { + return ; + } + + if (error) { + // TODO: replace with proper UI elements + return

Oooops! Something went wrong

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

Sorry, no data found.

; + } + + return ( + + {data.organizationTasks.map(organizationTask => ( + + + {organizationTask.title} + {organizationTask.description} + + {organizationTask.isDone ? ( + + + Task to be done + + + ) : ( + + + Task to be taken + + + )} + + ))} + + ); +} + +const useStyles = makeStyles(() => ({ + isDone: { + backgroundColor: 'rgb(99, 206, 98)', + width: '100%', + padding: '10px', + }, + NotDone: { + backgroundColor: 'rgb(249, 185, 207)', + width: '100%', + padding: '10px', + }, + cardCharacteristics: { + width: '50%', + margin: '10px', + }, +})); From 8b14ed928d3f38157eb5a5979b99531279c6d491 Mon Sep 17 00:00:00 2001 From: Ieva Sinkeviciute Date: Tue, 27 Apr 2021 20:37:39 +0300 Subject: [PATCH 2/2] add changes after review --- src/pages/OrganizationTasksPage.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/OrganizationTasksPage.tsx b/src/pages/OrganizationTasksPage.tsx index e74b37d2..eb888610 100644 --- a/src/pages/OrganizationTasksPage.tsx +++ b/src/pages/OrganizationTasksPage.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { useQuery } from '@apollo/client'; import { Card, CardActions, CardContent, Typography } from '@material-ui/core'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles, Theme } from '@material-ui/core/styles'; import { Skeleton } from '@material-ui/lab'; import Page from './Page'; @@ -42,8 +42,8 @@ export default function OrganizationTasksPage() { ) : ( - - + + Task to be taken @@ -54,14 +54,14 @@ export default function OrganizationTasksPage() { ); } -const useStyles = makeStyles(() => ({ +const useStyles = makeStyles((theme: Theme) => ({ isDone: { - backgroundColor: 'rgb(99, 206, 98)', + backgroundColor: theme.palette.success.light, width: '100%', padding: '10px', }, - NotDone: { - backgroundColor: 'rgb(249, 185, 207)', + notDone: { + backgroundColor: theme.palette.error.light, width: '100%', padding: '10px', },