@undp/carbon-library 1.0.48 → 1.0.50

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/esm/index.js CHANGED
@@ -1659,6 +1659,15 @@ var CompanyProfileComponent = function (props) {
1659
1659
  setErrorMsg("");
1660
1660
  setOpenReactivateModal(true);
1661
1661
  };
1662
+ var getEnumKeysFromValues = function (values) {
1663
+ var enumKeys = [];
1664
+ for (var key in SectoralScope) {
1665
+ if (values.includes(SectoralScope[key])) {
1666
+ enumKeys.push(key);
1667
+ }
1668
+ }
1669
+ return enumKeys;
1670
+ };
1662
1671
  return (React.createElement("div", { className: "content-container company-profile" },
1663
1672
  React.createElement("div", { className: "title-bar" },
1664
1673
  React.createElement("div", null,
@@ -1708,12 +1717,13 @@ var CompanyProfileComponent = function (props) {
1708
1717
  (companyDetails === null || companyDetails === void 0 ? void 0 : companyDetails.companyRole) === CompanyRole$1.MINISTRY && (React.createElement(React.Fragment, null,
1709
1718
  React.createElement(Row, { className: "field" },
1710
1719
  React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:ministerName")),
1711
- React.createElement(Col, { span: 12, className: "field-value" },
1712
- React.createElement(CompanyRoleIcon, { role: companyDetails.nameOfMinister }))),
1720
+ React.createElement(Col, { span: 12, className: "field-value" }, companyDetails.nameOfMinister
1721
+ ? companyDetails.nameOfMinister
1722
+ : "-")),
1713
1723
  React.createElement(Row, { className: "field" },
1714
1724
  React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:sectoralScope")),
1715
1725
  React.createElement(Col, { span: 12, className: "field-value" }, companyDetails.sectoralScope
1716
- ? companyDetails.sectoralScope.join(", ")
1726
+ ? getEnumKeysFromValues(companyDetails.sectoralScope).join(", ")
1717
1727
  : "-")))),
1718
1728
  React.createElement(Row, { className: "field" },
1719
1729
  React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:email")),
@@ -4797,21 +4807,24 @@ var AddNewUserComponent = function (props) {
4797
4807
  }); };
4798
4808
  var onUpdateUser = function () { return __awaiter(void 0, void 0, void 0, function () {
4799
4809
  var formOneValues, values, response, error_3;
4800
- var _a;
4801
- return __generator(this, function (_b) {
4802
- switch (_b.label) {
4810
+ var _a, _b, _c, _d;
4811
+ return __generator(this, function (_e) {
4812
+ switch (_e.label) {
4803
4813
  case 0:
4804
4814
  setLoading(true);
4805
4815
  formOneValues = formOne.getFieldsValue();
4806
4816
  formOneValues.phoneNo = formatPhoneNumberIntl(formOneValues.phoneNo);
4807
- _b.label = 1;
4817
+ _e.label = 1;
4808
4818
  case 1:
4809
- _b.trys.push([1, 3, , 4]);
4819
+ _e.trys.push([1, 3, , 4]);
4810
4820
  values = {
4811
4821
  id: (_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.id,
4812
4822
  name: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.name,
4813
4823
  phoneNo: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.phoneNo,
4814
4824
  };
4825
+ if (((_b = state === null || state === void 0 ? void 0 : state.record) === null || _b === void 0 ? void 0 : _b.companyRole) === CompanyRole$1.MINISTRY) {
4826
+ values.sectoralScope = (_d = (_c = state === null || state === void 0 ? void 0 : state.record) === null || _c === void 0 ? void 0 : _c.company) === null || _d === void 0 ? void 0 : _d.sectoralScope;
4827
+ }
4815
4828
  if (ability.can(Action.Update, plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "role"))
4816
4829
  values.role = formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.role;
4817
4830
  if (ability.can(Action.Update, plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "email"))
@@ -4819,7 +4832,7 @@ var AddNewUserComponent = function (props) {
4819
4832
  console.log("form one values -- > ", values, state.record);
4820
4833
  return [4 /*yield*/, put("national/user/update", values)];
4821
4834
  case 2:
4822
- response = _b.sent();
4835
+ response = _e.sent();
4823
4836
  if (response.status === 200 || response.status === 201) {
4824
4837
  message.open({
4825
4838
  type: "success",
@@ -4833,7 +4846,7 @@ var AddNewUserComponent = function (props) {
4833
4846
  }
4834
4847
  return [3 /*break*/, 4];
4835
4848
  case 3:
4836
- error_3 = _b.sent();
4849
+ error_3 = _e.sent();
4837
4850
  console.log("Error in user update", error_3);
4838
4851
  message.open({
4839
4852
  type: "error",