Skip to content

Commit

Permalink
Merge pull request #116 from socialappslab/fix/624/other-fields
Browse files Browse the repository at this point in the history
fix: handle "other" fields
  • Loading branch information
zant authored Jan 13, 2025
2 parents e0a1dba + e57134d commit 0bae083
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
30 changes: 16 additions & 14 deletions app/(public)/login.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import React, { useRef, useState } from "react";
import { TouchableOpacity, TextInput as RNTextInput } from "react-native";
import {
Controller,
FormProvider,
SubmitHandler,
useForm,
} from "react-hook-form";
import { useTranslation } from "react-i18next";
import Toast from "react-native-toast-message";
import { TextInput as RNTextInput, TouchableOpacity } from "react-native";
import CountryPicker, {
CountryCode,
DARK_THEME,
DEFAULT_THEME,
} from "react-native-country-picker-modal";
import PhoneInput from "react-native-phone-input";
import {
useForm,
Controller,
SubmitHandler,
FormProvider,
} from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import Toast from "react-native-toast-message";

import { Text, View, TextInput } from "@/components/themed";
import Logo from "@/assets/images/logo.svg";
import { PasswordInput, SafeAreaView, Button } from "@/components/themed";
import KeyboardAvoidingView from "@/components/control/KeyboardAvoidingView";
import { ExternalLink } from "@/components/ExternalLink";
import { useColorScheme } from "@/components/themed/useColorScheme";
import {
createLoginSchema,
Button,
PasswordInput,
SafeAreaView,
Text,
TextInput,
View,
} from "@/components/themed";
import {
LoginInputType,
LoginRequestType,
TYPE_LOGIN_REQUEST,
Expand Down
10 changes: 9 additions & 1 deletion util/prepareFormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const prepareFormData = (formData: FormState) => {
if (answer.resourceName) {
const resourceName = answer.resourceName;
if (answer.resourceType === "relation")
inspections[index][resourceName] = answer.text || answer.resourceId;
inspections[index][resourceName] = answer.resourceId;

if (answer.resourceType === "attribute") {
inspections[index][resourceName] =
Expand All @@ -68,6 +68,14 @@ export const prepareFormData = (formData: FormState) => {
: 1;
}

if (resourceName === "container_protection_id" && answer.text) {
inspections[index]["other_protection"] = answer.text;
}

if (resourceName === "elimination_method_type_id" && answer.text) {
inspections[index]["other_elimination_method"] = answer.text;
}

if (resourceName === "photo_id") {
inspections[index][resourceName] = "temp";
}
Expand Down

0 comments on commit 0bae083

Please sign in to comment.