@itilite/iui-user-management 0.3.11 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -947,6 +947,35 @@
947
947
  width: 100%;
948
948
  font-size: initial;
949
949
  }
950
+
951
+ ._2W2Jo {
952
+ min-width: 0px !important;
953
+ }
954
+
955
+ ._31IgO {
956
+ flex: none;
957
+ order: 0;
958
+ flex-grow: 0;
959
+ margin-top: 4px;
960
+ }
961
+
962
+ ._342t1 {
963
+ gap: 12px;
964
+ border: 1px solid #FDE047;
965
+ background-color: #FEFCE8;
966
+ border-radius: 6px;
967
+ padding: 16px;
968
+ word-break: break-word;
969
+ }
970
+
971
+ ._3hgYk {
972
+ position: absolute;
973
+ left: 8.33%;
974
+ right: 8.33%;
975
+ top: 8.33%;
976
+ bottom: 8.33%;
977
+ background: #CA8A04;
978
+ }
950
979
  ._1EFxC {
951
980
  flex: 0.17;
952
981
  max-width: 218px;
@@ -1041,4 +1070,9 @@
1041
1070
  font-family: "Inter", sans-serif;
1042
1071
  font-size: 1rem;
1043
1072
  line-height: 150%;
1073
+ }
1074
+
1075
+ ._3xdGF table tbody tr:first-child {
1076
+ height: 73px;
1077
+ background-color: rgba(0, 0, 0, 0.04);
1044
1078
  }
package/dist/index.js CHANGED
@@ -1789,6 +1789,7 @@ var STOP_LOADER$2 = 'STOP_LOADER';
1789
1789
  var OPEN_DIALOG = 'OPEN_DIALOG';
1790
1790
  var CLOSE_DIALOG = 'CLOSE_DIALOG';
1791
1791
  var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
1792
+ var UNASSIGNED_USERS = 'Not assigned';
1792
1793
 
1793
1794
  var api$3 = utils.configs.api;
1794
1795
  var IUIToastMessageService$2 = utils.services.IUIToastMessageService;
@@ -1984,6 +1985,7 @@ var SET_MODAL = 'SET_MODAL';
1984
1985
  var RESET_EDIT_MODAL = 'RESET_EDIT_MODAL';
1985
1986
  var SET_EDIT_MODAL = 'SET_EDIT_MODAL';
1986
1987
  var UPDATE_CUSTOM_FIELD = 'UPDATE_CUSTOM_FIELD';
1988
+ var SET_DELETE_MODAL = 'SET_DELETE_MODAL';
1987
1989
 
1988
1990
  var api$5 = utils.configs.api;
1989
1991
  var IUIToastMessageService$3 = utils.services.IUIToastMessageService;
@@ -2003,6 +2005,12 @@ var toggleModal = function toggleModal(payload) {
2003
2005
  payload: payload
2004
2006
  };
2005
2007
  };
2008
+ var toggleDeleteModal = function toggleDeleteModal(payload) {
2009
+ return {
2010
+ type: SET_DELETE_MODAL,
2011
+ payload: payload
2012
+ };
2013
+ };
2006
2014
  var resetEditModal = function resetEditModal() {
2007
2015
  return {
2008
2016
  type: RESET_EDIT_MODAL
@@ -2020,6 +2028,12 @@ var setCustomFields = function setCustomFields(payload) {
2020
2028
  payload: payload
2021
2029
  };
2022
2030
  };
2031
+ var removeCustomField = function removeCustomField(payload) {
2032
+ return {
2033
+ type: REMOVE_CUSTOM_FIELD,
2034
+ payload: payload
2035
+ };
2036
+ };
2023
2037
  var updateCustomField = function updateCustomField(payload) {
2024
2038
  return {
2025
2039
  type: UPDATE_CUSTOM_FIELD,
@@ -2051,6 +2065,31 @@ var fetchCustomFields = function fetchCustomFields() {
2051
2065
  });
2052
2066
  };
2053
2067
  };
