//>>built
require({cache:{"url:mill/jssupport/layout/layoutContent/reportToModeratorInternalForm.html":"\x3cdiv\x3e\x3cdiv data-dojo-type\x3d\"office.form.TextField\" data-dojo-props\x3d\"text: 'Office.MessageSubject;:', name: 'Subject', maxLength: 128\"\x3e\x3c/div\x3e\x3cdiv data-dojo-type\x3d\"office.form.TextAreaField\" data-dojo-props\x3d\"text: 'Office.MessageBody;:', required: true, name: 'TextMessage'\"\x3e\x3c/div\x3e\x3cdiv data-dojo-type\x3d\"office.form.FileAttachmentField\" data-dojo-props\x3d\"text: 'Office.AttachFile;:', doubleName: 'BinaryData', accept: 'image/bmp,image/jpeg,image/png,image/tiff,application/pdf', name: 'DataFile'\"\x3e\x3c/div\x3e\x3c/div\x3e"}});
define("mill/jssupport/layout/layoutContent/ReportToModeratorInternalForm","dojo/_base/declare dojo/_base/lang dojo/text!mill/jssupport/layout/layoutContent/reportToModeratorInternalForm.html mill/jssupport/form/_FormContent mill/jssupport/form/FilteringSelectField mill/jssupport/Announcement mill/mill mill/jssupport/base mill/jssupport/session".split(" "),function(u,m,v,w,l,x,n,b,p){return mill.registerAlias("office.ReportToModeratorInternalForm",u("mill.jssupport.layout.layoutContent.ReportToModeratorInternalForm",
[w],{content:v,formTitle:"Office.ReportToModerator",submitApplicationLabel:"Office.SendAMessage",hideSubmitTextColumn:"false",messageCampusWidget:null,messageCategoryWidget:null,startup:function(){this.inherited(arguments);if(window.app&&"acMagAbiturient"===window.app.accessCategory){var a=this.getField("Subject");if(a){a.set("required",!0);this.addChild(x({text:"MagAbitur.ModeratorMessageAnnouncement",icon:"info",color:"blue",readOnly:!0}),"first");var e=new l({text:"MagAbitur.ModeratorMessageCampus;:",
name:"Campus",required:!0}),c=e.controlNode;this.messageCampusWidget=c;c.set("searchAttrObject",{RU:"Description",EN:"EngDescription"});c.set("store",b.domainStore("TRegDepartment","TRegDepartment with AdmModeratorPosition required domain",null,["Description","EngDescription"],null,null,null,null,window.app.anonymousHandler));c.set("onChange",function(h){var k=this.getFormWidget("QuestionCategory");k&&(k.set("value",""),k.set("disabled",!h))}.bind(this));e.placeAt(a,"before");this.registerWidget(c);
e=new l({text:"MagAbitur.ModeratorMessageCategory;:",name:"QuestionCategory",required:!0});this.messageCategoryWidget=c=e.controlNode;c.set("searchAttrObject",{RU:"Description",EN:"EngDescription"});c.set("store",b.domainStore("TAbitMessageCategory","Magister abiturient message category (required)",[{domain:"TObject domain",name:"ARegDepartment",value:function(){return this.getWidgetAttr("Campus","value")}.bind(this)}],["Description","EngDescription"],null,null,null,null,window.app.anonymousHandler));
e.placeAt(a,"before");this.registerWidget(c);c.set("disabled",!0)}}else if("acForeignAbiturient"===b.accessCategory||"acForeignMagAbiturient"===b.accessCategory){if(a=this.getField("Subject"))a.set("required",!0),e=new l({text:"ForeignAbit.ModeratorMessageCategory;:",name:"QuestionCategory",required:!0}),this.messageCategoryWidget=e.controlNode,this.registerWidget(this.messageCategoryWidget),this.messageCategoryWidget.set("searchAttrObject",{RU:"Description",EN:"EngDescription"}),this.messageCategoryWidget.set("store",
b.domainStore("TFAMessageCategory","acForeignAbiturient"===b.accessCategory?"TFAMessageCategory ForBachAbiturient required domain":"TFAMessageCategory ForMagAbiturient required domain",null,["Description","EngDescription"],null,null,null,null,b.anonymousHandler)),e.placeAt(a,"before")}else if("acSchoolOlymp"===b.accessCategory||"acStudOlymp"===b.accessCategory){var d=this.getField("Subject");a=[{part:0,name:"ID"},{part:0,name:"Theme"},{part:1,name:"IsActual",value:"1"}];"acSchoolOlymp"===b.accessCategory?
a.push({part:1,name:"ForSchoolOlymp",value:"1"}):"acStudOlymp"===b.accessCategory&&a.push({part:1,name:"ForStudOlymp",value:"1"});mill.queryCursorJson({handler:window.anonymousHandler,headers:{"Disable-Basic-Auth":"yes"},sync:!1,className:"TOlympMessageCategory",query:a,load:function(h){h=window.app.createStore({data:h.data.sort(function(g,f){var q=mill.fieldValue(g,"Theme").toUpperCase(),r=mill.fieldValue(f,"Theme").toUpperCase();return q<r?-1:q>r?1:0}).map(function(g,f){g.Position=f;return g}).concat([{ID:0,
Position:h.data.length,Theme:"\u0414\u0440\u0443\u0433\u043e\u0435"}])});if(d){var k=new l({text:"acSchoolOlymp"===b.accessCategory?"SchlOlymp.ModeratorMessageCategory;:":"StudOlymp.ModeratorMessageCategory;:",name:"questioncategory",required:!0}),t=function(g){if(d&&g){var f=g.get("item");f=!f||0!==f.ID;d.set("disabled",f);d.set("required",!f);d.controlNode.set("value","");return t.bind(null,g)}};this.messageCategoryWidget=k.controlNode;this.messageCategoryWidget.set("onChange",t.call(null,this.messageCategoryWidget));
this.messageCategoryWidget.set("searchAttrObject","Theme");this.messageCategoryWidget.set("fetchProperties",{sort:[{attribute:"Position",descending:!1}]});this.messageCategoryWidget.set("store",h);this.registerWidget(this.messageCategoryWidget);k.placeAt(d,"before")}}.bind(this)})}},postForm:function(){this.inherited(arguments);var a={className:"TModeratorMessage",methodName:"Create",params:{IPAddress:(p||mill.session).ipAddress,RemoteUser:(p||mill.session).getRemoteUserID(),ReferText:mill.getReferText(),
CommunicationLanguage:b.locale.toUpperCase()}};this.inspectFormWidgets(function(c,d){this._isAttachment(d)?0<d._uploadState&&d._uploadedFile&&(a.params.DataFileName=d._uploadedFile.name):a.params[c]=this.formWidgetValue(c)},null,null);a.params.QuestionCategory="";this.messageCategoryWidget&&(a.params.QuestionCategory=window.app&&"acMagAbiturient"===window.app.accessCategory?this.messageCategoryWidget.get("value"):"acSchoolOlymp"===b.accessCategory||"acStudOlymp"===b.accessCategory?this.messageCategoryWidget.validate()&&
"0"!==String(mill.fieldValue(this.messageCategoryWidget.get("item"),"ID"))?this.messageCategoryWidget.get("displayedValue"):this.getFormWidget("Subject").get("value"):this.messageCategoryWidget.validate()?this.messageCategoryWidget.get("displayedValue"):"");a.params.RegDepartment=this.messageCampusWidget?this.messageCampusWidget.get("value"):"";var e=n.buildQueryParams(a);this.postRequest({url:n.getRequestUrl(b.mainHandler||window.app.handler,"execute.xml"),data:e}).then(m.hitch(this,function(){this.createSuccessMessage("Office.ReportToModeratorRequestSuccess",
m.hitch(this,function(){this.toggleFormView()}),null,null,!1);this.toggleFormView();this.resetForm()}))}}))});