"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk"] = self["webpackChunk"] || []).push([["react-ui-ext"],{

/***/ "../react-ui/ext/ErpSearch.tsx":
/*!*************************************!*\
  !*** ../react-ui/ext/ErpSearch.tsx ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ ErpSearch)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/Request */ \"../react-ui/core/Request.tsx\");\n/* harmony import */ var react_select_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-select/async */ \"../react-ui/node_modules/react-select/async/dist/react-select-async.esm.js\");\n/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-select */ \"../react-ui/node_modules/react-select/dist/index-641ee5b8.esm.js\");\n\n\n\n\nconst Option = (innerProps, isDisabled) => {\n  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_select__WEBPACK_IMPORTED_MODULE_3__.c.Option, innerProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, innerProps.data.label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n    className: \"text-xs\"\n  }, innerProps.data.description), innerProps.data.APP_SHORT_NAME ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n    className: \"badge badge-extra-small text-xs\"\n  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n    className: \"pr-2 fas fa-\" + innerProps.data.APP_ICON\n  }), innerProps.data.APP_SHORT_NAME) : null);\n};\nclass ErpSearch extends react__WEBPACK_IMPORTED_MODULE_0__.Component {\n  constructor(props) {\n    super(props);\n    this.searchRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n    globalThis.hubleto.reactElements['global-fulltext-search'] = this;\n    this.state = {\n      // query: '',\n      results: null\n    };\n  }\n  loadOptions(inputValue = null, callback = null) {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_1__[\"default\"].post(this.props.endpoint, {\n      ...this.props.endpointParams,\n      query: inputValue\n    }, {}, results => {\n      this.setState({\n        results: results\n      });\n      if (callback) callback(Object.values(results ?? {}));\n    });\n  }\n  onChange(item) {\n    // let query = this.state.query;\n    if (item) {\n      if (item.url) {\n        location.href = globalThis.hubleto.config.projectUrl + '/' + item.url;\n      }\n      // if (item.autocomplete) {\n      //   console.log('setva', {id: 0, label: item.autocomplete});\n      //   this.searchRef.current.setValue({id: 0, label: item.autocomplete});\n      //   this.searchRef.current\n      // }\n    }\n    // this.setState({query: query});\n  }\n  render() {\n    // console.log('q', this.state.query);\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_select_async__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n    // value={{\n    //   id: 0,\n    //   label: this.state.query\n    // }}\n    , {\n      ref: this.searchRef,\n      isClearable: true\n      // inputValue={this.state.query}\n      // defaultInputValue=\"Type Ctrl+K to start searching...\"\n      ,\n      loadOptions: (inputValue, callback) => this.loadOptions(inputValue, callback),\n      getOptionLabel: option => {\n        return option.label;\n      },\n      getOptionValue: option => {\n        return option.id;\n      }\n      // onKeyDown={(e: any) => { console.log(this.searchRef.current.getValue()); }}\n      ,\n      onChange: item => {\n        this.onChange(item);\n      },\n      components: {\n        Option\n      },\n      placeholder: globalThis.hubleto.translate('[Ctrl+K] Search in Hubleto...', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\ErpSearch'),\n      noOptionsMessage: () => globalThis.hubleto.translate('No options', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\ErpSearch'),\n      className: \"hubleto-lookup\",\n      styles: {\n        menuPortal: base => ({\n          ...base,\n          zIndex: 9999\n        })\n      },\n      menuPosition: \"fixed\",\n      menuPortalTarget: document.body\n    }));\n  }\n}\n\n//# sourceURL=webpack:///../react-ui/ext/ErpSearch.tsx?\n}");

/***/ }),

