- added duplicate form from another call functionality;

- fixed styles;
- added copy icon for user emails;
- added hotkey to open loginadmin page quickly;
- added modal for archiving document;
- added modal for create appointment;
This commit is contained in:
Vitalii Kiiko
2024-11-28 15:54:08 +01:00
parent 6f11070259
commit 7dad6c056d
11 changed files with 362 additions and 43 deletions

View File

@@ -28,6 +28,10 @@ import BlockingOverlay from '../../components/BlockingOverlay';
import { Toast } from 'primereact/toast';
import HelpIcon from '../../icons/HelpIcon';
import { Dialog } from 'primereact/dialog';
import ArchiveDocument from './components/ArchiveDocument';
import { classNames } from 'primereact/utils';
import { InputTextarea } from 'primereact/inputtextarea';
import { InputText } from 'primereact/inputtext';
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
@@ -46,6 +50,13 @@ const DomandaEditPreInstructor = () => {
const [isVisibleCompleteDialog, setIsVisibleCompleteDialog] = useState(false);
const [operationType, setOperationType] = useState('');
const [motivation, setMotivation] = useState('');
const [isVisibleAppointmentDialog, setIsVisibleAppointmentDialog] = useState(false);
const [appointmentData, setAppointmentData] = useState({
title: '',
text: '',
duration: 0,
amount: 0
});
const goToEvaluationsPage = () => {
navigate('/domande');
@@ -322,10 +333,53 @@ const DomandaEditPreInstructor = () => {
setIsVisibleCompleteDialog(true);
}
const doCreateAppointment = () => {
const doCheckNDG = () => {
// TODO
}
const doCreateAppointment = () => {
setAppointmentData({
title: '',
text: '',
duration: 0,
amount: 0
});
setIsVisibleAppointmentDialog(true);
}
const setValue = (name, value) => {
const newData = wrap(appointmentData).set(name, value).value();
setAppointmentData(newData);
}
const headerAppointmentDialog = () => {
return <span>{__('Crea appuntamento', 'gepafin')}</span>;
}
const hideAppointmentDialog = () => {
setIsVisibleAppointmentDialog(false);
setAppointmentData({});
}
const footerAppointmentDialog = () => {
return <div>
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideAppointmentDialog} outlined/>
<Button
type="button"
disabled={loading}
label={__('Invia', 'gepafin')} onClick={doCreateAppointmentRequest}/>
</div>
}
const doCreateAppointmentRequest = () => {
if (
!isEmpty(appointmentData.title) && !isEmpty(appointmentData.text) && !isEmpty(appointmentData.amount)
&& !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
) {
console.log(appointmentData);
}
}
const doMakeAdmisible = () => {
// TODO
}
@@ -565,6 +619,7 @@ const DomandaEditPreInstructor = () => {
}}>
<span>{k.name}</span>
<div className="appPageSection__iconActions">
<ArchiveDocument ndg={data.ndg} fileId={k.id}/>
<Button icon="pi pi-eye" rounded
onClick={() => window.open(k.filePath, '_blank').focus()}
outlined severity="info"
@@ -615,6 +670,13 @@ const DomandaEditPreInstructor = () => {
onClick={doSaveDraft}
label={__('Crea valutazione', 'gepafin')}
icon="pi pi-save" iconPos="right"/>}
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
? <Button
type="button"
disabled={!data.id}
onClick={doCheckNDG}
label={__('Controlla NDG', 'gepafin')}
/> : null}
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
? <Button
type="button"
@@ -675,6 +737,55 @@ const DomandaEditPreInstructor = () => {
</div>
</Dialog>
<Dialog
visible={isVisibleAppointmentDialog}
modal
header={headerAppointmentDialog}
footer={footerAppointmentDialog}
style={{ maxWidth: '600px', width: '100%' }}
onHide={hideAppointmentDialog}>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.amount) || appointmentData.amount === 0})}>
{__('Importo', 'gepafin')}
</label>
<InputNumber
value={appointmentData.amount}
keyfilter="int"
invalid={isEmpty(appointmentData.amount) || appointmentData.amount === 0}
onChange={(e) => setValue('amount', e.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.duration) || appointmentData.duration === 0 })}>
{__('Durata', 'gepafin')}
</label>
<InputNumber
value={appointmentData.duration}
keyfilter="int"
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
onChange={(e) => setValue('duration', e.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.title) })}>
{__('Titolo', 'gepafin')}
</label>
<InputText
value={appointmentData.title}
invalid={isEmpty(appointmentData.title)}
onChange={(e) => setValue('title', e.target.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.text) })}>
{__('Messaggio', 'gepafin')}
</label>
<InputTextarea
value={appointmentData.text}
invalid={isEmpty(appointmentData.text)}
onChange={(e) => setValue('text', e.target.value)}
rows={3}
cols={30}/>
</div>
</Dialog>
</div>
: <>
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>