Skip to content

Commit

Permalink
after release bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
imkarimkarim committed Aug 21, 2021
1 parent d4acbda commit 182e267
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "goje",
"productName": "goje",
"version": "1.2.4",
"description": "My Electron application description",
"version": "1.4.1",
"description": "a Electron cross-platform desktop app for fruit stores",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
Expand All @@ -16,7 +16,7 @@
},
"keywords": [],
"author": {
"name": "alirezainjast",
"name": "imkarimkarim",
"email": "[email protected]"
},
"license": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions src/App/Components/Car/CarProductInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TextField from "@material-ui/core/TextField";
import Input from "../Input.jsx";
import ExpenseInput from "../ExpenseInput.jsx";
import "./CarProductInput.css";
import { convertToIntIfIsNumber } from "../../utils";
import { convertToFloatIfIsNumber } from "../../utils";

// TODO: also up/down with arrow keys

Expand Down Expand Up @@ -56,7 +56,7 @@ const CarProductInput = React.memo(({ formDispatch }) => {
fun={(e) => {
setState({
...state,
amount: convertToIntIfIsNumber(e.target.value),
amount: convertToFloatIfIsNumber(e.target.value),
});
}}
/>
Expand All @@ -66,15 +66,15 @@ const CarProductInput = React.memo(({ formDispatch }) => {
fun={(e) => {
setState({
...state,
weight: convertToIntIfIsNumber(e.target.value),
weight: convertToFloatIfIsNumber(e.target.value),
});
}}
/>
<ExpenseInput
value={state.price}
label="فی حدودی"
fun={(e) => {
setState({ ...state, price: convertToIntIfIsNumber(e.target.value) });
setState({ ...state, price: convertToFloatIfIsNumber(e.target.value) });
}}
/>
<Button
Expand Down
8 changes: 4 additions & 4 deletions src/App/Components/Product/Cheat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Input from "../Input.jsx";
import ExpenseInput from "../ExpenseInput.jsx";
import { NotifContext } from "../../Contexts/NotifContext.jsx";
import "./Cheat.css";
import { convertToIntIfIsNumber } from "../../utils.js";
import { convertToFloatIfIsNumber } from "../../utils.js";

// TODO: also up/down with arrow keys

Expand Down Expand Up @@ -68,21 +68,21 @@ const Cheat = React.memo(({ productId, setCountI }) => {
value={amount}
label="تعداد*"
fun={(e) => {
setAmount(convertToIntIfIsNumber(e.target.value));
setAmount(convertToFloatIfIsNumber(e.target.value));
}}
/>
<Input
value={weight}
label="وزن*"
fun={(e) => {
setWeight(convertToIntIfIsNumber(e.target.value));
setWeight(convertToFloatIfIsNumber(e.target.value));
}}
/>
<ExpenseInput
value={price}
label="فی فروش*"
fun={(e) => {
setPrice(convertToIntIfIsNumber(e.target.value));
setPrice(convertToFloatIfIsNumber(e.target.value));
}}
/>
<Button
Expand Down
26 changes: 13 additions & 13 deletions src/App/Reducers/EditCarReducer.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { convertToIntIfIsNumber } from "../utils";
import { convertToFloatIfIsNumber } from "../utils";

export default function reducer(state, action) {
switch (action.type) {
case "setForm":
return action.payload;
case "setarrivalDate":
return { ...state, arrivalDate: convertToIntIfIsNumber(action.payload) };
return { ...state, arrivalDate: convertToFloatIfIsNumber(action.payload) };
case "setowner":
return { ...state, owner: action.payload1, ownerId: action.payload2 };
case "setPlaque":
return { ...state, plaque: action.payload };
case "setbasculeWeight":
return {
...state,
basculeWeight: convertToIntIfIsNumber(action.payload),
basculeWeight: convertToFloatIfIsNumber(action.payload),
};
case "setunload":
return { ...state, unload: convertToIntIfIsNumber(action.payload) };
return { ...state, unload: convertToFloatIfIsNumber(action.payload) };
case "setcommission":
return { ...state, commission: convertToIntIfIsNumber(action.payload) };
return { ...state, commission: convertToFloatIfIsNumber(action.payload) };
case "setportage":
return { ...state, portage: convertToIntIfIsNumber(action.payload) };
return { ...state, portage: convertToFloatIfIsNumber(action.payload) };
case "addProduct":
return { ...state, products: [...state.products, action.payload] };
case "editProduct":
Expand All @@ -29,17 +29,17 @@ export default function reducer(state, action) {
customeId: action.payload1,
productName: action.payload5,
signHint: action.payload6,
amount: convertToIntIfIsNumber(action.payload2),
weight: convertToIntIfIsNumber(action.payload3),
price: convertToIntIfIsNumber(action.payload4),
amount: convertToFloatIfIsNumber(action.payload2),
weight: convertToFloatIfIsNumber(action.payload3),
price: convertToFloatIfIsNumber(action.payload4),
});
} else {
state.products.splice(action.payload0, 1, {
productName: action.payload5,
signHint: action.payload6,
amount: convertToIntIfIsNumber(action.payload2),
weight: convertToIntIfIsNumber(action.payload3),
price: convertToIntIfIsNumber(action.payload4),
amount: convertToFloatIfIsNumber(action.payload2),
weight: convertToFloatIfIsNumber(action.payload3),
price: convertToFloatIfIsNumber(action.payload4),
});
}

Expand All @@ -61,7 +61,7 @@ export default function reducer(state, action) {
products: state.products,
};
case "setcash":
return { ...state, cash: convertToIntIfIsNumber(action.payload) };
return { ...state, cash: convertToFloatIfIsNumber(action.payload) };
case "setPs":
return { ...state, ps: action.payload };
default:
Expand Down
22 changes: 11 additions & 11 deletions src/App/Reducers/EditFactorReducer.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertToIntIfIsNumber } from "../utils";
import { convertToFloatIfIsNumber } from "../utils";

export default function reducer(state, action) {
switch (action.type) {
Expand All @@ -9,9 +9,9 @@ export default function reducer(state, action) {
case "setIsPayed":
return { ...state, isPayed: action.payload };
case "setFactorDate":
return { ...state, factorDate: convertToIntIfIsNumber(action.payload) };
return { ...state, factorDate: convertToFloatIfIsNumber(action.payload) };
case "setChangeDate":
return { ...state, changeDate: convertToIntIfIsNumber(action.payload) };
return { ...state, changeDate: convertToFloatIfIsNumber(action.payload) };
case "addProduct":
return {
...state,
Expand All @@ -20,9 +20,9 @@ export default function reducer(state, action) {
{
productId: action.payload1,
productName: action.payload5,
amount: convertToIntIfIsNumber(action.payload2),
weight: convertToIntIfIsNumber(action.payload3),
price: convertToIntIfIsNumber(action.payload4),
amount: convertToFloatIfIsNumber(action.payload2),
weight: convertToFloatIfIsNumber(action.payload3),
price: convertToFloatIfIsNumber(action.payload4),
},
],
};
Expand All @@ -36,9 +36,9 @@ export default function reducer(state, action) {
state.products.splice(action.payload0, 1, {
productId: action.payload1,
productName: action.payload5,
amount: convertToIntIfIsNumber(action.payload2),
weight: convertToIntIfIsNumber(action.payload3),
price: convertToIntIfIsNumber(action.payload4),
amount: convertToFloatIfIsNumber(action.payload2),
weight: convertToFloatIfIsNumber(action.payload3),
price: convertToFloatIfIsNumber(action.payload4),
});
return {
...state,
Expand All @@ -50,8 +50,8 @@ export default function reducer(state, action) {
pays: [
...state.pays,
{
date: convertToIntIfIsNumber(action.payload1),
amount: convertToIntIfIsNumber(action.payload2),
date: convertToFloatIfIsNumber(action.payload1),
amount: convertToFloatIfIsNumber(action.payload2),
},
],
};
Expand Down
16 changes: 8 additions & 8 deletions src/App/Reducers/EditProductReducer.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertToIntIfIsNumber } from "../utils";
import { convertToFloatIfIsNumber } from "../utils";

export default function reducer(state, action) {
switch (action.type) {
Expand All @@ -11,20 +11,20 @@ export default function reducer(state, action) {
case "setbasculeWeight":
return {
...state,
basculeWeight: convertToIntIfIsNumber(action.payload),
basculeWeight: convertToFloatIfIsNumber(action.payload),
};
case "setamount":
return { ...state, amount: convertToIntIfIsNumber(action.payload) };
return { ...state, amount: convertToFloatIfIsNumber(action.payload) };
case "setarrivalDate":
return { ...state, arrivalDate: convertToIntIfIsNumber(action.payload) };
return { ...state, arrivalDate: convertToFloatIfIsNumber(action.payload) };
case "setcommission":
return { ...state, commission: convertToIntIfIsNumber(action.payload) };
return { ...state, commission: convertToFloatIfIsNumber(action.payload) };
case "setunload":
return { ...state, unload: convertToIntIfIsNumber(action.payload) };
return { ...state, unload: convertToFloatIfIsNumber(action.payload) };
case "setportage":
return { ...state, portage: convertToIntIfIsNumber(action.payload) };
return { ...state, portage: convertToFloatIfIsNumber(action.payload) };
case "setcash":
return { ...state, cash: convertToIntIfIsNumber(action.payload) };
return { ...state, cash: convertToFloatIfIsNumber(action.payload) };
case "setPlaque":
return { ...state, plaque: action.payload };
case "toggleIsProductFinish":
Expand Down
14 changes: 7 additions & 7 deletions src/App/Reducers/IncludeCarReducer.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { convertToIntIfIsNumber } from "../utils";
import { convertToFloatIfIsNumber } from "../utils";

export default function reducer(state, action) {
switch (action.type) {
case "setForm":
return action.payload;
case "setarrivalDate":
return { ...state, arrivalDate: convertToIntIfIsNumber(action.payload) };
return { ...state, arrivalDate: convertToFloatIfIsNumber(action.payload) };
case "setowner":
return { ...state, owner: action.payload1, ownerId: action.payload2 };
case "setPlaque":
return { ...state, plaque: action.payload };
case "setbasculeWeight":
return {
...state,
basculeWeight: convertToIntIfIsNumber(action.payload),
basculeWeight: convertToFloatIfIsNumber(action.payload),
};
case "setunload":
return { ...state, unload: convertToIntIfIsNumber(action.payload) };
return { ...state, unload: convertToFloatIfIsNumber(action.payload) };
case "setcommission":
return { ...state, commission: convertToIntIfIsNumber(action.payload) };
return { ...state, commission: convertToFloatIfIsNumber(action.payload) };
case "setportage":
return { ...state, portage: convertToIntIfIsNumber(action.payload) };
return { ...state, portage: convertToFloatIfIsNumber(action.payload) };
case "addProduct":
return { ...state, products: [...state.products, action.payload] };
case "removeProduct":
Expand All @@ -30,7 +30,7 @@ export default function reducer(state, action) {
products: state.products,
};
case "setcash":
return { ...state, cash: convertToIntIfIsNumber(action.payload) };
return { ...state, cash: convertToFloatIfIsNumber(action.payload) };
case "setPs":
return { ...state, ps: action.payload };
default:
Expand Down
22 changes: 11 additions & 11 deletions src/App/Reducers/NewFactorReducer.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateInputByUserFactorSchema } from "../../schemas.js";
import { convertToIntIfIsNumber } from "../utils";
import { convertToFloatIfIsNumber } from "../utils";

export function reducer(state, action) {
switch (action.type) {
Expand All @@ -14,9 +14,9 @@ export function reducer(state, action) {
case "setIsPayed":
return { ...state, isPayed: action.payload };
case "setFactorDate":
return { ...state, factorDate: convertToIntIfIsNumber(action.payload) };
return { ...state, factorDate: convertToFloatIfIsNumber(action.payload) };
case "setChangeDate":
return { ...state, changeDate: convertToIntIfIsNumber(action.payload) };
return { ...state, changeDate: convertToFloatIfIsNumber(action.payload) };
case "addProduct":
return {
...state,
Expand All @@ -25,9 +25,9 @@ export function reducer(state, action) {
{
productId: action.payload1,
productName: action.payload5,
amount: convertToIntIfIsNumber(action.payload2),
weight: convertToIntIfIsNumber(action.payload3),
price: convertToIntIfIsNumber(action.payload4),
amount: convertToFloatIfIsNumber(action.payload2),
weight: convertToFloatIfIsNumber(action.payload3),
price: convertToFloatIfIsNumber(action.payload4),
},
],
};
Expand All @@ -41,18 +41,18 @@ export function reducer(state, action) {
state.products.splice(action.payload0, 1, {
productId: action.payload1,
productName: action.payload5,
amount: convertToIntIfIsNumber(action.payload2),
weight: convertToIntIfIsNumber(action.payload3),
price: convertToIntIfIsNumber(action.payload4),
amount: convertToFloatIfIsNumber(action.payload2),
weight: convertToFloatIfIsNumber(action.payload3),
price: convertToFloatIfIsNumber(action.payload4),
});
case "addPay":
return {
...state,
pays: [
...state.pays,
{
date: convertToIntIfIsNumber(action.payload1),
amount: convertToIntIfIsNumber(action.payload2),
date: convertToFloatIfIsNumber(action.payload1),
amount: convertToFloatIfIsNumber(action.payload2),
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions src/App/Reducers/NewProductOwnerReducer.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertToIntIfIsNumber } from '../utils';
import { convertToFloatIfIsNumber } from '../utils';

export default function reducer(state, action) {
switch (action.type) {
Expand All @@ -9,7 +9,7 @@ export default function reducer(state, action) {
case "setPaysNumber":
return { ...state, payNumber: action.payload };
case "setDefaultCommission":
return { ...state, defaultCommission: convertToIntIfIsNumber(action.payload) };
return { ...state, defaultCommission: convertToFloatIfIsNumber(action.payload) };
default:
return state;
}
Expand Down
4 changes: 2 additions & 2 deletions src/App/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ const persianNumberToEnglish = (num) => {
return num;
};

export const convertToIntIfIsNumber = (number) => {
export const convertToFloatIfIsNumber = (number) => {
number = persianNumberToEnglish(number);
if (
!isNaN(number) &&
number !== "" &&
typeof number == "string" &&
number.toString().length != 0
) {
return parseInt(number);
return parseFloat(number);
} else {
return number;
}
Expand Down

0 comments on commit 182e267

Please sign in to comment.