Merge branch 'movil' of github.com:DeimosPr4/katoikia-app into movil
This commit is contained in:
		
						commit
						fd54abcc49
					
				| 
						 | 
				
			
			@ -319,6 +319,8 @@ export class AppController {
 | 
			
		|||
    @Body('number_plate') number_plate: string,
 | 
			
		||||
    @Body('phone') phone: number,
 | 
			
		||||
    @Body('status') status: string,
 | 
			
		||||
    @Body('tenant_id') tenant_id: string,
 | 
			
		||||
    @Body('community_id') community_id: string,
 | 
			
		||||
    @Body('date_entry') date_entry: Date,
 | 
			
		||||
  ) {
 | 
			
		||||
    return this.appService.createGuest(
 | 
			
		||||
| 
						 | 
				
			
			@ -328,6 +330,8 @@ export class AppController {
 | 
			
		|||
      number_plate,
 | 
			
		||||
      phone,
 | 
			
		||||
      status,
 | 
			
		||||
      tenant_id,
 | 
			
		||||
      community_id,
 | 
			
		||||
      date_entry,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -342,6 +346,12 @@ export class AppController {
 | 
			
		|||
    return this.appService.findGuest(paramGuestDNI);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Get('guest/findGuestUser/:id')
 | 
			
		||||
  findGuestUser(@Param('id') paramGuestId: string) {
 | 
			
		||||
    return this.appService.findGuestUser(paramGuestId);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // #==== API Payment
 | 
			
		||||
 | 
			
		||||
  @Post('payment/createPayment')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -416,12 +416,14 @@ export class AppService {
 | 
			
		|||
    number_plate: string,
 | 
			
		||||
    phone: number,
 | 
			
		||||
    status: string,
 | 
			
		||||
    tenant_id: string,
 | 
			
		||||
    community_id: string,
 | 
			
		||||
    date_entry: Date,
 | 
			
		||||
  ) {
 | 
			
		||||
    const pattern = { cmd: 'createGuest' };
 | 
			
		||||
    const payload = {
 | 
			
		||||
      name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone,
 | 
			
		||||
      status: status, date_entry: date_entry
 | 
			
		||||
      status: status,tenant_id:tenant_id, community_id:community_id,date_entry: date_entry
 | 
			
		||||
    };
 | 
			
		||||
    return this.clientGuestApp
 | 
			
		||||
      .send<string>(pattern, payload)
 | 
			
		||||
| 
						 | 
				
			
			@ -444,7 +446,14 @@ export class AppService {
 | 
			
		|||
      .send<string>(pattern, payload)
 | 
			
		||||
      .pipe(map((message: string) => ({ message })));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //GET parameter from API
 | 
			
		||||
  findGuestUser(paramGuestId: string) {
 | 
			
		||||
    const pattern = { cmd: 'findGuestUser' };
 | 
			
		||||
    const payload = { di: paramGuestId };
 | 
			
		||||
    return this.clientGuestApp
 | 
			
		||||
      .send<string>(pattern, payload)
 | 
			
		||||
      .pipe(map((message: string) => ({ message })));
 | 
			
		||||
  }
 | 
			
		||||
  // ====================== PAYMENTS =============================== 
 | 
			
		||||
 | 
			
		||||
  //POST parameter from API
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,20 +1,115 @@
 | 
			
		|||
import React from "react";
 | 
			
		||||
 | 
			
		||||
import React, { useContext, useEffect, useState } from "react";
 | 
			
		||||
import { MaterialCommunityIcons } from '@expo/vector-icons';
 | 
			
		||||
import { UserContext } from "../context/UserContext";
 | 
			
		||||
import { API } from "../environment/api";
 | 
			
		||||
import {
 | 
			
		||||
 
 | 
			
		||||
  Center,
 | 
			
		||||
 
 | 
			
		||||
  Box, Button,
 | 
			
		||||
  Center, FormControl, Heading, ScrollView, VStack,FlatList, HStack,Avatar,Spacer,Text
 | 
			
		||||
} from "native-base";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default function Invitados({navigation}) {
 | 
			
		||||
  const [isRequesting, setIsRequesting] = useState(false);
 | 
			
		||||
  const [invitados, setInvitados] = useState([]);
 | 
			
		||||
  const id = "62ff074949eb1e993a9d0fda";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
 | 
			
		||||
    const onRequestCommentsData = async () => {
 | 
			
		||||
      setIsRequesting(true);
 | 
			
		||||
 | 
			
		||||
      try {
 | 
			
		||||
        const jsonResponse = await fetch(`${API.BASE_URL}/guest/findGuestUser/`+`${id}`, {
 | 
			
		||||
          method: "GET",
 | 
			
		||||
          headers: {
 | 
			
		||||
            'Content-Type': 'application/json'
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        const response = await jsonResponse.json();
 | 
			
		||||
        console.log(response);
 | 
			
		||||
        setInvitados(response.message);
 | 
			
		||||
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      setIsRequesting(false)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onRequestCommentsData()
 | 
			
		||||
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  const data = [{
 | 
			
		||||
    id: "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba",
 | 
			
		||||
    fullName: "Aafreen Khan",
 | 
			
		||||
    timeStamp: "12:47 PM",
 | 
			
		||||
    recentText: "Good Day!"
 | 
			
		||||
    }, {
 | 
			
		||||
    id: "3ac68afc-c605-48d3-a4f8-fbd91aa97f63",
 | 
			
		||||
    fullName: "Sujitha Mathur",
 | 
			
		||||
    timeStamp: "11:11 PM",
 | 
			
		||||
    recentText: "Cheer up, there!"
 | 
			
		||||
  }, {
 | 
			
		||||
    id: "58694a0f-3da1-471f-bd96-145571e29d72",
 | 
			
		||||
    fullName: "Anci Barroco",
 | 
			
		||||
    timeStamp: "6:22 PM",
 | 
			
		||||
    recentText: "Good Day!"
 | 
			
		||||
  }, {
 | 
			
		||||
    id: "68694a0f-3da1-431f-bd56-142371e29d72",
 | 
			
		||||
    fullName: "Aniket Kumar",
 | 
			
		||||
    timeStamp: "8:56 PM",
 | 
			
		||||
    recentText: "All the best"
 | 
			
		||||
  }, {
 | 
			
		||||
    id: "28694a0f-3da1-471f-bd96-142456e29d72",
 | 
			
		||||
    fullName: "Kiara",
 | 
			
		||||
    timeStamp: "12:47 PM",
 | 
			
		||||
    recentText: "I will call today."
 | 
			
		||||
    }];
 | 
			
		||||
  return (
 | 
			
		||||
  
 | 
			
		||||
       <Box>
 | 
			
		||||
      <Heading fontSize="xl" p="4" pb="3">
 | 
			
		||||
        Lista de invitados
 | 
			
		||||
      </Heading>
 | 
			
		||||
      <FlatList data={invitados} renderItem={({
 | 
			
		||||
      item
 | 
			
		||||
    }) => <Box borderBottomWidth="1" _dark={{
 | 
			
		||||
      borderColor: "gray.600"
 | 
			
		||||
    }} borderColor="coolGray.200" pl="4" pr="5" py="2">
 | 
			
		||||
            <HStack space={3} justifyContent="space-between">
 | 
			
		||||
            <MaterialCommunityIcons name="account" size={48} color="green" />
 | 
			
		||||
              <VStack>
 | 
			
		||||
                <Text _dark={{
 | 
			
		||||
            color: "warmGray.50"
 | 
			
		||||
          }} color="coolGray.800" bold>
 | 
			
		||||
                  {item.name+" "+item.last_name}
 | 
			
		||||
                </Text>
 | 
			
		||||
                <Text color="coolGray.600" _dark={{
 | 
			
		||||
            color: "warmGray.200"
 | 
			
		||||
          }}>
 | 
			
		||||
                  {item.dni}
 | 
			
		||||
                </Text>
 | 
			
		||||
                <Text color="coolGray.600" _dark={{
 | 
			
		||||
            color: "warmGray.200"
 | 
			
		||||
          }}>
 | 
			
		||||
                  {item.phone}
 | 
			
		||||
                </Text>
 | 
			
		||||
              </VStack>
 | 
			
		||||
              <Spacer />
 | 
			
		||||
              <Text fontSize="xs" _dark={{
 | 
			
		||||
          color: "warmGray.50"
 | 
			
		||||
        }} color="coolGray.800" alignSelf="flex-start">
 | 
			
		||||
                {item.number_plate}
 | 
			
		||||
              </Text>
 | 
			
		||||
            </HStack>
 | 
			
		||||
          </Box>} keyExtractor={item => item.id} />
 | 
			
		||||
    </Box>
 | 
			
		||||
         
 | 
			
		||||
      <Center w="100%">
 | 
			
		||||
       
 | 
			
		||||
         
 | 
			
		||||
      </Center>
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,7 @@
 | 
			
		|||
    "react-native-screens": "~3.10.1",
 | 
			
		||||
    "react-native-simple-time-picker": "^1.3.11",
 | 
			
		||||
    "react-native-svg": "12.1.1",
 | 
			
		||||
    "react-native-table-component": "^1.2.2",
 | 
			
		||||
    "react-native-web": "0.17.1",
 | 
			
		||||
    "universal-cookie": "^4.0.4"
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,10 @@ export class GuestsController {
 | 
			
		|||
  findAll() {
 | 
			
		||||
    return this.guestsService.findAll();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @MessagePattern({ cmd: 'findGuestUser' })
 | 
			
		||||
  findGuestUser(@Payload() id: string) {
 | 
			
		||||
    return this.guestsService.findGuestUser(id);
 | 
			
		||||
  }
 | 
			
		||||
  @MessagePattern({ cmd: 'findOneGuest' })
 | 
			
		||||
  findOneById(@Payload() id: string) {
 | 
			
		||||
    let _id = id['_id'];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,10 @@ export class GuestsService {
 | 
			
		|||
    return this.guestModel.find().setOptions({ sanitizeFilter: true }).exec();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async findGuestUser(id: string): Promise<Guest[]> {
 | 
			
		||||
    return this.guestModel.find({_tenant_id:id}).setOptions({ sanitizeFilter: true }).exec();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  findOneId(id: string): Promise<Guest> {
 | 
			
		||||
    return this.guestModel.findOne({ _id: id }).exec();
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue