@undp/carbon-library 1.0.48 → 1.0.50

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -1679,6 +1679,15 @@ var CompanyProfileComponent = function (props) {
1679
1679
  setErrorMsg("");
1680
1680
  setOpenReactivateModal(true);
1681
1681
  };
1682
+ var getEnumKeysFromValues = function (values) {
1683
+ var enumKeys = [];
1684
+ for (var key in exports.SectoralScope) {
1685
+ if (values.includes(exports.SectoralScope[key])) {
1686
+ enumKeys.push(key);
1687
+ }
1688
+ }
1689
+ return enumKeys;
1690
+ };
1682
1691
  return (React.createElement("div", { className: "content-container company-profile" },
1683
1692
  React.createElement("div", { className: "title-bar" },
1684
1693
  React.createElement("div", null,
@@ -1728,12 +1737,13 @@ var CompanyProfileComponent = function (props) {
1728
1737
  (companyDetails === null || companyDetails === void 0 ? void 0 : companyDetails.companyRole) === exports.CompanyRole.MINISTRY && (React.createElement(React.Fragment, null,
1729
1738
  React.createElement(antd.Row, { className: "field" },
1730
1739
  React.createElement(antd.Col, { span: 12, className: "field-key" }, t("companyProfile:ministerName")),
1731
- React.createElement(antd.Col, { span: 12, className: "field-value" },
1732
- React.createElement(CompanyRoleIcon, { role: companyDetails.nameOfMinister }))),
1740
+ React.createElement(antd.Col, { span: 12, className: "field-value" }, companyDetails.nameOfMinister
1741
+ ? companyDetails.nameOfMinister
1742
+ : "-")),
1733
1743
  React.createElement(antd.Row, { className: "field" },
1734
1744
  React.createElement(antd.Col, { span: 12, className: "field-key" }, t("companyProfile:sectoralScope")),
1735
1745
  React.createElement(antd.Col, { span: 12, className: "field-value" }, companyDetails.sectoralScope
1736
- ? companyDetails.sectoralScope.join(", ")
1746
+ ? getEnumKeysFromValues(companyDetails.sectoralScope).join(", ")
1737
1747
  : "-")))),
1738
1748
  React.createElement(antd.Row, { className: "field" },
1739
1749
  React.createElement(antd.Col, { span: 12, className: "field-key" }, t("companyProfile:email")),
@@ -4817,21 +4827,24 @@ var AddNewUserComponent = function (props) {
4817
4827
  }); };
4818
4828
  var onUpdateUser = function () { return __awaiter(void 0, void 0, void 0, function () {
4819
4829
  var formOneValues, values, response, error_3;
4820
- var _a;
4821
- return __generator(this, function (_b) {
4822
- switch (_b.label) {
4830
+ var _a, _b, _c, _d;
4831
+ return __generator(this, function (_e) {
4832
+ switch (_e.label) {
4823
4833
  case 0:
4824
4834
  setLoading(true);
4825
4835
  formOneValues = formOne.getFieldsValue();
4826
4836
  formOneValues.phoneNo = PhoneInput.formatPhoneNumberIntl(formOneValues.phoneNo);
4827
- _b.label = 1;
4837
+ _e.label = 1;
4828
4838
  case 1:
4829
- _b.trys.push([1, 3, , 4]);
4839
+ _e.trys.push([1, 3, , 4]);
4830
4840
  values = {
4831
4841
  id: (_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.id,
4832
4842
  name: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.name,
4833
4843
  phoneNo: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.phoneNo,
4834
4844
  };
4845
+ if (((_b = state === null || state === void 0 ? void 0 : state.record) === null || _b === void 0 ? void 0 : _b.companyRole) === exports.CompanyRole.MINISTRY) {
4846
+ 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;
4847
+ }
4835
4848
  if (ability.can(Action.Update, classTransformer.plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "role"))
4836
4849
  values.role = formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.role;
4837
4850
  if (ability.can(Action.Update, classTransformer.plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "email"))
@@ -4839,7 +4852,7 @@ var AddNewUserComponent = function (props) {
4839
4852
  console.log("form one values -- > ", values, state.record);
4840
4853
  return [4 /*yield*/, put("national/user/update", values)];
4841
4854
  case 2:
4842
- response = _b.sent();
4855
+ response = _e.sent();
4843
4856
  if (response.status === 200 || response.status === 201) {
4844
4857
  antd.message.open({
4845
4858
  type: "success",
@@ -4853,7 +4866,7 @@ var AddNewUserComponent = function (props) {
4853
4866
  }
4854
4867
  return [3 /*break*/, 4];
4855
4868
  case 3:
4856
- error_3 = _b.sent();
4869
+ error_3 = _e.sent();
4857
4870
  console.log("Error in user update", error_3);
4858
4871
  antd.message.open({
4859
4872
  type: "error",