2068
+ var deleteCustomField = function deleteCustomField(attributeColumn) {
2069
+ return function (dispatch) {
2070
+ return new Promise(function (resolve, reject) {
2071
+ api$5["delete"](customFieldsUrls.customFields(), {
2072
+ data: {
2073
+ attribute_column: attributeColumn
2074
+ }
2075
+ }).then(function (res) {
2076
+ if (res.data.status === true) {
2077
+ dispatch(removeCustomField(attributeColumn));
2078
+ IUIToastMessageService$3.sNotify(res.data.message);
2079
+ resolve();
2080
+ } else {
2081
+ IUIToastMessageService$3.warningNotify(res.data.message);
2082
+ reject(res);
2083
+ }
2084
+ })["catch"](function (err) {
2085
+ var _err$response2, _err$response2$data;
2086
+
2087
+ IUIToastMessageService$3.warningNotify((err === null || err === void 0 ? void 0 : (_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.message) || 'Opps, Something went wrong.');
2088
+ reject(err);
2089
+ });
2090
+ });
2091
+ };
2092
+ };
2054
2093
  var editCustomFieldLabel = function editCustomFieldLabel(payload) {
2055
2094
  return function (dispatch) {
2056
2095
  return new Promise(function (resolve, reject) {
@@ -4070,6 +4109,12 @@ var reducer$2 = function reducer(state, action) {
4070
4109
  switch (action.type) {
4071
4110
  case FETCH_USERPANEL_DATA:
4072
4111
  {
4112
+ action.payload.previous === null && action.payload.results.unshift({
4113
+ code: UNASSIGNED_USERS,
4114
+ company: 4,
4115
+ name: UNASSIGNED_USERS,
4116
+ no_of_users: action.payload.unassigned_users
4117
+ });
4073
4118
  return _extends({}, state, {
4074
4119
  userPanelData: action.payload
4075
4120
  });
@@ -4234,6 +4279,7 @@ var initialState$5 = {
4234
4279
  loading: false,
4235
4280
  data: [],
4236
4281
  isOpenModal: false,
4282
+ isOpenDeleteModal: false,
4237
4283
  editLabel: {
4238
4284
  isEditMode: false,
4239
4285
  attribute_column: null,
@@ -4264,6 +4310,13 @@ var reducer$5 = function reducer(state, action) {
4264
4310
  });
4265
4311
  }
4266
4312
 
4313
+ case SET_DELETE_MODAL:
4314
+ {
4315
+ return _extends({}, state, {
4316
+ isOpenDeleteModal: action.payload
4317
+ });
4318
+ }
4319
+
4267
4320
  case RESET_EDIT_MODAL:
4268
4321
  {
4269
4322
  return _extends({}, state, {
@@ -8177,7 +8230,7 @@ var BulkActionHistoryTable = function BulkActionHistoryTable(props) {
8177
8230
  });
8178
8231
  };
8179
8232
 
8180
- var styles$6 = {"UUICustomFields":"_tdVCY","pageHeader":"_8iQvL","buttonWrapper":"_2k_GJ","headingWrapper":"_1rYVz","heading":"_2nxXO","headingLarge":"_2auvl","headingMedium":"_Wjaw1","headingSmall":"_1UmTe","description":"_2BS2i","headerText":"_3SZ_X","letterImage":"_2AwAF","tablewrapper":"_3qSxj","rowText":"_2ZSw6","textTransform":"_1F6ss","lightColor":"_2Wjom","importModalBodyContainer":"_2JCWP","dividerColor":"_3EsJG","downloadTemplateContainer":"_2uRic","downloadTemplateDescContainer":"_55kg5","labelContainer":"_78mCn","downlTempHeader":"_lqUA2","downlTempDescription":"_1vT5l","colGap":"_1x_9W","tableHead":"_5SygC","actionButtons":"_3PeqN","emptyData":"_1bHs-"};
8233
+ var styles$6 = {"UUICustomFields":"_tdVCY","pageHeader":"_8iQvL","buttonWrapper":"_2k_GJ","headingWrapper":"_1rYVz","heading":"_2nxXO","headingLarge":"_2auvl","headingMedium":"_Wjaw1","headingSmall":"_1UmTe","description":"_2BS2i","headerText":"_3SZ_X","letterImage":"_2AwAF","tablewrapper":"_3qSxj","rowText":"_2ZSw6","textTransform":"_1F6ss","lightColor":"_2Wjom","importModalBodyContainer":"_2JCWP","dividerColor":"_3EsJG","downloadTemplateContainer":"_2uRic","downloadTemplateDescContainer":"_55kg5","labelContainer":"_78mCn","downlTempHeader":"_lqUA2","downlTempDescription":"_1vT5l","colGap":"_1x_9W","tableHead":"_5SygC","actionButtons":"_3PeqN","emptyData":"_1bHs-","buttonWidth":"_2W2Jo","iconLayout":"_31IgO","baseAlert":"_342t1","iconStyle":"_3hgYk"};
8181
8234
 
8182
8235
  function SkeletonLoader(_ref) {
8183
8236
  var _ref$data = _ref.data,
@@ -9172,7 +9225,7 @@ function Header(props) {
9172
9225
  })));
9173
9226
  }
9174
9227
 
9175
- var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","buttonWidth":"_13tv0","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV"};
9228
+ var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","buttonWidth":"_13tv0","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV","tableContainer":"_3xdGF"};
9176
9229
 
9177
9230
  function Listview(_ref) {
9178
9231
  var data = _ref.data,
@@ -9214,7 +9267,7 @@ function Listview(_ref) {
9214
9267
  label: 'Actions',
9215
9268
  width: '10%',
9216
9269
  cell: function cell(row) {
9217
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9270
+ return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9218
9271
  display: "flex"
9219
9272
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9220
9273
  buttonText: "Edit",
@@ -9238,7 +9291,8 @@ function Listview(_ref) {
9238
9291
  }
9239
9292
  }];
9240
9293
  return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9241
- p: 3
9294
+ p: 3,
9295
+ className: data !== null && data !== void 0 && data.results && data.results.length > 0 && data.results[0].code === UNASSIGNED_USERS ? styles$7.tableContainer : ''
9242
9296
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITable, {
9243
9297
  searchHide: true,
9244
9298
  hasFilter: true,
@@ -9932,6 +9986,60 @@ function UserAddEdit$1() {
9932
9986
  }, "Levels"));
9933
9987
  }
9934
9988
 
9989
+ var DeleteCustomFieldModal = function DeleteCustomFieldModal(_ref) {
9990
+ var isOpenDeleteModal = _ref.isOpenDeleteModal,
9991
+ _ref$closeModalHandle = _ref.closeModalHandler,
9992
+ closeModalHandler = _ref$closeModalHandle === void 0 ? function () {} : _ref$closeModalHandle,
9993
+ data = _ref.data;
9994
+ var dispatch = reactRedux.useDispatch();
9995
+
9996
+ var deleteCustomFields = function deleteCustomFields() {
9997
+ if (data.attribute_column) {
9998
+ dispatch(deleteCustomField(data.attribute_column)).then(function (res) {
9999
+ closeModalHandler();
10000
+ });
10001
+ }
10002
+ };
10003
+
10004
+ return /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
10005
+ isOpen: isOpenDeleteModal,
10006
+ closeHandler: closeModalHandler,
10007
+ headerText: "Delete " + data.field_name + " ?",
10008
+ cancelLabel: "Cancel",
10009
+ submitLabel: "Delete",
10010
+ submitHandler: deleteCustomFields,
10011
+ width: "365px",
10012
+ modalBodyStyle: {
10013
+ maxHeight: '600px',
10014
+ overflow: 'auto',
10015
+ margin: '0px'
10016
+ },
10017
+ footerStyle: {
10018
+ justifyContent: 'end'
10019
+ }
10020
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10021
+ display: "flex",
10022
+ justifyContent: "center",
10023
+ alignItems: "center",
10024
+ flexDirection: "column"
10025
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10026
+ display: "flex",
10027
+ className: styles$6.baseAlert
10028
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10029
+ className: styles$6.iconLayout
10030
+ }, /*#__PURE__*/React__default.createElement(BoldInfoIcon, {
10031
+ color: "#CA8A04",
10032
+ width: "25",
10033
+ height: "20",
10034
+ className: styles$6.iconStyle
10035
+ })), /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
10036
+ label: "User data associated with the custom field \"" + data.field_name + "\" will get lost. It may also affect the reporting and rules associated with the field.",
10037
+ style: {
10038
+ fontWeight: 'normal'
10039
+ }
10040
+ }))));
10041
+ };
10042
+
9935
10043
  var PageHeader = function PageHeader() {
9936
10044
  var dispatch = reactRedux.useDispatch();
9937
10045
 
@@ -9939,7 +10047,8 @@ var PageHeader = function PageHeader() {
9939
10047
  return state.customFields;
9940
10048
  }),
