Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"moment-duration-format": "^2.3.2",
"moment-timezone": "^0.5.33",
"node-sass": "^7.0.1",
"openstack-uicore-foundation": "4.2.19",
"openstack-uicore-foundation": "4.2.21",
"p-limit": "^6.1.0",
"path-browserify": "^1.0.1",
"postcss-loader": "^6.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/form-template-item-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
authErrorHandler,
escapeFilterValue
} from "openstack-uicore-foundation/lib/utils/actions";
import { amountToCents } from "openstack-uicore-foundation/lib/utils/money";
import history from "../history";
import { getAccessTokenSafely } from "../utils/methods";
import {
Expand All @@ -42,7 +43,6 @@ import {
archiveItem,
unarchiveItem
} from "./inventory-shared-actions";
import { amountToCents } from "../utils/currency";

export const ADD_FORM_TEMPLATE_ITEM = "ADD_FORM_TEMPLATE_ITEM";
export const CHANGE_FORM_TEMPLATE_ITEM_SEARCH_TERM =
Expand Down
2 changes: 1 addition & 1 deletion src/actions/inventory-item-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
authErrorHandler,
escapeFilterValue
} from "openstack-uicore-foundation/lib/utils/actions";
import { amountToCents } from "openstack-uicore-foundation/lib/utils/money";
import history from "../history";
import { getAccessTokenSafely } from "../utils/methods";
import {
Expand All @@ -42,7 +43,6 @@ import {
archiveItem,
unarchiveItem
} from "./inventory-shared-actions";
import { amountToCents } from "../utils/currency";

export const ADD_INVENTORY_ITEM = "ADD_INVENTORY_ITEM";
export const CHANGE_INVENTORY_ITEM_SEARCH_TERM =
Expand Down
13 changes: 5 additions & 8 deletions src/actions/sponsor-forms-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import {
startLoading,
stopLoading
} from "openstack-uicore-foundation/lib/utils/actions";

import { amountToCents } from "openstack-uicore-foundation/lib/utils/money";
import T from "i18n-react/dist/i18n-react";
import moment from "moment-timezone";
import { escapeFilterValue, getAccessTokenSafely } from "../utils/methods";
import {
CENTS_FACTOR,
DEFAULT_CURRENT_PAGE,
DEFAULT_ORDER_DIR,
DEFAULT_PER_PAGE
Expand Down Expand Up @@ -1152,17 +1153,13 @@ const normalizeItem = (entity) => {

if (early_bird_rate === "" || typeof early_bird_rate === "undefined")
delete normalizedEntity.early_bird_rate;
else
normalizedEntity.early_bird_rate = Math.round(
early_bird_rate * CENTS_FACTOR
);
else normalizedEntity.early_bird_rate = amountToCents(early_bird_rate);
if (standard_rate === "" || typeof standard_rate === "undefined")
delete normalizedEntity.standard_rate;
else
normalizedEntity.standard_rate = Math.round(standard_rate * CENTS_FACTOR);
else normalizedEntity.standard_rate = amountToCents(standard_rate);
if (onsite_rate === "" || typeof onsite_rate === "undefined")
delete normalizedEntity.onsite_rate;
else normalizedEntity.onsite_rate = Math.round(onsite_rate * CENTS_FACTOR);
else normalizedEntity.onsite_rate = amountToCents(onsite_rate);

if (quantity_limit_per_show === "")
delete normalizedEntity.quantity_limit_per_show;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sponsors/sponsor-form-item-list-page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import AddIcon from "@mui/icons-material/Add";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import ImageIcon from "@mui/icons-material/Image";
import { parsePrice } from "openstack-uicore-foundation/lib/utils/money";
import {
deleteSponsorFormItem,
getSponsorFormItem,
Expand All @@ -40,7 +41,6 @@ import {
import ItemPopup from "./components/item-popup";
import InventoryPopup from "./components/inventory-popup";
import MuiTableEditable from "../../../components/mui/editable-table/mui-table-editable";
import { parsePrice } from "../../../utils/currency";
import { DEFAULT_CURRENT_PAGE } from "../../../utils/constants";

const SponsorFormItemListPage = ({
Expand Down
24 changes: 7 additions & 17 deletions src/reducers/sponsors/sponsor-form-items-list-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* limitations under the License.
* */

import { amountFromCents } from "openstack-uicore-foundation/lib/utils/money";
import { LOGOUT_USER } from "openstack-uicore-foundation/lib/security/actions";
import {
RECEIVE_SPONSOR_FORM_ITEM,
Expand All @@ -22,7 +23,6 @@ import {
SPONSOR_FORM_ITEM_UNARCHIVED
} from "../../actions/sponsor-forms-actions";
import { SET_CURRENT_SUMMIT } from "../../actions/summit-actions";
import { CENTS_FACTOR, DECIMAL_DIGITS } from "../../utils/constants";

const DEFAULT_STATE = {
items: [],
Expand Down Expand Up @@ -86,15 +86,9 @@ const sponsorFormItemsListReducer = (state = DEFAULT_STATE, action) => {
id: a.id,
code: a.code,
name: a.name,
early_bird_rate: `$${(a.early_bird_rate / CENTS_FACTOR).toFixed(
DECIMAL_DIGITS
)}`,
standard_rate: `$${(a.standard_rate / CENTS_FACTOR).toFixed(
DECIMAL_DIGITS
)}`,
onsite_rate: `$${(a.onsite_rate / CENTS_FACTOR).toFixed(
DECIMAL_DIGITS
)}`,
early_bird_rate: `$${amountFromCents(a.early_bird_rate)}`,
standard_rate: `$${amountFromCents(a.standard_rate)}`,
onsite_rate: `$${amountFromCents(a.onsite_rate)}`,
default_quantity: a.default_quantity,
is_archived: a.is_archived,
images: a.images
Expand All @@ -113,13 +107,9 @@ const sponsorFormItemsListReducer = (state = DEFAULT_STATE, action) => {

const currentItem = {
...item,
early_bird_rate: (item.early_bird_rate / CENTS_FACTOR).toFixed(
DECIMAL_DIGITS
),
standard_rate: (item.standard_rate / CENTS_FACTOR).toFixed(
DECIMAL_DIGITS
),
onsite_rate: (item.onsite_rate / CENTS_FACTOR).toFixed(DECIMAL_DIGITS),
early_bird_rate: amountFromCents(item.early_bird_rate),
standard_rate: amountFromCents(item.standard_rate),
onsite_rate: amountFromCents(item.onsite_rate),
meta_fields:
item.meta_fields.length > 0
? item.meta_fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* */

import { LOGOUT_USER } from "openstack-uicore-foundation/lib/security/actions";
import { amountFromCents } from "openstack-uicore-foundation/lib/utils/money";
import {
RECEIVE_FORM_TEMPLATE_ITEM,
RESET_FORM_TEMPLATE_ITEM_FORM,
Expand All @@ -24,7 +25,6 @@ import {
FORM_TEMPLATE_ITEM_IMAGE_SAVED,
FORM_TEMPLATE_ITEM_IMAGE_DELETED
} from "../../actions/form-template-item-actions";
import { amountFromCents } from "../../utils/currency";

export const DEFAULT_ENTITY = {
id: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/sponsors_inventory/inventory-item-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* */

import { LOGOUT_USER } from "openstack-uicore-foundation/lib/security/actions";
import { amountFromCents } from "openstack-uicore-foundation/lib/utils/money";
import {
RECEIVE_INVENTORY_ITEM,
RESET_INVENTORY_ITEM_FORM,
Expand All @@ -24,7 +25,6 @@ import {
INVENTORY_ITEM_IMAGE_SAVED,
INVENTORY_ITEM_IMAGE_DELETED
} from "../../actions/inventory-item-actions";
import { amountFromCents } from "../../utils/currency";

export const DEFAULT_ENTITY = {
id: 0,
Expand Down
3 changes: 0 additions & 3 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ export const EXPORT_PAGE_SIZE_200 = 200;

export const DATE_FILTER_ARRAY_SIZE = 2;

export const CENTS_FACTOR = 100;
export const DECIMAL_PLACES = 2;

export const MILLISECONDS_TO_SECONDS = 1000;

export const INDEX_NOT_FOUND = -1;
Expand Down
49 changes: 0 additions & 49 deletions src/utils/currency.js

This file was deleted.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10342,10 +10342,10 @@ open@^8.0.9:
is-docker "^2.1.1"
is-wsl "^2.2.0"

openstack-uicore-foundation@4.2.19:
version "4.2.19"
resolved "https://registry.npmjs.org/openstack-uicore-foundation/-/openstack-uicore-foundation-4.2.19.tgz#40ae09230b483a3279592bdeb0e7c164af4e5c97"
integrity sha512-spRHx76SlFmJqUtsUz786pnX+oaco/gDH7LJ7u5MIj5c9VcCo9rkeBfwl7htCLaCC68msuRGwlrMJpkSsY6gxw==
openstack-uicore-foundation@4.2.21:
version "4.2.21"
resolved "https://registry.yarnpkg.com/openstack-uicore-foundation/-/openstack-uicore-foundation-4.2.21.tgz#8bb505db7559890c902ea7b3d634d46f879287e1"
integrity sha512-KOFIJnh4swsIAn5L/DV7I70cPtdgZxl47Kp7oX05uET7mqdFUVp5M08ysgMWXQRaoKqjpZnOzERLFxPNfKpqvg==

optionator@^0.9.1:
version "0.9.4"
Expand Down