Skip to content

Commit

Permalink
Merge pull request #223 from Actualiza-Tu-Carro/205-admindashboard
Browse files Browse the repository at this point in the history
205 - adminDashboard
  • Loading branch information
Squiffles authored Nov 10, 2023
2 parents bf66ff0 + c40ca3e commit 480cbea
Show file tree
Hide file tree
Showing 17 changed files with 1,247 additions and 31 deletions.
55 changes: 54 additions & 1 deletion src/app/dashboardAdmin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
import CardBarChart from "~/components/componetsDashboard/Cards/CardBarChart";
import CardLineChart from "~/components/componetsDashboard/Cards/CardLineChart";
import CardPageVisits from "~/components/componetsDashboard/Cards/CardPageVisits";
import CardProfile from "~/components/componetsDashboard/Cards/CardProfile";
import CardSettings from "~/components/componetsDashboard/Cards/CardSettings";
import CardSocialTraffic from "~/components/componetsDashboard/Cards/CardSocialTraffic";
import CardStats from "~/components/componetsDashboard/Cards/CardStats";
import CardTable from "~/components/componetsDashboard/Cards/CardTable";

// import Navbar from "~/components/componetsDashboard/Navbars/IndexNavbar";
import NavBar from "~/components/navBar/navBar";
import Navbar from "../../components/componetsDashboard/Navbars/AdminNavbar";
import Sidebar from "~/components/componetsDashboard/Sidebar/Sidebar";
import CardUsers from "~/components/componetsDashboard/Cards/CardUsers"
import CardProducts from "~/components/componetsDashboard/Cards/CardProducts";
import CardOrders from "~/components/componetsDashboard/Cards/CardOrders";
import CardCategories from "~/components/componetsDashboard/Cards/CardCategories";
import CardBrands from "~/components/componetsDashboard/Cards/CardBrands";


