2021-06-23 11:54:16 +03:00
|
|
|
|
import React, { useState } from 'react';
|
2021-06-21 17:41:26 +03:00
|
|
|
|
import style from './ReportForm.module.css';
|
|
|
|
|
import calendarIcon from '../../images/calendar_icon.png';
|
|
|
|
|
import ellipse from '../../images/ellipse.png';
|
2021-06-22 18:00:52 +03:00
|
|
|
|
import remove from '../../images/remove.png';
|
|
|
|
|
import addIcon from '../../images/addIcon.png';
|
2021-06-23 12:48:02 +03:00
|
|
|
|
import { currentMonthAndDayReportPage } from '../Calendar/calendarHelper';
|
2021-06-23 11:54:16 +03:00
|
|
|
|
import InputsComponent from '../InputsComponent/InputsComponent';
|
2021-06-21 17:41:26 +03:00
|
|
|
|
|
|
|
|
|
const ReportForm = () => {
|
2021-06-23 11:54:16 +03:00
|
|
|
|
const [inputs, setInputs] = useState([1]);
|
2021-06-22 18:00:52 +03:00
|
|
|
|
|
2021-06-23 11:54:16 +03:00
|
|
|
|
const addInput = () => {
|
|
|
|
|
const lastElement = inputs[inputs.length - 1];
|
2021-06-22 18:00:52 +03:00
|
|
|
|
|
2021-06-23 11:54:16 +03:00
|
|
|
|
setInputs((prev) => [...prev, lastElement + 1]);
|
|
|
|
|
};
|
2021-06-22 18:00:52 +03:00
|
|
|
|
|
2021-06-23 11:54:16 +03:00
|
|
|
|
const deleteInput = (id) => {
|
2021-06-29 17:58:15 +03:00
|
|
|
|
if (id !== 1) {
|
|
|
|
|
setInputs((prev) => prev.filter((el) => el !== id));
|
|
|
|
|
}
|
2021-06-22 18:00:52 +03:00
|
|
|
|
};
|
|
|
|
|
|
2021-06-21 17:41:26 +03:00
|
|
|
|
return (
|
|
|
|
|
<section className="reportForm">
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-xl-12">
|
2021-06-22 18:00:52 +03:00
|
|
|
|
<div className={style.reportForm__block}>
|
|
|
|
|
<div className={style.reportForm__blockTitle}>
|
2021-06-21 17:41:26 +03:00
|
|
|
|
<h2>Добавить отчет</h2>
|
|
|
|
|
<h3>Дата заполнения отчета:</h3>
|
|
|
|
|
</div>
|
2021-06-22 18:00:52 +03:00
|
|
|
|
<div className={style.reportForm__blockImg}>
|
2021-06-21 17:41:26 +03:00
|
|
|
|
<img className={style.calendarIcon} src={calendarIcon} alt="" />
|
2021-06-23 12:48:02 +03:00
|
|
|
|
{currentMonthAndDayReportPage()}
|
2021-06-21 17:41:26 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div className={style.reportForm__tasks}>
|
|
|
|
|
<img src={ellipse} alt="" />
|
|
|
|
|
<span>Какие задачи были выполнены?</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-06-22 18:00:52 +03:00
|
|
|
|
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-8">
|
|
|
|
|
<div className={style.reportForm__text}>
|
|
|
|
|
<p className={style.text1}>Краткое описание задачи</p>
|
|
|
|
|
<p className={style.text2}>Количество часов</p>
|
|
|
|
|
</div>
|
2021-06-23 12:53:56 +03:00
|
|
|
|
<InputsComponent deleteInput={deleteInput} inputsArr={inputs} remove={remove} />
|
2021-06-22 18:00:52 +03:00
|
|
|
|
<div className={style.reportForm__formAdd}>
|
2021-06-23 11:54:16 +03:00
|
|
|
|
<img onClick={addInput} src={addIcon} alt="" />
|
2021-06-22 18:00:52 +03:00
|
|
|
|
<span>Добавить еще </span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="col-4"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-12">
|
|
|
|
|
<div className={style.reportForm__inptuBox}>
|
|
|
|
|
<div className={style.reportForm__tasks}>
|
|
|
|
|
<img src={ellipse} alt="" />
|
|
|
|
|
<span>Какие сложности возникли?</span>
|
|
|
|
|
</div>
|
|
|
|
|
<input type="text" />
|
|
|
|
|
<div className={style.reportForm__tasks}>
|
|
|
|
|
<img src={ellipse} alt="" />
|
|
|
|
|
<span>Что планируется сделать завтра?</span>
|
|
|
|
|
</div>
|
|
|
|
|
<input type="text" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-12">
|
|
|
|
|
<div className={style.reportForm__footer}>
|
|
|
|
|
<button className={style.reportForm__footer__btn} type="submit">
|
|
|
|
|
Отправить
|
|
|
|
|
</button>
|
|
|
|
|
<p className={style.reportForm__footer__text}>
|
|
|
|
|
Всего за день : <span>60 часов</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-06-21 17:41:26 +03:00
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default ReportForm;
|