Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian-Sandoval-x committed Jun 5, 2024
2 parents db449b2 + 906144d commit 7266648
Show file tree
Hide file tree
Showing 75 changed files with 5,361 additions and 2,333 deletions.
5 changes: 4 additions & 1 deletion client/public/scripts/editarPerfil.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,19 @@ btn.addEventListener('click', async()=>{
//fecha
if(dia.value && dia.value !=''){
formData.append('dia_id',dia.id); formData.append('dia',dia.value);
console.log('si hubo un dia');
cantidad++;
}

if(mes.value && mes.value !=''){
formData.append('mes_id',mes.id); formData.append('mes',mes.value);
console.log('si hubo un mes');
cantidad++;
}

if(año.value && año.value !=''){
formData.append('año_id',año.id); formData.append('año',año.value);
formData.append('year_id',año.id); formData.append('year',año.value);
console.log('si hubo un ano');
cantidad++;
}

Expand Down
101 changes: 82 additions & 19 deletions client/src/components/ui/Agenda.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faTrash } from "@fortawesome/free-solid-svg-icons";
import Soon from "./Proximamente";
import Eliminar from "./EliminarAdvertencia";
import { IoIosWarning } from "react-icons/io";
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { useRef } from "react";
Expand All @@ -14,6 +14,29 @@ function Agenda({ restart, next }) {
const [soon, setSoon] = useState(false);
const [del, setDel] = useState(false);
const [selectedCitaIndex, setSelectedCitaIndex] = useState(null);
const [clave, setClave] = useState(false);
const [sus, setSus] = useState(false); //<<< CARACTERISTICA GRAFICA DE QUE EL USUARIO ES SOCIO

async function recibido() {
const respuesta = await fetch("/api/logueado", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});

if (!respuesta.ok) {
setClave(false);
}

let respuestaJson = await respuesta.json();

if (respuestaJson.logueado == true) {
setClave(respuestaJson.clave);
} else {
setClave(false);
}
}

const handleModificar = () => {
selectedCitaIndex === null && notify();
Expand Down Expand Up @@ -47,6 +70,26 @@ function Agenda({ restart, next }) {
};
}, []);

useEffect(() => {
recibido();
}, [])

useEffect(() => {
const Prod = async () => {
try {
if (clave) {

const response = await fetch(`/api/admin/cliente/StatusSus/${clave}`)
const data = await response.json();
setSus(data)
}
} catch (error) {
console.error("hubo error :", error)
}
}
Prod()
}, [clave])

const toggleSoon = () => {
setSoon(!soon);
};
Expand All @@ -73,18 +116,20 @@ function Agenda({ restart, next }) {
setCitasItems(myArray);
};