export default function landing() {
return <h1>Hola soy DashboardAdmin</h1>;
return (
<>
<NavBar />
<Navbar />
<main className="mt-[109px] md:mt-[60px]">
{/* <Sidebar /> */}
<div className="bg-white dark:bg-background-dm w-full mb-6 shadow-lg rounded">
<h6 className="mb-1 px-4 py-3 uppercase text-blueGray-100 text-[2rem] font-semibold">Administración</h6>
</div>

{/* USERS */}
<CardUsers />

{/* PRODUCTS */}
<CardProducts />
<CardCategories />
<CardBrands />

{/* ORDERS */}
<CardOrders />

{/* <CardBarChart /> */}
SETTINGS:
{/* SETTINGS */}
<CardSettings />
{/* <CardProfile /> */}

{/* <CardLineChart /> */}
{/* <CardPageVisits /> */}
{/* <CardSocialTraffic /> */}
{/* <CardStats /> */}
</main>
</>
);
}
2 changes: 1 addition & 1 deletion src/components/componetsDashboard/Cards/CardBarChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function CardBarChart() {
}, []);
return (
<>
<div className="relative flex flex-col min-w-0 break-words bg-white w-full mb-6 shadow-lg rounded">
<div className="relative flex flex-col min-w-0 break-words bg-white dark:bg-background-dm w-full mb-6 shadow-lg rounded">
<div className="rounded-t mb-0 px-4 py-3 bg-transparent">
<div className="flex flex-wrap items-center">
<div className="relative w-full max-w-full flex-grow flex-1">
Expand Down
137 changes: 137 additions & 0 deletions src/components/componetsDashboard/Cards/CardBrands.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
"use client";
import { useEffect } from 'react';
import PropTypes from 'prop-types';

// components
import SearchBar from '../SearchBar/SearchBar';
import TableDropdown from '~/components/componetsDashboard/Dropdowns/TableDropdown';

import useDashboardAdminStore from '~/store/dashboardAdminStore';


interface BrandsInterface {
id: number,
name: string,
};

const BRANDS: BrandsInterface[] = [
{
id: 1,
name: "Audi"
},
{
id: 2,
name: "Mitsubishi"
}
];


type CardBrandsProps = {
color: string
};

export default function CardBrands({ color }: CardBrandsProps) {


// GLOBAL STORE:
const { brands, updateBrands }: any = useDashboardAdminStore();


// LIFE CYCLES:
useEffect(() => {
updateBrands(BRANDS);
}, []);


// COMPONENT:
return (
<>
<div
className={
'relative flex flex-col min-w-0 break-words w-full mb-6 shadow-lg rounded ' +
(color === 'light' ? 'bg-white' : 'bg-lightBlue-900 text-white')
}
>
<div className="rounded-t mb-0 px-4 py-3 border-0">
<div className="flex flex-wrap items-center">
<div className="relative flex items-center justify-between w-full px-4 max-w-full flex-grow flex-1">
<h3
className={
'font-semibold text-lg ' +
(color === 'light' ? 'text-blueGray-700' : 'text-white')
}
>
Marcas
</h3>
<SearchBar section="brand" />
</div>
</div>
</div>
<div className="block w-full overflow-x-auto">
{/* Projects table */}
<table className="items-center w-full bg-transparent border-collapse">
<thead>
<tr>
<th
className={
'px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left ' +
(color === 'light'
? 'bg-blueGray-50 text-blueGray-500 border-blueGray-100'
: 'bg-lightBlue-800 text-lightBlue-300 border-lightBlue-700')
}
>
Id
</th>
<th
className={
'px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left ' +
(color === 'light'
? 'bg-blueGray-50 text-blueGray-500 border-blueGray-100'
: 'bg-lightBlue-800 text-lightBlue-300 border-lightBlue-700')
}
>
Nombre
</th>
<th
className={
'px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left ' +
(color === 'light'
? 'bg-blueGray-50 text-blueGray-500 border-blueGray-100'
: 'bg-lightBlue-800 text-lightBlue-300 border-lightBlue-700')
}
>
Acciones
</th>
</tr>
</thead>
<tbody>
{
brands.map((BRAND: any, idx: any) => (
<tr key={idx}>
<th className="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4">
{BRAND.id}
</th>
<td className="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left flex items-center">
{BRAND.name}
</td>
<td className="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-right">
<TableDropdown />
</td>
</tr>
))
}
</tbody>
</table>
</div>
</div>
</>
);
};

CardBrands.defaultProps = {
color: 'light',
};

CardBrands.propTypes = {
color: PropTypes.oneOf(['light', 'dark']),
};
137 changes: 137 additions & 0 deletions src/components/componetsDashboard/Cards/CardCategories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
"use client";
import { useEffect } from "react";
import PropTypes from 'prop-types';

// components
import SearchBar from '../SearchBar/SearchBar';
import TableDropdown from '~/components/componetsDashboard/Dropdowns/TableDropdown';

import useDashboardAdminStore from "~/store/dashboardAdminStore";


interface CategoriesInterface {
id: number,
name: string,
};

const CATEGORIES: CategoriesInterface[] = [
{
id: 1,
name: "Escape"
},
{
id: 2,
name: "Pisos"
}
];


type CardCategoriesProps = {
color: string
};

export default function CardCategories({ color }: CardCategoriesProps) {


// GLOBAL STORE:
const { categories, updateCategories }: any = useDashboardAdminStore();


// LIFE CYCLES:
useEffect(() => {
updateCategories(CATEGORIES);
}, []);


// COMPONENT:
return (
<>
<div
className={
'relative flex flex-col min-w-0 break-words w-full mb-6 shadow-lg rounded ' +
(color === 'light' ? 'bg-white' : 'bg-lightBlue-900 text-white')
}
>
<div className="rounded-t mb-0 px-4 py-3 border-0">
<div className="flex flex-wrap items-center">
<div className="relative flex items-center justify-between w-full px-4 max-w-full flex-grow flex-1">
<h3
className={
'font-semibold text-lg ' +
(color === 'light' ? 'text-blueGray-700' : 'text-white')
}
>
Categorías
</h3>
<SearchBar section="category" />
</div>
</div>
</div>
<div className="block w-full overflow-x-auto">
{/* Projects table */}
<table className="items-center w-full bg-transparent border-collapse">
<thead>
<tr>
<th
className={
'px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left ' +
(color === 'light'
? 'bg-blueGray-50 text-blueGray-500 border-blueGray-100'
: 'bg-lightBlue-800 text-lightBlue-300 border-lightBlue-700')
}
>
Id
</th>
<th
className={
'px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left ' +
(color === 'light'
? 'bg-blueGray-50 text-blueGray-500 border-blueGray-100'
: 'bg-lightBlue-800 text-lightBlue-300 border-lightBlue-700')
}
>
Nombre
</th>
<th
className={
'px-6 align-middle border border-solid py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left ' +
(color === 'light'
? 'bg-blueGray-50 text-blueGray-500 border-blueGray-100'
: 'bg-lightBlue-800 text-lightBlue-300 border-lightBlue-700')
}
>
Acciones
</th>
</tr>
</thead>
<tbody>
{
categories.map((CATEGORY: any, idx: any) => (
<tr key={idx}>
<th className="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4">
{CATEGORY.id}
</th>
<td className="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left flex items-center">
{CATEGORY.name}
</td>
<td className="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-right">
<TableDropdown />
</td>
</tr>
))
}
</tbody>
</table>
</div>
</div>
</>
);
};

CardCategories.defaultProps = {
color: 'light',
};

CardCategories.propTypes = {
color: PropTypes.oneOf(['light', 'dark']),
};
Loading

0 comments on commit 480cbea

Please sign in to comment.