/***/ "../react-ui/ext/ErpWorkflowSelector.tsx":
/*!***********************************************!*\
  !*** ../react-ui/ext/ErpWorkflowSelector.tsx ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ ErpWorkflowSelector),\n/* harmony export */   updateFormWorkflowByTag: () => (/* binding */ updateFormWorkflowByTag)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_TranslatedComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/TranslatedComponent */ \"../react-ui/core/TranslatedComponent.tsx\");\n/* harmony import */ var primereact_progressbar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/progressbar */ \"../react-ui/node_modules/primereact/progressbar/progressbar.esm.js\");\n/* harmony import */ var _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hubleto/react-ui/core/Request */ \"../react-ui/core/Request.tsx\");\n\n\n\n\nclass ErpWorkflowSelector extends _hubleto_react_ui_core_TranslatedComponent__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n  translationContext = 'Hubleto\\\\App\\\\Community\\\\Workflow\\\\Loader\\\\Loader';\n  translationContextInner = 'Components\\\\ErpWorkflowSelector';\n  constructor(props) {\n    super(props);\n    this.state = this.getStateFromProps(props);\n  }\n  getStateFromProps(props) {\n    return {\n      workflows: null,\n      history: null,\n      changeWorkflow: false,\n      initialLoad: true,\n      readonly: this.props.readonly\n    };\n  }\n  componentDidMount() {\n    this.loadData();\n  }\n  loadData(onSuccess) {\n    const R = this.props.parentForm.state.record ?? {};\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_3__[\"default\"].post('workflow/api/get-workflows', {\n      model: this.props.parentForm.props.model,\n      recordId: R.id\n    }, {}, data => {\n      if (this.state.initialLoad == true) {\n        // sets the original record to include WORKFLOW_HISTORY\n        this.props.parentForm.setRecord({\n          ...this.props.parentForm.state.record,\n          WORKFLOW_HISTORY: data.history\n        });\n        this.setState({\n          initialLoad: false\n        });\n      } else {\n        this.props.parentForm.updateRecord({\n          ...this.props.parentForm.state.record,\n          WORKFLOW_HISTORY: data.history\n        });\n      }\n      this.setState({\n        workflows: data.workflows,\n        history: data.history\n      });\n      if (onSuccess) onSuccess();\n    });\n  }\n  onWorkflowChange(idWorkflow) {\n    if (this.state.readonly) return;\n    this.setState({\n      idWorkflow: idWorkflow,\n      changeWorkflow: false\n    }, () => {\n      this.props.parentForm.updateRecord({\n        id_workflow: String(idWorkflow)\n      }, () => {\n        this.loadData(() => {\n          if (this.props.onWorkflowChange) {\n            this.props.onWorkflowChange(idWorkflow, 0);\n          }\n        });\n      });\n    });\n  }\n  onWorkflowStepChange(idWorkflowStep, step) {\n    if (this.state.readonly) return;\n    this.setState({\n      idWorkflowStep: idWorkflowStep\n    }, () => {\n      this.props.parentForm.updateRecord({\n        id_workflow_step: String(idWorkflowStep)\n      }, () => {\n        if (this.props.onWorkflowStepChange) {\n          this.props.onWorkflowStepChange(idWorkflowStep, step);\n        }\n      });\n    });\n  }\n  render() {\n    if (!this.state.workflows) {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(primereact_progressbar__WEBPACK_IMPORTED_MODULE_2__.ProgressBar, {\n        mode: \"indeterminate\",\n        style: {\n          height: '8px'\n        }\n      });\n    }\n    const R = this.props.parentForm.state.record ?? {};\n    const workflows = this.state.workflows;\n    const history = this.state.history.filter(item => item.id_workflow_step == R.id_workflow_step);\n    const steps = workflows ? workflows[R.id_workflow]?.STEPS : null;\n    let stepBtnClass = \"btn-light\";\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex flex-row flex-wrap\"\n    }, this.state.changeWorkflow ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex gap-2 items-center\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"input-body\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"hubleto component input\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"inner\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"input-element\"\n    }, Object.keys(workflows).map((idWorkflow, key) => {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n        key: key,\n        className: \"btn \" + (R.id_workflow == idWorkflow ? \"btn-primary\" : \"btn-transparent\"),\n        onClick: () => {\n          this.onWorkflowChange(idWorkflow);\n        }\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n        className: \"text\"\n      }, workflows[idWorkflow]?.name));\n    })))))) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex gap-2\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex flex-col\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex items-center flex-col items-start\"\n    }, steps && steps.length > 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, steps.map((s, i) => {\n      if (stepBtnClass == \"btn-primary\") stepBtnClass = \"btn-transparent\";else if (s.id == R.id_workflow_step) stepBtnClass = \"btn-primary\";\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n        key: i,\n        onClick: () => this.onWorkflowStepChange(s.id, s),\n        className: `btn btn-small ${stepBtnClass} border-none rounded-none`\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"icon p-0\",\n        style: {\n          borderTop: '1em solid transparent',\n          borderBottom: '1em solid transparent',\n          borderLeft: '1em solid ' + s.color\n        }\n      }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"text\"\n      }, s.name));\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"text-xs text-gray-400 flex gap-2\"\n    }, this.state.readonly ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-lock\"\n    }) : null, history[0] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, this.translate('Last update: {{ date }} by {{ user }}', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\ErpWorkflowSelector').replace('{{ date }}', history[0].datetime_change).replace('{{ user }}', history[0].USER?.nick ?? this.translate('unknown', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\ErpWorkflowSelector'))) : null, this.state.readonly ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n      href: \"#\",\n      onClick: () => {\n        this.setState({\n          changeWorkflow: true\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text\"\n    }, this.translate('Change workflow', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\ErpWorkflowSelector'))))) : this.state.readonly ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n      className: \"btn btn-primary-outline btn-small\",\n      onClick: () => {\n        this.setState({\n          changeWorkflow: true\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-timeline\"\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text\"\n    }, this.translate('Change workflow', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\ErpWorkflowSelector')))))))));\n  }\n}\nfunction updateFormWorkflowByTag(form, tag, onsuccess) {\n  _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_3__[\"default\"].post('workflow/api/get-workflow-step-by-tag', {\n    idWorkflow: form.state.record.id_workflow,\n    tag: tag\n  }, {}, result => {\n    form.updateRecord({\n      id_workflow_step: result.id\n    }, () => {\n      if (onsuccess) onsuccess();\n    });\n  });\n}\n\n//# sourceURL=webpack:///../react-ui/ext/ErpWorkflowSelector.tsx?\n}");

/***/ }),

