WIP Формы создания события исправлены под input

This commit is contained in:
Daria Golova
2022-12-27 16:36:35 +03:00
parent 84ddeb74a1
commit b5d74ab6be
5 changed files with 17 additions and 21 deletions

View File

@@ -202,10 +202,8 @@ export default {
], ],
start: `${this.currentDate.format( start: `${this.currentDate.format(
"YYYY-MM-DD" "YYYY-MM-DD"
)}T${hours}:${minuts}:00Z`, )}T${hours}:${minuts}:00`,
end: `${this.currentDate.format( end: `${this.currentDate.format("YYYY-MM-DD")}T${hours}:${minuts}:00`,
"YYYY-MM-DD"
)}T${hours}:${minuts}:00Z`,
}); });
}, },
}, },

View File

@@ -207,7 +207,7 @@ export default {
}, },
methods: { methods: {
trimTime(time) { trimTime(time) {
return time.slice(11, -4); return time.slice(11, 16);
}, },
composeFullName(object) { composeFullName(object) {
return `${object.last_name} ${object.first_name ?? ""} ${ return `${object.last_name} ${object.first_name ?? ""} ${

View File

@@ -137,7 +137,7 @@ export default {
if (!this.disabled) this.$emit("close-description-card"); if (!this.disabled) this.$emit("close-description-card");
}, },
trimTime(time) { trimTime(time) {
return time.slice(11, -4); return time.slice(11, 16);
}, },
composeFullName(object) { composeFullName(object) {
return `${object.last_name} ${object.first_name ?? ""} ${ return `${object.last_name} ${object.first_name ?? ""} ${

View File

@@ -188,13 +188,14 @@ export default {
return true; return true;
}, },
disabledUpdateButton() { disabledUpdateButton() {
let start = moment.parseZone(this.selectedEventData.start); let start = moment(this.selectedEventData.start);
let end = moment.parseZone(this.selectedEventData.end); let end = moment(this.selectedEventData.end);
if ( if (
this.eventDate === start.format("YYYY-MM-DD") && moment(this.eventDate).format("YYYY-MM-DD") ===
start.format("YYYY-MM-DD") &&
this.startTime === start.format("HH:mm") && this.startTime === start.format("HH:mm") &&
this.endTime === end.format("HH:mm") && this.endTime === end.format("HH:mm") &&
this.status.label === this.selectedEventData.status && this.findStatus(this.status.label) === this.selectedEventData.status &&
this.employees.employee.id === this.employees.employee.id ===
this.personId(this.selectedEventData.employees, "employee") && this.personId(this.selectedEventData.employees, "employee") &&
this.members.person.id === this.members.person.id ===
@@ -202,6 +203,7 @@ export default {
) { ) {
return true; return true;
} }
if (!this.eventDate) return true;
return false; return false;
}, },
startDate() { startDate() {
@@ -312,7 +314,8 @@ export default {
if (foundedEmployee) if (foundedEmployee)
foundedSchedule = foundedEmployee.schedules.find( foundedSchedule = foundedEmployee.schedules.find(
(elem) => (elem) =>
elem.date === this.eventDate && elem.status === this.WORKING_STATUS elem.date === moment(this.eventDate).format("YYYY-MM-DD") &&
elem.status === this.WORKING_STATUS
); );
if (!foundedSchedule) { if (!foundedSchedule) {
this.addErrorNotification( this.addErrorNotification(
@@ -417,7 +420,10 @@ export default {
this.closeForm(); this.closeForm();
}, },
mergeDate(eventDate, time) { mergeDate(eventDate, time) {
return moment(`${eventDate} ${time}`).format("YYYY-MM-DDTHH:mm:ss"); let parseTime = time.split(":");
return moment(eventDate.setHours(parseTime[0], parseTime[1]), 0).format(
"YYYY-MM-DDTHH:mm:ss"
);
}, },
findPerson(requestedList, object, field) { findPerson(requestedList, object, field) {
let foundPerson = requestedList.find(({ id }) => id === object[field].id); let foundPerson = requestedList.find(({ id }) => id === object[field].id);
@@ -490,7 +496,7 @@ export default {
}, },
fetchMembersData() { fetchMembersData() {
fetchWrapper fetchWrapper
.get("general/person/?limit=100") .get("general/person/?limit=200")
.then((res) => this.saveMembersData(res)); .then((res) => this.saveMembersData(res));
}, },
fetchOwnersData() { fetchOwnersData() {

View File

@@ -96,14 +96,6 @@ export default {
}, },
finish() {}, finish() {},
}, },
watch: {
selectedClientId: {
immediate: true,
handler(newValue) {
console.log(newValue);
},
},
},
}; };
</script> </script>