From c1600045a243e3547fe589bfc7e474d2decaea4c Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Mon, 13 Sep 2021 17:26:09 +0530 Subject: moved interfaces to new folder --- src/Interfaces/interfaces.ts | 71 +++++++++++++++++++++++ src/components/Display/ClientInfoDisplay.tsx | 2 +- src/components/Display/DisplayItem.tsx | 2 +- src/components/Display/ItemsDisplay.tsx | 2 +- src/components/Display/SummaryDisplay.tsx | 2 +- src/components/Form/Document/DocumentInfoForm.tsx | 3 +- src/components/Form/Items/AddNewItemForm.tsx | 2 +- src/components/Form/Items/RegisterItemForm.tsx | 2 +- src/components/Form/People/SelectClientForm.tsx | 2 +- src/components/Form/Transport/TransportForm.tsx | 2 +- src/components/Menu/SubmitMenu.tsx | 2 +- src/components/Pages/BillingPage.tsx | 2 +- src/components/Print/Print.scss | 13 ----- src/components/Print/PrintableDoc.tsx | 40 ------------- src/components/Util/SearchBar.scss | 28 --------- src/components/Util/SearchBar.tsx | 50 ---------------- src/interfaces.ts | 71 ----------------------- 17 files changed, 82 insertions(+), 214 deletions(-) create mode 100644 src/Interfaces/interfaces.ts delete mode 100644 src/components/Print/Print.scss delete mode 100644 src/components/Print/PrintableDoc.tsx delete mode 100644 src/components/Util/SearchBar.scss delete mode 100644 src/components/Util/SearchBar.tsx delete mode 100644 src/interfaces.ts (limited to 'src') diff --git a/src/Interfaces/interfaces.ts b/src/Interfaces/interfaces.ts new file mode 100644 index 0000000..53d14c3 --- /dev/null +++ b/src/Interfaces/interfaces.ts @@ -0,0 +1,71 @@ +export interface Transport { + Name: string + VehicleNum: string + Method: string + GSTIN: string + Builty: string +} + +export interface Item { + Model: string + Description: string + Quantity: number + UnitPrice: number // price without tax/discount + TotalValue: number // UnitPrice * Quantity + Discount: number // percentage of discount + DiscountValue: number + HSN: string + + TotalGST: number // gst percentage + SGST: number | boolean + CGST: number | boolean + IGST: number | boolean + TotalGSTValue: number // total tax + Brand: string + Category: string +} + +// for registering new item to DB +export interface NewItem { + Model: string + Description: string + UnitPrice: number // price without tax/discount + HSN: string + TotalGST: number // gst percentage + Brand: string + Category: string +} + +export interface Address { + AddressLine: string + City: string + State: string + PINCode: string + Country: string +} + +export interface Person { + ID?: number + Name: string + Phone?: string + Email?: string + BillAddress: Address + ShipAddress?: Address + Address?: string // to be removed +} + +export interface Invoice { + //Client: Person + Items: Item[] + Transport: Transport +} + +export interface InvoiceSummary { + TotalQuantity: number + TotalRawPrice: number // total price without gst/discount + TotalDiscount: number // total amount of discount + TotalGST: number // total gst to be paid + TotalPriceAfterDiscount: number + TotalPriceAfterGST: number + TotalRoundedOff: number +} diff --git a/src/components/Display/ClientInfoDisplay.tsx b/src/components/Display/ClientInfoDisplay.tsx index ad65e40..fda8fe7 100644 --- a/src/components/Display/ClientInfoDisplay.tsx +++ b/src/components/Display/ClientInfoDisplay.tsx @@ -7,7 +7,7 @@ */ import React from "react"; -import { Person } from "./../../interfaces"; +import { Person } from "./../../Interfaces/interfaces"; import "./Display.scss"; interface Props { diff --git a/src/components/Display/DisplayItem.tsx b/src/components/Display/DisplayItem.tsx index 448460b..26137f5 100644 --- a/src/components/Display/DisplayItem.tsx +++ b/src/components/Display/DisplayItem.tsx @@ -7,7 +7,7 @@ */ import React from "react"; -import { Item } from "./../../interfaces"; +import { Item } from "./../../Interfaces/interfaces"; import "./Display.scss"; interface Props { diff --git a/src/components/Display/ItemsDisplay.tsx b/src/components/Display/ItemsDisplay.tsx index 79eed40..d03ee9e 100644 --- a/src/components/Display/ItemsDisplay.tsx +++ b/src/components/Display/ItemsDisplay.tsx @@ -7,7 +7,7 @@ */ import React from "react"; -import { Item } from "./../../interfaces"; +import { Item } from "./../../Interfaces/interfaces"; import "./Display.scss"; import DisplayItem from "./DisplayItem"; import {SummaryDisplayTR} from "./SummaryDisplay"; diff --git a/src/components/Display/SummaryDisplay.tsx b/src/components/Display/SummaryDisplay.tsx index ae779bf..d2dfb4e 100644 --- a/src/components/Display/SummaryDisplay.tsx +++ b/src/components/Display/SummaryDisplay.tsx @@ -7,7 +7,7 @@ */ import React, {Dispatch, SetStateAction} from "react"; -import { Item, InvoiceSummary } from "./../../interfaces" +import { Item, InvoiceSummary } from "./../../Interfaces/interfaces" import "./Display.scss"; interface Props { diff --git a/src/components/Form/Document/DocumentInfoForm.tsx b/src/components/Form/Document/DocumentInfoForm.tsx index 2d7dcd9..9689d9f 100644 --- a/src/components/Form/Document/DocumentInfoForm.tsx +++ b/src/components/Form/Document/DocumentInfoForm.tsx @@ -9,8 +9,7 @@ import React, { useState } from "react"; import DatePicker from "react-datepicker"; import "./../../../styles/datepicker.scss"; // custom datepicker css -// import "react-datepicker/dist/react-datepicker.css"; -import { Person } from "./../../../interfaces"; +import { Person } from "./../../../Interfaces/interfaces"; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSync } from '@fortawesome/free-solid-svg-icons'; import "./../Form.scss"; diff --git a/src/components/Form/Items/AddNewItemForm.tsx b/src/components/Form/Items/AddNewItemForm.tsx index b810964..7988ddd 100644 --- a/src/components/Form/Items/AddNewItemForm.tsx +++ b/src/components/Form/Items/AddNewItemForm.tsx @@ -7,7 +7,7 @@ */ import React, { useState } from "react"; -import { Item } from "../../../interfaces"; +import { Item } from "../../../Interfaces/interfaces"; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faSync } from '@fortawesome/free-solid-svg-icons' import "./../Form.scss"; diff --git a/src/components/Form/Items/RegisterItemForm.tsx b/src/components/Form/Items/RegisterItemForm.tsx index 4089084..4c90875 100644 --- a/src/components/Form/Items/RegisterItemForm.tsx +++ b/src/components/Form/Items/RegisterItemForm.tsx @@ -8,7 +8,7 @@ import React, { useState, Dispatch, SetStateAction } from "react"; import "./../Form.scss"; -import { NewItem } from "./../../../interfaces" +import { NewItem } from "./../../../Interfaces/interfaces" import axios from "axios"; interface props { diff --git a/src/components/Form/People/SelectClientForm.tsx b/src/components/Form/People/SelectClientForm.tsx index ca984ca..1e47e55 100644 --- a/src/components/Form/People/SelectClientForm.tsx +++ b/src/components/Form/People/SelectClientForm.tsx @@ -7,7 +7,7 @@ */ import React, { Dispatch, SetStateAction } from "react"; -import { Person } from "./../../../interfaces"; +import { Person } from "./../../../Interfaces/interfaces"; import "./../Form.scss"; import ClientInfoDisplay from "../../Display/ClientInfoDisplay"; diff --git a/src/components/Form/Transport/TransportForm.tsx b/src/components/Form/Transport/TransportForm.tsx index af64d80..427b7de 100644 --- a/src/components/Form/Transport/TransportForm.tsx +++ b/src/components/Form/Transport/TransportForm.tsx @@ -7,7 +7,7 @@ */ import React, { useState, Dispatch, SetStateAction } from "react"; -import { Transport } from "./../../../interfaces" +import { Transport } from "./../../../Interfaces/interfaces" interface Props { setVisibility: Dispatch> // this component's visibility diff --git a/src/components/Menu/SubmitMenu.tsx b/src/components/Menu/SubmitMenu.tsx index 6e5e317..93b6d30 100644 --- a/src/components/Menu/SubmitMenu.tsx +++ b/src/components/Menu/SubmitMenu.tsx @@ -7,7 +7,7 @@ */ import React, { Dispatch, SetStateAction } from "react"; -import { Transport, Item } from "./../../interfaces"; +import { Transport, Item } from "./../../Interfaces/interfaces"; interface Props { setVisibility: Dispatch> // this component's visibility diff --git a/src/components/Pages/BillingPage.tsx b/src/components/Pages/BillingPage.tsx index e065cbc..a61ffbf 100644 --- a/src/components/Pages/BillingPage.tsx +++ b/src/components/Pages/BillingPage.tsx @@ -8,7 +8,7 @@ import React, { useState, useEffect } from "react"; import "./BillingPage.scss"; -import { Item, Person, Transport/*, Invoice*/ } from "../../interfaces"; +import { Item, Person, Transport/*, Invoice*/ } from "../../Interfaces/interfaces"; import axios from "axios"; import DocumentInfoForm from "./../Form/Document/DocumentInfoForm"; diff --git a/src/components/Print/Print.scss b/src/components/Print/Print.scss deleted file mode 100644 index bae5f76..0000000 --- a/src/components/Print/Print.scss +++ /dev/null @@ -1,13 +0,0 @@ -@import "../../styles/theme"; - -.PDFViewer { - height: 95%; - width: 95%; - border: 2px solid $border0; - - position: fixed; - top: 0; bottom: 0; - left: 0; right: 0; - margin: auto; - z-index: 3; -} diff --git a/src/components/Print/PrintableDoc.tsx b/src/components/Print/PrintableDoc.tsx deleted file mode 100644 index 67c8580..0000000 --- a/src/components/Print/PrintableDoc.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * OpenBills - Self hosted browser app to generate and keep track of simple invoices - * Version - 0 - * Licensed under the MIT license - https://opensource.org/licenses/MIT - * - * Copyright (c) 2021 Vidhu Kant Sharma -*/ - -import React, { /*useState,*/ } from "react"; -import "./Print.scss"; -import { Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer'; - -const styles = StyleSheet.create({ - page: { - flexDirection: 'row', - backgroundColor: '#E4E4E4' - }, - section: { - margin: 10, - padding: 10, - flexGrow: 1 - } -}); - -const PrintableDoc: React.FC = () => { - return ( - - - - Section #1 - - - Section #2 - - - - ); -} - -export default PrintableDoc; diff --git a/src/components/Util/SearchBar.scss b/src/components/Util/SearchBar.scss deleted file mode 100644 index d08f1ac..0000000 --- a/src/components/Util/SearchBar.scss +++ /dev/null @@ -1,28 +0,0 @@ -@import "../../styles/theme"; - -.searchBar input { - width: 12rem; -} - -.searchResults { - margin-top: $fontSize1; - width: 12rem; - height: 10rem; - background-color: $background3; - overflow-x: hidden; - overflow-y: auto; - border: 1px solid $border2; -} - -.searchResult { - color: $defFG; -} - -.searchResults .dataItem { - width: 100%; - height: 50px; - display: flex; - align-items: center; - color: black; -} - diff --git a/src/components/Util/SearchBar.tsx b/src/components/Util/SearchBar.tsx deleted file mode 100644 index d26415b..0000000 --- a/src/components/Util/SearchBar.tsx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * OpenBills - Self hosted browser app to generate and keep track of simple invoices - * Version - 0 - * Licensed under the MIT license - https://opensource.org/licenses/MIT - * - * Copyright (c) 2021 Vidhu Kant Sharma -*/ - -import React, { useState } from "react"; -import "./SearchBar.scss"; - -const SearchBar: React.FC = () => { - const sampledata: string[] = ["one", "two", "three", "four", "five", "six"] - - const [searchValue, setSearchValue] = useState(""); - const [searchSelection, setSearchSelection] = useState(""); - - const setSelectionValue = (value: string) => { - setSearchValue(""); - setSearchSelection(value); - console.log(searchSelection); - } - - return ( -
-
- { - setSearchValue(event.target.value); - console.log(searchSelection); - } - } - /> -
- -
- { - searchValue === "" - || sampledata.map((i) => i.toLowerCase().includes(searchValue.toLowerCase()) - && (

setSelectionValue(i)}>{i}

)) - } -
-
- ); -} - -export default SearchBar; diff --git a/src/interfaces.ts b/src/interfaces.ts deleted file mode 100644 index 53d14c3..0000000 --- a/src/interfaces.ts +++ /dev/null @@ -1,71 +0,0 @@ -export interface Transport { - Name: string - VehicleNum: string - Method: string - GSTIN: string - Builty: string -} - -export interface Item { - Model: string - Description: string - Quantity: number - UnitPrice: number // price without tax/discount - TotalValue: number // UnitPrice * Quantity - Discount: number // percentage of discount - DiscountValue: number - HSN: string - - TotalGST: number // gst percentage - SGST: number | boolean - CGST: number | boolean - IGST: number | boolean - TotalGSTValue: number // total tax - Brand: string - Category: string -} - -// for registering new item to DB -export interface NewItem { - Model: string - Description: string - UnitPrice: number // price without tax/discount - HSN: string - TotalGST: number // gst percentage - Brand: string - Category: string -} - -export interface Address { - AddressLine: string - City: string - State: string - PINCode: string - Country: string -} - -export interface Person { - ID?: number - Name: string - Phone?: string - Email?: string - BillAddress: Address - ShipAddress?: Address - Address?: string // to be removed -} - -export interface Invoice { - //Client: Person - Items: Item[] - Transport: Transport -} - -export interface InvoiceSummary { - TotalQuantity: number - TotalRawPrice: number // total price without gst/discount - TotalDiscount: number // total amount of discount - TotalGST: number // total gst to be paid - TotalPriceAfterDiscount: number - TotalPriceAfterGST: number - TotalRoundedOff: number -} -- cgit v1.2.3