"use strict";sap.ui.define(["./BaseController","sap/ui/model/json/JSONModel","sap/m/MessageBox"],function(t,e,o){"use strict";function a(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const l=a(t);const n=l.extend("com.optrabot.ui.controller.TradeTemplateDetail",{onInit:function t(){var o=this.getOwnerComponent();this.oRouter=o.getRouter();this.oControlModel=o.getModel("control");this.oViewModel=new e({template:null,editable:false});this.getView().setModel(this.oViewModel,"viewModel");this.oRouter.getRoute("template").attachPatternMatched(this._onTemplateMatched,this);this.oRouter.getRoute("templateWOLayout").attachPatternMatched(this._onTemplateMatched,this)},onEditToggleButtonPress:function t(){this.showFunctionNotImplementedMessage();return;var e=this.getView().byId("TemplatePageLayout");var o=e.getShowFooter();e.setShowFooter(!o)},loadTemplateDetails:async function t(){try{const t=this.getOwnerComponent().getModel("global");const e=t.getProperty("/backendBaseUrl");const o=await fetch(`${e}/api/templates/`+this._template);if(!o.ok){throw new Error("Failed to fetch template details")}console.log("Template details loaded");const a=await o.json();this.oViewModel.setProperty("/template",a)}catch(t){o.error("Failed to load template details: "+t.message)}},_onTemplateMatched:function t(e){console.log("Template matched");this._template=e.getParameter("arguments").template||this._template||"0";var o=e.getParameter("arguments").layout||"TwoColumnsMidExpanded";this.oControlModel.setProperty("/currentLayout",o);this.loadTemplateDetails()},onFullscreenPressed:function t(){var e=this.oControlModel.getProperty("/currentLayout");var o=e;if(e==="MidColumnFullScreen"){o="TwoColumnsMidExpanded"}else if(e==="TwoColumnsMidExpanded"){o="MidColumnFullScreen"}this.oRouter.navTo("template",{layout:o,template:this._template},true)},onClosePressed:function t(){this.oRouter.navTo("templates",{layout:"OneColumn"},true)},onExit:function t(){this.oRouter.getRoute("template").detachPatternMatched(this._onTemplateMatched,this);this.oRouter.getRoute("templateWOLayout").detachPatternMatched(this._onTemplateMatched,this)}});return n});
//# sourceMappingURL=TradeTemplateDetail.controller.js.map