mirror of
https://github.com/abhay-raizada/PeerScribe.git
synced 2026-04-26 08:14:03 +00:00
Add different forms
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2,8 +2,6 @@ import {Text, TextInput, View} from 'react-native';
|
||||
import {Section} from './Section';
|
||||
import {styles, TextTheme} from './styles';
|
||||
import {useState} from 'react';
|
||||
import DatePicker from 'react-native-date-picker';
|
||||
import {Button} from '@ant-design/react-native';
|
||||
|
||||
interface AddressForm {
|
||||
address_line_1?: string;
|
||||
@@ -21,7 +19,6 @@ export const AddressForm: React.FC<AddressFormProps> = ({
|
||||
nestedFormCallback,
|
||||
}) => {
|
||||
const [form, setForm] = useState<AddressForm>({});
|
||||
const [openDate, setOpenDate] = useState<boolean>(false);
|
||||
|
||||
const handleTextChange = (tag: keyof AddressForm, text: string) => {
|
||||
let newForm = {...form};
|
||||
@@ -34,10 +31,10 @@ export const AddressForm: React.FC<AddressFormProps> = ({
|
||||
<Section title="Address">
|
||||
<View>
|
||||
<View>
|
||||
<Text style={TextTheme}>Name</Text>
|
||||
<Text style={TextTheme}>Address Line 1</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
placeholder="Address Line 1"
|
||||
placeholder="Enter street"
|
||||
value={form.address_line_1}
|
||||
placeholderTextColor="white"
|
||||
onChangeText={(text: string) =>
|
||||
@@ -45,6 +42,52 @@ export const AddressForm: React.FC<AddressFormProps> = ({
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Text style={TextTheme}>City</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
placeholder="Enter city"
|
||||
value={form.city}
|
||||
placeholderTextColor="white"
|
||||
onChangeText={(text: string) => handleTextChange('city', text)}
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Text style={TextTheme}>State Provice</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
placeholder="enter state..."
|
||||
value={form.state_province}
|
||||
placeholderTextColor="white"
|
||||
onChangeText={(text: string) =>
|
||||
handleTextChange('state_province', text)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Text style={TextTheme}>Postal Code</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
placeholder="Enter postal code..."
|
||||
value={form.postal_code}
|
||||
placeholderTextColor="light"
|
||||
onChangeText={(text: string) =>
|
||||
handleTextChange('postal_code', text)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Text style={TextTheme}>Country Code</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
placeholder="Enter Country Code..."
|
||||
value={form.country_code}
|
||||
placeholderTextColor="light"
|
||||
onChangeText={(text: string) =>
|
||||
handleTextChange('country_code', text)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</Section>
|
||||
);
|
||||
|
||||
@@ -66,7 +66,7 @@ export const PatientForm: React.FC<PatientFormProps> = ({
|
||||
modal
|
||||
mode={'date'}
|
||||
open={openDate}
|
||||
date={new Date(form.date_of_birth || '01-01-1990')}
|
||||
date={new Date(form.date_of_birth || '01-01-1999')}
|
||||
onCancel={() => setOpenDate(false)}
|
||||
onConfirm={(date: Date) => {
|
||||
handleTextChange('date_of_birth', date.toDateString());
|
||||
|
||||
@@ -204,7 +204,7 @@ export const PrescriptionCreator = () => {
|
||||
const finalEvent = finalizeEvent(baseKind4Event, sk);
|
||||
const pool = new SimplePool();
|
||||
console.log('publishing event');
|
||||
await Promise.any(pool.publish(selectedPharmacyRelays, finalEvent));
|
||||
await Promise.allSettled(pool.publish(selectedPharmacyRelays, finalEvent));
|
||||
console.log('Event Published');
|
||||
Alert.alert('Prescription Sent to the pharmacy!');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user