diff --git a/app/frontend/src/javascript/api/space.ts b/app/frontend/src/javascript/api/space.ts index 6f1d9c9b9..5633bd658 100644 --- a/app/frontend/src/javascript/api/space.ts +++ b/app/frontend/src/javascript/api/space.ts @@ -12,5 +12,4 @@ export default class SpaceAPI { const res: AxiosResponse = await apiClient.get(`/api/spaces/${id}`); return res?.data; } - } diff --git a/app/frontend/src/javascript/components/pricing/machines/configure-packs-button.tsx b/app/frontend/src/javascript/components/pricing/machines/configure-packs-button.tsx index ec3cbd2be..c5b1ff43c 100644 --- a/app/frontend/src/javascript/components/pricing/machines/configure-packs-button.tsx +++ b/app/frontend/src/javascript/components/pricing/machines/configure-packs-button.tsx @@ -64,8 +64,8 @@ export const ConfigurePacksButton: React.FC = ({ pack }; return ( -
- {showList && @@ -73,7 +73,7 @@ export const ConfigurePacksButton: React.FC = ({ pack {packs?.map(p =>
  • {formatDuration(p.minutes)} - {FormatLib.price(p.amount)} - + diff --git a/app/frontend/src/javascript/components/pricing/machines/delete-pack.tsx b/app/frontend/src/javascript/components/pricing/machines/delete-pack.tsx index bfd8a40a0..dc1d01089 100644 --- a/app/frontend/src/javascript/components/pricing/machines/delete-pack.tsx +++ b/app/frontend/src/javascript/components/pricing/machines/delete-pack.tsx @@ -42,8 +42,8 @@ const DeletePackComponent: React.FC = ({ onSuccess, onError, pa }; return ( -
    - } onClick={toggleDeletionModal} /> +
    + } onClick={toggleDeletionModal} /> = ({ pack, onSuccess, onError }) }; return ( -
    - } onClick={handleRequestEdit} /> +
    + } onClick={handleRequestEdit} /> - {packData && } + onConfirmSendFormId="edit-group"> + {packData && }
    ); diff --git a/app/frontend/src/javascript/components/pricing/machines/machines-pricing.tsx b/app/frontend/src/javascript/components/pricing/machines/machines-pricing.tsx index 80334aab0..5b3618b7d 100644 --- a/app/frontend/src/javascript/components/pricing/machines/machines-pricing.tsx +++ b/app/frontend/src/javascript/components/pricing/machines/machines-pricing.tsx @@ -107,7 +107,7 @@ const MachinesPricing: React.FC = ({ onError, onSuccess }) }; return ( -
    +

    diff --git a/app/frontend/src/javascript/components/pricing/machines/pack-form.tsx b/app/frontend/src/javascript/components/pricing/machines/pack-form.tsx index ba4381c46..831e0d899 100644 --- a/app/frontend/src/javascript/components/pricing/machines/pack-form.tsx +++ b/app/frontend/src/javascript/components/pricing/machines/pack-form.tsx @@ -103,7 +103,7 @@ export const PackForm: React.FC = ({ formId, onSubmit, pack }) => }; return ( -
    + (false); /** - * Open/closes the popover listing the existing packs + * Open/closes the popover listing the existing extended prices */ const toggleShowList = (): void => { setShowList(!showList); @@ -57,8 +57,8 @@ export const ConfigureExtendedPriceButton: React.FC - {showList && @@ -66,7 +66,7 @@ export const ConfigureExtendedPriceButton: React.FC
  • {extendedPrice.duration} {t('app.admin.calendar.minutes')} - {FormatLib.price(extendedPrice.amount)} - + diff --git a/app/frontend/src/javascript/components/pricing/spaces/delete-extended-price.tsx b/app/frontend/src/javascript/components/pricing/spaces/delete-extended-price.tsx index 82307709f..56af8784e 100644 --- a/app/frontend/src/javascript/components/pricing/spaces/delete-extended-price.tsx +++ b/app/frontend/src/javascript/components/pricing/spaces/delete-extended-price.tsx @@ -41,8 +41,8 @@ export const DeleteExtendedPrice: React.FC = ({ onSucc }; return ( -
    - } onClick={toggleDeletionModal} /> +
    + } onClick={toggleDeletionModal} /> = ({ price, onS }; return ( -
    - } onClick={handleRequestEdit} /> +
    + } onClick={handleRequestEdit} /> - {extendedPriceData && } + onConfirmSendFormId="edit-group"> + {extendedPriceData && }
    ); diff --git a/app/frontend/src/javascript/components/pricing/spaces/extended-price-form.tsx b/app/frontend/src/javascript/components/pricing/spaces/extended-price-form.tsx index 34e8e354c..31445ee81 100644 --- a/app/frontend/src/javascript/components/pricing/spaces/extended-price-form.tsx +++ b/app/frontend/src/javascript/components/pricing/spaces/extended-price-form.tsx @@ -7,7 +7,7 @@ import { IFablab } from '../../../models/fablab'; declare let Fablab: IFablab; -interface PackFormProps { +interface ExtendedPriceFormProps { formId: string, onSubmit: (pack: Price) => void, price?: Price, @@ -17,7 +17,7 @@ interface PackFormProps { * A form component to create/edit a extended price. * The form validation must be created elsewhere, using the attribute form={formId}. */ -export const ExtendedPriceForm: React.FC = ({ formId, onSubmit, price }) => { +export const ExtendedPriceForm: React.FC = ({ formId, onSubmit, price }) => { const [extendedPriceData, updateExtendedPriceData] = useImmer(price || {} as Price); const { t } = useTranslation('admin'); @@ -49,7 +49,7 @@ export const ExtendedPriceForm: React.FC = ({ formId, onSubmit, p }; return ( - + = ({ onError, onSuccess }) => // retrieve the initial data useEffect(() => { - SpaceAPI.index(false) + SpaceAPI.index() .then(data => setSpaces(data)) .catch(error => onError(error)); GroupAPI.index({ disabled: false, admins: false }) @@ -67,7 +67,7 @@ const SpacesPricing: React.FC = ({ onError, onSuccess }) => * Find the default price (hourly rate) matching the given criterion */ const findPriceBy = (spaceId, groupId): Price => { - return prices.find(price => price.priceable_id === spaceId && price.group_id === groupId && price.duration == 60); + return prices.find(price => price.priceable_id === spaceId && price.group_id === groupId && price.duration === 60); }; /** @@ -101,7 +101,7 @@ const SpacesPricing: React.FC = ({ onError, onSuccess }) => }; return ( -
    +

    @@ -118,7 +118,7 @@ const SpacesPricing: React.FC = ({ onError, onSuccess }) => {spaces?.map(space => {space.name} {groups?.map(group => - {prices && } + {prices.length && }