"use strict";(self.webpackChunkhws_app_import_export=self.webpackChunkhws_app_import_export||[]).push([[665],{665:(e,n,o)=>{o.r(n),o.d(n,{default:()=>u});var t=o(4848),r=o(7963),i=o(6782),a=o(2822),l=o(6302),c=o(8361),s=o(7201);const u=({collection:e,queryData:n,attributes:o})=>{const{enqueueSnackbar:u}=(0,l.useSnackbar)(),[d,p]=(0,i.useState)(!1);return(0,t.jsxs)(r.Button,Object.assign({className:"whitespace-nowrap mx-4",variant:"contained",color:"secondary",disabled:d,onClick:()=>{return t=void 0,r=void 0,l=function*(){var t;Object.assign([],n).forEach(e=>{var n,t,r,i,a,l;if(3!==e.Condition)e.Value=null===(r=null===(t=null===(n=null===window||void 0===window?void 0:window.HWS)||void 0===n?void 0:n.Utils)||void 0===t?void 0:t.Data)||void 0===r?void 0:r.EncodeAttribute(e.Name,e.Value,o);else{let n=e.Value.split(",");for(let t=0;t<n.length;t++)n[t]=null===(l=null===(a=null===(i=null===window||void 0===window?void 0:window.HWS)||void 0===i?void 0:i.Utils)||void 0===a?void 0:a.Data)||void 0===l?void 0:l.EncodeAttribute(e.Name,n[t].trim(),o);e.Value=n}}),p(!0);try{let o=yield(0,c.G8)(a.o.ExportExcel.action,{Collection:e,Parameters:n,Locale:navigator.language});if(o.Success&&null!=o.Data){const{Base64:e,ContentType:n,FileName:t}=o.Data,r=atob(e),i=new Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);const a=new Uint8Array(i),l=new Blob([a],{type:n}),c=document.createElement("a");c.href=URL.createObjectURL(l),c.download=t||"download.xlsx",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(c.href)}else u((0,s.s)(null!==(t=null==o?void 0:o.Message)&&void 0!==t?t:""),{variant:"error"});return o}catch(e){u(e,{variant:"error"})}finally{p(!1)}},new((i=void 0)||(i=Promise))(function(e,n){function o(e){try{c(l.next(e))}catch(e){n(e)}}function a(e){try{c(l.throw(e))}catch(e){n(e)}}function c(n){var t;n.done?e(n.value):(t=n.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}c((l=l.apply(t,r||[])).next())});var t,r,i,l}},{children:[(0,s.s)("HWS_APP_IMPORT_EXPORT_EXPORT"),d&&(0,t.jsx)(r.CircularProgress,{style:{marginLeft:"3px"},size:"2rem"})]}))}},2822:(e,n,o)=>{o.d(n,{o:()=>t});const t={ImportExcel:{action:"HWS_APP_IMPORT_EXPORT_IMPORT_EXCEL",description:"Import Excel",inputInterface:"interface ImportExcelModel\n    {\n        Collection: string;\n        File: any;\n        IncludeDefaultAttributes?: boolean;\n    }",example:{Collection:"Users",File:null}},ExportExcel:{action:"HWS_APP_IMPORT_EXPORT_EXPORT_EXCEL",description:"Export Excel",inputInterface:"interface ExportExcelModel\n    {\n        Collection: string;\n        Parameters: any;\n        SelectSettings?: boolean;\n    }",example:{Collection:"Users",Parameters:[]}},GetTemplate:{action:"HWS_APP_IMPORT_EXPORT_GET_TEMPLATE",description:"Get Template",inputInterface:"interface ExportExcelModel\n    {\n        Collection: string;\n        Parameters: any;\n        SelectSettings?: boolean;\n    }",example:{Collection:"Users",Parameters:[]}}}},7201:(e,n,o)=>{o.d(n,{s:()=>t,u:()=>r});const t=e=>{var n,o,t;return null!==(t=null===(o=null===(n=null===window||void 0===window?void 0:window.HWS)||void 0===n?void 0:n.I18n)||void 0===o?void 0:o.t(e))&&void 0!==t?t:e},r=(e,n)=>{let o=t(e);if(!n)return o;const r=n.split(":").map(e=>t(e.trim())).join(" : ");return r?`${o}${r}`:o}},8361:(e,n,o)=>{function t(e){const n=window;if(n.core&&n.core[e])return n.core[e];console.warn(`[coreExports] window.core.${String(e)} not ready`)}o.d(n,{EA:()=>a,G8:()=>i,ri:()=>r}),t("Error404Page"),t("FusePageCarded"),t("FuseLoading"),t("FuseDialog");const r=t("FuseSvgIcon"),i=(t("FusePageSimple"),t("FuseSplashScreen"),t("NavLinkAdapter"),t("Store"),t("UnAuthorized"),t("useThemeMediaQuery"),t("ErrorBoundary"),t("FuseLayout"),t("FuseTheme"),t("ThemeLayouts"),t("BrowserRouter"),t("FuseUtils"),t("WithRouter"),t("History"),t("HUIDynamic"),t("HWSRoutes"),t("HWSContext"),t("HorizechWorkspaceProvider"),t("useHorizechWorkspace"),t("RunAction")),a=t("RunFormAction");t("APIResult")}}]);