Files
bodyshop/client/src/components/eula/eula.component.jsx
Dave Richer 1a93e1de41 ### Eula V1
- Front end logic implemented

Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-17 00:38:02 -05:00

243 lines
8.5 KiB
JavaScript

import React, {useState} from "react";
import {Button, Card, Checkbox, Col, Form, Input, Modal, Row, Space} from "antd";
import Markdown from "react-markdown";
const EULA = `# End User License Agreement (EULA)
## 1. Introduction
This End User License Agreement ("EULA") governs your use of our website and any related services. By using our website, you agree to be bound by the terms of this EULA.
## 2. License Grant
We grant you a non-exclusive, non-transferable, revocable license to use our website for your personal, non-commercial use.
## 3. Restrictions
You agree not to:
- Use our website for any illegal or unauthorized purpose
- Attempt to reverse engineer or otherwise derive the source code of our website
## 4. Termination
We reserve the right to terminate your license to use our website at any time and for any reason.
## 5. Disclaimer of Warranties
Our website is provided "as is" and without any warranty of any kind.
## 6. Limitation of Liability
We will not be liable for any damages or losses arising from your use of our website.
## 7. Governing Law
This EULA is governed by the laws of [Your Jurisdiction].
## 8. Changes to this EULA
We reserve the right to modify this EULA at any time. Your continued use of our website after any such changes constitutes your acceptance of the new EULA.
## 9. Contact Us
If you have any questions about this EULA, please contact us at [Your Contact Information].
## 1. Introduction
This End User License Agreement ("EULA") governs your use of our website and any related services. By using our website, you agree to be bound by the terms of this EULA.
## 2. License Grant
We grant you a non-exclusive, non-transferable, revocable license to use our website for your personal, non-commercial use.
## 3. Restrictions
You agree not to:
- Use our website for any illegal or unauthorized purpose
- Attempt to reverse engineer or otherwise derive the source code of our website
## 4. Termination
We reserve the right to terminate your license to use our website at any time and for any reason.
## 5. Disclaimer of Warranties
Our website is provided "as is" and without any warranty of any kind.
## 6. Limitation of Liability
We will not be liable for any damages or losses arising from your use of our website.
## 7. Governing Law
This EULA is governed by the laws of [Your Jurisdiction].
## 8. Changes to this EULA
We reserve the right to modify this EULA at any time. Your continued use of our website after any such changes constitutes your acceptance of the new EULA.
## 9. Contact Us
If you have any questions about this EULA, please contact us at [Your Contact Information].
## 1. Introduction
This End User License Agreement ("EULA") governs your use of our website and any related services. By using our website, you agree to be bound by the terms of this EULA.
## 2. License Grant
We grant you a non-exclusive, non-transferable, revocable license to use our website for your personal, non-commercial use.
## 3. Restrictions
You agree not to:
- Use our website for any illegal or unauthorized purpose
- Attempt to reverse engineer or otherwise derive the source code of our website
## 4. Termination
We reserve the right to terminate your license to use our website at any time and for any reason.
## 5. Disclaimer of Warranties
Our website is provided "as is" and without any warranty of any kind.
## 6. Limitation of Liability
We will not be liable for any damages or losses arising from your use of our website.
## 7. Governing Law
This EULA is governed by the laws of [Your Jurisdiction].
## 8. Changes to this EULA
We reserve the right to modify this EULA at any time. Your continued use of our website after any such changes constitutes your acceptance of the new EULA.
## 9. Contact Us
If you have any questions about this EULA, please contact us at [Your Contact Information].`
/**
* Returns true if the EULA is applicable to the current user.
* @param currentUser
* @param online
* @param bodyshop
* @param client
* @returns {boolean}
*/
export function eulaIsApplicable({currentUser, isAccepted}) {
return !isAccepted || currentUser.authorized === false;
}
export default function Eula({setIsAccepted}) {
const [isModalOpen, setIsModalOpen] = useState(true);
const handleAccept = (values) => {
localStorage.setItem('termsAccepted', 'true');
setIsAccepted(true);
setIsModalOpen(false);
};
return <Modal
title="Terms and Conditions"
width={'90vh'}
open={isModalOpen}
footer={() => (
<>
<Button form='tosForm' type="primary" htmlType="submit">
Accept
</Button>
</>
)}
closable={false}
>
<Space direction='vertical'>
<Card type='inner' style={{
maxHeight: '50vh',
overflowY: 'auto',
backgroundColor: 'lightgray',
padding: '0 25px 0 25px'
}}>
<Markdown children={EULA}/>
</Card>
<Card type='inner' title='Acknowledgement'>
<Form id='tosForm' onFinish={handleAccept}>
<Row gutter={24}>
<Col span={12}>
<Form.Item
label="First Name"
name="firstName"
rules={[{required: true, message: 'Please input your first name!'}]}
>
<Input placeholder="First Name" aria-label="First Name"/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
label="Last Name"
name="lastName"
rules={[{required: true, message: 'Please input your last name!'}]}
>
<Input placeholder="Last Name" aria-label="Last Name"/>
</Form.Item>
</Col>
</Row>
<Row gutter={24}>
<Col span={12}>
<Form.Item
label="Legal Business Name"
name="businessName"
rules={[{required: true, message: 'Please input your legal business name!'}]}
>
<Input placeholder="Legal Business Name" aria-label="Legal Business Name"/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
label="Phone"
name="phone"
>
<Input placeholder="Phone" aria-label="Phone"/>
</Form.Item>
</Col>
</Row>
<Row gutter={24}>
<Col span={12}>
<Form.Item
label="Address"
name="address"
>
<Input placeholder="Address" aria-label="Address"/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
label="Date"
name="date"
rules={[{required: true, message: 'Please input the date!'}]}
>
<Input type="date" aria-label="Date"/>
</Form.Item>
</Col>
</Row>
<Form.Item
name="acceptTerms"
valuePropName="checked"
rules={[
{
validator: (_, value) =>
value ? Promise.resolve() : Promise.reject(new Error('You must accept the terms and conditions')),
},
]}
>
<Checkbox aria-label="Accept Terms">I accept the terms and conditions</Checkbox>
</Form.Item>
</Form>
</Card>
</Space>
</Modal>
}