Добавила поля ввода даты
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
:current-date="currentDate"
|
:current-date="currentDate"
|
||||||
:time-information="timeInformation"
|
:time-information="timeInformation"
|
||||||
:events-data="eventsData"
|
:events-data="eventsData"
|
||||||
|
:members-data="membersData"
|
||||||
:sidebar-width="sidebarWidth"
|
:sidebar-width="sidebarWidth"
|
||||||
:close-form-create-event="closeFormCreateEvent"
|
:close-form-create-event="closeFormCreateEvent"
|
||||||
:is-open-form="isOpenForm"
|
:is-open-form="isOpenForm"
|
||||||
|
|||||||
@@ -19,17 +19,30 @@
|
|||||||
.flex.gap-x-4.items-center
|
.flex.gap-x-4.items-center
|
||||||
.icon-time.text-xl.icon
|
.icon-time.text-xl.icon
|
||||||
.flex.gap-x-2.items-center
|
.flex.gap-x-2.items-center
|
||||||
.time-input.flex.gap-x-2.px-4.py-2.items-center
|
.time-input.flex.px-4.py-2.items-center
|
||||||
input.item-input.text-base.cursor-text(
|
input.item-input.text-base.cursor-text(
|
||||||
v-model="start"
|
v-model="startTime"
|
||||||
placeholder ="11:00"
|
placeholder ="11:00"
|
||||||
)
|
)
|
||||||
span —
|
span —
|
||||||
.time-input.flex.gap-x-2.px-4.py-2.items-center
|
.time-input.flex.px-4.py-2.items-center
|
||||||
input.item-input.text-base.cursor-text(
|
input.item-input.text-base.cursor-text(
|
||||||
v-model="end"
|
v-model="endTime"
|
||||||
placeholder ="12:30"
|
placeholder ="12:30"
|
||||||
)
|
)
|
||||||
|
.flex.items-center
|
||||||
|
.flex.gap-x-2.items-center
|
||||||
|
.data-input.flex.px-4.py-2.items-center
|
||||||
|
input.item-input.text-base.cursor-text(
|
||||||
|
v-model="startDate"
|
||||||
|
placeholder ="2022-10-01"
|
||||||
|
)
|
||||||
|
span —
|
||||||
|
.data-input.flex.px-4.py-2.items-center
|
||||||
|
input.item-input.text-base.cursor-text(
|
||||||
|
v-model="endDate"
|
||||||
|
placeholder ="2022-10-01"
|
||||||
|
)
|
||||||
.flex.gap-x-4.items-center
|
.flex.gap-x-4.items-center
|
||||||
.icon-person.text-xl.icon
|
.icon-person.text-xl.icon
|
||||||
base-select(
|
base-select(
|
||||||
@@ -83,8 +96,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as moment from "moment/moment";
|
import BaseSelect from "@/components/base/BaseSelect";
|
||||||
import BaseSelect from "@/components/base/OldBaseSelect";
|
|
||||||
import BaseButton from "@/components/base/BaseButton";
|
import BaseButton from "@/components/base/BaseButton";
|
||||||
export default {
|
export default {
|
||||||
name: "FormChangeEvent",
|
name: "FormChangeEvent",
|
||||||
@@ -113,8 +125,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
listContacts: [1],
|
listContacts: [1],
|
||||||
ownerSelectSize: 22,
|
|
||||||
kindEventSelectSize: 10,
|
|
||||||
memberSelectSize: 29,
|
memberSelectSize: 29,
|
||||||
kindEvents: ["Встреча", "Планерка", "Интервью", "Важная работа"],
|
kindEvents: ["Встреча", "Планерка", "Интервью", "Важная работа"],
|
||||||
eventData: {},
|
eventData: {},
|
||||||
@@ -123,12 +133,13 @@ export default {
|
|||||||
role: null,
|
role: null,
|
||||||
},
|
},
|
||||||
contacts: [],
|
contacts: [],
|
||||||
start: "",
|
startTime: "",
|
||||||
end: "",
|
endTime: "",
|
||||||
employees: {
|
employees: {
|
||||||
employee: null,
|
employee: null,
|
||||||
role: "owner",
|
role: "owner",
|
||||||
},
|
},
|
||||||
|
startDate: "",
|
||||||
kind: "",
|
kind: "",
|
||||||
id: null,
|
id: null,
|
||||||
};
|
};
|
||||||
@@ -174,14 +185,14 @@ export default {
|
|||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
eventStartTime() {
|
eventStartTime() {
|
||||||
if (this.start) {
|
if (this.startTime && this.startDate) {
|
||||||
return `${moment().format("YYYY-MM-DD")}T${this.start}:00Z`;
|
return this.addDate(this.startDate, this.startTime);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
eventEndTime() {
|
eventEndTime() {
|
||||||
if (this.end) {
|
if (this.endtime && this.endDate) {
|
||||||
return `${moment().format("YYYY-MM-DD")}T${this.end}:00Z`;
|
return this.addDate(this.endDate, this.endTime);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
@@ -197,6 +208,18 @@ export default {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
ownerSelectSize() {
|
||||||
|
if (this.ownerName) {
|
||||||
|
return this.ownerName.split(" ").join("").length;
|
||||||
|
}
|
||||||
|
return 22;
|
||||||
|
},
|
||||||
|
kindEventSelectSize() {
|
||||||
|
if (this.kind) {
|
||||||
|
return this.kind.split(" ").join("").length;
|
||||||
|
}
|
||||||
|
return 10;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
chooseOptionOwner(e) {
|
chooseOptionOwner(e) {
|
||||||
@@ -209,11 +232,9 @@ export default {
|
|||||||
first_name: foundEmployee.first_name,
|
first_name: foundEmployee.first_name,
|
||||||
patronymic: foundEmployee.patronymic,
|
patronymic: foundEmployee.patronymic,
|
||||||
};
|
};
|
||||||
this.ownerSelectSize = this.ownerName.split(" ").join("").length;
|
|
||||||
},
|
},
|
||||||
chooseOptionTypeEvent(e) {
|
chooseOptionTypeEvent(e) {
|
||||||
this.kind = e.target.id;
|
this.kind = e.target.id;
|
||||||
this.kindEventSelectSize = this.kind.split(" ").join("").length;
|
|
||||||
},
|
},
|
||||||
chooseOptionMember(e) {
|
chooseOptionMember(e) {
|
||||||
let foundMember = this.membersData.find(
|
let foundMember = this.membersData.find(
|
||||||
@@ -253,14 +274,39 @@ export default {
|
|||||||
sendEventData() {
|
sendEventData() {
|
||||||
this.eventData = {
|
this.eventData = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
start: this.eventStartTime,
|
start: this.addDate(this.startTime, this.startDate),
|
||||||
end: this.eventEndTime,
|
end: this.addDate(this.endTime, this.endDate),
|
||||||
kind: this.kind,
|
kind: this.kind,
|
||||||
employees: [this.employees],
|
employees: [this.employees],
|
||||||
members: [this.members],
|
members: [this.members],
|
||||||
};
|
};
|
||||||
this.closeForm();
|
this.closeForm();
|
||||||
},
|
},
|
||||||
|
addDate(time, data) {
|
||||||
|
return `${data}T${time}:00Z`;
|
||||||
|
},
|
||||||
|
trimTime(str) {
|
||||||
|
return str.slice(11, -4);
|
||||||
|
},
|
||||||
|
trimDate(str) {
|
||||||
|
return str.slice(0, 12);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.id = this.selectedEventData.id || null;
|
||||||
|
this.startTime = this.trimTime(this.selectedEventData.start) || "";
|
||||||
|
this.endTime = this.trimTime(this.selectedEventData.end) || "";
|
||||||
|
this.kind = this.selectedEventData.kind || "";
|
||||||
|
this.employees = this.selectedEventData.employees[0] || {
|
||||||
|
employee: null,
|
||||||
|
role: "owner",
|
||||||
|
};
|
||||||
|
this.members = this.selectedEventData.members[0] || {
|
||||||
|
member: null,
|
||||||
|
role: null,
|
||||||
|
};
|
||||||
|
this.startDate = this.trimDate(this.selectedEventData.start);
|
||||||
|
this.endDate = this.trimDate(this.selectedEventData.end);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -296,6 +342,11 @@ export default {
|
|||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
background-color: var(--bg-ligth-blue-color)
|
background-color: var(--bg-ligth-blue-color)
|
||||||
|
|
||||||
|
.date-input
|
||||||
|
width: 120px
|
||||||
|
border-radius: 4px
|
||||||
|
background-color: var(--bg-ligth-blue-color)
|
||||||
|
|
||||||
.icon
|
.icon
|
||||||
width: 24px
|
width: 24px
|
||||||
height: 24px
|
height: 24px
|
||||||
|
|||||||
@@ -112,7 +112,20 @@ export default {
|
|||||||
pixelsPerHour: 62,
|
pixelsPerHour: 62,
|
||||||
columnHeaderHeight: 48,
|
columnHeaderHeight: 48,
|
||||||
defaultColumnWidth: 470,
|
defaultColumnWidth: 470,
|
||||||
selectedEvent: {},
|
selectedEvent: {
|
||||||
|
id: null,
|
||||||
|
start: "",
|
||||||
|
end: "",
|
||||||
|
kind: "",
|
||||||
|
employees: {
|
||||||
|
employee: null,
|
||||||
|
role: "owner",
|
||||||
|
},
|
||||||
|
members: {
|
||||||
|
member: null,
|
||||||
|
role: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
Reference in New Issue
Block a user