Skip to content

Commit

Permalink
feat: ✨ changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrnoch committed Mar 13, 2024
1 parent 527721b commit b1f83d3
Show file tree
Hide file tree
Showing 14 changed files with 499 additions and 52 deletions.
Binary file modified src-tauri/.DS_Store
Binary file not shown.
Binary file modified src-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/icon.icns
Binary file not shown.
Binary file modified src-tauri/icons/icon.ico
Binary file not shown.
Binary file modified src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "uno.css";

const Overview = lazy(() => import("./screens/Dashboard/pages"));
const Invoices = lazy(() => import("./screens/Dashboard/pages/Sales/Invoices"));
const Templates = lazy(() => import("./screens/Dashboard/pages/Sales/Templates"));
const Schedules = lazy(() => import("./screens/Dashboard/pages/Sales/Schedules"));
const Expenses = lazy(() => import("./screens/Dashboard/pages/Purchase/Expenses"));
const Clients = lazy(() => import("./screens/Dashboard/pages/Other/Clients"));
const Reports = lazy(() => import("./screens/Dashboard/pages/Other"));
Expand Down Expand Up @@ -33,6 +35,8 @@ render(
<Route path="/" component={Overview} />
<Route path="/sales">
<Route path="/invoices" component={Invoices} />
<Route path="/templates" component={Templates} />
<Route path="/schedules" component={Schedules} />
</Route>
<Route path="/other/clients" component={Clients} />
<Route path="/other/reports" component={Reports} />
Expand Down
7 changes: 7 additions & 0 deletions src/screens/Dashboard/components/Popup/Popup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ParentComponent } from "solid-js";

const Popup: ParentComponent<{}> = (props) => {
return <div>{props.children}</div>;
};