/***/ "../react-ui/ext/FormExtended.tsx":
/*!****************************************!*\
  !*** ../react-ui/ext/FormExtended.tsx ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ FormExtended)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/Form */ \"../react-ui/core/Form.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hubleto/react-ui/core/Request */ \"../react-ui/core/Request.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_HtmlFrame__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hubleto/react-ui/core/HtmlFrame */ \"../react-ui/core/HtmlFrame.tsx\");\n/* harmony import */ var _hubleto_react_ui_ext_ErpWorkflowSelector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @hubleto/react-ui/ext/ErpWorkflowSelector */ \"../react-ui/ext/ErpWorkflowSelector.tsx\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! moment */ \"../react-ui/node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_5__);\n\n\n\n\n\n//@ts-ignore\n\n\nclass FormExtended extends _hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n  static defaultProps = {\n    ..._hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__[\"default\"].defaultProps\n  };\n  constructor(props) {\n    super(props);\n    this.state = this.getStateFromProps(props);\n  }\n  getParentApp() {\n    if (typeof this.parentApp == 'string') return globalThis.hubleto.getApp(this.parentApp);else return this.parentApp;\n  }\n  getTabsLeft() {\n    return [];\n  }\n  getCustomTabs() {\n    const customTabs = this.getParentApp()?.getCustomFormTabs() ?? [];\n    return customTabs;\n  }\n  getTabsRight() {\n    let tabs = [];\n    if (this.props.renderPreviewUi) {\n      tabs.push({\n        uid: 'preview',\n        icon: 'fas fa-print',\n        cssClass: 'btn-violet',\n        position: 'right'\n      });\n    }\n    return tabs;\n  }\n  getTabs() {\n    return [...this.getTabsLeft(), ...this.getCustomTabs(), ...this.getTabsRight()];\n  }\n  getStateFromProps(props) {\n    return {\n      ...super.getStateFromProps(props),\n      isInlineEditing: true,\n      icon: this.props.icon,\n      tabs: this.getTabs()\n    };\n  }\n  getTitleAsText() {\n    return this.props.model.split('/').pop() + ' ' + this.state.record.id;\n  }\n  updatePreview(idTemplate) {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post('documents/api/get-preview-html', {\n      model: this.props.model,\n      recordId: this.state.record.id,\n      idTemplate: idTemplate\n    }, {}, result => {\n      this.setState({\n        htmlPreview: result.html\n      });\n    });\n  }\n  showPreviewVars() {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post('documents/api/get-preview-vars', {\n      model: this.props.model,\n      recordId: this.state.record.id\n    }, {}, vars => {\n      this.setState({\n        htmlPreview: '<pre>' + JSON.stringify(vars.vars, null, 2) + '</pre>'\n      });\n    });\n  }\n  generatePdf() {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post('documents/api/generate-pdf', {\n      model: this.props.model,\n      recordId: this.state.record.id,\n      documentName: this.getTitleAsText()\n    }, {}, result => {\n      // if (result.idDocument) {\n      //   window.open(globalThis.hubleto.config.projectUrl + '/documents/' + result.idDocument);\n      // }\n      // this.reload();\n      if (result && result.pdfFile) {\n        this.updateRecord({\n          idDocument: result.idDocument,\n          pdf: result.pdfFile\n        });\n      }\n    });\n  }\n  onTabChange() {\n    super.onTabChange();\n    const tabUid = this.state.activeTabUid;\n    switch (tabUid) {\n      case 'preview':\n        this.updatePreview(this.state.record.id_template);\n        break;\n    }\n  }\n  onAfterSaveRecord(saveResponse, customSaveOptions) {\n    super.onAfterSaveRecord(saveResponse, customSaveOptions);\n    if (this.props.junctionSaveEndpoint && this.props.junctionModel && this.props.junctionSourceColumn && this.props.junctionDestinationColumn && this.props.junctionSourceRecordId) {\n      _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post(this.props.junctionSaveEndpoint, {\n        junctionModel: this.props.junctionModel,\n        junctionSourceColumn: this.props.junctionSourceColumn,\n        junctionDestinationColumn: this.props.junctionDestinationColumn,\n        junctionSourceRecordId: this.props.junctionSourceRecordId,\n        junctionDestinationRecordId: saveResponse.savedRecord['id']\n      }, {}, data => {/* */});\n    }\n  }\n  renderHeaderLeft() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex gap-2 items-center\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"hidden md:block\"\n    }, this.state.icon ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: this.state.icon + ' text-3xl text-primary/20 m-2'\n    }) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex flex-col gap-2\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex\"\n    }, super.renderHeaderLeft()))));\n  }\n  renderFooter() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, this.state.record.id > 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n      className: \"btn btn-primary-outline\",\n      href: globalThis.hubleto.config.projectUrl + '/ai-assistant?model=' + this.props.model + '&id=' + this.state.record.id,\n      target: \"_blank\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-wand-magic-sparkles\"\n    }))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"w-full flex justify-between flex-col md:flex-row\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex gap-2 items-center dark:text-white\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, \"#\", this.state.record.id), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, this.renderPrevRecordButton()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, this.renderNextRecordButton()), this.state.recordChanged ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"badge badge-small badge-warning block \"\n    }, this.translate('unsaved changes', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\FormExtended')) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex gap-2 items-center\"\n    }, this.getRecordFormUrl() ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n      className: \"text-sm text-gray-500 text-nowrap\",\n      title: this.translate('Open in new tab', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\FormExtended'),\n      href: globalThis.hubleto.config.projectUrl + '/' + this.getRecordFormUrl(),\n      target: \"_blank\"\n    }, globalThis.hubleto.config.projectUrl + '/' + this.getRecordFormUrl()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n      className: \"btn btn-transparent\",\n      title: this.translate('Copy link to clipboard', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\FormExtended'),\n      onClick: () => {\n        navigator.clipboard.writeText(globalThis.hubleto.config.projectUrl + '/' + this.getRecordFormUrl());\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-copy\"\n    })))) : null, this.state.description && this.state.description.inputs && this.state.description.inputs.shared_with ? this.input('shared_with') : null), this.props.junctionModel ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"badge flex gap-2\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-link\"\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, this.props.junctionTitle), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, \"#\", this.props.junctionSourceRecordId, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex gap-2\"\n    }, this.renderCopyButton(), this.renderDeleteButton())));\n  }\n  renderWorkflowUi() {\n    return this.state.id <= 0 ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex grow p-2 bg-gradient-to-b from-gray-50 to-white dark:from-gray-900 dark:to-gray-800\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex-2\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hubleto_react_ui_ext_ErpWorkflowSelector__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n      parentForm: this,\n      readonly: this.state.record.id_manager && this.state.record.id_manager != globalThis.hubleto.idUser\n    })), this.state.description && this.state.description.inputs && this.state.description.inputs.is_closed ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"text-right\"\n    }, this.inputWrapper('is_closed', {\n      wrapperCssClass: 'flex gap-2'\n    })) : null);\n  }\n  renderOwnerManagerUi() {\n    const idOwner = this.state.record.id_owner;\n    const owner = globalThis.hubleto.users ? globalThis.hubleto.users[idOwner] : null;\n    const idManager = this.state.record.id_manager;\n    const manager = globalThis.hubleto.users ? globalThis.hubleto.users[idManager] : null;\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"p-2 flex flex-col\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"btn-group flex-col\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"btn btn-transparent\",\n      onClick: () => {\n        this.setState({\n          showOwnerManagerSelector: !this.state.showOwnerManagerSelector\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text flex gap-2\"\n    }, owner ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text-xs text-gray-500\"\n    }, \"Owner\"), owner.photo ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"img\", {\n      src: globalThis.hubleto.config.uploadUrl + '/' + owner.photo,\n      className: \"max-w-4 max-h-4 rounded-xl\"\n    }) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text-xs\"\n    }, Array.from(owner.first_name ?? '')[0].toString() + Array.from(owner.last_name ?? '')[0].toString() + (owner.id == globalThis.hubleto.idUser ? ' (you) ' : ''))) : '-')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"btn btn-transparent\",\n      onClick: () => {\n        this.setState({\n          showOwnerManagerSelector: !this.state.showOwnerManagerSelector\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text flex gap-2\"\n    }, manager ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text-xs text-gray-500\"\n    }, \"Manager\"), manager.photo ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"img\", {\n      src: globalThis.hubleto.config.uploadUrl + '/' + manager.photo,\n      className: \"max-w-4 max-h-4 rounded-xl\"\n    }) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text-xs\"\n    }, Array.from(manager.first_name ?? '')[0].toString() + Array.from(manager.last_name ?? '')[0].toString() + (manager.id == globalThis.hubleto.idUser ? ' (you) ' : ''))) : '-'))), this.state.showOwnerManagerSelector ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"relative w-0 h-0\",\n      style: {\n        zIndex: 99999999999\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"mt-2 shadow min-w-64 border border-primary bg-white rounded\"\n    }, this.inputWrapper('id_owner'), this.inputWrapper('id_manager'))) : null);\n  }\n  renderTopMenu() {\n    const topMenu = super.renderTopMenu();\n    const dynamicMenu = globalThis.hubleto.injectDynamicContent(this.constructor.name + ':TopMenu', {\n      form: this\n    });\n    let topMenuWithDynamicMenu = null;\n    if (topMenu != null || dynamicMenu != null) {\n      topMenuWithDynamicMenu = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, topMenu, \" \", dynamicMenu);\n    }\n    let workflowUi = null;\n    if (this.props.renderWorkflowUi) {\n      workflowUi = this.renderWorkflowUi();\n    }\n    let ownerManagerUi = null;\n    if (this.props.renderOwnerManagerUi) {\n      ownerManagerUi = this.renderOwnerManagerUi();\n    }\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex flex-col\"\n    }, topMenuWithDynamicMenu, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex justify-between\"\n    }, ownerManagerUi, workflowUi));\n  }\n  renderTimeline(timelineConfig) {\n    let timeline = null;\n    let timelinePointsUnsorted = {};\n    timelineConfig.map((aboutEntry, key) => {\n      const entries = aboutEntry.data(this) ?? [];\n      entries.map((entry, key) => {\n        timelinePointsUnsorted[aboutEntry.timestampFormatter(entry)] = {\n          icon: aboutEntry.icon,\n          color: aboutEntry.color,\n          value: aboutEntry.valueFormatter ? aboutEntry.valueFormatter(entry) : null,\n          userName: aboutEntry.userNameFormatter ? aboutEntry.userNameFormatter(entry) : null\n        };\n      });\n    });\n    let timelinePoints = Object.keys(timelinePointsUnsorted).sort() // Sort the keys alphabetically\n    .reverse().reduce((obj, key) => {\n      obj[key] = timelinePointsUnsorted[key]; // Rebuild the object with sorted keys\n      return obj;\n    }, {});\n    if (JSON.stringify(timelinePoints) != '{}') {\n      let now = moment__WEBPACK_IMPORTED_MODULE_5___default()();\n      timeline = Object.keys(timelinePoints).map(key => {\n        const days = moment__WEBPACK_IMPORTED_MODULE_5___default()(now).diff(moment__WEBPACK_IMPORTED_MODULE_5___default()(key), 'days');\n        const entry = timelinePoints[key];\n        now = moment__WEBPACK_IMPORTED_MODULE_5___default()(key);\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, days <= 0 ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"badge text-xs\"\n        }, days, \" day(s)\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"\\r flex items-center p-2 border-l border-l-4 overflow-hidden hover:shadow-sm\\r justify-center bg-white\\r \",\n          style: {\n            borderColor: entry.color\n          }\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"text-xs font-bold text-nowrap\"\n        }, key), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"p-2 text-center text-xs\"\n        }, entry.value)));\n      });\n    }\n    if (timeline) {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"card card-body max-w-92 m-auto\"\n      }, timeline);\n    } else {\n      return null;\n    }\n  }\n  renderTab(tabUid) {\n    const R = this.state.record;\n    switch (tabUid) {\n      case 'preview':\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"flex gap-2 h-full\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"flex-1 w-72 flex flex-col gap-2\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"grow\"\n        }, this.inputWrapper('id_template', {\n          uiStyle: 'buttons-vertical',\n          onChange: input => {\n            this.updatePreview(input.state.value);\n          }\n        })), this.inputWrapper('id_document', {\n          readonly: true\n        })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"flex-3 flex flex-col\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"flex gap-2 align-center justify-end\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, this.input('pdf', {\n          readonly: true\n        })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"flex gap-2\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n          className: \"btn btn-transparent mb-4\",\n          onClick: () => {\n            this.generatePdf();\n          }\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"icon\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n          className: \"fas fa-download\"\n        })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"text\"\n        }, this.translate('Export to PDF'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n          className: \"btn btn-transparent mb-4\",\n          onClick: () => {\n            const iframe = window.frames[this.props.uid + '_preview'];\n            const origDocumentTitle = document.title;\n            document.title += this.getTitleAsText();\n            iframe.contentWindow.focus();\n            iframe.contentWindow.print();\n            document.title = origDocumentTitle;\n          }\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"icon\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n          className: \"fas fa-print\"\n        })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"text\"\n        }, this.translate('Print'))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"w-full h-full card mt-2\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"card-body\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hubleto_react_ui_core_HtmlFrame__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n          className: \"w-full h-full\",\n          iframeId: this.props.uid + '_preview',\n          content: this.state.htmlPreview\n        })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"card-footer\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n          href: \"#\",\n          onClick: () => {\n            this.showPreviewVars();\n          }\n        }, this.translate('Show variables available in template'))))));\n        // removed by dead control flow\n\n      default:\n        return super.renderTab(tabUid);\n        // removed by dead control flow\n\n    }\n  }\n}\n\n//# sourceURL=webpack:///../react-ui/ext/FormExtended.tsx?\n}");

