Merge pull request #208 from DeimosPr4/UH-actualizacionInvitado
Agregar categoría al invitado
This commit is contained in:
commit
53b1973d8b
|
@ -5,7 +5,6 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "api-gateway",
|
||||
"version": "0.0.1",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
|
|
|
@ -403,6 +403,7 @@ export class AppController {
|
|||
@Body('tenant_id') tenant_id: string,
|
||||
@Body('community_id') community_id: string,
|
||||
@Body('date_entry') date_entry: Date,
|
||||
@Body('type_guest') type_guest: string,
|
||||
) {
|
||||
return this.appService.createGuest(
|
||||
name,
|
||||
|
@ -414,6 +415,7 @@ export class AppController {
|
|||
tenant_id,
|
||||
community_id,
|
||||
date_entry,
|
||||
type_guest,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -512,11 +512,12 @@ export class AppService {
|
|||
tenant_id: string,
|
||||
community_id: string,
|
||||
date_entry: Date,
|
||||
type_guest: string,
|
||||
) {
|
||||
const pattern = { cmd: 'createGuest' };
|
||||
const payload = {
|
||||
name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone,
|
||||
status: status,tenant_id:tenant_id, community_id:community_id,date_entry: date_entry
|
||||
status: status,tenant_id:tenant_id, community_id:community_id,date_entry: date_entry,type_guest:type_guest
|
||||
};
|
||||
return this.clientGuestApp
|
||||
.send<string>(pattern, payload)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React, { useContext, useState } from "react";
|
||||
import { API } from "../environment/api";
|
||||
|
||||
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
||||
import {
|
||||
Box, Button,
|
||||
Center, FormControl, Heading, ScrollView, VStack
|
||||
Center, FormControl, Heading, ScrollView, VStack,Select
|
||||
} from "native-base";
|
||||
|
||||
import { StyleSheet, TextInput } from "react-native";
|
||||
|
@ -21,6 +21,7 @@ export default function AgregarInvitados({ navigation }) {
|
|||
const [community_id, setCommunity_id] = useState();
|
||||
const { user } = useContext(UserContext);
|
||||
const [errors, setErrors] = useState({});
|
||||
const [categoria, setCategoria] = React.useState("");
|
||||
|
||||
const [info, setInfo] = useState({
|
||||
name: "",
|
||||
|
@ -28,9 +29,12 @@ export default function AgregarInvitados({ navigation }) {
|
|||
dni: "",
|
||||
phone: "",
|
||||
number_plate:"",
|
||||
status: "-0",
|
||||
status: "1",
|
||||
tenant_id: user._id,
|
||||
community_id: user.community_id
|
||||
//tenant_id: "6301df20dac7dcf76dcecade",
|
||||
community_id: user.community_id,
|
||||
//community_id: "62be68215692582bbfd77134",
|
||||
type_guest:""
|
||||
});
|
||||
|
||||
const onHandleChange = (name) => (value) => setInfo(prev => ({...prev, [name]: value}))
|
||||
|
@ -90,6 +94,7 @@ export default function AgregarInvitados({ navigation }) {
|
|||
if (response.status != 201){
|
||||
console.log('ocurrio un error ');
|
||||
}else{
|
||||
navigation.navigate('Inicio');
|
||||
return response.json();
|
||||
}
|
||||
})
|
||||
|
@ -143,6 +148,18 @@ export default function AgregarInvitados({ navigation }) {
|
|||
<FormControl >
|
||||
<FormControl.Label>Placa</FormControl.Label>
|
||||
<TextInput style={styles.input} type="text" onChangeText={onHandleChange("number_plate")} />
|
||||
</FormControl>
|
||||
<FormControl >
|
||||
<FormControl.Label>Tipo de invitado</FormControl.Label>
|
||||
|
||||
<Select onChangeText={onHandleChange("type_guest")} selectedValue={categoria} minWidth="200" accessibilityLabel="Choose Service" placeholder="Choose Service" _selectedItem={{
|
||||
bg: "teal.600"
|
||||
}} mt={1} onValueChange={onHandleChange("type_guest")}>
|
||||
<Select.Item label="Invitado Frecuente" value="Frecuente" />
|
||||
<Select.Item label="Invitado de acceso rápido" value="Rapido" />
|
||||
</Select>
|
||||
|
||||
|
||||
</FormControl>
|
||||
<Button mt="2" backgroundColor='tertiary.600' onPress={() => saveInvitado()}>
|
||||
Guardar
|
||||
|
|
|
@ -13,8 +13,8 @@ export default function Invitados({navigation}) {
|
|||
const [isRequesting, setIsRequesting] = useState(false);
|
||||
const [invitados, setInvitados] = useState([]);
|
||||
const { user } = useContext(UserContext);
|
||||
//const id = user._id;
|
||||
const id = "62ff074949eb1e993a9d0fda";
|
||||
const id = user._id;
|
||||
//const id = "6301df20dac7dcf76dcecade";
|
||||
const [invitado, setInvitado] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -110,6 +110,11 @@ export default function Invitados({navigation}) {
|
|||
}}>
|
||||
{"Número Placa: "+item.number_plate}
|
||||
</Text>
|
||||
<Text color="coolGray.600" _dark={{
|
||||
color: "warmGray.200"
|
||||
}}>
|
||||
{"Tipo de acceso: "+item.type_guest}
|
||||
</Text>
|
||||
|
||||
</VStack>
|
||||
<Spacer />
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "servicio-invitados",
|
||||
"version": "0.0.1",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
|
|
|
@ -19,7 +19,7 @@ export class GuestsService {
|
|||
|
||||
async findGuestUser(id: string): Promise<Guest[]> {
|
||||
console.log(id);
|
||||
return this.guestModel.find({_tenant_id:id, status:"-0"}).setOptions({ sanitizeFilter: true }).exec();
|
||||
return this.guestModel.find({_tenant_id:id, status:"1"}).setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
findOneId(id: string): Promise<Guest> {
|
||||
|
|
|
@ -32,6 +32,9 @@ export class Guest {
|
|||
@Prop()
|
||||
community_id: string; ///creo que se debe de agregar para facilitar al guarda ver
|
||||
// ver los invitados de x comunidad
|
||||
|
||||
@Prop()
|
||||
type_guest: string;
|
||||
}
|
||||
|
||||
export const GuestSchema = SchemaFactory.createForClass(Guest);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "servicio-usuarios",
|
||||
"version": "0.0.1",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Reference in New Issue