9941
10049
  editLabel = _useSelector.editLabel,
9942
- isOpenModal = _useSelector.isOpenModal;
10050
+ isOpenModal = _useSelector.isOpenModal,
10051
+ isOpenDeleteModal = _useSelector.isOpenDeleteModal;
9943
10052
 
9944
10053
  var _useSelector2 = reactRedux.useSelector(function (state) {
9945
10054
  return state.common;
@@ -10004,6 +10113,12 @@ var PageHeader = function PageHeader() {
10004
10113
  isEditMode: editLabel.isEditMode,
10005
10114
  editId: editLabel.attribute_column,
10006
10115
  defaultValue: editLabel.field_name
10116
+ }), /*#__PURE__*/React__default.createElement(DeleteCustomFieldModal, {
10117
+ isOpenDeleteModal: isOpenDeleteModal,
10118
+ closeModalHandler: function closeModalHandler() {
10119
+ return dispatch(toggleDeleteModal(false));
10120
+ },
10121
+ data: editLabel
10007
10122
  }));
10008
10123
  };
10009
10124
 
@@ -10020,10 +10135,16 @@ function Table() {
10020
10135
  dispatch(toggleModal(true));
10021
10136
  };
10022
10137
 
10138
+ var handleDelete = function handleDelete(field) {
10139
+ dispatch(setEditModal(field));
10140
+ dispatch(toggleDeleteModal(true));
10141
+ };
10142
+
10023
10143
  var columns = [{
10024
10144
  id: 'sno',
10025
10145
  label: '#',
10026
10146
  sortable: false,
10147
+ width: '45%',
10027
10148
  cell: function cell(row, i) {
10028
10149
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10029
10150
  component: "div"
@@ -10033,6 +10154,7 @@ function Table() {
10033
10154
  id: 'name',
10034
10155
  label: 'Name',
10035
10156
  sortable: false,
10157
+ width: '45%',
10036
10158
  cell: function cell(row) {
10037
10159
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10038
10160
  component: "div"
@@ -10041,17 +10163,23 @@ function Table() {
10041
10163
  }, {
10042
10164
  id: 'actions',
10043
10165
  label: 'Actions',
10044
- align: 'left',
10166
+ width: '10%',
10045
10167
  cell: function cell(row) {
10046
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
10168
+ return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10169
+ display: "flex"
10170
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
10047
10171
  buttonText: "Edit",
10172
+ className: styles$6.buttonWidth,
10048
10173
  onClick: function onClick() {
10049
10174
  return handleEdit(row);
10050
10175
  }
10051
- });
10052
- },
10053
- style: {
10054
- paddingLeft: '40px'
10176
+ }), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
10177
+ buttonText: "Delete",
10178
+ className: styles$6.buttonWidth,
10179
+ onClick: function onClick() {
10180
+ return handleDelete(row);
10181
+ }
10182
+ }));
10055
10183
  }
10056
10184
  }];
10057
10185
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {