//>>built
require({cache:{"url:mill/jssupport/jsApplication/controlSet/controlSetGroup.html":'\x3cdiv\x3e\x3cdiv class\x3d"officeFormContentHeader"\x3e\x3cdiv class\x3d"table" style\x3d"width:100%" data-dojo-attach-point\x3d"contentHeaderNode"\x3e\x3cdiv class\x3d"table-cell vertical-align-middle bold white" data-dojo-type\x3d"office.TranslatableNode" data-dojo-props\x3d"display: \'table-cell\'" data-dojo-attach-point\x3d"titleWidget"\x3e\x3c/div\x3e\x3cdiv class\x3d"officeFormContentHeaderActionButton table-cell" data-dojo-attach-point\x3d"titleCollapseButton" data-dojo-attach-event\x3d"onClick: toggleContentView"\x3e\x26#150; \x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"officeFormContentFormWrapper" data-dojo-attach-point\x3d"contentFormWrapper"\x3e\x3cdiv class\x3d"officeFormContentForm" data-dojo-attach-point\x3d"containerNode"\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'}});
define("mill/jssupport/jsApplication/controlSet/ControlSetGroup","dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/dom-construct dojo/dom-style dojo/dom-class dojo/on dojo/aspect dojo/when dojo/Deferred dojo/DeferredList dijit/registry dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dijit/_Container dijit/form/CheckBox mill/jssupport/jsApplication/controls/_WidgetTitleMixin mill/jssupport/jsApplication/controls/controlField/ControlField mill/jssupport/jsApplication/controls/buttonControl/ButtonControl mill/jssupport/jsApplication/controls/fileEditor/FileEditor mill/jssupport/jsApplication/controlSet/ControlSet mill/jssupport/TranslatableNode mill/mill mill/jssupport/base dojo/text!mill/jssupport/jsApplication/controlSet/controlSetGroup.html".split(" "),
function(z,k,h,t,A,l,B,u,C,v,L,p,D,E,F,G,H,I,q,r,w,x,y,n,J,K){return n.registerAlias("app.view.ControlSetGroup",z("mill.jssupport.jsApplication.controlSet.ControlSetGroup",[D,E,F,G,I],{baseClass:"officeFormContent",templateString:K,contentHeaderNode:null,changeMode:!0,controlWidgets:null,dataSource:null,preventButtonCreate:null,saveButtonIdent:null,createFinalizeButton:null,finalizeButtonIdent:null,successMessageIdent:null,finalizeButtonFieldWidget:null,finalizeButtonWidget:null,titleCollapseButton:null,
idPostfix:null,data:null,controlSetName:null,controlSetWidget:null,saveButton:null,cancelButton:null,canRemove:null,onRemove:null,contentHidden:null,breadcrumbs:null,breadcrumbItem:null,isRequired:null,postMixInProperties:function(){this.inherited(arguments);this.data=window.app.handlerDataByIdent(this.dataSource,function(c){return c.params.ControlSetName===this.controlSetName}.bind(this))[0]||null;this.data||(this.data=window.app.anonymousDataByIdent(this.dataSource)[0]||null);this.data||J.logError('ControlSetGroup: data is null for "'+
this.dataSource+'".');var a=this.id.match(/_\d+$/);this.idPostfix=a?a[0]:"";this.data&&(this.isRequired=this.data.isRequired)},_setChangeModeAttr:function(){return function(a){this.changeMode=a;l[this.changeMode?"remove":"add"](this.domNode,"notChangeMode");h.forEach(window.app.getControlNestedControlSet(this),function(c){h.forEach(window.app.getControlNestedControlSetGroup(c),function(d){d.set("changeMode",this.changeMode)},this)},this);this.finalizeButtonFieldWidget&&A.set(this.finalizeButtonFieldWidget.domNode,
{display:"none"});(a=this.get("controlSetWidget"))&&a._onChange(null,null,null)}}(),_setContentHiddenAttr:function(){return function(a){this.contentHidden=a;this.titleCollapseButton.innerHTML=this.contentHidden?"\x26#43;":"\x26#150;";l[this.contentHidden?"add":"remove"](this.contentFormWrapper,"officeFormContentFormWrapperHidden")}}(),_getControlSetWidgetAttr:function(){return function(){if(!this.controlSetWidget){for(var a=this;!a.isInstanceOf(x)&&a.getParent();)a=a.getParent();this.controlSetWidget=
a.isInstanceOf(x)?a:null}return this.controlSetWidget}}(),startup:function(){this.inherited(arguments);if(this.data&&this.data.controlNames){var a=this.data.controlNames.split(",");this.controlWidgets=h.map(a,function(f){return p.byId(f+this.idPostfix)},this)}this.preventButtonCreate?this.createFinalizeButton&&this.initFinalizeButton():this.initActions();var c=this.get("controlSetWidget");if(!0===c.canRemove){a=t.create("div",{className:"table-cell changeModeOnly officeFormContentHeaderActionButton"},
this.contentHeaderNode);var d=t.create("a",{innerHTML:"\x26#215;",className:"white",style:{cursor:"pointer"}},a);B(d,"click",function(){this.changeMode&&(k.isFunction(c.onRemove)?c.onRemove.call(c,null):c.destroyRecursive())}.bind(this));c.closeIconNode=a}},switchChangeMode:function(){this.cancelButton&&(this.cancelButton.destroyRecursive(),this.cancelButton=null);this.saveButton&&this.saveButton.set("labelIdent","Office.ChangeData");this.set("changeMode",!1);this.breadcrumbs&&this.breadcrumbs.initItemsState()},
hideWidgetsForValue:function(a,c,d){void 0===d||k.isArray(d)||(d=[d]);var f=this.get("controlWidgets");k.isArray(d)&&(f=h.filter(f,function(b){return 0>h.indexOf(d,b)}));a||(a=h.map(h.filter(f,function(b){return b.isInstanceOf(w)&&b.get("value")&&b.get("fileReference")}),function(b){return{widget:b,value:b.get("value"),fileReference:b.get("fileReference")}}));window.app.hideForValue(f,a,c);this.switchChangeMode()},hideWidgetsAndSaveButtonForValue:function(){return function(a){this.hideWidgetsForValue();
this.saveButton&&("none"!==window.app.getControlField(this.saveButton).domNode.style.display&&this.addInfoMessage({text:window.app.combinedTranslationIdent(a||"DataChangeRequestSent")}),dojo.style(window.app.getControlField(this.saveButton).domNode,{display:"none"}))}}(),addInfoMessage:function(a){var c=q();a=y(a);c.addChild(a);a.set("fullWidth",!0);this.addChild(c)},onValidate:function(){var a=!!this.data&&this.data.onValidate.apply(this,this.controlWidgets);if(a)for(var c=window.app.getControlNestedControlSet(this),
d=0;d<c.length;d+=1)for(var f=window.app.getControlNestedControlSetGroup(c[d]),b=0;b<f.length;b+=1)if(!f[b].onValidate())return a=!1;return a},onSaveData:function(){if(!this.data)return!1;var a=new v,c=[],d=function(b){h.forEach(b,function(g){g=window.app.getControlNestedControlSetGroup(g);c=c.concat(g);h.forEach(g,function(e){d(window.app.getControlNestedControlSet(e))})})};d(window.app.getControlNestedControlSet(this));var f=function(){var b=c.splice(0,1)[0];if(b)C(b.data.onSaveData.apply(b,b.controlWidgets),
function(e){"boolean"!==typeof e||e?"boolean"!==typeof e&&(n.parseErrorMessage(e)||e[0].hasOwnProperty("requiredFieldName"))?n.parseErrorMessage(e)?a.resolve(e):a.resolve(k.mixin(e[0],{idPostfix:b.idPostfix})):f():a.resolve(e)});else{var g=this.data.onSaveData.apply(this,this.controlWidgets);void 0===g?(window.undefined,a.resolve(!1)):"boolean"===typeof g?a.resolve(g):window.app.isDeferred(g)&&g.then(function(e){n.parseErrorMessage(e)?a.resolve(e):a.resolve(e[0])})}}.bind(this);f();return a},onChangeMode:function(){this.data&&
(this.data.onChangeMode.apply(this,this.controlWidgets),h.forEach(window.app.getControlNestedControlSet(this),function(a){h.forEach(window.app.getControlNestedControlSetGroup(a),function(c){c.onChangeMode()})}),this.breadcrumbs&&this.breadcrumbs.initItemsState())},onCancelChange:function(){if(this.data){this.data.onCancelChange.apply(this,this.controlWidgets);h.forEach(window.app.getControlNestedControlSet(this),function(d){h.forEach(window.app.getControlNestedControlSetGroup(d),function(f){f.onCancelChange()})});
var a=null,c=null;this.hasOwnProperty("contentFormWrapper")&&(l.remove(this.contentFormWrapper,"officeFormContentFormWrapperInvalid"),(a=app.getControlParentControlSet(this))&&(c=app.getControlParentControlSetGroup(a))&&c.hasOwnProperty("contentFormWrapper")&&l.remove(c.contentFormWrapper,"officeFormContentFormWrapperInvalid"));this.breadcrumbs&&this.breadcrumbs.initItemsState();c&&c.breadcrumbs&&c.breadcrumbs.initItemsState()}},getIsAvail:function(){return this.data?this.data.getIsAvail.apply(this,
this.controlWidgets):!0},initActions:function(){var a=this,c=q();this.saveButton=r({labelIdent:window.app.combinedTranslationIdent(a.saveButtonIdent)||"Office.Save",onClick:function(){if(a.changeMode){if(a.onValidate()){this.set("labelIdent","Office.SubmittingApplication");window.app.setControlValue([this,a.cancelButton],!0,"disabled");var d=new v;setTimeout(function(){var f=function(){this.set("labelIdent","Office.RetrySubmitApplication");window.app.setControlValue([this,a.cancelButton],!1,"disabled")}.bind(this);
a.onSaveData().then(function(b){if("boolean"===typeof b)b?(a.switchChangeMode(),a.breadcrumbs&&a.breadcrumbs.nextItem()):f(),d.resolve(b);else{var g=!!n.parseErrorMessage(b)||b.hasOwnProperty("requiredFieldName");if(b.hasOwnProperty("requiredFieldName")){window.undefined;var e=p.byId(b.requiredFieldName+(b.idPostfix||""));if(!e)window.undefined;else if(k.isFunction(e.reset)){e.isInstanceOf(w)&&e.set("value","");if(b=window.app.getControlField(e))if(window.app.hideControlForNode(e,!1),window.app.setControlValue(e,
!1,"disabled"),b.set("required",!0),e.set("required",!0),e.isInstanceOf(H)&&b.containerNode&&(b=b.containerNode.childNodes)&&b[1]){var m=p.byNode(b[1]);m&&k.isObject(m)&&k.isFunction(m.isInstanceOf)&&m.isInstanceOf(y)&&(l.add(m.domNode,"red"),u.after(e,"onChange",function(){e.get("checked")&&l.remove(m.domNode,"red")}))}e.reset()}}g?(a.onValidate(),f()):(a.switchChangeMode(),a.breadcrumbs&&a.breadcrumbs.nextItem());d.resolve(!g)}}.bind(this))}.bind(this),100);return d}}else this.set("labelIdent",
window.app.combinedTranslationIdent(a.saveButtonIdent)||"Office.Save"),a.cancelButton=r({labelIdent:"Office.Cancel",onClick:function(){this.destroyRecursive();a.cancelButton=null;a.saveButton.set("labelIdent","Office.ChangeData");a.set("changeMode",!1);a.onCancelChange()}}),c.addChild(a.cancelButton),a.set("changeMode",!0),a.onChangeMode()}});c.addChild(a.saveButton);this.addChild(c)},initFinalizeButton:function(){var a=this.get("controlSetWidget"),c=!0===a.get("fullScreenMode")||"1"===String(a.get("fullScreenMode"));
this.finalizeButtonFieldWidget=q();var d=r({labelIdent:window.app.combinedTranslationIdent(this.finalizeButtonIdent)||"Office.SubmitApplication",onClick:function(){if(a._onValidate()){var f=function(){c?a.offFullScreenMode():(this.set("changeMode",!1),this.addInfoMessage({text:window.app.combinedTranslationIdent(this.successMessageIdent)}))}.bind(this),b=function(){d.set("labelIdent","Office.RetrySubmitApplication");window.app.setControlValue([d],!1,"disabled")};d.set("labelIdent","Office.SubmittingApplication");
window.app.setControlValue([d],!0,"disabled");setTimeout(function(){var g=a._onSaveData();void 0===g?window.undefined:window.app.isDeferred(g)?g.then(f,b):g?f():b()}.bind(this),100)}}.bind(this)});this.finalizeButtonFieldWidget.addChild(d);this.finalizeButtonWidget=d;this.addChild(this.finalizeButtonFieldWidget);"acForeignPrepStudent"===window.app.accessCategory&&u.after(a,"onChange",function(){a._onValidate()})},toggleContentView:function(){return function(){this.set("contentHidden",!this.get("contentHidden"))}}()}))});