"use strict";
exports.id = 398;
exports.ids = [398];
exports.modules = {

/***/ 8398:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ UserTable)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _cromwell_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1815);
/* harmony import */ var _cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4536);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _components_entity_entityTable_EntityTable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(256);
/* harmony import */ var _constants_PageInfos__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(379);
/* harmony import */ var _helpers_addressParser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9177);
/* harmony import */ var _helpers_customEntities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4531);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_entity_entityTable_EntityTable__WEBPACK_IMPORTED_MODULE_4__, _helpers_customEntities__WEBPACK_IMPORTED_MODULE_6__]);
([_components_entity_entityTable_EntityTable__WEBPACK_IMPORTED_MODULE_4__, _helpers_customEntities__WEBPACK_IMPORTED_MODULE_6__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);








function UserTable() {
    const client = (0,_cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__.getGraphQLClient)();
    const [roles, setRoles] = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)([]);
    const init = async ()=>{
        try {
            const roles = await (0,_cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__.getGraphQLClient)().getRoles({
                pagedParams: {
                    pageSize: 1000
                }
            });
            setRoles(roles?.elements ?? []);
        } catch (error) {
            console.error(error);
        }
    };
    (0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{
        init();
    }, []);
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_entity_entityTable_EntityTable__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
        entityCategory: _cromwell_core__WEBPACK_IMPORTED_MODULE_1__.EDBEntity.User,
        entityListRoute: _constants_PageInfos__WEBPACK_IMPORTED_MODULE_5__/* .userListPageInfo.route */ .sG.route,
        entityBaseRoute: _constants_PageInfos__WEBPACK_IMPORTED_MODULE_5__/* .userPageInfo.baseRoute */ .Uu.baseRoute,
        listLabel: "Users",
        entityLabel: "User",
        nameProperty: "fullName",
        getMany: client.getUsers,
        deleteOne: client.deleteUser,
        deleteMany: client.deleteManyUsers,
        columns: [
            {
                name: "avatar",
                label: "Avatar",
                type: "Image",
                visible: true,
                getValueView: (value)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                        style: {
                            height: "40px",
                            width: "40px",
                            borderRadius: "100%",
                            backgroundPosition: "center",
                            backgroundSize: "cover",
                            backgroundImage: `url(${value})`
                        }
                    })
            },
            {
                name: "fullName",
                label: "Name",
                type: "Simple text",
                visible: true
            },
            {
                name: "email",
                label: "Email",
                type: "Simple text",
                visible: true
            },
            {
                name: "roles",
                label: "Role",
                type: "Simple text",
                exactSearch: true,
                customGraphQlFragment: "roles {\n id\n name\n title\n }\n",
                getValueView: (value)=>value?.map((r)=>r.title).join(", "),
                getTooltipValueView: (value)=>value?.map((r)=>r.title).join(", "),
                searchOptions: roles.map((role)=>({
                        value: role.name,
                        label: role.title
                    })),
                applyFilter: (value, filter)=>{
                    filter.roles = [
                        value
                    ].filter(Boolean);
                    return filter;
                },
                visible: true
            },
            ..._helpers_customEntities__WEBPACK_IMPORTED_MODULE_6__/* .baseEntityColumns.map */ .xz.map((col)=>{
                if (col.name === "createDate") return {
                    ...col,
                    visible: true
                };
                return {
                    ...col,
                    visible: false
                };
            }),
            {
                name: "phone",
                label: "Phone",
                type: "Simple text",
                visible: false
            },
            {
                name: "address",
                label: "Address",
                type: "Simple text",
                visible: false,
                getValueView: _helpers_addressParser__WEBPACK_IMPORTED_MODULE_7__/* .getValueView */ .Gy,
                getTooltipValueView: _helpers_addressParser__WEBPACK_IMPORTED_MODULE_7__/* .getTooltipValueView */ .WF
            }
        ]
    });
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ })

};
;