export default Popup;
6 changes: 5 additions & 1 deletion src/screens/Dashboard/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const Sidebar: Component = () => {
const sidebarSections = [
{
title: t("sidebar.section.sales"),
buttons: [{ target: "/dashboard/sales/invoices", icon: <FiFileText />, label: t("sidebar.button.invoices") }],
buttons: [
{ target: "/dashboard/sales/invoices", icon: <FiFileText />, label: t("sidebar.button.invoices") },
{ target: "/dashboard/sales/templates", icon: <FiFileText />, label: t("sidebar.button.invoices") },
{ target: "/dashboard/sales/schedules", icon: <FiFileText />, label: t("sidebar.button.invoices") },
],
},
{
title: t("sidebar.section.purchase"),
Expand Down
10 changes: 9 additions & 1 deletion src/screens/Dashboard/pages/Purchase/Expenses/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import Popover from "@/shared/components/Popover";
import { useSelector } from "@/store";
import { Component } from "solid-js";
import { Component, createSignal } from "solid-js";

const Home: Component = () => {
const company = useSelector((state) => state.companyService.company);
const [showPopup, setShowPopup] = createSignal(false);

return (
<div class="flex flex-col items-center justify-center h-screen w-full">
<h1 class="text-4xl font-bold">Hello, world, {company.name}!</h1>
<button class="mt-4 bg-primary text-white px-4 py-2 rounded-md" onClick={() => setShowPopup(true)}>
popup
</button>
<Popover title="dd" show={showPopup()} onClose={() => setShowPopup(false)}>
<div>content</div>
</Popover>
</div>
);
};
Expand Down
204 changes: 204 additions & 0 deletions src/screens/Dashboard/pages/Sales/Schedules/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
import { getInvoices } from "@/bindings";
import { useI18n } from "@/i18n";
import Table from "@/screens/Dashboard/components/Table";
import { useSelector } from "@/store";
import { FiActivity, FiTrash } from "solid-icons/fi";
import { Component, createSignal } from "solid-js";

const Invoices: Component = () => {
const company = useSelector((state) => state.companyService.company);
const [t] = useI18n();
const [invoices, setInvoices] = createSignal([]);

const fetchInvoices = async () => {
console.log(company);
const data = await getInvoices(company.id);
console.log(data);
// setInvoices(data);
};
fetchInvoices();

const loadPage = async (page: number, pageSize: number) => {
// Simulating an API call to fetch data for the specified page
const startIndex = (page - 1) * pageSize;
const endIndex = startIndex + pageSize;
const data = books.slice(startIndex, endIndex);
return data;
};

const columns = [
{ field: "id", header: "ID" },
{ field: "title", header: "Title" },
{ field: "author", header: "Author" },
{ field: "year", header: "Year" },
];

interface Book {
id: number;
title: string;
author: string;
year: number;
[key: string]: unknown;
}

const books: Book[] = [
{ id: 1, title: "To Kill a Mockingbird", author: "Harper Lee", year: 1960 },
{ id: 2, title: "1984", author: "George Orwell", year: 1949 },
{ id: 3, title: "Pride and Prejudice", author: "Jane Austen", year: 1813 },
{ id: 4, title: "The Great Gatsby", author: "F. Scott Fitzgerald", year: 1925 },
{ id: 5, title: "One Hundred Years of Solitude", author: "Gabriel García Márquez", year: 1967 },
{
id: 6,
title: "The Lord of the Rings",
author: "J.R.R. Tolkien",
year: 1954,
genre: "Fantasy",
language: "English",
pages: 1178,
},
{
id: 7,
title: "Harry Potter and the Sorcerer's Stone",
author: "J.K. Rowling",
year: 1997,
genre: "Fantasy",
language: "English",
pages: 309,
},
{
id: 8,
title: "The Hobbit",
author: "J.R.R. Tolkien",
year: 1937,
genre: "Fantasy",
language: "English",
pages: 310,
},
{
id: 9,
title: "The Catcher in the Rye",
author: "J.D. Salinger",
year: 1951,
genre: "Fiction",
language: "English",
pages: 277,
},
{
id: 10,
title: "The Alchemist",
author: "Paulo Coelho",
year: 1988,
genre: "Fiction",
language: "Portuguese",
pages: 197,
},
{
id: 11,
title: "The Little Prince",
author: "Antoine de Saint-Exupéry",
year: 1943,
genre: "Novella",
language: "French",
pages: 93,
},
{
id: 12,
title: "The Book Thief",
author: "Markus Zusak",
year: 2005,
genre: "Historical Fiction",
language: "English",
pages: 552,
},
{
id: 13,
title: "The Kite Runner",
author: "Khaled Hosseini",
year: 2003,
genre: "Fiction",
language: "English",
pages: 371,
},
{
id: 14,
title: "The Hunger Games",
author: "Suzanne Collins",
year: 2008,
genre: "Science Fiction",
language: "English",
pages: 374,
},
{
id: 15,
title: "The Giver",
author: "Lois Lowry",
year: 1993,
genre: "Dystopian Fiction",
language: "English",
pages: 179,
},
];

const handleEdit = (item: Book) => {
console.log("Edit:", item);
// Handle edit action
};

const handleDelete = (item: Book) => {
console.log("Delete:", item);
// Handle delete action
};

const rowActions = [
{
label: "Edit",
onClick: handleEdit,
icon: FiActivity,
},
{
label: "Delete",
onClick: handleDelete,
icon: FiTrash,
},
];

return (
<div class="">
<h1 class="text-3xl font-bold">{t("invoices.title")}</h1>
<Table
data={[]}
columns={columns}
totalItems={books.length}
loadPage={loadPage}
rowActions={rowActions}
extraContent={
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Create New</button>
}
/>

{/* <table class="w-full ">
<tbody>
<TableHeader>
<td class="">ID</td>
<td>Castka</td>
<td>Ahoj,</td>
</TableHeader>
<Row>
<td>
<Badge color="danger">Cuspic</Badge>{" "}
</td>
<td>Centro </td>
<td>Centro </td>
</Row>
<Row>
<td>Centro </td>
<td>Centro </td>
<td>Centro </td>
</Row>
</tbody>
</table> */}
</div>
);
};

export default Invoices;
Loading

0 comments on commit b1f83d3

Please sign in to comment.