aboutsummaryrefslogtreecommitdiff
path: root/src/components/editors
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-13 14:28:29 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-13 14:28:29 +0530
commit097a393b2bf170d69ba1cef16c5e70f204e2fe65 (patch)
tree91254e3de332506be13cff7bea74cca170fe3efc /src/components/editors
parent300a4eb39ccea56da416d83400cddc97118e1649 (diff)
added an invoice summary component
Diffstat (limited to 'src/components/editors')
-rw-r--r--src/components/editors/address-editor.js2
-rw-r--r--src/components/editors/brand-editor.js7
-rw-r--r--src/components/editors/client-editor.js2
-rw-r--r--src/components/editors/contact-editor.js2
-rw-r--r--src/components/editors/item-editor.js6
-rw-r--r--src/components/editors/multi-address-editor.js1
6 files changed, 5 insertions, 15 deletions
diff --git a/src/components/editors/address-editor.js b/src/components/editors/address-editor.js
index 5fb8ff6..1a4beab 100644
--- a/src/components/editors/address-editor.js
+++ b/src/components/editors/address-editor.js
@@ -15,10 +15,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Address } from './../../classes/client';
import './scss/address-editor.scss';
-import { useState, useEffect } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faXmark } from '@fortawesome/free-solid-svg-icons';
diff --git a/src/components/editors/brand-editor.js b/src/components/editors/brand-editor.js
index 64950ec..7796c68 100644
--- a/src/components/editors/brand-editor.js
+++ b/src/components/editors/brand-editor.js
@@ -18,7 +18,7 @@
import { Brand, saveBrand, editBrand } from './../../classes/brand'
import './scss/brand-editor.scss'
-import { useState, useEffect } from 'react';
+import { useState } from 'react';
const BrandEditor = (props) => {
const [name, setName] = useState(props.brand.Name);
@@ -54,11 +54,6 @@ const BrandEditor = (props) => {
props.editing && props.hide();
}
- const validateFloatInput = (e, callback) => {
- const f = parseFloat(e.target.value);
- f && callback(f)
- }
-
return (
<div className={`editor-wrapper ${props.className ? props.className : ''}`}>
<p>{props.heading}</p>
diff --git a/src/components/editors/client-editor.js b/src/components/editors/client-editor.js
index e07c749..9a752c7 100644
--- a/src/components/editors/client-editor.js
+++ b/src/components/editors/client-editor.js
@@ -38,7 +38,7 @@ const ClientEditor = (props) => {
// will delete existing shipping addresses if false
useEffect(() =>
setShippingAddresses(shipToBillingAddress ? [] : (shippingAddresses.length > 0 ? shippingAddresses : [new Address()]))
- , [shipToBillingAddress]);
+ , [shipToBillingAddress, shippingAddresses]);
const handleSubmit = (e) => {
e.preventDefault();
diff --git a/src/components/editors/contact-editor.js b/src/components/editors/contact-editor.js
index 99baeca..b03326c 100644
--- a/src/components/editors/contact-editor.js
+++ b/src/components/editors/contact-editor.js
@@ -15,8 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Contact } from './../../classes/client';
-import { useState, useEffect } from 'react';
import './scss/contact-editor.scss';
const ContactEditor = ({ heading, contact, setContact }) => {
diff --git a/src/components/editors/item-editor.js b/src/components/editors/item-editor.js
index eb6e8c1..d72cff3 100644
--- a/src/components/editors/item-editor.js
+++ b/src/components/editors/item-editor.js
@@ -28,7 +28,7 @@ const ItemEditor = (props) => {
const [unit, setUnit] = useState(props.item.UnitOfMeasure);
const [unitPrice, setUnitPrice] = useState(props.item.UnitPrice);
const [gstP, setGSTP] = useState(props.item.GSTPercentage);
- const [minQty, setMinQty] = useState(props.item.MinQuantity);
+ const [minQty, setMinQty] = useState(props.item.MinQuantity > 0 ? props.item.MinQuantity : 1);
const [maxQty, setMaxQty] = useState(props.item.MaxQuantity);
const [brand, setBrand] = useState(props.item.Brand);
const [savedBrands, setSavedBrands] = useState([]);
@@ -163,7 +163,7 @@ const ItemEditor = (props) => {
Minimum Quantity:
<input
type="number"
- value={minQty == "0" ? "" : minQty}
+ value={minQty === 0 ? "" : minQty}
min="0"
onChange={(e) => setMinQty(e.target.value)} />
</label>
@@ -172,7 +172,7 @@ const ItemEditor = (props) => {
Maximum Quantity:
<input
type="number"
- value={maxQty == "0" ? "" : maxQty}
+ value={maxQty === 0 ? "" : maxQty}
min="0"
onChange={(e) => setMaxQty(e.target.value)} />
</label>
diff --git a/src/components/editors/multi-address-editor.js b/src/components/editors/multi-address-editor.js
index bb69e20..1159fab 100644
--- a/src/components/editors/multi-address-editor.js
+++ b/src/components/editors/multi-address-editor.js
@@ -15,7 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Address } from './../../classes/client';
import AddressEditor from './address-editor';
const MultiAddressEditor = ({addresses, setAddresses, setShipToBillingAddress}) => {