/***/ }),

/***/ "../react-ui/ext/TableExtended.tsx":
/*!*****************************************!*\
  !*** ../react-ui/ext/TableExtended.tsx ***!
  \*****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ TableExtended)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_Table__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/Table */ \"../react-ui/core/Table.tsx\");\n/* harmony import */ var _FormExtended__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FormExtended */ \"../react-ui/ext/FormExtended.tsx\");\n/* harmony import */ var _TableExtendedExportCsvForm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TableExtendedExportCsvForm */ \"../react-ui/ext/TableExtendedExportCsvForm.tsx\");\n/* harmony import */ var _TableExtendedImportCsvForm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TableExtendedImportCsvForm */ \"../react-ui/ext/TableExtendedImportCsvForm.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_Helper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hubleto/react-ui/core/Helper */ \"../react-ui/core/Helper.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_ModalForm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @hubleto/react-ui/core/ModalForm */ \"../react-ui/core/ModalForm.tsx\");\n/* harmony import */ var _TableExtendedColumnsCustomize__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TableExtendedColumnsCustomize */ \"../react-ui/ext/TableExtendedColumnsCustomize.tsx\");\n\n\n\n\n\n\n\n\n\nclass TableExtended extends _hubleto_react_ui_core_Table__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n  static defaultProps = {\n    ..._hubleto_react_ui_core_Table__WEBPACK_IMPORTED_MODULE_1__[\"default\"].defaultProps,\n    formUseModalSimple: true\n  };\n  constructor(props) {\n    super(props);\n    this.refExportCsvModal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n    this.refImportCsvModal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n    this.refColumnConfigModal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n    this.refExportCsvForm = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n    this.refImportCsvForm = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n    this.refColumnsConfigScreen = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef();\n  }\n  getStateFromProps(props) {\n    return {\n      ...super.getStateFromProps(props),\n      showExportCsvScreen: false,\n      showImportCsvScreen: false,\n      showColumnConfigScreen: false,\n      collapsedNodeIds: []\n    };\n  }\n  getEndpointParams() {\n    return {\n      ...super.getEndpointParams(),\n      junctionTitle: this.props.junctionTitle,\n      junctionModel: this.props.junctionModel,\n      junctionSourceColumn: this.props.junctionSourceColumn,\n      junctionDestinationColumn: this.props.junctionDestinationColumn,\n      junctionSourceRecordId: this.props.junctionSourceRecordId,\n      junctionSaveEndpoint: this.props.junctionSaveEndpoint ?? 'api/record/save-junction'\n    };\n  }\n  getFormProps() {\n    return {\n      ...super.getFormProps(),\n      junctionTitle: this.props.junctionTitle,\n      junctionModel: this.props.junctionModel,\n      junctionSourceColumn: this.props.junctionSourceColumn,\n      junctionDestinationColumn: this.props.junctionDestinationColumn,\n      junctionSourceRecordId: this.props.junctionSourceRecordId,\n      junctionSaveEndpoint: this.props.junctionSaveEndpoint ?? 'api/record/save-junction'\n    };\n  }\n  getFormModalProps() {\n    if ((0,_hubleto_react_ui_core_Helper__WEBPACK_IMPORTED_MODULE_5__.getUrlParam)('recordId') > 0) {\n      return {\n        ...super.getFormModalProps(),\n        type: 'right'\n      };\n    } else return {\n      ...super.getFormModalProps()\n    };\n  }\n  renderSidebarFilter() {\n    if (this.state?.description?.ui?.filters && !this.state.sidebarFilterHidden) {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"flex flex-col gap-2 text-nowrap\"\n      }, Object.keys(this.state.description.ui.filters).map(filterName => {\n        const filter = this.state.description.ui.filters[filterName];\n        const filterValue = this.state.filters[filterName] ?? filter.default ?? null;\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          key: filterName\n        }, filter.title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"bg-primary/10 p-1 text-sm dark:text-white dark:bg-slate-800\"\n        }, filter.title) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"list dense\" + (filter.direction == \"horizontal\" ? \" horizontal\" : \"\")\n        }, Object.keys(filter.options).map(key => {\n          return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n            key: key,\n            className: \"max-w-60 btn btn-small btn-list-item \" + (filterValue == key ? \"btn-primary\" : \"btn-transparent\") + (filter.direction == \"horizontal\" ? \" text-center\" : \"\"),\n            style: {\n              borderLeft: filter.colors && filter.colors[key] ? '0.5em solid ' + filter.colors[key] : null\n            },\n            onClick: () => {\n              let filters = this.state.filters ?? {};\n              if (filter.type == 'multipleSelectButtons') {\n                if (filterValue) {\n                  if (filterValue.includes(key)) {\n                    filters[filterName] = [];\n                    for (let i in filterValue) {\n                      if (filterValue[i] != key) filters[filterName].push(filterValue[i]);\n                    }\n                  } else {\n                    filters[filterName] = filterValue;\n                    filters[filterName].push(key);\n                  }\n                } else {\n                  filters[filterName] = [key];\n                }\n              } else {\n                if (filters[filterName] == key) {\n                  delete filters[filterName];\n                } else {\n                  filters[filterName] = key;\n                }\n              }\n              if (!this.props.parentForm) {\n                (0,_hubleto_react_ui_core_Helper__WEBPACK_IMPORTED_MODULE_5__.setUrlParam)('filters', filters);\n              }\n              this.setState({\n                recordId: 0,\n                filters: filters\n              }, () => this.reload());\n            }\n          }, filter.type == 'multipleSelectButtons' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n            className: \"icon\"\n          }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", {\n            type: \"checkbox\",\n            checked: filterValue && filterValue.includes(key)\n          })) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n            className: \"text\"\n          }, filter.options[key]));\n        })));\n      }));\n    } else {\n      return null;\n    }\n  }\n  renderForm() {\n    let formProps = this.getFormProps();\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_FormExtended__WEBPACK_IMPORTED_MODULE_2__[\"default\"], formProps);\n  }\n  renderTree(nodes, idParent = 0, level = 0) {\n    if (nodes.length && nodes.length > 0) {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"list\"\n      }, nodes.map((node, index) => {\n        const hasChildren = node.CHILDREN && node.CHILDREN.length > 0;\n        const isExpanded = !this.state.collapsedNodeIds.includes(node.id);\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"list-item\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"flex gap-2 justify-between\"\n        }, hasChildren ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n          className: \"btn btn-transparent btn-list-item w-full\",\n          onClick: () => {\n            let collapsedNodeIds = this.state.collapsedNodeIds;\n            if (collapsedNodeIds.includes(node.id)) {\n              for (let i in collapsedNodeIds) {\n                if (collapsedNodeIds[i] == node.id) {\n                  delete collapsedNodeIds[i];\n                }\n              }\n            } else {\n              collapsedNodeIds.push(node.id);\n            }\n            this.setState({\n              collapsedNodeIds: collapsedNodeIds\n            });\n          }\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"icon\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n          className: 'fas fa-' + (isExpanded ? 'chevron-up' : 'chevron-down')\n        })))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"grow\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n          className: \"btn btn-transparent btn-list-item w-full\",\n          onClick: () => {\n            this.openForm(node.id);\n          }\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"text\"\n        }, node.title)))), hasChildren && isExpanded ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n          className: \"m-4\"\n        }, this.renderTree(node.CHILDREN, node.id, level + 1), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n          className: \"btn btn-transparent btn-list-item w-full\",\n          onClick: () => {\n            this.openForm(-1);\n          }\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"icon\"\n        }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n          className: \"fas fa-plus\"\n        })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n          className: \"text\"\n        }, this.translate('Add new', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\TableExtended')))) : null);\n      }));\n    } else {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null);\n    }\n  }\n  renderDataView() {\n    // console.log('this.state.description?.ui?.dataView', this.state.description?.ui);\n    switch (this.state.description?.ui?.dataView) {\n      case 'tree':\n        return this.renderTree(this.state?.data?.tree);\n        // removed by dead control flow\n\n      default:\n        return super.renderDataView();\n        // removed by dead control flow\n\n    }\n  }\n  renderContent() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, super.renderContent(), this.state.showExportCsvScreen ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hubleto_react_ui_core_ModalForm__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n      ref: this.refExportCsvModal,\n      form: this.refExportCsvForm,\n      uid: this.props.uid + '_export_csv_modal',\n      isOpen: true,\n      type: \"centered large\",\n      onClose: () => {\n        this.setState({\n          showExportCsvScreen: false\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_TableExtendedExportCsvForm__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n      ref: this.refExportCsvForm,\n      modal: this.refExportCsvModal,\n      model: this.props.model,\n      parentTable: this,\n      onClose: () => {\n        this.setState({\n          showExportCsvScreen: false\n        });\n      }\n    })) : null, this.state.showImportCsvScreen ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hubleto_react_ui_core_ModalForm__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n      ref: this.refImportCsvModal,\n      form: this.refImportCsvForm,\n      uid: this.props.uid + '_import_csv_modal',\n      isOpen: true,\n      type: \"centered large\",\n      onClose: () => {\n        this.setState({\n          showImportCsvScreen: false\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_TableExtendedImportCsvForm__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n      ref: this.refImportCsvForm,\n      modal: this.refImportCsvModal,\n      model: this.props.model,\n      parentTable: this,\n      onClose: () => {\n        this.setState({\n          showImportCsvScreen: false\n        });\n      }\n    })) : null, this.state.showColumnConfigScreen ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hubleto_react_ui_core_ModalForm__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n      ref: this.refColumnConfigModal,\n      form: this.refColumnsConfigScreen,\n      uid: this.props.uid + '_columns_config_modal',\n      isOpen: true,\n      type: \"right\",\n      title: this.translate('Customize Columns', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\TableExtended'),\n      onClose: () => {\n        this.setState({\n          showColumnConfigScreen: false\n        });\n      }\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_TableExtendedColumnsCustomize__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n      ref: this.refColumnsConfigScreen,\n      parentTable: this,\n      tableTag: this.props.tag,\n      tableModel: this.model,\n      onClose: () => this.setState({\n        showColumnConfigScreen: false\n      })\n    })) : null);\n  }\n}\n\n//# sourceURL=webpack:///../react-ui/ext/TableExtended.tsx?\n}");

