import{r as t,h as i,H as s}from"./p-cb5076d4.js";import"./p-8a308033.js";import{D as a,a as e}from"./p-3b35e507.js";import{S as p,a as o}from"./p-1c5c6afa.js";import{T as r}from"./p-0db2169b.js";import{T as n}from"./p-7f474e9b.js";import{A as m}from"./p-27da9105.js";import{I as d,d as c}from"./p-2f5caa4e.js";import{A as l}from"./p-06588791.js";import"./p-944da115.js";import"./p-d343a062.js";import{c as f,b as j}from"./p-c4bbdd1e.js";import{g as h,m as b}from"./p-3a5f9c0f.js";import{g as u}from"./p-84720732.js";import{D as w}from"./p-d50d0ec8.js";import"./p-eebad85b.js";import"./p-b0970d03.js";import"./p-234c1f97.js";import"./p-c705c477.js";import"./p-4f99fb23.js";import"./p-0e4ae084.js";import"./p-97c18602.js";import"./p-d27cb594.js";import"./p-cd2f59dd.js";import"./p-35c7f358.js";import"./p-3bdf4c50.js";import"./p-f97ba04a.js";import"./p-a2aae1b0.js";import"./p-b673f44e.js";import"./p-61301881.js";import"./p-6cf8ecf7.js";import"./p-ecbaf6d8.js";import"./p-56d4255d.js";import"./p-73aa5f56.js";import"./p-138d8bf9.js";import"./p-814af281.js";import"./p-e929429b.js";import"./p-9043df2a.js";import"./p-cb860bcb.js";const g={applicationIsSent:"Your application is sent.",applicationFailed:"Sending the application failed.",firstName:"First name",lastName:"Last name",email:"Email",date:"Date",sendApplication:"Send Application"},A={applicationIsSent:"Başvurunuz gönderildi.",applicationFailed:"Başvuru gönderilirken hata oluştu.",firstName:"İsim",lastName:"Soyisim",email:"E-posta",date:"Tarih",sendApplication:"Başvuruyu Gönder"};class v{constructor(t,i,s,a,e){this.client=new l(s,a),this.organisationId=t,this.language=i,this.onRoleFilterChange=e}addAuthInterceptor(t){}get(t,i,s){}query(t,i){var s;const a=(null===(s=i.filter)||void 0===s?void 0:s.filters[0].value)||"mentors";return this.onRoleFilterChange(a),new Promise((t=>{this.client.get(`organisations/${this.organisationId}/${a}/applications`).then((i=>{t({results:i.results.map((t=>w.decode(Object.assign(Object.assign({_id:t._id,createdAt:t.createdAt,applicationStatus:t.applicationStatus},t.data||{}),{role:a,language:this.language})))),meta:{total:i.results.length}})})).catch((t=>{console.log(t)}))}))}update(t,i,s){}}const y=class{constructor(i){t(this,i),this.isProgressing=!1,this.onRoleChange=t=>{this.formViewConfig=void 0;const i=u(this.viewConfigs,"mentors"===t?j.MentorApplicationForm:j.MenteeApplicationForm);i&&(this.formViewConfig=i.dvnAppViewConfig)}}onAction(t){this.listView.invalidate(t)}async componentWillLoad(){const{context:{organisationId:t},headers:i}=h();this.api=new v(t,this.language,b,i,this.onRoleChange);const s=await f(b,i).getViewConfigs(t).catch((t=>this.error=t));if(!s)return;this.viewConfigs=s.results;const a=u(this.viewConfigs,j.MentorApplicationForm);a&&(this.formViewConfig=a.dvnAppViewConfig)}render(){const{api:t,formViewConfig:a,language:e}=this;return i(s,{class:"d-flex flex-grow-1"},i("mentornity-root-wrapper",{class:"d-flex pl-3 pr-3"},i("dvn-app-view-list-view-table",{ref:t=>this.listView=t,id:d,apiData:t,view:I("tr"===e?A:g,a)})))}},I=(t,i)=>{const s={createdAt:{width:150},email:{width:250},firstName:{width:150},lastName:{width:150},actions:{width:120}};return i&&i.ui.fields.forEach((t=>{s[t.fieldId]={width:250}})),n.decode({_id:d,type:m.ListViewTable,base:"mentornity",title:"Applications",space:c,table:{fields:[new r("firstName",t.firstName),new r("lastName",t.lastName),new r("email",t.email),...i?i.table.fields:[],new a("createdAt",t.date).setDataType(e.Unix).setDateFormat("DD MMM YYYY")]},query:{},ui:n.decode({main:{fields:[{fieldDisplay:{id:"actions"},componentTag:"mentornity-accept-application-button"},{fieldId:"createdAt"},{fieldId:"email"},{fieldId:"firstName"},{fieldId:"lastName"},...i?i.ui.fields:[]],columns:s},quickSearch:{fields:[{field:new p("role","Role",[new o("Mentor applications","mentors"),new o("Mentee applications","mentees")]).setValue("mentors")}],fieldUIConfigs:[{fieldId:"role",width:"200px"}]}})})};export{y as mentornity_membership_application_list_wrapper}