diff --git a/Thermo.Active/wwwroot/src/app.business-logic.ts b/Thermo.Active/wwwroot/src/app.business-logic.ts index 82791cec..e4d86b91 100644 --- a/Thermo.Active/wwwroot/src/app.business-logic.ts +++ b/Thermo.Active/wwwroot/src/app.business-logic.ts @@ -39,7 +39,7 @@ messageService.subscribeToChannel("show-contact-info", () => { ModalHelper.ShowM // messageService.subscribeToChannel("show-axes-calibration", () => { ModalHelper.ShowNcModal(AxesCalibration); }); // messageService.subscribeToChannel("hide-axes-calibration", () => { ModalHelper.HideNcModal(AxesCalibration); }); -// messageService.subscribeToChannel("show-m155-questions", () => { ModalHelper.ShowNextM155Modal(); }); +messageService.subscribeToChannel("show-m155-questions", () => { ModalHelper.ShowNextM155Modal(); }); // messageService.subscribeToChannel("show-nochange-page", () => { // ModalHelper.ShowMessage( // Vue.filter('localize')("modal_nochangepage_title", "Operazione non possibile"), diff --git a/Thermo.Active/wwwroot/src/app_modules/machine/components/m155-dialog.ts b/Thermo.Active/wwwroot/src/app_modules/machine/components/m155-dialog.ts new file mode 100644 index 00000000..353080a5 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules/machine/components/m155-dialog.ts @@ -0,0 +1,64 @@ +import { AppModel } from "src/store"; +import { Modal, ModalHelper } from "src/components/modals"; +import Component from "vue-class-component"; +import Vue from "vue"; +import { Hub } from "src/services"; +import { Factory, messageService } from "src/_base"; +import { Watch } from "vue-property-decorator"; + +@Component({ components: { modal: Modal } }) +export default class M155Dialog extends Vue{ + + data = null; + value = 0; + + MULTIPLE_BUTTONS = "MULTIPLE_BUTTONS"; + REAL = "REAL"; + SHOW_VAL = "SHOW_VAL" + + mounted(){ + this.data = ModalHelper.M155ModalData.data; + this.value = 0; + messageService.subscribeToChannel("show-modal-nc", args => { + this.data = ModalHelper.M155ModalData.data; + }); + } + + + get process(){ + if(this.data) + return this.data.process; + return 0; + } + + @Watch("data") + dataChanged(){ + this.value = 0; + } + + ischecked(k){ + return k == this.value; + } + check(k){ + return this.value = k; + } + canSendAnswer(){ + if(this.getType == this.REAL) + return this.value != null && this.value != undefined; + else + return this.value && this.value != 0; + } + get getType(){ + if(this.data) + return this.data.type + + return "" + } + hide() { + ModalHelper.M155ModalData.data.toDisplay = false; + ModalHelper.HideThisM155Modal(ModalHelper.M155ModalData.data.processId); + } + answer(){ + Hub.Current.WriteM155Response(this.data.process,this.value); + } +}; diff --git a/Thermo.Active/wwwroot/src/app_modules/machine/components/m155-dialog.vue b/Thermo.Active/wwwroot/src/app_modules/machine/components/m155-dialog.vue new file mode 100644 index 00000000..147b145d --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules/machine/components/m155-dialog.vue @@ -0,0 +1,33 @@ + + + + {{data.message}} + + {{'modal_m155_value' | localize("Value: ")}} + + + + + {{data.message}} + + + + + + + {{t}} + + + + + + + + diff --git a/Thermo.Active/wwwroot/src/app_modules/machine/index.ts b/Thermo.Active/wwwroot/src/app_modules/machine/index.ts index 1fde7a77..b6631c4c 100644 --- a/Thermo.Active/wwwroot/src/app_modules/machine/index.ts +++ b/Thermo.Active/wwwroot/src/app_modules/machine/index.ts @@ -12,6 +12,7 @@ export { MachineInfoDialog, ContactInfoDialog, UserInfoDialog, + M155Questions, UserInfo, CmsconnectInfoDialog } diff --git a/Thermo.Active/wwwroot/src/components/modals/ModalHelper.ts b/Thermo.Active/wwwroot/src/components/modals/ModalHelper.ts index 8d127389..16d39615 100644 --- a/Thermo.Active/wwwroot/src/components/modals/ModalHelper.ts +++ b/Thermo.Active/wwwroot/src/components/modals/ModalHelper.ts @@ -2,6 +2,7 @@ import { Factory, messageService } from "@/_base"; import ConfirmModal from "./modal-confirm.vue"; import { Deferred } from "@/services/Deferred"; +import { M155Questions } from "src/app_modules/machine"; import { processStore, processModelActions } from "@/store/runningProcess.store"; import { store } from "@/store"; declare let $: any; @@ -57,6 +58,9 @@ export class ModalHelper { isMessage: false }; + public static M155ModalData = { + data: null + }; public static MaintenancePasswordData = { maintenance: null, @@ -101,6 +105,37 @@ export class ModalHelper { return deferred.promise; } + public static ShowNextM155Modal() { + ModalHelper.M155ModalData.data = null; + for (let i = 0; i < processStore.state.m155messages.length; i++) { + if (processStore.state.m155messages[i].toDisplay) { + ModalHelper.M155ModalData.data = processStore.state.m155messages[i]; + break; + } + } + if (ModalHelper.M155ModalData.data) { + messageService.publishToChannel("show-modal-nc", M155Questions); + } + else { + messageService.publishToChannel("hide-modal-nc", M155Questions); + } + } + + public static HideThisM155Modal(processId) { + processModelActions.hideM155Messsage(store, processId); + } + + + public static ShowM155ModaloOfProcess(proc: number) { + if (!ModalHelper.M155ModalData.data) { + let find = processStore.state.m155messages.find(X => X.process == proc) + if (find) { + ModalHelper.M155ModalData.data = find; + messageService.publishToChannel("show-modal-nc", M155Questions); + } + } + } + public static HideModal(modalname: string = "modal") { messageService.publishToChannel("hide-" + modalname); }