[WIP] Фикс create таблицы

This commit is contained in:
megavrilinvv
2023-01-23 12:56:20 +03:00
parent 611558597a
commit 11af24f8bc
2 changed files with 13 additions and 15 deletions

View File

@@ -202,7 +202,7 @@ export default {
}; };
if (this.insideSchedules?.length > 0) { if (this.insideSchedules?.length > 0) {
this.postUpdateSchedule(); this.postUpdateSchedule();
if (this.outsideSchedules) if (this.outsideSchedules) {
this.outsideSchedules.forEach((el) => { this.outsideSchedules.forEach((el) => {
fetchWrapper.post("accounts/schedules/create/", { fetchWrapper.post("accounts/schedules/create/", {
...data, ...data,
@@ -210,6 +210,7 @@ export default {
end_date: el.end_date, end_date: el.end_date,
}); });
}); });
}
} else { } else {
fetchWrapper fetchWrapper
.post("accounts/schedules/create/", { .post("accounts/schedules/create/", {

View File

@@ -81,13 +81,6 @@ export default {
choiceCell(day, id, schedule) { choiceCell(day, id, schedule) {
if (this.showTime) return; if (this.showTime) return;
let formatTime = day.format("YYYY-MM-DD"); let formatTime = day.format("YYYY-MM-DD");
let insideSchedules = schedule?.schedules.filter(
(el) =>
(el.date > this.dateInterval.start &&
el.date < this.dateInterval.end) ||
el.date === this.dateInterval.start ||
el.date === this.dateInterval.end
);
if (this.dateInterval.id !== id) { if (this.dateInterval.id !== id) {
this.dateInterval.start = ""; this.dateInterval.start = "";
@@ -100,14 +93,18 @@ export default {
this.dateInterval.id = id; this.dateInterval.id = id;
} else if (day.isAfter(this.dateInterval.start)) { } else if (day.isAfter(this.dateInterval.start)) {
this.dateInterval.end = formatTime; this.dateInterval.end = formatTime;
} else this.dateInterval.start = formatTime; } else {
this.dateInterval.start = formatTime;
}
this.$emit("schedule-employee", this.dateInterval, id); this.$emit("schedule-employee", this.dateInterval, id);
if ( let insideSchedules = schedule?.schedules.filter(
!this.selectEmployee.label && (el) =>
this.dateInterval.start && (el.date > this.dateInterval.start &&
this.dateInterval.end && el.date < this.dateInterval.end) ||
insideSchedules el.date === this.dateInterval.start ||
) el.date === this.dateInterval.end
);
if (!this.selectEmployee.label && !!insideSchedules)
this.rangeSchdedules(schedule, insideSchedules, id); this.rangeSchdedules(schedule, insideSchedules, id);
}, },
rangeSchdedules(schedule, insideSchedules, id) { rangeSchdedules(schedule, insideSchedules, id) {