const RLSCitas = (id) => {
const RLSCitas = (index) => {
let citas = JSON.parse(localStorage.getItem("citas")) || [];
citas = citas.filter((obj) => obj.id !== id);
citas.splice(index, 1); // Elimina el elemento en la posición 'index'
localStorage.setItem("citas", JSON.stringify(citas));
};

//Para remover por completo un servicio.
const removeItem = (itemId) => {
setCitasItems(citasItems.filter((item) => item.idServicio !== itemId)); //este lo elimina de la vista carrito
RLSCitas(itemId); //este elimina el item de locaStorage
//Para remover por completo un servicio.
const removeItem = (index) => {
setCitasItems(citasItems.filter((_, i) => i !== index)); // este lo elimina de la vista carrito
RLSCitas(index); // este elimina el item de localStorage
};


const [descuento, setDescuento] = useState("");
const handleChange = (event) => {
setDescuento(event.target.value);
Expand All @@ -102,15 +147,13 @@ function Agenda({ restart, next }) {
)
.toFixed(2);

const iva = (total * 0.08).toFixed(2);
const totalIva = (parseFloat(total) + parseFloat(iva)).toFixed(2);
// const iva = (total * 0.08).toFixed(2);
// const totalIva = (parseFloat(total) + parseFloat(iva)).toFixed(2);

const puntos = parseFloat(totalIva) / 10;
//En caso de ser Socio VVV
//const puntos = (parseInt(totalIva))/5;
const puntos = (sus ? ((parseInt(total)) / 5) : ((parseFloat(total)) / 10));

localStorage.setItem("total", total);
localStorage.setItem("totalIva", totalIva);
localStorage.setItem("puntos", puntos);
const citasList = citasItems.map((item, index) => (
<li
key={index}
Expand Down Expand Up @@ -142,8 +185,8 @@ function Agenda({ restart, next }) {
</div>
<button
className="duration-200 hover:text-[#ec5766] text-2xl"
/*onClick={() => removeItem(item.idServicio)}*/
onClick={toggleDel}
onClick={() => removeItem(index)}
// onClick={toggleDel}
>
<FontAwesomeIcon icon={faTrash} />
</button>
Expand Down Expand Up @@ -217,10 +260,10 @@ function Agenda({ restart, next }) {
<span>{totalCitas} Servicio(s)</span>
<h1 className="font-bold">${total}</h1>
</div>
<div className="flex justify-between mb-2">
{/* <div className="flex justify-between mb-2">
<h1>IVA</h1>
<h1 className="font-bold">${iva}</h1>
</div>
</div> */}
<div className="flex justify-between">
<h1>Descuento por membresía</h1>
<h1 className="font-bold">$0.00</h1>
Expand Down Expand Up @@ -261,9 +304,13 @@ function Agenda({ restart, next }) {
<div className="flex justify-between p-6 px-10 mb-4 border-2 shadow-md rounded-xl border-gray">
<h4 className="text-xl font-bold">Total:</h4>
<span className="font-bold text-[rgb(3,109,99)] text-xl">
${totalIva}
${total}
</span>
</div>
<div className='flex justify-between p-6 px-10 mb-4 border-2 shadow-md rounded-xl border-gray'>
<h4 className='text-xl font-bold'>Puntos obtenidos:</h4>
<span className='font-bold text-[rgb(3,109,99)] text-xl'>{parseInt(puntos)}</span>
</div>
</div>
<div className="flex justify-around mb-6">
<button
Expand Down Expand Up @@ -291,8 +338,24 @@ function Agenda({ restart, next }) {
)}
{del && (
<div className="soon-fondo">
<div className="text-black soon-fx" onClick={toggleDel}>
<Eliminar />
<div className="text-black soon-fx">
<div className="rounded-md bg-white ring-4 ring-[#E40000]">
<div className="grid my-2 place-content-center">
<IoIosWarning style={{ fontSize: "52px", color: "#E40000" }} />
</div>
<p className="my-2 text-2xl text-center">¡Advertencia!</p>
<p className="mx-4 my-2 text-lg text-center">
¿Está seguro que desea eliminar este producto?
</p>
<div className="grid grid-cols-[30%_30%] place-content-center my-4">
<button onClick={() => removeItem()} className="w-[4rem] mx-auto text-white bg-[#E40000] hover:bg-[#BC0000] rounded-sm">
</button>
<button onClick={() => setDel(!del)} className="w-[4rem] mx-auto bg-white text-[#E40000] ring-2 ring-[#E40000] hover:bg-[#F2F2F2] hover:text-[#BC0000] hover:ring-[#BC0000] rounded-sm">
No
</button>
</div>
</div>
</div>
</div>
)}
Expand Down
151 changes: 80 additions & 71 deletions client/src/components/ui/CarruselServicios.jsx
Original file line number Diff line number Diff line change
@@ -1,82 +1,91 @@
import Carousel from "react-multi-carousel";
import Tarjeta from "./TarjetaDeServicio.jsx";
import { useState } from "react";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { ArrowProps } from 'react-multi-carousel/lib/types'
import { faDiamond, faAngleLeft, faAngleRight } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { ArrowProps } from "react-multi-carousel/lib/types";
import {
faDiamond,
faAngleLeft,
faAngleRight,
} from "@fortawesome/free-solid-svg-icons";

const CarruselServicios = ({ servicios, next }) => {
const CarruselServicios = ({ id, servicios, next, update }) => {
return (
<Carousel
additionalTransfrom={0}
arrows
autoPlay
autoPlaySpeed={3000}
centerMode={false}
className="z-0"
containerclassName="container-with-dots z-0"
dotListclassName=""
// draggable
focusOnSelect={false}
infinite
itemclassName=""
keyBoardControl
minimumTouchDrag={80}
pauseOnHover
renderArrowsWhenDisabled={false}
renderButtonGroupOutside={false}
renderDotsOutside={false}
responsive={{
desktop: {
breakpoint: {
max: 3000,
min: 1024,
<div className={servicios == undefined ? "loader mx-auto my-auto" : ""}>
<Carousel
additionalTransfrom={0}
arrows
autoPlay
autoPlaySpeed={3000}
centerMode={false}
className="z-0"
containerclassName="container-with-dots z-0"
dotListclassName=""
// draggable
focusOnSelect={false}
infinite
itemclassName=""
keyBoardControl
minimumTouchDrag={80}
pauseOnHover
renderArrowsWhenDisabled={false}
renderButtonGroupOutside={false}
renderDotsOutside={false}
responsive={{
desktop: {
breakpoint: {
max: 3000,
min: 1024,
},
items: 3,
partialVisibilityGutter: 40,
},
items: 3,
partialVisibilityGutter: 40,
},
mobile: {
breakpoint: {
max: 464,
min: 0,
mobile: {
breakpoint: {
max: 464,
min: 0,
},
items: 1,
partialVisibilityGutter: 30,
},
items: 1,
partialVisibilityGutter: 30,
},
tablet: {
breakpoint: {
max: 1024,
min: 464,
tablet: {
breakpoint: {
max: 1024,
min: 464,
},
items: 2,
partialVisibilityGutter: 30,
},
items: 2,
partialVisibilityGutter: 30,
},
}}

rewind={false}
rewindWithAnimation={false}
rtl={false}
shouldResetAutoplay
showDots={false}
sliderclassName=""
slidesToSlide={1}
swipeable
customLeftArrow={<FontAwesomeIcon
icon={faAngleLeft}
size="lg"
className="absolute cursor-pointer top-1/2 transform -translate-y-1/2 -left-0 text-3xl text-primary-900 aspect-square bg-[#e6e6e6] rounded-full text-[#036C65] p-3 hover:opacity-90 overflow-visible z-10"
/>}
customRightArrow={<FontAwesomeIcon
size="lg"
icon={faAngleRight}
className="absolute cursor-pointer top-1/2 transform -translate-y-1/2 -right-0 text-3xl text-primary-900 bg-[#e6e6e6] rounded-full aspect-square text-[#036C65] p-3 hover:opacity-90 overflow-visible z-10"
/>}
// className=''
>
{servicios.map((servicio) => (
<Tarjeta servicio={servicio} next={next} />
))}
</Carousel>
}}
rewind={false}
rewindWithAnimation={false}
rtl={false}
shouldResetAutoplay
showDots={false}
sliderclassName=""
slidesToSlide={1}
swipeable
customLeftArrow={
<FontAwesomeIcon
icon={faAngleLeft}
size="lg"
className="absolute cursor-pointer top-1/2 transform -translate-y-1/2 -left-0 text-3xl text-primary-900 aspect-square bg-[#e6e6e6] rounded-full text-[#036C65] p-3 hover:opacity-90 overflow-visible z-10"
/>
}
customRightArrow={
<FontAwesomeIcon
size="lg"
icon={faAngleRight}
className="absolute cursor-pointer top-1/2 transform -translate-y-1/2 -right-0 text-3xl text-primary-900 bg-[#e6e6e6] rounded-full aspect-square text-[#036C65] p-3 hover:opacity-90 overflow-visible z-10"
/>
}
// className=''
>
{servicios.map((servicio) => (
<Tarjeta id={id} servicio={servicio} next={next} update={update} />
))}
</Carousel>
</div>
);
};

Expand Down
Loading

0 comments on commit 7266648

Please sign in to comment.