1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

Merge remote-tracking branch 'origin/fix-extended-prices' into dev

This commit is contained in:
Sylvain 2022-01-17 15:42:21 +01:00
commit 86c595ea30
3 changed files with 9 additions and 9 deletions

View File

@ -28,10 +28,10 @@ export const ConfigureExtendedPriceButton: React.FC<ConfigureExtendedPriceButton
const [showList, setShowList] = useState<boolean>(false);
/**
* Return the number of minutes, user-friendly formatted
* Return the number of hours, user-friendly formatted
*/
const formatDuration = (minutes: number): string => {
return t('app.admin.configure_extended_prices_button.extended_price_DURATION', { DURATION: minutes });
return t('app.admin.configure_extended_prices_button.extended_price_DURATION', { DURATION: minutes / 60 });
};
/**

View File

@ -40,11 +40,11 @@ export const ExtendedPriceForm: React.FC<ExtendedPriceFormProps> = ({ formId, on
};
/**
* Callback triggered when the user inputs a number of minutes for the current extended price.
* Callback triggered when the user inputs a number of hours for the current extended price.
*/
const handleUpdateHours = (minutes: string) => {
updateExtendedPriceData(draft => {
draft.duration = parseInt(minutes, 10);
draft.duration = parseFloat(minutes) * 60;
});
};
@ -53,10 +53,10 @@ export const ExtendedPriceForm: React.FC<ExtendedPriceFormProps> = ({ formId, on
<label htmlFor="duration">{t('app.admin.extended_price_form.duration')} *</label>
<FabInput id="duration"
type="number"
defaultValue={extendedPriceData?.duration || ''}
defaultValue={extendedPriceData?.duration / 60 || ''}
onChange={handleUpdateHours}
step={1}
min={1}
step={0.25}
min={0.5}
icon={<i className="fas fa-clock" />}
required />
<label htmlFor="amount">{t('app.admin.extended_price_form.amount')} *</label>

View File

@ -389,9 +389,9 @@ en:
configure_extended_prices_button:
extended_prices: "Extended prices"
no_extended_prices: "No extended price for now"
extended_price_DURATION: "{DURATION} minutes"
extended_price_DURATION: "{DURATION} hours"
extended_price_form:
duration: "Duration (minutes)"
duration: "Duration (hours)"
amount: "Price"
pack_form:
hours: "Hours"