@itilite/iui-user-management 0.4.4 → 0.4.6

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.js CHANGED
@@ -16,6 +16,7 @@ var reactRouterDom = require('react-router-dom');
16
16
  var styles$8 = require('@material-ui/core/styles');
17
17
  var Switch = _interopDefault(require('@material-ui/core/Switch'));
18
18
  var MoreHorizIcon = _interopDefault(require('@material-ui/icons/MoreHoriz'));
19
+ var InfoIcon = _interopDefault(require('@material-ui/icons/Info'));
19
20
 
20
21
  function _extends() {
21
22
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -1508,8 +1509,8 @@ var makePrimaryAdmin = function makePrimaryAdmin(payload) {
1508
1509
  return function (dispatch) {
1509
1510
  return new Promise(function (resolve, reject) {
1510
1511
  api$1.put(userAddEditUrl.primaryAdmin(payload.userId)).then(function (res) {
1511
- if (res.message) {
1512
- IUIToastMessageService.sNotify(res.message);
1512
+ if (res) {
1513
+ IUIToastMessageService.sNotify('Primary Admin updated successfully.');
1513
1514
  resolve();
1514
1515
  } else {
1515
1516
  reject(res);
@@ -1529,7 +1530,7 @@ var resetPasswordForUser = function resetPasswordForUser(data) {
1529
1530
  api$1.post("" + userAddEditUrl.resetPasswordForUserApi(), {
1530
1531
  email: data.email
1531
1532
  }).then(function (res) {
1532
- IUIToastMessageService.sNotify(' Reset password link sent successfully');
1533
+ IUIToastMessageService.sNotify(res.data.message.toString());
1533
1534
  resolve();
1534
1535
  })["catch"](function (err) {
1535
1536
  if (!err.response.data.status) {
@@ -1549,7 +1550,7 @@ var resendInviteForUser = function resendInviteForUser(data) {
1549
1550
  api$1.post(userAddEditUrl.resendInviteForUserApi(), {
1550
1551
  user_ids: data
1551
1552
  }).then(function (res) {
1552
- IUIToastMessageService.sNotify('Invitation sent successfully');
1553
+ IUIToastMessageService.sNotify(res.data.message.toString());
1553
1554
  resolve();
1554
1555
  })["catch"](function (err) {
1555
1556
  if (!err.response.data.status) {
@@ -8643,8 +8644,8 @@ var StickyHeadTable = function StickyHeadTable(props) {
8643
8644
  handleSingleCheckBoxClick = _props$handleSingleCh === void 0 ? function () {} : _props$handleSingleCh,
8644
8645
  _props$onResetPasswor = props.onResetPasswordHandler,
8645
8646
  onResetPasswordHandler = _props$onResetPasswor === void 0 ? function () {} : _props$onResetPasswor,
8646
- _props$onResendInvite = props.onResendInviteHandler,
8647
- onResendInviteHandler = _props$onResendInvite === void 0 ? function () {} : _props$onResendInvite,
8647
+ _props$toggleInviteMo = props.toggleInviteModal,
8648
+ toggleInviteModal = _props$toggleInviteMo === void 0 ? function () {} : _props$toggleInviteMo,
8648
8649
  orderBy = props.orderBy,
8649
8650
  order = props.order,
8650
8651
  _props$onRequestSort = props.onRequestSort,
@@ -8685,12 +8686,12 @@ var StickyHeadTable = function StickyHeadTable(props) {
8685
8686
  }, {
8686
8687
  id: 'first_name',
8687
8688
  label: '',
8688
- minWidth: 100,
8689
+ minWidth: 60,
8689
8690
  sortable: true,
8690
8691
  cell: function cell(row) {
8691
8692
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8692
8693
  component: "div",
8693
- width: 100
8694
+ width: 60
8694
8695
  }, row && row.has_visited === 0 ? /*#__PURE__*/React__default.createElement("div", {
8695
8696
  title: "This user hasn't logged on to the platform yet",
8696
8697
  style: {
@@ -8759,7 +8760,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8759
8760
  }, {
8760
8761
  id: 'status',
8761
8762
  label: 'Status',
8762
- minWidth: 190,
8763
+ minWidth: 170,
8763
8764
  cell: function cell(row) {
8764
8765
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIFormGroup, null, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
8765
8766
  component: "div",
@@ -8785,7 +8786,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8785
8786
  }, {
8786
8787
  id: 'actions',
8787
8788
  label: 'Actions',
8788
- minWidth: 170,
8789
+ minWidth: 100,
8789
8790
  align: 'left',
8790
8791
  cell: function cell(row) {
8791
8792
  var options = [{
@@ -8815,7 +8816,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8815
8816
  options.push({
8816
8817
  label: 'Resend invite',
8817
8818
  handler: function handler() {
8818
- return onResendInviteHandler(row.id);
8819
+ return toggleInviteModal(row.id);
8819
8820
  }
8820
8821
  });
8821
8822
  }
@@ -8948,6 +8949,14 @@ var UserList = function UserList(_ref) {
8948
8949
  isApiFetching = _useState10[0],
8949
8950
  setisApiFetching = _useState10[1];
8950
8951
 
8952
+ var _useState11 = React.useState(false),
8953
+ showInviteModal = _useState11[0],
8954
+ setToggleInviteModal = _useState11[1];
8955
+
8956
+ var _useState12 = React.useState(''),
8957
+ userIds = _useState12[0],
8958
+ setUserIds = _useState12[1];
8959
+
8951
8960
  var openDeactivateModal = function openDeactivateModal() {
8952
8961
  if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
8953
8962
  IUIToastMessageService$7.warningNotify('Select at least one user to deactivate.');
@@ -9093,16 +9102,29 @@ var UserList = function UserList(_ref) {
9093
9102
  }));
9094
9103
  };
9095
9104
 
9096
- var onResendInviteHandler = function onResendInviteHandler(userId) {
9105
+ var toggleInviteModal = function toggleInviteModal(ids) {
9106
+ setUserIds(ids);
9107
+ setToggleInviteModal(!showInviteModal);
9108
+ };
9109
+
9110
+ var onResendInviteHandler = function onResendInviteHandler() {
9097
9111
  var userIdArr = [];
9098
9112
 
9099
- if (userId && !isNaN(userId)) {
9100
- userIdArr = [userId];
9101
- } else if (selected[page] && selected[page].length) {
9102
- userIdArr = selected[page];
9113
+ if (userIds && !isNaN(userIds)) {
9114
+ userIdArr = [userIds];
9115
+ } else if (Object.keys(selected).length) {
9116
+ Object.values(selected).map(function (val, i) {
9117
+ if (val.length) {
9118
+ val.map(function (idx, i) {
9119
+ userIdArr.push(idx);
9120
+ });
9121
+ }
9122
+ });
9103
9123
  }
9104
9124
 
9125
+ setUserIds('');
9105
9126
  dispatch(resendInviteForUser(userIdArr));
9127
+ setToggleInviteModal(!showInviteModal);
9106
9128
  };
9107
9129
 
9108
9130
  var handleExportUsers = function handleExportUsers() {
@@ -9148,7 +9170,7 @@ var UserList = function UserList(_ref) {
9148
9170
  handler: handleBulkActionHistoryClick
9149
9171
  }, {
9150
9172
  label: 'Resend invite',
9151
- handler: onResendInviteHandler
9173
+ handler: toggleInviteModal
9152
9174
  }];
9153
9175
  React.useEffect(function () {
9154
9176
  var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
@@ -9303,7 +9325,7 @@ var UserList = function UserList(_ref) {
9303
9325
  isILadmin: isILadmin,
9304
9326
  onPrimaryAdminHandler: onPrimaryAdminHandler,
9305
9327
  onResetPasswordHandler: onResetPasswordHandler,
9306
- onResendInviteHandler: onResendInviteHandler
9328
+ toggleInviteModal: toggleInviteModal
9307
9329
  }))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9308
9330
  isOpen: Object.values(selected).flat().length > 0 && isOpenDeActivateModal,
9309
9331
  closeHandler: closeDeActivateModal,
@@ -9330,7 +9352,41 @@ var UserList = function UserList(_ref) {
9330
9352
  className: styles$5.headerText
9331
9353
  }, 'Are you sure you want to deactivate ' + Object.values(selected).flat().length.toString() + (Object.values(selected).flat().length === 1 ? ' user ?' : ' users ?')), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9332
9354
  className: styles$5.description
9333
- }, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(BulkUploadModal, {
9355
+ }, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9356
+ isOpen: showInviteModal,
9357
+ closeHandler: toggleInviteModal,
9358
+ cancelLabel: "Cancel",
9359
+ headerText: "Resend Invites",
9360
+ submitLabel: "Send",
9361
+ submitHandler: function submitHandler() {
9362
+ return onResendInviteHandler();
9363
+ },
9364
+ width: "400px",
9365
+ modalBodyStyle: {
9366
+ padding: '0px'
9367
+ },
9368
+ footerStyle: {
9369
+ justifyContent: 'center'
9370
+ }
9371
+ }, /*#__PURE__*/React__default.createElement("div", {
9372
+ style: {
9373
+ display: 'flex',
9374
+ padding: '16px',
9375
+ margin: '8px 24px',
9376
+ border: '1px solid #FDE047',
9377
+ background: '#FEFCE8'
9378
+ }
9379
+ }, /*#__PURE__*/React__default.createElement(InfoIcon, {
9380
+ style: {
9381
+ marginRight: '10px',
9382
+ color: '#EC5D25'
9383
+ }
9384
+ }), /*#__PURE__*/React__default.createElement("div", {
9385
+ style: {
9386
+ fontSize: '14px',
9387
+ color: '#374151'
9388
+ }
9389
+ }, "This invitation will be sent to users who have not logged into the platform."))), /*#__PURE__*/React__default.createElement(BulkUploadModal, {
9334
9390
  isOpenImportUsersModal: isOpenImportUsersModal,
9335
9391
  closeImportUsersModal: closeImportUsersModal,
9336
9392
  closeImportModal: closeImportModal