1import{d as w,aR as L,am as C,an as h,g as V,aj as S,_,r as y,o as m,a as b,f as r,w as i,b as n,t as u,p as q,e as T,l as v}from"./index-B1lZVFUp.js";import{v as k}from"./validation-BG-r0lYE.js";import{K as Q}from"./KTPService-UwUJr-tB.js";const M=w({name:"VAddMaterialModalWindow",mixins:[k],components:{VSelect:C,VFieldArea:L},props:{groupId:Number,subjectId:Number,parallel:Number,eduLang:String,scheduleUuid:String,callback:Function},data(){return{selectedType:null,optionsTypes:[],selectedQuarter:null,optionsQuarters:[],selectedLessonTemplate:null,optionsLessonTemplates:[],selectedTheme:null,optionsThemes:[],selectedCustomLesson:{value:"personal"}}},setup(){return{glClose:S("glClose")}},async created(){await this.reqLessonTypes(),await this.reqQuarters()},watch:{selectedType(){this.selectedQuarter=null,this.selectedTheme=null,this.selectedLessonTemplate=null},selectedQuarter(){this.selectedTheme=null,this.selectedLessonTemplate=null},async filterUpdate(e){var s;e.type==="regular"&&e.quarter&&(await this.reqLessonThemes((s=this.selectedQuarter)==null?void 0:s.value),this.selectedTheme=null),e.type!=="regular"&&e.quarter&&(await this.reqCustomLessons(),this.selectedLessonTemplate=null)}},computed:{...V(["loadingProgress","getSchoolId","selectedYear","hasOMSubscription"]),filterUpdate(){var e,s;return{type:((e=this.selectedType)==null?void 0:e.type)||{},quarter:((s=this.selectedQuarter)==null?void 0:s.value)||{}}},validateForm(){return this.selectedType&&this.selectedQuarter&&(this.selectedType.type==="regular"&&this.selectedTheme||this.selectedType.type!=="regular"&&this.selectedLessonTemplate)}},methods:{async handlerAdd(){this.validateForm&&(this.$store.commit("setLoadingProgress",!0),await new Q(this).fetchAddMaterial({schoolId:this.getSchoolId,eduYear:this.selectedYear,scheduleUuid:this.scheduleUuid,entityKind:this.selectedType.type,entityId:this.selectedType.type==="regular"?this.selectedTheme.entity_id:this.selectedLessonTemplate.id||this.selectedLessonTemplate.value})&&(this.$metrika&&this.$metrika.reachGoal("interactive_lesson_add_completed"),this.callback&&await this.callback(),this.glClose()),this.$store.commit("setLoadingProgress",!1))},async reqLessonTypes(){const s=await new h(this).fetchLessonTypeDict();s.error||(this.optionsTypes=s.data.filter(a=>a.type!=="lecture"&&(this.hasOMSubscription||a.type!=="regular")))},async reqQuarters(){const s=await new h(this).fetchQuartersList(!1,this.$store.state.common.lang);s&&(this.optionsQuarters=s.reduce((a,d)=>[...a,{value:null,label:d.year,divide:!0},...d.quarters.map(p=>({value:p.value,label:p.label}))],[]))},async reqLessonThemes(e=null){const a=await new h(this).fetchSubjectLessonsDict({subject_id:this.subjectId,group_id:this.groupId,quarter:e});a.error||(this.optionsThemes=a.data)},async reqCustomLessons(){var e,s,a,d,p,g;if(((e=this.selectedCustomLesson)==null?void 0:e.value)==="personal"){this.selectedLessonTemplate=null,this.optionsLessonTemplates=[];const c={groupName:this.parallel,discipline:this.subjectId,eduLang:this.eduLang,type:(s=this.selectedCustomLesson)==null?void 0:s.value,quarter:(a=this.selectedQuarter)==null?void 0:a.value},o=new h(this);let l;((d=this.selectedType)==null?void 0:d.type)==="soch"?l=await o.fetchUserSoch(c):((p=this.selectedType)==null?void 0:p.type)==="lecture"?l=await o.fetchMyLectures(c):((g=this.selectedType)==null?void 0:g.type)==="custom-lesson"?l=await o.fetchMyCu
1stomLessons(c):l=await o.fetchUserSor(c),l.error||(this.optionsLessonTemplates=l.data.customTemplates)}}}}),F={class:"v-add-material-modal-window"},$={class:"vs-select__no-options"},U={key:0,class:"vs__option-divide"},P={key:1},I={class:"vs-select__no-options"},j={class:"vs-select__no-options"},N={class:"vs-select__no-options"},A={class:"row justify-content-between"},K={class:"col-12 col-sm-auto mt-16"},B={class:"col-12 col-sm-auto mt-16"};function D(e,s,a,d,p,g){const c=y("v-form-requirements-fields-inform"),o=y("v-select"),l=y("v-field-area"),f=y("v-butt");return m(),b("div",F,[r(c),r(l,{label:e.trans("spa.label.lesson_type"),error:e.hasValidationFail("type"),"error-message":e.getValidationMessage("type"),hor:"",required:"",class:"mt-16"},{default:i(()=>[r(o,{modelValue:e.selectedType,"onUpdate:modelValue":[s[0]||(s[0]=t=>e.selectedType=t),s[1]||(s[1]=t=>e.flashValidationFail("type"))],options:e.optionsTypes,placeholder:e.trans("spa.label.select_option"),"append-to-body":"",clearable:!1,searchable:!1,class:"ol-w-100"},{"no-options":i(()=>[n("div",$,u(e.trans("spa.warning.no_data")),1)]),_:1},8,["modelValue","options","placeholder"])]),_:1},8,["label","error","error-message"]),r(l,{label:e.trans("spa.label.lesson_quarter"),error:e.hasValidationFail("type"),"error-message":e.getValidationMessage("type"),hor:"",required:"",class:"mt-16"},{default:i(()=>[r(o,{modelValue:e.selectedQuarter,"onUpdate:modelValue":s[2]||(s[2]=t=>e.selectedQuarter=t),class:q([{"v-select-orange":e.selectedQuarter,"ol-process":e.loadingProgress},"ol-w-100 vs__select-groups"]),options:e.optionsQuarters,placeholder:e.trans("spa.label.select_option"),disabled:e.loadingProgress,clearable:!1,selectable:t=>!t.divide},{option:i(t=>[t.divide?(m(),b("span",U,[n("span",null,u(t.label),1)])):(m(),b("span",P,u(t.label),1))]),"no-options":i(()=>[n("div",I,u(e.trans("spa.warning.no_data")),1)]),_:1},8,["modelValue","class","options","placeholder","disabled","selectable"])]),_:1},8,["label","error","error-message"]),e.selectedType&&e.selectedType.type==="regular"?(m(),T(l,{key:0,label:e.trans("spa.label.lesson_theme"),error:e.hasValidationFail("theme"),"error-message":e.getValidationMessage("theme"),hor:"",required:"",class:"mt-16"},{default:i(()=>[r(o,{modelValue:e.selectedTheme,"onUpdate:modelValue":[s[3]||(s[3]=t=>e.selectedTheme=t),s[4]||(s[4]=t=>e.flashValidationFail("theme"))],options:e.optionsThemes,placeholder:e.trans("spa.label.select_option"),"append-to-body":"",label:"theme",clearable:!1,searchable:!1,class:"ol-w-100"},{"no-options":i(()=>[n("div",j,u(e.trans("spa.warning.no_data")),1)]),_:1},8,["modelValue","options","placeholder"])]),_:1},8,["label","error","error-message"])):v("",!0),e.selectedType&&e.selectedType.type!=="regular"?(m(),T(l,{key:1,label:e.trans("spa.label.my_exam_select"),error:e.hasValidationFail("type"),"error-message":e.getValidationMessage("type"),hor:"",required:"",class:"mt-16"},{default:i(()=>[r(o,{modelValue:e.selectedLessonTemplate,"onUpdate:modelValue":[s[5]||(s[5]=t=>e.selectedLessonTemplate=t),s[6]||(s[6]=t=>e.flashValidationFail("type"))],options:e.optionsLessonTemplates,placeholder:e.trans("spa.label.select_option"),"append-to-body":"",clearable:!1,searchable:!1,class:"ol-w-100"},{"no-options":i(()=>[n("div",N,u(e.trans("spa.warning.no_data")),1)]),_:1},8,["modelValue","options","placeholder"])]),_:1},8,["label","error","error-message"])):v("",!0),n("div",A,[n("div",K,[r(f,{color:"form-fields",outline:"",label:e.trans("spa.action.cancel"),disabled:e.loadingProgress,class:"ol-minw-200",onClick:e.glClose},null,8,["label","disabled","onClick"])]),n("div",B,[r(f,{bg:"carrot-orange",label:e.trans("spa.action.save"),disabled:!e.validateForm,loading:e.loadingProgress,class:"ol-minw-200",onClick:e.handlerAdd},null,8,["label","disabled","loading","onClick"])])])])}const W=_(M,[["render",D]]);export{W as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.