import{r as i,h as t}from"./p-c1e62c18.js";import{T as e}from"./p-eb6e2a8b.js";import"./p-35c7f358.js";import"./p-d66fb38c.js";import"./p-22a0eb5c.js";import"./p-552063c3.js";import"./p-a9eda644.js";import"./p-25c0eb4f.js";import"./p-551d2360.js";import"./p-6279360b.js";import"./p-a8682d9e.js";import"./p-d343a062.js";import"./p-3df73e7b.js";import{V as s}from"./p-56463912.js";import{c as r}from"./p-06571436.js";import{g as a,m as n}from"./p-a5d71685.js";const o={applicationIsSent:"Your application is sent.",applicationFailed:"Sending the application failed.",firstName:"First name",lastName:"Last name",email:"Email",sendApplication:"Send Application"},p={applicationIsSent:"Başvurunuz gönderildi.",applicationFailed:"Başvuru gönderilirken hata oluştu.",firstName:"İsim",lastName:"Soyisim",email:"E-posta",sendApplication:"Başvuruyu Gönder"},d=i=>[new e("firstName","",i.firstName,"").setErrorTitle(i.firstName).require(),new e("lastName","",i.lastName,"").setErrorTitle(i.lastName).require(),new e("email","",i.email,"","email").setErrorTitle(i.email).addInterceptor("onSubmit",new s).require()],m=class{constructor(t){i(this,t),this.isProgressing=!1,this.isComplete=!1,this.onSubmit=i=>{const{context:t}=a(),e=i.detail.values;this.isProgressing=!0,this.api.createMembershipApplication(t.organisationId,this.role,e).then(this.onSucceed,this.onError)},this.onSucceed=()=>{this.isProgressing=!1,this.isComplete=!0},this.onError=i=>{this.error=i,this.isProgressing=!1}}componentWillLoad(){const{context:i,headers:t}=a();this.api=r(n,t),this.api.getOrganisation(i.organisationId).then((i=>{this.organisation=i})),this.api.getMembershipApplicationForm(i.organisationId,this.role).then((i=>{this.form=i}))}render(){const{error:i,form:e,language:s,organisation:r,isComplete:a,isProgressing:n}=this,m="tr"===s?p:o;return e&&r?t("mentornity-root-wrapper",{class:"d-flex flex-column align-items-center"},t("div",{style:{width:"288px"}},t("dvn-card",{leanedSides:!0},t("dvn-card-header",{title:e.title,slot:"header",showCover:!0,coverBrightness:50,coverSrc:r.coverUrl||"https://bit.ly/36goixD",showImage:!0,imageSrc:r.logoUrl,imageShape:"rounded",imageBorder:!0}),t("dvn-markdown",{content:e.description})),t("dvn-card",{leanedSides:!0},t("doldurma-form",{fields:d(m),onSubmit:this.onSubmit,submitButtonLabel:m.sendApplication,progressing:n||a,formErrors:[]})),a&&t("dvn-card",{leanedSides:!0,tint:"secondary"},m.applicationIsSent),i&&t("dvn-card",{leanedSides:!0,tint:"danger"},m.applicationFailed))):t("mentornity-root-wrapper",null,t("div",{class:"d-flex justify-content-center pt-3"},t("dvn-progress",{indefinite:!0})))}};export{m as mentornity_membership_application_wrapper}