Skip to content

Commit

Permalink
Merge pull request #26 from Edwardb11/refactor/fix
Browse files Browse the repository at this point in the history
Refactor FIX
  • Loading branch information
Edwardb11 authored Oct 4, 2022
2 parents eb78e45 + eda0afe commit 1c914d3
Show file tree
Hide file tree
Showing 24 changed files with 255 additions and 99 deletions.
24 changes: 24 additions & 0 deletions src/admin/AdminPackage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'
import Footer from '../components/Footer'
import NavBar from '../components/NavBar'

const AdminPackage = () => {
return (
<>
<NavBar />
<div className="py-10 mt-10">
<div className="flex flex-col px-8 mx-auto space-y-12 max-w-7xl xl:px-12">
<div className="relative">
<h2 className="w-full text-3xl font-bold text-center sm:text-4xl md:text-5xl">
{" "}
Acciones permitidas
</h2>
</div>
</div>
</div>
<Footer />
</>
)
}

export default AdminPackage
4 changes: 2 additions & 2 deletions src/admin/Staff.js → src/admin/AdminStaff.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import StaffCards from "../components/admin/StaffCards";
import Footer from "../components/Footer";
import NavBar from "../components/NavBar";

const Staff = () => {
const AdminStaff = () => {
return (
<>
<NavBar />
Expand All @@ -23,4 +23,4 @@ const Staff = () => {
);
};

export default Staff;
export default AdminStaff;
4 changes: 2 additions & 2 deletions src/admin/AdminView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import NavBar from "../components/NavBar";

const AdminView = () => {
return (
<div>
<div >
<NavBar />
<div>Hola</div>
<div className="mt-20">Admin</div>
<Footer />
</div>
);
Expand Down
15 changes: 15 additions & 0 deletions src/admin/Dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import Footer from "../components/Footer";
import NavBar from "../components/NavBar";

const Dashboard = () => {
return (
<div>
<NavBar />
<div lassName="mt-20">Dashboard</div>
<Footer />
</div>
);
};

export default Dashboard;
202 changes: 142 additions & 60 deletions src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,73 +1,155 @@
import React from "react";
import React, { useContext } from "react";
import { Link } from "react-router-dom";
import User from "../context/userContext";

const Footer = () => {
return (
<footer className="footer bg-gray-100 relative pt-1 border-b-2 border-blue-700">
<div className="container mx-auto px-6">
<div className="sm:flex sm:mt-8">
<div className="mt-8 sm:mt-0 sm:w-full sm:px-8 flex flex-col md:flex-row justify-between">
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mb-2">
Seguimiento de paquetes
</span>
<span className="my-2">
<Link to="/tracking" className="text-blue-700 text-md hover:text-blue-500">
Seguimiento
</Link>
</span>
<span className="my-2">
<Link to="/package" className="text-blue-700 text-md hover:text-blue-500">
Agregar
</Link>
</span>
</div>
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mt-4 md:mt-0 mb-2">
FAQ
</span>
const { user } = useContext(User);
const rol = user?.rol;
if (rol === undefined) {
return (
<footer className="footer bg-gray-100 relative pt-1 border-b-2 border-blue-700">
<div className="container mx-auto px-6">
<div className="sm:flex sm:mt-8">
<div className="mt-8 sm:mt-0 sm:w-full sm:px-8 flex flex-col md:flex-row justify-between">
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mb-2">
Seguimiento de paquetes
</span>
<span className="my-2">
<Link
to="/tracking"
className="text-blue-700 text-md hover:text-blue-500">
Seguimiento
</Link>
</span>
<span className="my-2">
<Link
to="/package"
className="text-blue-700 text-md hover:text-blue-500">
Agregar
</Link>
</span>
</div>
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mt-4 md:mt-0 mb-2">
FAQ
</span>

<span className="my-2">
<Link to="/faq" className="text-blue-700 text-md hover:text-blue-500">
Preguntas frecuentes
</Link>
</span>
<span className="my-2">
<Link className="text-blue-700 text-md hover:text-blue-500">
Soporte
</Link>
</span>
<span className="my-2">
<Link
to="/faq"
className="text-blue-700 text-md hover:text-blue-500">
Preguntas frecuentes
</Link>
</span>
<span className="my-2">
<Link className="text-blue-700 text-md hover:text-blue-500">
Soporte
</Link>
</span>
</div>
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mt-4 md:mt-0 mb-2">
Acerca de nosotros
</span>
<span className="my-2">
<Link
to="/about"
className="text-blue-700 text-md hover:text-blue-500">
¿Quiénes somos?
</Link>
</span>
<span className="my-2">
<Link
to="/NoFound"
className="text-blue-700 text-md hover:text-blue-500">
404
</Link>
</span>
</div>
</div>
</div>
</div>
<div className="container mx-auto px-6">
<div className="mt-16 border-t-2 border-gray-300 flex flex-col items-center">
<div className="sm:w-2/3 text-center py-6">
<p className="text-sm font-bold mb-2">
© 2022 Todos los derechos reservados.
</p>
</div>
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mt-4 md:mt-0 mb-2">
Acerca de nosotros
</span>
<span className="my-2">
<Link to="/about" className="text-blue-700 text-md hover:text-blue-500">
¿Quiénes somos?
</Link>
</span>
<span className="my-2">
<Link to="/NoFound" className="text-blue-700 text-md hover:text-blue-500">
404
</Link>
</span>
</div>
</div>
</footer>
);
} else {
return (
<footer className="footer bg-gray-100 relative pt-1 border-b-2 border-blue-700">
<div className="container mx-auto px-6">
<div className="sm:flex sm:mt-8">
<div className="mt-8 sm:mt-0 sm:w-full sm:px-8 flex flex-col md:flex-row justify-between">
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mb-2">
Seguimiento de paquetes
</span>
<span className="my-2">
<Link
to="/tracking"
className="text-blue-700 text-md hover:text-blue-500">
Seguimiento UPS
</Link>
</span>
<span className="my-2">
<Link
to="/admin/package"
className="text-blue-700 text-md hover:text-blue-500">
Administrar Paquetes
</Link>
</span>
</div>
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mt-4 md:mt-0 mb-2">
FAQ
</span>

<span className="my-2">
<Link
to="/faq"
className="text-blue-700 text-md hover:text-blue-500">
Preguntas frecuentes
</Link>
</span>
<span className="my-2">
<Link className="text-blue-700 text-md hover:text-blue-500">
Soporte
</Link>
</span>
</div>
<div className="flex flex-col">
<span className="font-bold text-gray-700 uppercase mt-4 md:mt-0 mb-2">
Acerca de nosotros
</span>
<span className="my-2">
<Link
to="/about"
className="text-blue-700 text-md hover:text-blue-500">
¿Quiénes somos?
</Link>
</span>
</div>
</div>
</div>
</div>
</div>
<div className="container mx-auto px-6">
<div className="mt-16 border-t-2 border-gray-300 flex flex-col items-center">
<div className="sm:w-2/3 text-center py-6">
<p className="text-sm font-bold mb-2">
© 2022 Todos los derechos reservados.
</p>
<div className="container mx-auto px-6">
<div className="mt-16 border-t-2 border-gray-300 flex flex-col items-center">
<div className="sm:w-2/3 text-center py-6">
<p className="text-sm font-bold mb-2">
© 2022 Todos los derechos reservados.
</p>
</div>
</div>
</div>
</div>
</footer>
);
</footer>
);
}
};

export default Footer;
4 changes: 2 additions & 2 deletions src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function NavBar() {
const navigation = useNavigation(user);

// Close session of normal user or of the employee according to the one that is connected
const logout = () => {
const Logout = () => {
if (user.staffId !== undefined) {
logoutStaff(user, setLog, setUser);
}
Expand Down Expand Up @@ -123,7 +123,7 @@ export default function NavBar() {
<Menu.Item>
{({ active }) => (
<div
onClick={() => logout()}
onClick={() => Logout()}
className={classNames(
active ? "bg-gray-100" : "",
"block px-4 py-2 text-sm text-gray-700 cursor-pointer "
Expand Down
9 changes: 9 additions & 0 deletions src/components/admin/PackageCards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const PackageCards = () => {
return (
<div>PackageCards</div>
)
}

export default PackageCards
4 changes: 2 additions & 2 deletions src/components/admin/StaffCards.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { cardData } from "../../utils/cardData.js";
import { staffCardData } from "../../utils/staffCardData.js";
import Card from "./Card.js";
const StaffCards = () => {
return (
Expand All @@ -11,7 +11,7 @@ const StaffCards = () => {
<section className="pt-10">
<div className="container shadow-xl ">
<div className="flex flex-wrap justify-evenly -mx-4">
{cardData.map((items) => {
{staffCardData.map((items) => {
return <Card key={items.id} {...items} />;
})}
</div>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useContext } from "react";
import AddPackage from "../utils/AddPackage";
import User from "../context/userContext";
import AddPackage from "../../utils/AddPackage";
import User from "../../context/userContext";

const PackageForms = () => {
const Quantitys = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios from "axios";
import React, { useEffect, useState } from "react";
import { useHistory, useParams } from "react-router-dom";
import { url } from "../api/api";
import PayBill from "../utils/PayBill";
import { url } from "../../api/api";
import PayBill from "../../utils/PayBill";

const PackagePayment = () => {
const history = useHistory();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext, useEffect, useState } from "react";
import User from "../context/userContext";
import { url } from "../api/api";
import User from "../../context/userContext";
import { url } from "../../api/api";
import { Link } from "react-router-dom";

const PackagesTable = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios from "axios";
import React, { useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { url } from "../api/api";
import convertDate from "../utils/convertDate";
import { url } from "../../api/api";
import convertDate from "../../utils/convertDate";

const ShowInvoice = () => {
const { id } = useParams();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";
import React, { useState } from "react";
import Swal from "sweetalert2";
import { url } from "../api/api";
import { url } from "../../api/api";

const UserFinalForms = () => {
const [name, setName] = useState("");
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const useNavigation = (user) => {
]);
} else if (rol[0].id_roles === 1) {
return setNavigation([
{ name: "Inicio", href: "/", current: true },
{ name: "Resumen", href: "/admin", current: false },
{ name: "Paquetes", href: "/", current: false },
{ name: "Inicio", href: "/admin", current: true },
{ name: "Dashboard", href: "/admin/dashboard", current: false },
{ name: "Paquetes", href: "/admin/package", current: false },
{ name: "Personal", href: "/admin/staff", current: false },
]);
}
Expand Down
Loading

0 comments on commit 1c914d3

Please sign in to comment.