added login modal

This commit is contained in:
Samandar Turgunboyev
2025-11-24 10:52:21 +05:00
parent 9aac17072f
commit 684d09e6b5
23 changed files with 1871 additions and 1351 deletions

View File

@@ -1,4 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQuery } from '@tanstack/react-query';
import { authApi } from 'api/auth';
import packetsApi from 'api/packets';
import AppText from 'components/AppText';
import React, { useEffect, useRef } from 'react';
@@ -52,6 +53,12 @@ const ModalPay = ({
const { bottom } = useSafeAreaInsets();
const [load, setLoad] = React.useState(false);
const { t } = useTranslation();
const { data: getMe } = useQuery({
queryKey: ['getMe'],
queryFn: authApi.getMe,
});
console.log(getMe, 'getMe');
const { mutate, isPending } = useMutation({
mutationFn: ({ id, payType }: { id: number; payType: string }) =>
@@ -137,45 +144,49 @@ const ModalPay = ({
},
]}
>
<TouchableOpacity
style={[
styles.option,
{
backgroundColor: selectedId === 'card' ? '#28A7E81A' : '#fff',
},
]}
onPress={() => setSelectedId('card')}
>
<View style={PaymentStyle.paymentCard}>
<CreditCard
color={selectedId == 'card' ? '#28A7E8' : '#000000'}
width={28}
height={28}
/>
<AppText
style={[
PaymentStyle.titleMethod,
{ color: selectedId == 'card' ? '#28A7E8' : '#000' },
]}
>
{t('Bank kartasi')}
</AppText>
</View>
<View
{getMe && !getMe.aviaCargoId.includes('CP') && (
<TouchableOpacity
style={[
PaymentStyle.select,
styles.option,
{
backgroundColor:
selectedId === 'card' ? '#28A7E8' : '#FFFFFF',
borderColor: selectedId === 'card' ? '#28A7E8' : '#383838',
selectedId === 'card' ? '#28A7E81A' : '#fff',
},
]}
onPress={() => setSelectedId('card')}
>
{selectedId === 'card' && (
<Check color="#fff" width={20} height={20} />
)}
</View>
</TouchableOpacity>
<View style={PaymentStyle.paymentCard}>
<CreditCard
color={selectedId == 'card' ? '#28A7E8' : '#000000'}
width={28}
height={28}
/>
<AppText
style={[
PaymentStyle.titleMethod,
{ color: selectedId == 'card' ? '#28A7E8' : '#000' },
]}
>
{t('Bank kartasi')}
</AppText>
</View>
<View
style={[
PaymentStyle.select,
{
backgroundColor:
selectedId === 'card' ? '#28A7E8' : '#FFFFFF',
borderColor:
selectedId === 'card' ? '#28A7E8' : '#383838',
},
]}
>
{selectedId === 'card' && (
<Check color="#fff" width={20} height={20} />
)}
</View>
</TouchableOpacity>
)}
{paymentType !== 'CASH' && (
<TouchableOpacity
style={[