Skip to content

Commit

Permalink
adminDashboard: sections, searchBar
Browse files Browse the repository at this point in the history
  • Loading branch information
Squiffles committed Nov 10, 2023
1 parent 8c3a5bf commit 9cbfb4f
Show file tree
Hide file tree
Showing 8 changed files with 793 additions and 26 deletions.
16 changes: 10 additions & 6 deletions src/app/dashboardAdmin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ 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/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 (
<>
{/* <NavBar /> */}
<NavBar />
<Navbar />
<main className="mt-[109px] md:mt-[60px]">
{/* <Sidebar /> */}
Expand All @@ -28,13 +30,15 @@ export default function landing() {
</div>

{/* USERS */}
<CardUsers/>
<CardUsers />

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

{/* ORDERS */}
<CardTable />
<CardOrders />

{/* <CardBarChart /> */}
SETTINGS:
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 9cbfb4f

Please sign in to comment.