Merge branch 'development' of…

Merge branch 'development' of ssh://git.attractor-school.com:30022/apollo64/crm-team-one into task-123-fix/invalid_Date
parents 08779b92 fe112b78
...@@ -40,7 +40,7 @@ import { DateTimeTask } from './DateTimeTask'; ...@@ -40,7 +40,7 @@ import { DateTimeTask } from './DateTimeTask';
id!: string id!: string
@Column({ name: 'title', type: 'varchar', length:50,nullable: false }) @Column({ name: 'title', type: 'varchar', length:50,nullable: false })
title!: string title!: string
@Column({ name: 'description', type: 'varchar', length:50,nullable: true }) @Column({ name: 'description', type: 'varchar', length:100,nullable: true })
description!: string description!: string
@Column({ name: 'note', type: 'varchar', length:100,nullable: true }) @Column({ name: 'note', type: 'varchar', length:100,nullable: true })
note!: string note!: string
......
...@@ -89,5 +89,8 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask, ...@@ -89,5 +89,8 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask,
</> </>
}; };
export default memo(CalendarRowDay); export default memo(CalendarRowDay, (prevProps, nextProps) => {
if (!prevProps.modal) return false
if (nextProps.modal) return true
});
...@@ -72,7 +72,7 @@ function CalendarModalTaskContent({ title, onChangeCurrentTaskHandler, descripti ...@@ -72,7 +72,7 @@ function CalendarModalTaskContent({ title, onChangeCurrentTaskHandler, descripti
/> />
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', margin: '10px 0' }}> <div style={{ display: 'flex', justifyContent: 'space-between', margin: '10px 0' }}>
<Button id='test_button_save_task' onClick={sendNewTaskHandler} disabled={!isValidate(title, project, startHour, endHour)}>Сохранить</Button> <Button id='test_button_save_task' onClick={sendNewTaskHandler} disabled={!isValidate(title, project, startHour, endHour, description)}>Сохранить</Button>
<Button onClick={deleteTaskHandler} disabled={!id}>Удалить</Button> <Button onClick={deleteTaskHandler} disabled={!id}>Удалить</Button>
</div> </div>
</>); </>);
......
export const isValidate = (title, project, startHour, endHour) => { export const isValidate = (title, project, startHour, endHour, description) => {
if (title && project) { if ((title && project) && (title?.length <= 50 && ( description?.length <= 100 || !description) )) {
const startHourInt = parseInt(startHour) const startHourInt = parseInt(startHour)
const endHourInt = parseInt(endHour) const endHourInt = parseInt(endHour)
if (startHourInt >= 8 && startHourInt <= 24) { if (startHourInt >= 0 && startHourInt <= 24) {
if (endHourInt >= 8 && endHourInt <= 24) { if (endHourInt >= 0 && endHourInt <= 24) {
if (startHourInt < endHourInt) { if (startHourInt < endHourInt) {
return true return true
} }
......
...@@ -10,12 +10,12 @@ export const getCurrentWeekDayString = (dayNumber) => { ...@@ -10,12 +10,12 @@ export const getCurrentWeekDayString = (dayNumber) => {
export const getMonthAndYearToDayColumn = (week, weekDay, month, year) => { export const getMonthAndYearToDayColumn = (week, weekDay, month, year) => {
if (week[0] > week[6]) { if (week[0] > week[6]) {
if (weekDay < week[0]) { if (weekDay < week[0]) {
return {month: month, year: year} if (month + 1 === 12) {
} else { return {month: 0, year: year + 1}
if (month === 0) {
return {month: 11, year: year - 1}
} }
return {month: month - 1, year: year} return {month: month + 1, year: year}
} else {
return {month: month, year: year}
} }
} else { } else {
return {month: month, year: year} return {month: month, year: year}
......
...@@ -20,3 +20,7 @@ export const priorities = [ ...@@ -20,3 +20,7 @@ export const priorities = [
{ value: 'B', text: 'B' }, { value: 'B', text: 'B' },
{ value: 'C', text: 'C' } { value: 'C', text: 'C' }
] ]
export const AllHoursOneHourFormat = ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
export const AllHoursTwoHourFormat = ['0:00', '2:00', '4:00', '6:00', '8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00']
\ No newline at end of file
...@@ -8,6 +8,7 @@ import { dateToISOLikeButLocal, getCurrentMonthString, getDaysInMonth } from '.. ...@@ -8,6 +8,7 @@ import { dateToISOLikeButLocal, getCurrentMonthString, getDaysInMonth } from '..
import { fetchAllUserProjects, fetchProject } from '../../store/actions/projectsActions'; import { fetchAllUserProjects, fetchProject } from '../../store/actions/projectsActions';
import { addCalendarTask, addCopyCalendarTask, deleteCalendarTask, editCalendarTask, fetchCalendarTasks } from '../../store/actions/tasksActions'; import { addCalendarTask, addCopyCalendarTask, deleteCalendarTask, editCalendarTask, fetchCalendarTasks } from '../../store/actions/tasksActions';
import { fetchCurrentCalendarDisplayName } from '../../store/actions/usersActions'; import { fetchCurrentCalendarDisplayName } from '../../store/actions/usersActions';
import { AllHoursOneHourFormat, AllHoursTwoHourFormat } from '../../constants';
function MonthCalendar() { function MonthCalendar() {
const dispatch = useDispatch(); const dispatch = useDispatch();
...@@ -56,9 +57,9 @@ function MonthCalendar() { ...@@ -56,9 +57,9 @@ function MonthCalendar() {
const hoursInDay = useMemo(() => { const hoursInDay = useMemo(() => {
let arr let arr
if (hourFormat) { if (hourFormat) {
arr = ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00'] arr = AllHoursOneHourFormat
} else { } else {
arr = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00'] arr = AllHoursTwoHourFormat
} }
const cells = arr.length const cells = arr.length
const xs = 10.8 / cells const xs = 10.8 / cells
......
...@@ -5,12 +5,12 @@ import CalendarModalWorkerContent from '../../components/Calendars/UI/CalendarMo ...@@ -5,12 +5,12 @@ import CalendarModalWorkerContent from '../../components/Calendars/UI/CalendarMo
import WeekCalendarBody from '../../components/Calendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody'; import WeekCalendarBody from '../../components/Calendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody';
import WeekCalendarHeader from '../../components/Calendars/WeekCalendar/WeekCalendarHeader/WeekCalendarHeader'; import WeekCalendarHeader from '../../components/Calendars/WeekCalendar/WeekCalendarHeader/WeekCalendarHeader';
import DefaultModal from '../../components/UI/DefaultModal/DefaultModal'; import DefaultModal from '../../components/UI/DefaultModal/DefaultModal';
import { AllHoursOneHourFormat, AllHoursTwoHourFormat } from '../../constants';
import { getWeekInfoString, getWeekFromCurrentDate, dateToISOLikeButLocal } from '../../helpers/CalendarHelpers'; import { getWeekInfoString, getWeekFromCurrentDate, dateToISOLikeButLocal } from '../../helpers/CalendarHelpers';
import { fetchAllUserProjects } from '../../store/actions/projectsActions'; import { fetchAllUserProjects } from '../../store/actions/projectsActions';
import { addCalendarTask, addCopyCalendarTask, deleteCalendarTask, editCalendarTask, fetchCalendarTasks } from '../../store/actions/tasksActions'; import { addCalendarTask, addCopyCalendarTask, deleteCalendarTask, editCalendarTask, fetchCalendarTasks } from '../../store/actions/tasksActions';
import { fetchCurrentCalendarDisplayName } from '../../store/actions/usersActions'; import { fetchCurrentCalendarDisplayName } from '../../store/actions/usersActions';
function WeekCalendar() { function WeekCalendar() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { calendarTasks } = useSelector(state => state.tasks); const { calendarTasks } = useSelector(state => state.tasks);
...@@ -54,9 +54,9 @@ function WeekCalendar() { ...@@ -54,9 +54,9 @@ function WeekCalendar() {
const hoursInDay = useMemo(() => { const hoursInDay = useMemo(() => {
let arr let arr
if (hourFormat) { if (hourFormat) {
arr = ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00'] arr = AllHoursOneHourFormat
} else { } else {
arr = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00'] arr = AllHoursTwoHourFormat
} }
return arr return arr
}, [hourFormat]) }, [hourFormat])
...@@ -160,7 +160,7 @@ function WeekCalendar() { ...@@ -160,7 +160,7 @@ function WeekCalendar() {
endHour: hourDue, endHour: hourDue,
startDay: dayNumber, startDay: dayNumber,
month: month, month: month,
year: year, startYear: year,
}, },
project: allUserProjects[0]?.id project: allUserProjects[0]?.id
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment