- styled asteriks sign;
- fixed issue with validation on registration page; - fixed issue with inputnumber; - fixed issue with editor field;; - added editors for new faq item form; - fixed displaying html as simple text; - fixed saving company data after saving; - added toast for edit bando form; - improved edit forms form; - fixed styles for various elements;
This commit is contained in:
@@ -9,9 +9,9 @@ import { Button } from 'primereact/button';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Accordion, AccordionTab } from 'primereact/accordion';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import { InputSwitch } from 'primereact/inputswitch';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import { Editor } from 'primereact/editor';
|
||||
|
||||
const FormFieldRepeaterFaq = ({
|
||||
data,
|
||||
@@ -108,7 +108,8 @@ const FormFieldRepeaterFaq = ({
|
||||
|
||||
const footerEditDialog = () => {
|
||||
return <div>
|
||||
<Button type="button" disabled={disabled} label={__('Anulla', 'gepafin')} onClick={hideEditDialog} outlined/>
|
||||
<Button type="button" disabled={disabled} label={__('Anulla', 'gepafin')} onClick={hideEditDialog}
|
||||
outlined/>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={isEmpty(title) || isEmpty(question) || isEmpty(answer) || disabled}
|
||||
@@ -122,6 +123,26 @@ const FormFieldRepeaterFaq = ({
|
||||
.map(o => o.title)
|
||||
}, [stateFieldData]);
|
||||
|
||||
const renderHeader = () => {
|
||||
return (
|
||||
<span className="ql-formats">
|
||||
<button className="ql-bold" aria-label="Bold"></button>
|
||||
<button className="ql-italic" aria-label="Italic"></button>
|
||||
<button className="ql-underline" aria-label="Underline"></button>
|
||||
<button className="ql-link" aria-label="Link"></button>
|
||||
<button className="ql-list" value="ordered"></button>
|
||||
<button className="ql-header" value="2"></button>
|
||||
<button className="ql-header" value="3"></button>
|
||||
<button className="ql-blockquote"></button>
|
||||
<button className="ql-list" value="bullet"></button>
|
||||
<button className="ql-indent" value="-1"></button>
|
||||
<button className="ql-indent" value="+1"></button>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
useEffect(() => {
|
||||
const storeFieldData = data ?? [];
|
||||
setStateFieldData(storeFieldData);
|
||||
@@ -163,41 +184,42 @@ const FormFieldRepeaterFaq = ({
|
||||
optionLabel="title"/>
|
||||
</div>
|
||||
<Accordion activeIndex={0}>
|
||||
{stateFieldData.map((o, i) => <AccordionTab key={i} tabIndex={i}
|
||||
header={
|
||||
<div className="appForm__faqTab">
|
||||
<div className="appForm__faqTabItem">
|
||||
{stateFieldData.map((o, i) =>
|
||||
<AccordionTab key={i} tabIndex={i}
|
||||
header={
|
||||
<div className="appForm__faqTab">
|
||||
<div className="appForm__faqTabItem">
|
||||
<span>
|
||||
{o.value}
|
||||
{renderHtmlContent(o.value)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="appForm__faqTabItem">
|
||||
{o.isVisible
|
||||
? <i className="pi pi-eye"
|
||||
style={{ fontSize: '1.5rem' }}></i> : null}
|
||||
{!o.isVisible
|
||||
? <i className="pi pi-eye-slash"
|
||||
style={{ fontSize: '1.5rem' }}></i> : null}
|
||||
<Button icon="pi pi-pencil" severity="success"
|
||||
disabled={disabled}
|
||||
className="actionBtn"
|
||||
type="button"
|
||||
aria-label={__('Modifica', 'gepafin')}
|
||||
onClick={(e) => editItem(e, i)}/>
|
||||
<Button icon="pi pi-times" severity="danger"
|
||||
disabled={disabled}
|
||||
className="actionBtn"
|
||||
type="button"
|
||||
aria-label={__('Cancella', 'gepafin')}
|
||||
onClick={() => removeItem(i)}/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<p className="m-0">
|
||||
{o.response}
|
||||
</p>
|
||||
</AccordionTab>)}
|
||||
</div>
|
||||
<div className="appForm__faqTabItem">
|
||||
{o.isVisible
|
||||
? <i className="pi pi-eye"
|
||||
style={{ fontSize: '1.5rem' }}></i> : null}
|
||||
{!o.isVisible
|
||||
? <i className="pi pi-eye-slash"
|
||||
style={{ fontSize: '1.5rem' }}></i> : null}
|
||||
<Button icon="pi pi-pencil" severity="success"
|
||||
disabled={disabled}
|
||||
className="actionBtn"
|
||||
type="button"
|
||||
aria-label={__('Modifica', 'gepafin')}
|
||||
onClick={(e) => editItem(e, i)}/>
|
||||
<Button icon="pi pi-times" severity="danger"
|
||||
disabled={disabled}
|
||||
className="actionBtn"
|
||||
type="button"
|
||||
aria-label={__('Cancella', 'gepafin')}
|
||||
onClick={() => removeItem(i)}/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<p className="m-0">
|
||||
{renderHtmlContent(o.response)}
|
||||
</p>
|
||||
</AccordionTab>)}
|
||||
</Accordion>
|
||||
<Dialog
|
||||
visible={isVisibleEditDialog}
|
||||
@@ -205,26 +227,41 @@ const FormFieldRepeaterFaq = ({
|
||||
footer={footerEditDialog}
|
||||
style={{ maxWidth: '600px', width: '100%' }}
|
||||
onHide={hideEditDialog}>
|
||||
<div className="appPage__spacer"></div>
|
||||
<div className="appForm__field">
|
||||
<label>{__('Titolo FAQ', 'gepafin')}</label>
|
||||
<InputText value={title} onChange={(e) => onChangeEditItem(e.target.value, 'title')}/>
|
||||
<label for="faqTitle">{__('Titolo FAQ', 'gepafin')}</label>
|
||||
<Editor
|
||||
id="faqTitle"
|
||||
value={title}
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => onChangeEditItem(e.htmlValue, 'title')}
|
||||
style={{ height: 80 * 1 }}
|
||||
/>
|
||||
</div>
|
||||
<div className="appForm__field">
|
||||
<label>{__('Domanda', 'gepafin')}</label>
|
||||
<InputText value={question} onChange={(e) => onChangeEditItem(e.target.value, 'value')}/>
|
||||
<label for="faqValue">{__('Domanda', 'gepafin')}</label>
|
||||
<Editor
|
||||
id="faqValue"
|
||||
value={question}
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => onChangeEditItem(e.htmlValue, 'value')}
|
||||
style={{ height: 80 * 1 }}
|
||||
/>
|
||||
</div>
|
||||
<div className="appForm__field">
|
||||
<label>{__('Risposta', 'gepafin')}</label>
|
||||
<InputTextarea value={answer} onChange={(e) => onChangeEditItem(e.target.value, 'response')}
|
||||
rows={5}
|
||||
cols={30}/>
|
||||
<label for="faqResponse">{__('Risposta', 'gepafin')}</label>
|
||||
<Editor
|
||||
id="faqResponse"
|
||||
value={answer}
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => onChangeEditItem(e.htmlValue, 'response')}
|
||||
style={{ height: 80 * 2 }}
|
||||
/>
|
||||
</div>
|
||||
<div className="appForm__field">
|
||||
<label>{__('Pubblicato?', 'gepafin')}</label>
|
||||
<InputSwitch checked={isVisible} onChange={(e) => onChangeEditItem(e.value, 'isVisible')}/>
|
||||
<InputSwitch checked={isVisible}
|
||||
onChange={(e) => onChangeEditItem(e.value, 'isVisible')}/>
|
||||
</div>
|
||||
<div className="appPage__spacer"></div>
|
||||
</Dialog>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user