(function(){u8.Crm.Surveys=function(){};$.extend(u8.Crm.Surveys.prototype,{hooks:{infoAreaAndFieldFieldHook:function(e){var s=e.getValue("TableId");var i=e.getValue("FieldId");var t=u8.services.schema.toFieldId("F2","Trigger");var a=$u(".ExpandView .[__field='Root/"+t+"']");var d=u8.services.schema.toFieldId("F2","Defaultvalues");var l=$u(".ExpandView .[__field='Root/"+d+"']");var r=u8.services.schema.toFieldId("F2","New2");var u=$u(".ExpandView .[__field='Root/"+r+"']");var o=u8.services.schema.toFieldId("F2","Addnewseparately");var v=$u(".ExpandView .[__field='Root/"+o+"']");var n=u8.services.schema.toFieldId("F2","Readanswer");var _=$u(".ExpandView .[__field='Root/"+n+"']");var f=u8.services.schema.toFieldId("F2","Saveanswer");var h=$u(".ExpandView .[__field='Root/"+f+"']");if(s){this._setDisabled(a,false);this._setDisabled(l,false);this._setDisabled(u,false);this._setDisabled(v,false);if(i){this._setDisabled(_,false);this._setDisabled(h,false)}else{this._setDisabled(_,true);this._setDisabled(h,true)}}else{this._setDisabled(a,true);this._setDisabled(l,true);this._setDisabled(u,true);this._setDisabled(v,true);this._setDisabled(_,true);this._setDisabled(h,true)}},renderHook:function(e,s,i){var t=i.getValue("TableId");var a=i.getValue("FieldId");var d=u8.services.schema.toFieldId("F2",e);var l=$u(".ExpandView .[__field='Root/"+d+"']");if(!t||s&&!a){this._setDisabled(l,true)}else{this._setDisabled(l,false)}},_setDisabled:function(e,s){if(e&&e.length==1){e.attr("disabled",s);if(s){e.setValue(undefined)}}}},getSurvey:function(e,s){u8.request("SurveysChannel.GetSurvey",e,function(e,i){if(i.response){s({survey:i.response})}else{s(i)}})}});u8.services.add("surveys",u8.Crm.Surveys)})();