(function(){const a=new VueJsAsyncComponentTemplateRepository(webContext+"/community/jsp/javaScript/vuejs/components/silverpeas-community-templates.jsp");SpVue.component("silverpeas-community-management",a.get("community-management",{mixins:[VuejsApiMixin,VuejsI18nTemplateMixin],inject:["context","communityService"],emits:["space-homepage-saved","charter-saved"],props:{displayCharterOnSpaceHomepage:{type:Boolean,"default":false}},data:function(){return{adminSpaceHomepagePopinApi:undefined,defineCharterPopinApi:undefined,defineCharterFormApi:undefined,community:undefined}},created:function(){this.loadCommunity();this.extendApiWith({modifySpaceHomepage:function(){return this.adminSpaceHomepagePopinApi.open()},defineCharter:function(){return this.defineCharterPopinApi.open({callback:this.defineCharterFormApi.validate})}})},methods:{loadCommunity:function(){return this.communityService.get().then(function(b){this.community=b}.bind(this))},saveSpaceHomepage:function(c){const b=extendsObject({},this.community);b.homePageType=c.type;b.homePage=c.value;return this.communityService.saveSpaceHomepage(b).then(function(d){this.community=d;c.deferredSave.resolve();this.$emit("space-homepage-saved",d)}.bind(this),function(){c.deferredSave.reject()})},saveCharter:function(b){const c=extendsObject({},this.community);c.charterURL=b.charterURL;b.validationFormPromise=this.communityService.saveCharter(c,{displayCharterOnSpaceHomepage:b.displayCharterOnSpaceHomepage}).then(function(d){this.community=d;notySuccess(this.messages.saveCharterSuccessMsg);this.$emit("charter-saved",{community:d,displayCharterOnSpaceHomepage:b.displayCharterOnSpaceHomepage})}.bind(this))}},computed:{spaceId:function(){return this.community.spaceId},spaceHomepage:function(){return{type:this.community.homePageType,value:this.community.homePage}}}}));SpVue.component("silverpeas-community-define-charter-form",a.get("community-define-charter-form",{mixins:[VuejsFormApiMixin,VuejsI18nTemplateMixin],inject:["context","communityService"],props:{community:{type:Object,required:true},displayCharterOnSpaceHomepage:{type:Boolean,required:true}},data:function(){return{charterURL:undefined,displayCharter:undefined}},created:function(){this.initFormData();this.extendApiWith({validateForm:function(){return this.rootFormApi.errorMessage().none()},updateFormData:function(b){b.charterURL=this.charterURL;b.displayCharterOnSpaceHomepage=this.displayCharter}})},methods:{initFormData:function(){this.charterURL=this.community.charterURL;this.displayCharter=this.displayCharterOnSpaceHomepage}},watch:{"community.charterURL":function(){this.initFormData()},displayCharterOnSpaceHomepage:function(){this.initFormData()}}}))})();