- added cache faq items;

- added terms pdf;
- added redirect to 'add company' for new users;
This commit is contained in:
Vitalii Kiiko
2024-10-11 12:51:15 +02:00
parent 8fb1551880
commit bd64a34347
26 changed files with 168 additions and 36 deletions

View File

@@ -20,10 +20,12 @@ import LogoIcon from '../../icons/LogoIcon';
import { Button } from 'primereact/button';
import { Messages } from 'primereact/messages';
import { Panel } from 'primereact/panel';
import { Dialog } from 'primereact/dialog';
const Registration = () => {
const token = useStore().main.token();
const [loading, setLoading] = useState(false);
const [visibleTerms, setVisibleTerms] = useState(false);
const errorMsgs = useRef(null);
let [searchParams] = useSearchParams();
const {
@@ -34,6 +36,8 @@ const Registration = () => {
getValues
} = useForm({ mode: 'onChange' });
const values = getValues();
const { origin } = window.location;
const urlTermsPdf = `${origin}/loaded-files/termini-e-condizioni.pdf`;
const onSubmit = (formData) => {
errorMsgs.current.clear();
@@ -117,6 +121,15 @@ const Registration = () => {
setValue('thirdParty', true);
}
const openTermsDoc = (e) => {
e.preventDefault();
setVisibleTerms(true);
}
const hideTerms = () => {
setVisibleTerms(false);
}
useEffect(() => {
if (!isEmpty(token)) {
setLoading(true);
@@ -279,7 +292,7 @@ const Registration = () => {
}}
toggleable>
<p className="m-0">
{__('Termini e condizioni', 'gepafin')}
<a href={urlTermsPdf} onClick={openTermsDoc}>{__('Termini e condizioni', 'gepafin')}</a>
</p>
</Panel>
@@ -350,9 +363,16 @@ const Registration = () => {
</Panel>
<Button
label={__('Accedi', 'gepafin')}
label={__('Invia', 'gepafin')}
disabled={loading}/>
</form>
<Dialog header={__('Termini e condizioni', 'gepafin')} visible={visibleTerms} style={{
width: '70vw',
minHeight: 500
}} onHide={hideTerms}>
<iframe src={urlTermsPdf} title={__('Termini e condizioni', 'gepafin')}></iframe>
</Dialog>
</div>
</div>
)