var $url="/settings/sitesSave",data=utils.init({active:0,site:null,directories:null,files:null,channel:null,checkAllDirectories:!1,checkAllFiles:!1,form:{siteId:utils.getQueryInt("siteId"),templateName:null,templateDir:null,webSiteUrl:null,description:null,checkedDirectories:[],checkedFiles:[],isAllFiles:!0,isSaveContents:!0,isSaveAllChannels:!0,checkedChannelIds:[]}}),methods={apiGet:function(){var e=this;$api.get($url,{params:{siteId:this.form.siteId}}).then(function(t){var i=t.data;e.site=i.site,e.form.templateName=i.site.siteName,e.form.templateDir=i.templateDir}).catch(function(e){utils.error(e)}).then(function(){utils.loading(e,!1)})},handleCheckAllDirectoriesChange(e){this.form.checkedDirectories=e?this.directories:[],this.checkAllDirectories=e},handleCheckedDirectoriesChange(e){this.checkAllDirectories=this.form.checkedDirectories.length===this.directories.length},handleCheckAllFilesChange(e){this.form.checkedFiles=e?this.files:[],this.checkAllFiles=e},handleCheckedFilesChange(e){this.checkAllFiles=this.form.checkedFiles.length===this.files.length},btnNextClick:function(){var e=this;0===e.active?this.$refs.form.validate(function(t){t&&e.apiSaveSettings()}):1===e.active?e.apiSaveFiles():2===e.active&&e.apiSaveData()},apiSaveSettings:function(){var e=this;utils.loading(this,!0),$api.post($url+"/actions/settings",this.form).then(function(t){var i=t.data;e.directories=i.directories,e.files=i.files,e.active=1}).catch(function(e){utils.error(e)}).then(function(){utils.loading(e,!1)})},apiSaveFiles:function(){var e=this;utils.loading(this,!0),$api.post($url+"/actions/files",this.form).then(function(t){var i=t.data;e.channel=i.channel,e.active=2}).catch(function(e){utils.error(e)}).then(function(){utils.loading(e,!1)})},apiSaveData:function(){var e=this;utils.loading(this,!0),$api.post($url+"/actions/data",this.form).then(function(t){t.data;e.active=3,setTimeout(function(){location.href=utils.getSettingsUrl("sitesTemplates")},3e3)}).catch(function(e){utils.error(e)}).then(function(){utils.loading(e,!1)})},handleTreeChanged:function(){this.form.checkedChannelIds=this.$refs.tree.getCheckedKeys()}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});