This commit is contained in:
Andrew Nicols 2023-07-20 00:07:00 +08:00 committed by Ilya Tregubov
commit b701a934ef
No known key found for this signature in database
GPG Key ID: 0F58186F748E55C1
3 changed files with 3 additions and 3 deletions

View File

@ -1,3 +1,3 @@
define("tool_dataprivacy/selectedcourses",["exports","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment","core/prefetch","core/str"],(function(_exports,_ajax,_notification,_modal_factory,_modal_events,_fragment,_prefetch,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_ajax=_interopRequireDefault(_ajax),_notification=_interopRequireDefault(_notification),_modal_factory=_interopRequireDefault(_modal_factory),_modal_events=_interopRequireDefault(_modal_events),_fragment=_interopRequireDefault(_fragment),(0,_prefetch.prefetchStrings)("tool_dataprivacy",["selectedcourses","approverequest","errornoselectedcourse"]);return _exports.default=class{constructor(contextId,requestId){_defineProperty(this,"contextId",0),_defineProperty(this,"requestId",0),this.contextId=contextId,this.requestId=requestId,_modal_factory.default.create({type:_modal_factory.default.types.SAVE_CANCEL,title:(0,_str.get_string)("selectcourses","tool_dataprivacy"),body:this.getBody({requestid:requestId}),large:!0,removeOnClose:!0,buttons:{save:(0,_str.get_string)("approverequest","tool_dataprivacy")}}).then((modal=>(this.modal=modal,modal))).then((modal=>(modal.getRoot().on(_modal_events.default.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),modal.show(),modal))).catch(_notification.default.exception)}getBody(formdata){const params=formdata?{jsonformdata:JSON.stringify(formdata)}:null;return _fragment.default.loadFragment("tool_dataprivacy","selectcourses_form",this.contextId,params)}submitForm(e){e.preventDefault(),this.modal.getRoot().find("form").submit()}submitFormAjax(e){e.preventDefault();let formData=this.modal.getRoot().find("form").serialize();if(-1===formData.indexOf("coursecontextids")){const customSelect=this.modal.getRoot().find(".custom-select"),invalidText=this.modal.getRoot().find(".invalid-feedback");return customSelect.addClass("is-invalid"),invalidText.attr("style","display: block"),void(0,_str.get_string)("errornoselectedcourse","tool_dataprivacy").then((value=>{invalidText.empty().append(value)})).catch(_notification.default.exception)}_ajax.default.call([{methodname:"tool_dataprivacy_submit_selected_courses_form",args:{requestid:this.requestId,jsonformdata:JSON.stringify(formData)}}])[0].then((data=>(data.warnings.length>0?this.modal.setBody(this.getBody(formData)):(this.modal.destroy(),document.location.reload()),data))).catch((error=>_notification.default.exception(error)))}},_exports.default})); define("tool_dataprivacy/selectedcourses",["exports","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment","core/prefetch","core/str"],(function(_exports,_ajax,_notification,_modal_factory,_modal_events,_fragment,_prefetch,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_ajax=_interopRequireDefault(_ajax),_notification=_interopRequireDefault(_notification),_modal_factory=_interopRequireDefault(_modal_factory),_modal_events=_interopRequireDefault(_modal_events),_fragment=_interopRequireDefault(_fragment),(0,_prefetch.prefetchStrings)("tool_dataprivacy",["selectcourses","approverequest","errornoselectedcourse"]);return _exports.default=class{constructor(contextId,requestId){_defineProperty(this,"contextId",0),_defineProperty(this,"requestId",0),this.contextId=contextId,this.requestId=requestId,_modal_factory.default.create({type:_modal_factory.default.types.SAVE_CANCEL,title:(0,_str.get_string)("selectcourses","tool_dataprivacy"),body:this.getBody({requestid:requestId}),large:!0,removeOnClose:!0,buttons:{save:(0,_str.get_string)("approverequest","tool_dataprivacy")}}).then((modal=>(this.modal=modal,modal))).then((modal=>(modal.getRoot().on(_modal_events.default.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),modal.show(),modal))).catch(_notification.default.exception)}getBody(formdata){const params=formdata?{jsonformdata:JSON.stringify(formdata)}:null;return _fragment.default.loadFragment("tool_dataprivacy","selectcourses_form",this.contextId,params)}submitForm(e){e.preventDefault(),this.modal.getRoot().find("form").submit()}submitFormAjax(e){e.preventDefault();let formData=this.modal.getRoot().find("form").serialize();if(-1===formData.indexOf("coursecontextids")){const customSelect=this.modal.getRoot().find(".custom-select"),invalidText=this.modal.getRoot().find(".invalid-feedback");return customSelect.addClass("is-invalid"),invalidText.attr("style","display: block"),void(0,_str.get_string)("errornoselectedcourse","tool_dataprivacy").then((value=>{invalidText.empty().append(value)})).catch(_notification.default.exception)}_ajax.default.call([{methodname:"tool_dataprivacy_submit_selected_courses_form",args:{requestid:this.requestId,jsonformdata:JSON.stringify(formData)}}])[0].then((data=>(data.warnings.length>0?this.modal.setBody(this.getBody(formData)):(this.modal.destroy(),document.location.reload()),data))).catch((error=>_notification.default.exception(error)))}},_exports.default}));
//# sourceMappingURL=selectedcourses.min.js.map //# sourceMappingURL=selectedcourses.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ import {prefetchStrings} from 'core/prefetch';
import {get_string as getString} from 'core/str'; import {get_string as getString} from 'core/str';
prefetchStrings('tool_dataprivacy', [ prefetchStrings('tool_dataprivacy', [
'selectedcourses', 'selectcourses',
'approverequest', 'approverequest',
'errornoselectedcourse', 'errornoselectedcourse',
]); ]);