2023-01-30 23:20:28 +01:00
|
|
|
!function(){"use strict";var e={662:function(e,o,r){var t=c(r(754)),i=c(r(311)),d=c(r(363)),l=r(691),n=r(648),s=r(845),a=c(r(872)),m=c(r(902));function c(e){return e&&e.__esModule?e:{default:e}}const f=(0,n.loadComponent)("FormBuilderModal");i.default.entwine("ss",(e=>{function o(o,r,t){o?(e(r).show(),e(t).hide()):(e(t).show(),e(r).hide())}e("#Form_EditForm_Fields").entwine({onmatch(){this._super(),this.on("addnewinline",(()=>{this.one("reload",(()=>{this.find(".ss-gridfield-item").last().find(".col-ClassName select").attr("data-folderconfirmed",0)}))}))}}),e("#Form_ConfirmFolderForm_FolderOptions-new").entwine({onmatch(){e("#Form_ConfirmFolderForm_CreateFolder_Holder").detach().appendTo(e("#Form_ConfirmFolderForm_FolderOptions-new").parent().parent()),o(e(this).prop("checked"),"#Form_ConfirmFolderForm_CreateFolder_Holder","#Form_ConfirmFolderForm_FolderID_Holder")},onchange(){o(e(this).prop("checked"),"#Form_ConfirmFolderForm_CreateFolder_Holder","#Form_ConfirmFolderForm_FolderID_Holder")}}),e("#Form_ConfirmFolderForm_FolderOptions-existing").entwine({onmatch(){e("#Form_ConfirmFolderForm_FolderID_Holder").detach().appendTo(e("#Form_ConfirmFolderForm_FolderOptions-existing").parent().parent()),o(e(this).prop("checked"),"#Form_ConfirmFolderForm_FolderID_Holder","#Form_ConfirmFolderForm_CreateFolder_Holder")},onchange(){o(e(this).prop("checked"),"#Form_ConfirmFolderForm_FolderID_Holder","#Form_ConfirmFolderForm_CreateFolder_Holder")}}),e("#Form_ConfirmFolderForm_FolderID_Holder .treedropdownfield.is-open,#Form_ItemEditForm_FolderID .treedropdownfield.is-open").entwine({onunmatch(){const o=e(this).closest("#Form_ConfirmFolderForm").data("adminUrl"),r=a.default.parse((0,s.joinUrlPaths)(o,"user-forms/getfoldergrouppermissions")),t=m.default.parse(r.query);t.FolderID=e(this).find("input[name=FolderID]").val();const d=a.default.format({...r,search:m.default.stringify(t)});return fetch(d,{credentials:"same-origin"}).then((e=>e.json())).then((o=>(e(this).siblings(".form__field-description").html(o),e(this).parent().siblings(".form__field-description").html(o),o))).catch((e=>{i.default.noticeAdd({text:e.message,stay:!1,type:"error"})}))}}),e(".uf-field-editor .ss-gridfield-items .dropdown.editable-column-field.form-group--no-label:not([data-folderconfirmed='1'])").entwine({onchange(){if("SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFileField"!==this.get(0).value)return;if(e(".uf-field-editor .ss-gridfield-items .dropdown.editable-column-field.form-group--no-label[data-folderconfirmed='1']").length)return;let o=e("#confirm-folder__dialog-wrapper");o.length&&o.remove(),o=e('<div id="confirm-folder__dialog-wrapper" />');const r=e(this).closest("tr").data("id"),t=e(this).closest(".uf-field-editor").data("adminUrl");o.data("id",r),o.data("adminUrl",t),e("body").append(o),o.open()}}),e("#confirm-folder__dialog-wrapper").entwine({ReactRoot:null,onunmatch(){this._clearModal()},open(){this._renderModal(!0)},close(o){if(!o){const o=e("#confirm-folder__dialog-wrapper").data("id");e(`.ss-gridfield-item[data-id='${o}'] .dropdown.editable-column-field.form-group--no-label[data-folderconfirmed='0']`).val("SilverStripe\\UserForms\\Model\\EditableFormField\\EditableTextField")}this._renderModal(!1)},_renderModal(o){var r=this;const i=t.default._t("UserForms.FILE_CONFIRMATION_TITLE","Select file upload folder"),n=e(this).data("id"),c=e(this).data("adminUrl"),u=a.default.parse((0,s.joinUrlPaths)(c,"user-forms/confirmfolderformschema")),F=m.default.parse(u.query);F.ID=n;const p=a.default.format({...u,search:m.default.stringify(F)});let _=this.getReactRoot();_||(_=(0,l.createRoot)(this[0]),this.setReactRoot(_)),_.render(d.default.createElement(f,{title:i,isOpen:o,onSubmit:function(){return r._handleSubmitModal(...arguments)},onClosed:function(){return r._handleHideModal(...arguments)},schemaUrl:p,bodyClassName:"modal__dialog",className:"confirm-folder-modal",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good",identifier:"UserForms.ConfirmFolder"}))},_clearModal(){const e=th
|