/***/ }),

/***/ "../react-ui/ext/TableExtendedColumnsCustomize.tsx":
/*!*********************************************************!*\
  !*** ../react-ui/ext/TableExtendedColumnsCustomize.tsx ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ TableExtendedColumnsCustomize)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/Request */ \"../react-ui/core/Request.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_TranslatedComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hubleto/react-ui/core//TranslatedComponent */ \"../react-ui/core/TranslatedComponent.tsx\");\n\n\n\nclass TableExtendedColumnsCustomize extends _hubleto_react_ui_core_TranslatedComponent__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n  constructor(props) {\n    super(props);\n    this.state = {\n      record: null,\n      draggedKey: null\n    };\n  }\n  componentDidMount() {\n    this.loadRecord();\n  }\n  loadRecord() {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_1__[\"default\"].get(\"api/get-table-columns-customize\", {\n      model: this.props.tableModel,\n      tag: this.props.tableTag\n    }, res => {\n      if (res.status == \"success\") {\n        this.setState({\n          record: res.data\n        });\n      }\n    });\n  }\n  saveRecord() {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_1__[\"default\"].post(\"api/save-table-columns-customize\", {\n      record: this.state.record,\n      model: this.props.tableModel,\n      tag: this.props.tableTag\n    }, {}, data => {\n      if (data.status == \"success\") {\n        this.props.onClose();\n        this.props.parentTable.loadTableDescription();\n      }\n    });\n  }\n  resetRecord() {\n    _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_1__[\"default\"].post(\"api/reset-table-columns-customize\", {\n      record: this.state.record,\n      model: this.props.tableModel,\n      tag: this.props.tableTag\n    }, {}, data => {\n      if (data.status == \"success\") {\n        this.props.onClose();\n        this.props.parentTable.loadTableDescription();\n      }\n    });\n  }\n  onDragStart = (e, key) => {\n    this.setState({\n      draggedKey: key\n    });\n    e.dataTransfer.effectAllowed = \"move\";\n  };\n  onDragOver = (e, key) => {\n    e.preventDefault();\n    const {\n      draggedKey,\n      record\n    } = this.state;\n    if (draggedKey === key) return;\n    let entries = Object.entries(record);\n    const draggedIdx = entries.findIndex(([k]) => k === draggedKey);\n    const targetIdx = entries.findIndex(([k]) => k === key);\n    const [removed] = entries.splice(draggedIdx, 1);\n    entries.splice(targetIdx, 0, removed);\n    const newItems = Object.fromEntries(entries);\n    this.setState({\n      record: newItems\n    });\n  };\n  onDrop = e => {\n    e.preventDefault();\n    this.setState({\n      draggedKey: null\n    });\n  };\n  renderTitle() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, \"Customize Columns\");\n  }\n  render() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"modal-header active\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"modal-header-left\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n      className: \"btn btn-add\",\n      onClick: () => this.saveRecord()\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-save\"\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text\"\n    }, this.translate('Save', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\TableExtendedColumnsCustomize')))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"modal-header-title\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, this.translate('Customize Columns', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\TableExtendedColumnsCustomize'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"modal-header-right\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n      className: \"btn btn-close\",\n      type: \"button\",\n      \"aria-label\": \"Close\",\n      onClick: this.props.onClose\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-xmark\"\n    }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"shortcut\"\n    }, \"Esc\"))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"modal-body\"\n    }, this.state.record ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"p-2 flex flex-col gap-2\"\n    }, Object.entries(this.state.record).map(\n    //@ts-ignore\n    ([key, {\n      title,\n      is_hidden\n    }]) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"w-[100%]\",\n      key: key,\n      draggable: true,\n      onDragStart: e => this.onDragStart(e, key),\n      onDragOver: e => this.onDragOver(e, key),\n      onDrop: this.onDrop\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n      className: `btn btn-transparent w-[100%]`,\n      onClick: () => this.setState(prevState => ({\n        record: {\n          //@ts-ignore\n          ...prevState.record,\n          [key]: {\n            //@ts-ignore\n            ...prevState.record[key],\n            //@ts-ignore\n            is_hidden: !prevState.record[key].is_hidden\n          }\n        }\n      }))\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"flex flex-row items-center\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: `text-gray-500 fa fa-ellipsis-vertical`\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", {\n      type: \"checkbox\",\n      checked: !is_hidden\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text\"\n    }, title)))))) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"modal-footer\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n      className: \"btn btn-transparent\",\n      onClick: () => this.resetRecord()\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-refresh\"\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text\"\n    }, this.translate('Reset to default', 'Hubleto\\\\Erp\\\\Loader', 'Components\\\\TableExtendedColumnsCustomize')))));\n  }\n}\n\n//# sourceURL=webpack:///../react-ui/ext/TableExtendedColumnsCustomize.tsx?\n}");

/***/ }),

