81 lines
2.0 KiB
TypeScript
81 lines
2.0 KiB
TypeScript
import Vue from "vue";
|
|
import { Factory, MessageService } from "src/_base";
|
|
import { ConfirmModal, Modal } from "./";
|
|
import { Deferred } from "../../services/Deferred";
|
|
export class ModalHelper {
|
|
|
|
public static loadDepotModal = {
|
|
positionId: 0,
|
|
positionType: 0,
|
|
magazineId: 0
|
|
};
|
|
|
|
public static avaiableTools: Array<any> = [];
|
|
|
|
public static job: server.Job = null;
|
|
|
|
public static infoEquipmentModal = {
|
|
currentShank: null,
|
|
currentEquipment: null,
|
|
enableModalShank: false,
|
|
enableModalTool: false,
|
|
editEnabled: false
|
|
};
|
|
public static modalIframe = {
|
|
content: null,
|
|
title: null
|
|
};
|
|
public static modalImage = {
|
|
content: null,
|
|
title: null
|
|
};
|
|
public static maintenanceModal = {
|
|
currentMaintenance: null,
|
|
};
|
|
|
|
public static offsetAddModal = {
|
|
idTool: 0,
|
|
offsetData: null
|
|
}
|
|
|
|
private static _modalData = {
|
|
title: "",
|
|
content: "",
|
|
onConfirm: null,
|
|
onCancel: null,
|
|
containername: "modal"
|
|
};
|
|
|
|
public static GetModalData() {
|
|
return ModalHelper._modalData;
|
|
};
|
|
|
|
public static ShowModal(view, modalname: string = "modal") {
|
|
Factory.Get(MessageService).publishToChannel("show-" + modalname, view);
|
|
}
|
|
|
|
public static ShowModalAsync(view, model= null, modalname: string = "modal"): Promise<any> {
|
|
let deferred = new Deferred();
|
|
Factory.Get(MessageService).publishToChannel("show-" + modalname, view, deferred, model);
|
|
return deferred.promise;
|
|
}
|
|
|
|
public static HideModal(modalname: string = "modal") {
|
|
|
|
Factory.Get(MessageService).publishToChannel("hide-" + modalname);
|
|
}
|
|
|
|
public static AskConfirm(title: string, body: string, onConfirm: Function, onCancel: Function, modalcontainer: string = "modal2") {
|
|
|
|
ModalHelper._modalData.title = title;
|
|
ModalHelper._modalData.content = body;
|
|
ModalHelper._modalData.onCancel = onCancel;
|
|
ModalHelper._modalData.onConfirm = onConfirm;
|
|
ModalHelper._modalData.containername = modalcontainer;
|
|
|
|
this.ShowModal(ConfirmModal, modalcontainer);
|
|
}
|
|
|
|
|
|
}
|