Skip to content

Commit

Permalink
Merge branch 'integration' into LF-4528/Hide_Created_in_Error_option_…
Browse files Browse the repository at this point in the history
…for_animals_with_completed_Tasks
  • Loading branch information
SayakaOno committed Dec 2, 2024
2 parents ed86d4d + 5b60ce0 commit a6eb3c6
Show file tree
Hide file tree
Showing 68 changed files with 1,321 additions and 481 deletions.
5 changes: 5 additions & 0 deletions packages/api/src/controllers/animalBatchController.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ const animalBatchController = {
'origin_id',
'group_ids',
'animal_batch_use_relationships',
'birth_date',
'dam',
'sire',
'brought_in_date',
'weaning_date',
];

// select only allowed properties to edit
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/controllers/taskController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1261,4 +1261,5 @@ async function filterOutDeletedManagementPlans(data, req) {

const flattenInternalIdentifier = (animalOrBatch) => {
animalOrBatch.internal_identifier = animalOrBatch.animal_union_batch.internal_identifier;
delete animalOrBatch.animal_union_batch;
};
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ const getRecordIfExists = async (animalOrBatch, animalOrBatchKey, farm_id) => {
return await AnimalOrBatchModel[animalOrBatchKey]
.query()
.findById(animalOrBatch.id)
.where({ farm_id })
.where({ farm_id, animal_removal_reason_id: null })
.whereNotDeleted()
.withGraphFetched(relations);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,6 @@
},
"PREFERRED_CONTACT": "Bevorzugte Kontaktmethode",
"REQUIRED_LABEL": "Erforderliches Feld",
"TITLE": "Anfrage einreichen",
"TYPE_SUPPORT_LABEL": "Art der Anfrage",
"TYPE_SUPPORT_PLACEHOLDER": "Wählen Sie die Art der Unterstützung",
"WHATSAPP": "Whatsapp",
Expand Down Expand Up @@ -1809,6 +1808,7 @@
"ADD_TASK_FLOW": "Aufgabenerstellung",
"AMOUNT_TO_ALLOCATE": "Zuzuweisender Betrag",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "Mehrere Kulturpflanzen",
"MULTIPLE_LOCATIONS": "Mehrere Standorte"
Expand Down
5 changes: 5 additions & 0 deletions packages/webapp/public/locales/en/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
"UPDATE": "Successfully updated farm info!"
}
},
"HELP_REQUEST": {
"ERROR": {
"SEND": "Something went wrong while submitting your feedback. Please try again."
}
},
"LOG_HARVEST": {
"ERROR": {
"ADD_USE_TYPE": "Failed to add custom harvest use type",
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,6 @@
},
"PREFERRED_CONTACT": "Preferred contact method",
"REQUIRED_LABEL": "Required Field",
"TITLE": "Request Help",
"TYPE_SUPPORT_LABEL": "Type of support",
"TYPE_SUPPORT_PLACEHOLDER": "Choose type of support",
"WHATSAPP": "Whatsapp",
Expand Down Expand Up @@ -1953,6 +1952,7 @@
"ADD_TASK_FLOW": "task creation",
"AMOUNT_TO_ALLOCATE": "Amount to allocate",
"ANIMAL_MOVING_TO_LOCATION": "Moving to:",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "See detail list of animals to move",
"CARD": {
"MULTIPLE_CROPS": "Multiple crops",
"MULTIPLE_LOCATIONS": "Multiple locations"
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,6 @@
},
"PREFERRED_CONTACT": "Método de contacto preferido",
"REQUIRED_LABEL": "Campo solicitado",
"TITLE": "Solicitar ayuda",
"TYPE_SUPPORT_LABEL": "Tipo de ayuda",
"TYPE_SUPPORT_PLACEHOLDER": "Elija tipo de ayuda",
"WHATSAPP": "Whatsapp",
Expand Down Expand Up @@ -1956,6 +1955,7 @@
"ADD_TASK_FLOW": "creación de tareas",
"AMOUNT_TO_ALLOCATE": "Cantidad a asignar",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "Múltiples cultivos",
"MULTIPLE_LOCATIONS": "Múltiples ubicaciones"
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,6 @@
},
"PREFERRED_CONTACT": "Méthode de contact préférée",
"REQUIRED_LABEL": "Champ obligatoire",
"TITLE": "Demander de l'aide",
"TYPE_SUPPORT_LABEL": "Type de support",
"TYPE_SUPPORT_PLACEHOLDER": "Choisissez le type de support",
"WHATSAPP": "Whatsapp",
Expand Down Expand Up @@ -1955,6 +1954,7 @@
"ADD_TASK_FLOW": "création de tâche",
"AMOUNT_TO_ALLOCATE": "Montant à allouer",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "Plusieurs cultures",
"MULTIPLE_LOCATIONS": "Plusieurs emplacements"
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,6 @@
},
"PREFERRED_CONTACT": "पसंदीदा संपर्क विधि",
"REQUIRED_LABEL": "आवश्यक फील्ड",
"TITLE": "सहायता का अनुरोध",
"TYPE_SUPPORT_LABEL": "समर्थन का प्रकार",
"TYPE_SUPPORT_PLACEHOLDER": "समर्थन का प्रकार चुनें",
"WHATSAPP": "व्हाट्सएप",
Expand Down Expand Up @@ -1806,6 +1805,7 @@
"ADD_TASK_FLOW": "कार्य निर्माण",
"AMOUNT_TO_ALLOCATE": "आवंटित राशि",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "कई फसलें",
"MULTIPLE_LOCATIONS": "कई स्थान"
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/ml/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,6 @@
},
"PREFERRED_CONTACT": "കോൺടാക്ട് ചെയ്യാനുള്ള രീതി തിരഞ്ഞെടുക്കുക",
"REQUIRED_LABEL": "ആവശ്യമായ ഫീൽഡ്",
"TITLE": "സഹായം അഭ്യർത്ഥിക്കുക",
"TYPE_SUPPORT_LABEL": "എന്തുതരം സഹായമാണ് വേണ്ടത്",
"TYPE_SUPPORT_PLACEHOLDER": "എന്തുതരം സഹായമാണ് വേണ്ടതെന്ന് തിരഞ്ഞെടുക്കുക",
"WHATSAPP": "വാട്സ്ആപ്പ്",
Expand Down Expand Up @@ -1806,6 +1805,7 @@
"ADD_TASK_FLOW": "ചുമതല സൃഷ്ടിക്കൽ",
"AMOUNT_TO_ALLOCATE": "അനുവദിക്കേണ്ട തുക",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "ഒന്നിലധികം വിളകൾ",
"MULTIPLE_LOCATIONS": "ഒന്നിലധികം സ്ഥാനങ്ങൾ"
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/pa/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,6 @@
},
"PREFERRED_CONTACT": "ਪਸੰਦੀਦਾ ਸੰਪਰਕ ਵਿਧੀ",
"REQUIRED_LABEL": "ਲੋੜੀਂਦਾ ਖੇਤਰ",
"TITLE": "ਮਦਦ ਲਈ ਬੇਨਤੀ ਕਰੋ",
"TYPE_SUPPORT_LABEL": "ਸਹਾਇਤਾ ਦੀ ਕਿਸਮ",
"TYPE_SUPPORT_PLACEHOLDER": "ਸਹਾਇਤਾ ਦੀ ਕਿਸਮ ਚੁਣੋ",
"WHATSAPP": "ਵਟਸਐਪ",
Expand Down Expand Up @@ -1806,6 +1805,7 @@
"ADD_TASK_FLOW": "ਕਾਰਜ ਰਚਨਾ",
"AMOUNT_TO_ALLOCATE": "ਅਲਾਟ ਕਰਨ ਲਈ ਰਕਮ",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "ਕਈ ਫਸਲਾਂ",
"MULTIPLE_LOCATIONS": "ਕਈ ਸਥਾਨਾਂ"
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,6 @@
},
"PREFERRED_CONTACT": "Método de contato preferido",
"REQUIRED_LABEL": "Campo Obrigatório",
"TITLE": "Solicite Ajuda",
"TYPE_SUPPORT_LABEL": "Tipo de suporte",
"TYPE_SUPPORT_PLACEHOLDER": "Escolha o tipo de suporte",
"WHATSAPP": "WhatsApp",
Expand Down Expand Up @@ -1955,6 +1954,7 @@
"ADD_TASK_FLOW": "criação de tarefa",
"AMOUNT_TO_ALLOCATE": "Quantidade a ser alocada",
"ANIMAL_MOVING_TO_LOCATION": "MISSING",
"ANIMAL_MOVEMENT_EXPANDING_SUMMARY_TITLE": "MISSING",
"CARD": {
"MULTIPLE_CROPS": "Múltiplos cultivos",
"MULTIPLE_LOCATIONS": "Múltiplos locais"
Expand Down
4 changes: 2 additions & 2 deletions packages/webapp/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import { NotistackSnackbar } from './containers/Snackbar/NotistackSnackbar';
import { OfflineDetector } from './containers/hooks/useOfflineDetector/OfflineDetector';
import styles from './styles.module.scss';
import Routes from './routes';
import { ANIMALS_INVENTORY_URL } from './util/siteMapConstants';
import { ANIMALS_INVENTORY_URL, ANIMALS_URL } from './util/siteMapConstants';

function App() {
const [isCompactSideMenu, setIsCompactSideMenu] = useState(false);
const [isFeedbackSurveyOpen, setFeedbackSurveyOpen] = useState(false);
const FULL_WIDTH_ROUTES = ['/map', ANIMALS_INVENTORY_URL];
const FULL_WIDTH_ROUTES = ['/map', ANIMALS_INVENTORY_URL, ANIMALS_URL];
const isFullWidth = FULL_WIDTH_ROUTES.some((path) => matchPath(history.location.pathname, path));

return (
Expand Down
5 changes: 0 additions & 5 deletions packages/webapp/src/assets/images/navbar/help.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function AnimalBreedSelect<T extends FieldValues>({
placeholder={isTypeSelected ? undefined : t('ADD_ANIMAL.BREED_PLACEHOLDER_DISABLED')}
isDisabled={!isTypeSelected || isDisabled}
onChange={(option) => onChange(option)}
value={value}
value={value || null}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type ContainerWithButtonsProps = {
children: ReactNode;
contentClassName?: string;
isCompactView?: boolean;
showMenu: boolean;
isEditing?: boolean;
options: { label: ReactNode; onClick: () => void }[];
onBack: () => void;
Expand All @@ -93,6 +94,7 @@ const ContainerWithButtons = ({
children,
contentClassName,
isCompactView,
showMenu = true,
isEditing,
options,
onBack,
Expand All @@ -106,16 +108,20 @@ const ContainerWithButtons = ({
<div className={clsx(styles.content, contentClassName)}>{children}</div>
<div className={styles.statusAndButton}>
{!isCompactView && isEditing ? <div>{t('common:EDITING')}</div> : null}
<MeatballsMenu
options={options}
classes={{ button: isEditing ? styles.editingStatusButton : '' }}
/>
{showMenu && (
<MeatballsMenu
disabled={!!isEditing}
options={options}
classes={{ button: isEditing ? styles.editingStatusButton : '' }}
/>
)}
</div>
</div>
);
};

export type AnimalSingleViewHeaderProps = {
showMenu: boolean;
isEditing?: boolean;
onEdit: () => void;
onRemove: () => void;
Expand All @@ -128,6 +134,7 @@ export type AnimalSingleViewHeaderProps = {
};

const AnimalSingleViewHeader = ({
showMenu = true,
isEditing,
onEdit,
onRemove,
Expand Down Expand Up @@ -163,7 +170,7 @@ const AnimalSingleViewHeader = ({
{ label: <MenuItem iconName="TRASH" text={t('common:REMOVE')} />, onClick: onRemove },
];

const commonProp = { t, isEditing, isCompactView, options: menuOptions, onBack };
const commonProp = { t, showMenu, isEditing, isCompactView, options: menuOptions, onBack };

const renderCompactHeader = () => (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
padding-left: 16px;
}

.editingStatusButton {
.editingStatusButton,
.editingStatusButton:disabled {
background: var(--Btn-primary-hover);
box-shadow: 1px 1px 0px 0px var(--Colors-Primary-Primary-teal-300);

Expand Down Expand Up @@ -152,6 +153,8 @@
bottom: 8px;

height: 24px;
min-width: 20px;
max-width: 44px;
padding: 4px;
border-radius: 2px;
background: var(--Colors-Accent---singles-Purple-light);
Expand All @@ -160,6 +163,10 @@
color: var(--Colors-Accent---singles-Purple-full);
font-size: 12px;
font-weight: 600;
text-align: center;

/* Counts with more than five digits will be visually cut off */
overflow: hidden;
}

.desktopBasicInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ type FixedHeaderContainerProps = {
classes?: {
paper?: string;
divWrapper?: string;
wrapper?: string;
};
wrapperClassName?: string;
};

type WrapperProps = Pick<FixedHeaderContainerProps, 'children' | 'classes'> & {
Expand Down Expand Up @@ -77,7 +77,6 @@ const FixedHeaderContainer = ({
children,
classes = {},
kind = ContainerKind.OVERFLOW,
wrapperClassName,
}: FixedHeaderContainerProps) => {
const [paperHeightInPx, setPaperHeightInPx] = useState<number | null>(null);
const paperRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -123,7 +122,7 @@ const FixedHeaderContainer = ({
const Wrapper = kind === ContainerKind.OVERFLOW ? DivWrapper : PaperWrapper;

return (
<div className={clsx(styles.wrapper, wrapperClassName)}>
<div className={clsx(styles.wrapper, classes.wrapper)}>
{header}
<Wrapper paperRef={paperRef} classes={classes} hasMaxWidth={!isFullWidth}>
{childrenWithProps}
Expand Down
Loading

0 comments on commit a6eb3c6

Please sign in to comment.