/***/ "../react-ui/ext/TableExtendedExportCsvForm.tsx":
/*!******************************************************!*\
  !*** ../react-ui/ext/TableExtendedExportCsvForm.tsx ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ TableExtendedExportCsvForm)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/Form */ \"../react-ui/core/Form.tsx\");\n\n\nclass TableExtendedExportCsvForm extends _hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n  static defaultProps = {\n    ..._hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__[\"default\"].defaultProps\n  };\n  constructor(props) {\n    super(props);\n    this.state = this.getStateFromProps(props);\n  }\n  getStateFromProps(props) {\n    return {\n      separator: ',',\n      ...super.getStateFromProps(props)\n    };\n  }\n  renderTitle() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, this.translate('Export to CSV')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"small\", null, this.props.model));\n  }\n  renderWarningsOrErrors() {\n    return null;\n  }\n  renderFooter() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null);\n  }\n  renderHeaderLeft() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null);\n  }\n  renderHeaderRight() {\n    return this.renderCloseButton();\n  }\n  getExportParams() {\n    return {\n      separator: this.state.separator,\n      ...this.props.parentTable.getEndpointParams()\n    };\n  }\n  renderContent() {\n    const qs = __webpack_require__(/*! qs */ \"./node_modules/qs/lib/index.js\");\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"p-2\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n      className: \"alert alert-info\"\n    }, \"A CSV file with the following columns and \", this.props.parentTable.state?.data?.total, \" items will be generated\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"table\", {\n      className: \"table-default dense mt-2\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"thead\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"th\", null, this.translate('Column')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"th\", null, this.translate('Type'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"tbody\", null, Object.keys(this.props.parentTable.state.description.columns).map(columnName => {\n      const column = this.props.parentTable.state.description.columns[columnName];\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"tr\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"td\", null, columnName), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"td\", null, column.type));\n    }))), this.inputWrapper('separator', {\n      value: this.state.separator,\n      description: {\n        title: this.translate(\"Separator\")\n      },\n      isInlineEditing: true,\n      onChange: (input, value) => {\n        this.setState({\n          separator: value\n        });\n      }\n    }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n      className: \"btn btn-large mt-2\",\n      href: globalThis.hubleto.config.projectUrl + \"/api/table-export-csv?\" + qs.stringify(this.getExportParams(), {\n        arrayFormat: 'brackets'\n      }),\n      target: \"_blank\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"icon\"\n    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n      className: \"fas fa-download\"\n    })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n      className: \"text\"\n    }, this.translate('Export to CSV'))));\n  }\n}\n\n//# sourceURL=webpack:///../react-ui/ext/TableExtendedExportCsvForm.tsx?\n}");

