mirror of
https://github.com/abhay-raizada/PeerScribe.git
synced 2026-04-26 16:24: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 {Section} from './Section';
|
||||||
import {styles, TextTheme} from './styles';
|
import {styles, TextTheme} from './styles';
|
||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
import DatePicker from 'react-native-date-picker';
|
|
||||||
import {Button} from '@ant-design/react-native';
|
|
||||||
|
|
||||||
interface AddressForm {
|
interface AddressForm {
|
||||||
address_line_1?: string;
|
address_line_1?: string;
|
||||||
@@ -21,7 +19,6 @@ export const AddressForm: React.FC<AddressFormProps> = ({
|
|||||||
nestedFormCallback,
|
nestedFormCallback,
|
||||||
}) => {
|
}) => {
|
||||||
const [form, setForm] = useState<AddressForm>({});
|
const [form, setForm] = useState<AddressForm>({});
|
||||||
const [openDate, setOpenDate] = useState<boolean>(false);
|
|
||||||
|
|
||||||
const handleTextChange = (tag: keyof AddressForm, text: string) => {
|
const handleTextChange = (tag: keyof AddressForm, text: string) => {
|
||||||
let newForm = {...form};
|
let newForm = {...form};
|
||||||
@@ -34,10 +31,10 @@ export const AddressForm: React.FC<AddressFormProps> = ({
|
|||||||
<Section title="Address">
|
<Section title="Address">
|
||||||
<View>
|
<View>
|
||||||
<View>
|
<View>
|
||||||
<Text style={TextTheme}>Name</Text>
|
<Text style={TextTheme}>Address Line 1</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
placeholder="Address Line 1"
|
placeholder="Enter street"
|
||||||
value={form.address_line_1}
|
value={form.address_line_1}
|
||||||
placeholderTextColor="white"
|
placeholderTextColor="white"
|
||||||
onChangeText={(text: string) =>
|
onChangeText={(text: string) =>
|
||||||
@@ -45,6 +42,52 @@ export const AddressForm: React.FC<AddressFormProps> = ({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</View>
|
</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>
|
</View>
|
||||||
</Section>
|
</Section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export const PatientForm: React.FC<PatientFormProps> = ({
|
|||||||
modal
|
modal
|
||||||
mode={'date'}
|
mode={'date'}
|
||||||
open={openDate}
|
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)}
|
onCancel={() => setOpenDate(false)}
|
||||||
onConfirm={(date: Date) => {
|
onConfirm={(date: Date) => {
|
||||||
handleTextChange('date_of_birth', date.toDateString());
|
handleTextChange('date_of_birth', date.toDateString());
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ export const PrescriptionCreator = () => {
|
|||||||
const finalEvent = finalizeEvent(baseKind4Event, sk);
|
const finalEvent = finalizeEvent(baseKind4Event, sk);
|
||||||
const pool = new SimplePool();
|
const pool = new SimplePool();
|
||||||
console.log('publishing event');
|
console.log('publishing event');
|
||||||
await Promise.any(pool.publish(selectedPharmacyRelays, finalEvent));
|
await Promise.allSettled(pool.publish(selectedPharmacyRelays, finalEvent));
|
||||||
console.log('Event Published');
|
console.log('Event Published');
|
||||||
Alert.alert('Prescription Sent to the pharmacy!');
|
Alert.alert('Prescription Sent to the pharmacy!');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user