diff --git a/Step/wwwroot/assets/styles/base/alarms.less b/Step/wwwroot/assets/styles/base/alarms.less index 382be506..5a6a8f86 100644 --- a/Step/wwwroot/assets/styles/base/alarms.less +++ b/Step/wwwroot/assets/styles/base/alarms.less @@ -325,7 +325,7 @@ .all-message-box{ max-height: 310px; .message-box{ - width: 408px; + width: 390px; min-height: 96px; display: flex; flex-flow: column; @@ -341,7 +341,7 @@ textarea{ border: none; resize: none; - background-color: transparent; + // background-color: transparent; padding: 3px; box-sizing: border-box; cursor: pointer; diff --git a/Step/wwwroot/assets/styles/style.css b/Step/wwwroot/assets/styles/style.css index 25ad51c5..8aeba641 100644 --- a/Step/wwwroot/assets/styles/style.css +++ b/Step/wwwroot/assets/styles/style.css @@ -3828,7 +3828,7 @@ footer .container button.big:before { max-height: 310px; } .accordion section .dropdown .all-message-box .message-box { - width: 408px; + width: 390px; min-height: 96px; display: flex; flex-flow: column; @@ -3846,7 +3846,6 @@ footer .container button.big:before { .accordion section .dropdown .all-message-box .message-box .message-box-header textarea { border: none; resize: none; - background-color: transparent; padding: 3px; box-sizing: border-box; cursor: pointer; diff --git a/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.ts b/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.ts index 38eb77cd..c66919c4 100644 --- a/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.ts +++ b/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.ts @@ -6,6 +6,8 @@ import Component from "vue-class-component"; import { Prop } from "vue-property-decorator"; import { alarmsService } from "src/services/alarmsService"; import { ModalHelper } from "src/components/modals"; +import { getColorFromName, isDarkColor } from "src/_base/utils"; +import moment from "moment"; @Component({ components: { accordion: Accordion } }) export default class AlarmDetail extends Vue { @@ -16,8 +18,11 @@ export default class AlarmDetail extends Vue { attaches = []; notes = []; newAttach: any = null; - selectedAttachMaintenance: any = null; + newNote: any = {}; + selectedAttach: any = null; + selectedNote: any = null; limitationList: number = 3; + enableModifyNote = true; get currentUser() { return this.$store.state.currentUser; @@ -39,6 +44,10 @@ export default class AlarmDetail extends Vue { return this.attaches.filter((v, idx) => idx < this.limitationList); } + get filteredNotes() { + return this.notes.filter((v, idx) => idx < this.limitationList); + } + async mounted() { this.attaches = await alarmsService.getAttachments(this.alarm.id); this.notes = await alarmsService.getNote(this.alarm.id); @@ -52,12 +61,11 @@ export default class AlarmDetail extends Vue { // new MaintenanceService().uploadFile(this.selectedMaintenance, this.state.file); } - updateLimitation(limitationList) { - if (this.limitationList == this.attaches.length) { - this.limitationList = 3; - } else { - this.limitationList = this.attaches.length; - } + updateLimitation() { + if (this.limitationList > 3) + this.limitationList == 3; + else + this.limitationList = Math.max(this.attaches.length, this.notes.length, 3); } isimage(name) { @@ -86,8 +94,43 @@ export default class AlarmDetail extends Vue { } } + deselectNote() { + if (!this.enableModifyNote) return; + this.selectedNote = {}; + } + onClickSelectAttach(attach) { - this.selectedAttachMaintenance = attach; + this.selectedAttach = attach; + } + + onClickSelectNote(note) { + this.selectedNote = note; + } + + onClickModifyNote(note) { + if (this.selectedNote == note) { + this.enableModifyNote = false; + this.isDisabled(note); + } + this.enableModifyNote = false; + this.selectedNote = note; + } + onClickCancelModifyNote() { + this.enableModifyNote = true; + } + getColor(nome, cognome) { + return getColorFromName(nome, cognome); + } + isDarkColor(color) { + return isDarkColor(color); + } + isDisabled(note) { + if (this.selectedNote && this.selectedNote.id == note.id && !this.enableModifyNote) { + return false; + } + else { + return true; + } } async openAttach(attach) { @@ -95,4 +138,18 @@ export default class AlarmDetail extends Vue { await alarmsService.OpenModal(attach, this.isimage(attach.fileName)); } } + async saveNote(note) { + if (!note) return; + + let result = await alarmsService.postNote(this.alarm.id, note.message); + this.notes.push(result); + this.newNote = {}; + + } + convertDate(date) { + return moment(date).format('L'); + } + convertDateToTime(date) { + return moment(date).format('LT'); + } }; diff --git a/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.vue b/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.vue index 8228d335..6bb0dfd2 100644 --- a/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.vue +++ b/Step/wwwroot/src/app_modules/alarms/components/alarm-detail.vue @@ -46,34 +46,65 @@