/***/ }),

/***/ "../react-ui/ext/TableExtendedImportCsvForm.tsx":
/*!******************************************************!*\
  !*** ../react-ui/ext/TableExtendedImportCsvForm.tsx ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ TableExtendedImportCsvForm)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"../react-ui/node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hubleto/react-ui/core/Form */ \"../react-ui/core/Form.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_Inputs_File__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hubleto/react-ui/core/Inputs/File */ \"../react-ui/core/Inputs/File.tsx\");\n/* harmony import */ var _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hubleto/react-ui/core/Request */ \"../react-ui/core/Request.tsx\");\n\n\n\n\nclass TableExtendedImportCsvForm extends _hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n  static defaultProps = {\n    ..._hubleto_react_ui_core_Form__WEBPACK_IMPORTED_MODULE_1__[\"default\"].defaultProps\n  };\n  constructor(props) {\n    super(props);\n    this.refCsvFileInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n    this.state = {\n      ...this.getStateFromProps(props),\n      csvData: '',\n      testResult: null,\n      importResult: null\n    };\n  }\n  renderTitle() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, this.translate('Import to CSV')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"small\", null, this.props.model));\n  }\n  renderWarningsOrErrors() {\n    return null;\n  }\n  renderFooter() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null);\n  }\n  renderHeaderLeft() {\n    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null);\n  }\n  renderHeaderRight() {\n    return this.renderCloseButton();\n  }\n  renderContent() {\n    const csvImportEndpointParams = this.props.parentTable.getCsvImportEndpointParams();\n    if (this.props.parentTable.props.parentForm && !csvImportEndpointParams) {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"alert alert-danger\"\n      }, \"This table does not support CSV import in nested forms.\");\n    } else {\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"p-2\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"alert alert-info\"\n      }, \"How to import:\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"ul\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"li\", {\n        className: \"ml-2\"\n      }, \"\\u2022 Prepare your CSV file. Read \", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n        href: \"\",\n        target: \"_blank\",\n        className: \"btn btn-transparent\"\n      }, this.translate('this guide')), \" to learn how the CSV file shall be structured.\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"li\", {\n        className: \"ml-2\"\n      }, \"\\u2022 Upload the CSV file.\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"li\", {\n        className: \"ml-2\"\n      }, \"\\u2022 Start the import by clicking on \\\"Import from CSV\\\" button.\"))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        style: {\n          zoom: 2\n        }\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hubleto_react_ui_core_Inputs_File__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n        uid: this.props.parentTable.uid + '_import_csv_file',\n        ref: this.refCsvFileInput,\n        onChange: (input, value) => {\n          this.setState({\n            csvData: value.fileData ?? ''\n          });\n          _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_3__[\"default\"].post(\"api/table-import-csv\", {\n            ...csvImportEndpointParams,\n            testImport: true,\n            csvData: value.fileData ?? ''\n          }, {}, result => {\n            this.setState({\n              testResult: result\n            });\n          });\n        },\n        uploadButtonText: \"Select CSV file\",\n        acceptType: ['csv']\n      })), this.state.testResult && this.state.testResult.foundRecords ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"mt-2\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, this.translate('Found following records')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"table\", {\n        className: \"table-default dense\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"thead\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"tr\", null, Object.keys(this.state.testResult.foundRecords[0]).map(colName => {\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"td\", null, colName ?? '');\n      }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"tbody\", null, this.state.testResult.foundRecords.map((record, index) => {\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"tr\", null, Object.keys(record).map(colName => {\n          return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"td\", null, record[colName] ?? '');\n        }));\n      }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, \"CSV file size: \", Math.round(this.state.csvData.length * 100 / 1024) / 100, \" kB\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"mt-2\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"button\", {\n        className: \"btn btn-large mt-2\",\n        onClick: () => {\n          _hubleto_react_ui_core_Request__WEBPACK_IMPORTED_MODULE_3__[\"default\"].post(\"api/table-import-csv\", {\n            ...csvImportEndpointParams,\n            testImport: false,\n            csvData: this.state.csvData\n          }, {}, result => {\n            this.setState({\n              testResult: null,\n              importResult: result\n            });\n            this.props.parentTable.reload();\n          });\n        }\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n        className: \"icon\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"i\", {\n        className: \"fas fa-download\"\n      })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n        className: \"text\"\n      }, \"Run the import !\"))))) : null, this.state.importResult ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"mt-2\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"alert alert-success\"\n      }, \"Imported \", this.state.importResult.importedRecords, \" records.\"), this.state.importResult.failedImports && this.state.importResult.failedImports.length > 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", {\n        className: \"alert alert-danger mt-2\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"b\", null, \"Ooops. There were some errors during import.\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"pre\", {\n        className: \"text-xs overflow-x-auto\"\n      }, JSON.stringify(this.state.importResult.failedImports, null, 2))) : null) : null);\n    }\n  }\n}\n\n//# sourceURL=webpack:///../react-ui/ext/TableExtendedImportCsvForm.tsx?\n}");

/***/ })

}]);