Skip to content
Snippets Groups Projects
Unverified Commit b6f4fd7e authored by Maxime FRIESS's avatar Maxime FRIESS :blue_heart:
Browse files

[components] Added PaymentInput

parent 4a20c20e
Branches
Tags 0.1.0
No related merge requests found
import { TextField as MuiTextField } from "@material-ui/core";
import React from "react";
import { FormDataConsumer, SelectInput, useTranslate } from 'react-admin';
import PersonalAccountSelector from "../components/PersonalAccountSelector";
const PaymentInput = ({ price }) => {
const translate = useTranslate();
return (<>
<MuiTextField value={Number(price).toLocaleString('fr-FR', { currency: 'EUR', currencyDisplay: 'symbol', style: 'currency' })} disabled variant="filled" type="text" label={translate('inputs.multiproductcount.price')} />
<SelectInput source="payment" label="Moyen de paiement" allowEmpty={false} choices={[
{ id: 'cash', name: 'Liquide (Caisse)' },
{ id: 'card', name: 'Carte Bancaire' },
{ id: 'account', name: 'Compte personel' },
]} initialValue='cash' />
<FormDataConsumer>
{({ formData, ...rest }) => formData.payment === 'account' &&
<PersonalAccountSelector source="token" label="Compte" />
}
</FormDataConsumer>
</>);
};
export default PaymentInput;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment