@undp/carbon-library 1.0.274-CARBON-404.5 → 1.0.274-CARBON-363.56

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined } from '@ant-design/icons';
2
- import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Select, Upload, InputNumber, Tooltip, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, Popover, List, Typography, Spin, Tabs, Progress } from 'antd';
3
- import React, { useState, useEffect, useRef, useContext } from 'react';
1
+ import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, LockOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined } from '@ant-design/icons';
2
+ import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, InputNumber, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, Popover, List, Typography, Spin, Tabs, Progress } from 'antd';
3
+ import React, { useState, useEffect, useRef } from 'react';
4
4
  import { DateTime } from 'luxon';
5
5
  import { Buffer } from 'buffer';
6
6
  import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber } from 'react-phone-number-input';
@@ -2027,7 +2027,7 @@ var NdcActionStatus;
2027
2027
  NdcActionStatus["PENDING"] = "Pending";
2028
2028
  NdcActionStatus["APPROVED"] = "Approved";
2029
2029
  })(NdcActionStatus || (NdcActionStatus = {}));
2030
- var getNdcActionStatusEnumVal = function (value) {
2030
+ var getNdcActionStatusEnumVal$1 = function (value) {
2031
2031
  var index = Object.keys(NdcActionStatus).indexOf(value);
2032
2032
  if (index < 0) {
2033
2033
  return value;
@@ -2035,7 +2035,7 @@ var getNdcActionStatusEnumVal = function (value) {
2035
2035
  return Object.values(NdcActionStatus)[index];
2036
2036
  };
2037
2037
  var getNdcStatusTagType = function (status) {
2038
- switch (getNdcActionStatusEnumVal(status)) {
2038
+ switch (getNdcActionStatusEnumVal$1(status)) {
2039
2039
  case NdcActionStatus.PENDING:
2040
2040
  return "processing";
2041
2041
  case NdcActionStatus.APPROVED:
@@ -5687,188 +5687,6 @@ var SystemNames;
5687
5687
  SystemNames["CARBON_TRANSPARENCY"] = "CARBON_TRANSPARENCY_SYSTEM";
5688
5688
  })(SystemNames || (SystemNames = {}));
5689
5689
 
5690
- var GovDepartment;
5691
- (function (GovDepartment) {
5692
- GovDepartment["Cocoa Research Institute"] = "1";
5693
- GovDepartment["National Agricultural Extension, Research and Liaison Services"] = "2";
5694
- GovDepartment["National Veterinary Research Institute"] = "3";
5695
- GovDepartment["Agricultural Insurance Corporation"] = "4";
5696
- GovDepartment["National Root Crops Research Institute"] = "5";
5697
- GovDepartment["Agricultural Research Council"] = "6";
5698
- GovDepartment["Institute for Oceanography and Marine Research"] = "7";
5699
- GovDepartment["Institute for Oil Palm Research"] = "8";
5700
- GovDepartment["Agricultural Quarantine Service"] = "9";
5701
- GovDepartment["National Horticultural Research Institute"] = "10";
5702
- GovDepartment["Federal Airports Authority"] = "11";
5703
- GovDepartment["Airspace Management Agency"] = "12";
5704
- GovDepartment["Civil Aviation Authority"] = "13";
5705
- GovDepartment["Safety Investigation Bureau"] = "14";
5706
- GovDepartment["Meteorological Agency"] = "15";
5707
- GovDepartment["College of Aviation Technology"] = "16";
5708
- GovDepartment["National Information Technology Development Agency"] = "17";
5709
- GovDepartment["Satellite Limited"] = "18";
5710
- GovDepartment["Broadcasting Commission"] = "19";
5711
- GovDepartment["Commission"] = "20";
5712
- GovDepartment["Postal Service"] = "21";
5713
- GovDepartment["National Frequency Management Council"] = "22";
5714
- GovDepartment["Television Authority"] = "23";
5715
- GovDepartment["Galaxy Backbone"] = "24";
5716
- GovDepartment["Asset Management Corporation"] = "25";
5717
- GovDepartment["Social Security Administration"] = "26";
5718
- GovDepartment["Budget Office of the Federation"] = "27";
5719
- GovDepartment["Bureau of Public Enterprises"] = "28";
5720
- GovDepartment["Bureau of Public Procurement"] = "29";
5721
- GovDepartment["Central Bank"] = "30";
5722
- GovDepartment["Corporate Affairs Commission"] = "31";
5723
- GovDepartment["Debt Management Office"] = "32";
5724
- GovDepartment["Inland Revenue Service"] = "33";
5725
- GovDepartment["Mortgage Bank"] = "34";
5726
- GovDepartment["Fiscal Responsibility Commission"] = "35";
5727
- GovDepartment["Infrastructure Concession Regulatory Commission"] = "36";
5728
- GovDepartment["National Bureau of Statistics"] = "37";
5729
- GovDepartment["National Council on Privatisation"] = "38";
5730
- GovDepartment["National Insurance Commission"] = "39";
5731
- GovDepartment["National Pension Commission"] = "40";
5732
- GovDepartment["National Planning Commission"] = "41";
5733
- GovDepartment["National Sugar Development Council"] = "42";
5734
- GovDepartment["Niger Delta Development Commission"] = "43";
5735
- GovDepartment["Customs Service"] = "44";
5736
- GovDepartment["Deposit Insurance Corporation"] = "45";
5737
- GovDepartment["Investment Promotion Commission"] = "46";
5738
- GovDepartment["Export - Import Bank"] = "47";
5739
- GovDepartment["Export Promotion Council"] = "48";
5740
- GovDepartment["Oil and Gas Free Zones Authority"] = "49";
5741
- GovDepartment["Export Processing Zones Authority"] = "50";
5742
- GovDepartment["Revenue Mobilisation Allocation and Fiscal Commission"] = "51";
5743
- GovDepartment["Securities and Exchange Commission"] = "52";
5744
- GovDepartment["Standards Organisation"] = "53";
5745
- GovDepartment["Small and Medium Enterprise Development Agency"] = "54";
5746
- GovDepartment["National Board for Arabic And Islamic Studies"] = "55";
5747
- GovDepartment["Joint Admissions and Matriculation Board"] = "56";
5748
- GovDepartment["National Examination Council"] = "115";
5749
- GovDepartment["National Open University"] = "57";
5750
- GovDepartment["National Teachers Institute"] = "58";
5751
- GovDepartment["National Universities Commission"] = "59";
5752
- GovDepartment["Tertiary Education Trust Fund"] = "60";
5753
- GovDepartment["Teachers Registration Council"] = "61";
5754
- GovDepartment["National Business and Technical Examinations Board"] = "62";
5755
- GovDepartment["Universal Basic Education Commission"] = "63";
5756
- GovDepartment["West African Examination Council"] = "64";
5757
- GovDepartment["National Commission for Colleges of Education"] = "65";
5758
- GovDepartment["National Library"] = "66";
5759
- GovDepartment["Midstream and Downstream Petroleum Regulatory Authority"] = "67";
5760
- GovDepartment["Upstream Petroleum Regulatory Commission"] = "68";
5761
- GovDepartment["Electricity Management Services Limited"] = "69";
5762
- GovDepartment["Energy Commission"] = "70";
5763
- GovDepartment["National Power Training Institute"] = "71";
5764
- GovDepartment["Electricity Regulatory Commission"] = "72";
5765
- GovDepartment["Content Monitoring and Development Board"] = "73";
5766
- GovDepartment["National Petroleum Corporation"] = "74";
5767
- GovDepartment["Nuclear Regulatory Authority Science & Technology"] = "75";
5768
- GovDepartment["Petroleum Product Pricing Regulatory Agency"] = "76";
5769
- GovDepartment["Power Holding Company (defunct)"] = "77";
5770
- GovDepartment["Rural Electrification Agency"] = "78";
5771
- GovDepartment["Transmission Company"] = "79";
5772
- GovDepartment["Environmental Protection Agency (defunct)"] = "80";
5773
- GovDepartment["Forestry Research Institute"] = "81";
5774
- GovDepartment["National Biosafety Management Agency"] = "82";
5775
- GovDepartment["National Environmental Standards and Regulations Enforcement Agency"] = "83";
5776
- GovDepartment["National Oil Spill Detection and Response Agency"] = "84";
5777
- GovDepartment["Environmental Health Officers Registration Council"] = "85";
5778
- GovDepartment["National Health Insurance Scheme"] = "86";
5779
- GovDepartment["Institute for Pharmaceutical Research and Development"] = "87";
5780
- GovDepartment["Agency for the Control of AIDS"] = "88";
5781
- GovDepartment["Agency for Food and Drug Administration and Control"] = "89";
5782
- GovDepartment["Primary Health Care Development Agency"] = "90";
5783
- GovDepartment["Institute of Medical Research"] = "91";
5784
- GovDepartment["Centre for Disease Control"] = "92";
5785
- GovDepartment["Drug Law Enforcement Agency"] = "93";
5786
- GovDepartment["Defence Intelligence Agency"] = "94";
5787
- GovDepartment["State Security Service"] = "95";
5788
- GovDepartment["National Intelligence Agency"] = "96";
5789
- GovDepartment["Financial Intelligence Unit"] = "97";
5790
- GovDepartment["National Judicial Council"] = "98";
5791
- GovDepartment["Federal Judicial Service Commission"] = "99";
5792
- GovDepartment["National Judicial Institute"] = "100";
5793
- GovDepartment["Maritime Administration and Safety Agency"] = "101";
5794
- GovDepartment["Ports Authority"] = "102";
5795
- GovDepartment["Shippers' Council"] = "103";
5796
- GovDepartment["Broadcasting Organisation"] = "104";
5797
- GovDepartment["News Agency"] = "105";
5798
- GovDepartment["Press Council"] = "106";
5799
- GovDepartment["Television Authority Media"] = "107";
5800
- GovDepartment["Agency For Science and Engineering Infrastructure"] = "108";
5801
- GovDepartment["Biotechnology Development Agency"] = "109";
5802
- GovDepartment["Centre for Remote Sensing"] = "110";
5803
- GovDepartment["Science and Technology Complex"] = "111";
5804
- GovDepartment["Office for Technology Acquisition and Promotion"] = "112";
5805
- GovDepartment["Space Research and Development Agency"] = "113";
5806
- GovDepartment["Nuclear Regulatory Authority"] = "114";
5807
- GovDepartment["Raw Materials Research and Development Council"] = "116";
5808
- GovDepartment["Communications Satellite Ltd"] = "117";
5809
- GovDepartment["Centre for Technology Management"] = "118";
5810
- GovDepartment["Hydrological Services Agency"] = "119";
5811
- GovDepartment["Integrated Water Resources Commission"] = "120";
5812
- GovDepartment["Water Resources Institute"] = "121";
5813
- GovDepartment["River Basin Development Authorities"] = "122";
5814
- GovDepartment["Centre for Black and African Arts and Civilization"] = "123";
5815
- GovDepartment["Automotive Design and Development Council"] = "124";
5816
- GovDepartment["Code of Conduct Bureau"] = "125";
5817
- GovDepartment["Computer Professionals Registration Council"] = "126";
5818
- GovDepartment["Consumer Protection Council"] = "127";
5819
- GovDepartment["Economic and Financial Crimes Commission"] = "128";
5820
- GovDepartment["Federal Character Commission"] = "129";
5821
- GovDepartment["Federal Housing Authority"] = "130";
5822
- GovDepartment["Corrupt Practices and Other Related Offences Commission"] = "131";
5823
- GovDepartment["Independent National Electoral Commission"] = "132";
5824
- GovDepartment["Industrial Training Fund"] = "133";
5825
- GovDepartment["Legal Aid Council"] = "134";
5826
- GovDepartment["Agency for the Prohibition of Trafficking in Persons"] = "135";
5827
- GovDepartment["National Boundary Commission"] = "136";
5828
- GovDepartment["National Council of Arts and Culture"] = "137";
5829
- GovDepartment["Economic Reconstruction Fund"] = "138";
5830
- GovDepartment["Emergency Management Agency"] = "139";
5831
- GovDepartment["Hajj Commission"] = "140";
5832
- GovDepartment["Human Rights Commission"] = "141";
5833
- GovDepartment["Identity Management Commission"] = "142";
5834
- GovDepartment["Institute for Hospitality Tourism"] = "143";
5835
- GovDepartment["Lottery Regulatory Commission"] = "144";
5836
- GovDepartment["Orientation Agency"] = "145";
5837
- GovDepartment["Population Commission"] = "146";
5838
- GovDepartment["Poverty Eradication Programme (defunct)"] = "147";
5839
- GovDepartment["Salaries, Incomes and Wages Commission"] = "148";
5840
- GovDepartment["Sports Commission"] = "149";
5841
- GovDepartment["Extractive Industries Transparency Initiative"] = "150";
5842
- GovDepartment["Immigration Service"] = "151";
5843
- GovDepartment["Building and Road Research Institute"] = "152";
5844
- GovDepartment["Institute of Building"] = "153";
5845
- GovDepartment["Christian Pilgrim Commission"] = "154";
5846
- GovDepartment["Copyright Commission"] = "155";
5847
- GovDepartment["Tourism Development Corporation"] = "156";
5848
- GovDepartment["Public Complaints Commission"] = "157";
5849
- GovDepartment["Surveyors Council"] = "158";
5850
- GovDepartment["National Lottery Trust Fund"] = "159";
5851
- })(GovDepartment || (GovDepartment = {}));
5852
-
5853
- var Ministry;
5854
- (function (Ministry) {
5855
- Ministry["Agriculture"] = "Agriculture";
5856
- Ministry["Aviation"] = "Aviation";
5857
- Ministry["Communications"] = "Communications";
5858
- Ministry["Economy"] = "Economy";
5859
- Ministry["Education"] = "Education";
5860
- Ministry["Energy"] = "Energy";
5861
- Ministry["Environment"] = "Environment";
5862
- Ministry["Health"] = "Health";
5863
- Ministry["Intelligence"] = "Intelligence";
5864
- Ministry["Judiciary"] = "Judiciary";
5865
- Ministry["Maritime"] = "Maritime";
5866
- Ministry["Media"] = "Media";
5867
- Ministry["ScienceAndTechnology"] = "Science And Technology";
5868
- Ministry["WaterResources"] = "Water Resources";
5869
- Ministry["Other"] = "Other";
5870
- })(Ministry || (Ministry = {}));
5871
-
5872
5690
  var ConfigurationSettingsType;
5873
5691
  (function (ConfigurationSettingsType) {
5874
5692
  ConfigurationSettingsType[ConfigurationSettingsType["isTransferFrozen"] = 0] = "isTransferFrozen";
@@ -5914,197 +5732,6 @@ var ProgrammeCertify = /** @class */ (function () {
5914
5732
  return ProgrammeCertify;
5915
5733
  }());
5916
5734
 
5917
- var sectoralScopes$1 = {
5918
- Agriculture: [
5919
- "Cocoa Research Institute",
5920
- "National Agricultural Extension, Research and Liaison Services",
5921
- "National Veterinary Research Institute",
5922
- "Agricultural Insurance Corporation",
5923
- "National Root Crops Research Institute",
5924
- "Agricultural Research Council",
5925
- "Institute for Oceanography and Marine Research",
5926
- "Institute for Oil Palm Research",
5927
- "Agricultural Quarantine Service",
5928
- "National Horticultural Research Institute",
5929
- ],
5930
- Aviation: [
5931
- "Federal Airports Authority",
5932
- "Airspace Management Agency",
5933
- "Civil Aviation Authority",
5934
- "Safety Investigation Bureau",
5935
- "Meteorological Agency",
5936
- "College of Aviation Technology",
5937
- ],
5938
- Communications: [
5939
- "National Information Technology Development Agency",
5940
- "Communications Satellite Limited",
5941
- "Broadcasting Commission",
5942
- "Communications Commission",
5943
- "Postal Service",
5944
- "National Frequency Management Council",
5945
- "Television Authority",
5946
- "Galaxy Backbone",
5947
- ],
5948
- Economy: [
5949
- "Asset Management Corporation",
5950
- "Social Security Administration",
5951
- "Budget Office of the Federation",
5952
- "Bureau of Public Enterprises",
5953
- "Bureau of Public Procurement",
5954
- "Central Bank",
5955
- "Corporate Affairs Commission",
5956
- "Debt Management Office",
5957
- "Inland Revenue Service",
5958
- "Mortgage Bank",
5959
- "Fiscal Responsibility Commission",
5960
- "Infrastructure Concession Regulatory Commission",
5961
- "National Bureau of Statistics",
5962
- "National Council on Privatisation",
5963
- "National Insurance Commission",
5964
- "National Pension Commission",
5965
- "National Planning Commission",
5966
- "National Sugar Development Council",
5967
- "Niger Delta Development Commission",
5968
- "Customs Service",
5969
- "Deposit Insurance Corporation",
5970
- "Investment Promotion Commission",
5971
- "Export - Import Bank",
5972
- "Export Promotion Council",
5973
- "Oil and Gas Free Zones Authority",
5974
- "Export Processing Zones Authority",
5975
- "Revenue Mobilisation Allocation and Fiscal Commission",
5976
- "Securities and Exchange Commission",
5977
- "Standards Organisation",
5978
- "Small and Medium Enterprise Development Agency",
5979
- ],
5980
- Education: [
5981
- "National Board for Arabic And Islamic Studies",
5982
- "Joint Admissions and Matriculation Board",
5983
- "National Examination Council",
5984
- "National Open University",
5985
- "National Teachers Institute",
5986
- "National Universities Commission",
5987
- "Tertiary Education Trust Fund",
5988
- "Teachers Registration Council",
5989
- "National Business and Technical Examinations Board",
5990
- "Universal Basic Education Commission",
5991
- "West African Examination Council",
5992
- "National Commission for Colleges of Education",
5993
- "National Library",
5994
- ],
5995
- Energy: [
5996
- "Midstream and Downstream Petroleum Regulatory Authority",
5997
- "Upstream Petroleum Regulatory Commission",
5998
- "Electricity Management Services Limited",
5999
- "Energy Commission",
6000
- "National Power Training Institute",
6001
- "Electricity Regulatory Commission",
6002
- "Content Monitoring and Development Board",
6003
- "National Petroleum Corporation",
6004
- "Nuclear Regulatory Authority",
6005
- "Petroleum Product Pricing Regulatory Agency",
6006
- "Power Holding Company (defunct)",
6007
- "Rural Electrification Agency",
6008
- "Transmission Company",
6009
- ],
6010
- Environment: [
6011
- "Environmental Protection Agency (defunct)",
6012
- "Forestry Research Institute",
6013
- "National Biosafety Management Agency",
6014
- "National Environmental Standards and Regulations Enforcement Agency",
6015
- "National Oil Spill Detection and Response Agency",
6016
- "Environmental Health Officers Registration Council",
6017
- ],
6018
- Health: [
6019
- "National Health Insurance Scheme",
6020
- "Institute for Pharmaceutical Research and Development",
6021
- "Agency for the Control of AIDS",
6022
- "Agency for Food and Drug Administration and Control",
6023
- "Primary Health Care Development Agency",
6024
- "Institute of Medical Research",
6025
- "Centre for Disease Control",
6026
- "Drug Law Enforcement Agency",
6027
- ],
6028
- Intelligence: [
6029
- "Defence Intelligence Agency",
6030
- "State Security Service",
6031
- "National Intelligence Agency",
6032
- "Financial Intelligence Unit",
6033
- ],
6034
- Judiciary: [
6035
- "National Judicial Council",
6036
- "Federal Judicial Service Commission",
6037
- "National Judicial Institute",
6038
- ],
6039
- Maritime: [
6040
- "Maritime Administration and Safety Agency",
6041
- "Ports Authority",
6042
- "Shippers' Council",
6043
- ],
6044
- Media: [
6045
- "Broadcasting Organisation",
6046
- "News Agency",
6047
- "Press Council",
6048
- "Television Authority",
6049
- ],
6050
- ScienceAndTechnology: [
6051
- "Agency For Science and Engineering Infrastructure",
6052
- "Biotechnology Development Agency",
6053
- "Centre for Remote Sensing",
6054
- "Science and Technology Complex",
6055
- "Office for Technology Acquisition and Promotion",
6056
- "Space Research and Development Agency",
6057
- "Nuclear Regulatory Authority",
6058
- "Raw Materials Research and Development Council",
6059
- "Communications Satellite Ltd",
6060
- "Centre for Technology Management",
6061
- ],
6062
- WaterResources: [
6063
- "Hydrological Services Agency",
6064
- "Integrated Water Resources Commission",
6065
- "Water Resources Institute",
6066
- "River Basin Development Authorities",
6067
- ],
6068
- Other: [
6069
- "Centre for Black and African Arts and Civilization",
6070
- "Automotive Design and Development Council",
6071
- "Code of Conduct Bureau",
6072
- "Computer Professionals Registration Council",
6073
- "Consumer Protection Council",
6074
- "Economic and Financial Crimes Commission",
6075
- "Federal Character Commission",
6076
- "Federal Housing Authority",
6077
- "Corrupt Practices and Other Related Offences Commission",
6078
- "Independent National Electoral Commission",
6079
- "Industrial Training Fund",
6080
- "Legal Aid Council",
6081
- "Agency for the Prohibition of Trafficking in Persons",
6082
- "National Boundary Commission",
6083
- "National Council of Arts and Culture",
6084
- "Economic Reconstruction Fund",
6085
- "Emergency Management Agency",
6086
- "Hajj Commission",
6087
- "Human Rights Commission",
6088
- "Identity Management Commission",
6089
- "Institute for Hospitality Tourism",
6090
- "Lottery Regulatory Commission",
6091
- "Orientation Agency",
6092
- "Population Commission",
6093
- "Poverty Eradication Programme (defunct)",
6094
- "Salaries, Incomes and Wages Commission",
6095
- "Sports Commission",
6096
- "Extractive Industries Transparency Initiative",
6097
- "Immigration Service",
6098
- "Building and Road Research Institute",
6099
- "Institute of Building",
6100
- "Christian Pilgrim Commission",
6101
- "Copyright Commission",
6102
- "Tourism Development Corporation",
6103
- "Public Complaints Commission",
6104
- "Surveyors Council",
6105
- "National Lottery Trust Fund",
6106
- ],
6107
- };
6108
5735
  var AddNewCompanyComponent = function (props) {
6109
5736
  var _a;
6110
5737
  var t = props.t, onNavigateToCompanyManagement = props.onNavigateToCompanyManagement, maximumImageSize = props.maximumImageSize, useConnection = props.useConnection, useUserContext = props.useUserContext, useLocation = props.useLocation, regionField = props.regionField, isGuest = props.isGuest, onNavigateToHome = props.onNavigateToHome, systemType = props.systemType;
@@ -6123,53 +5750,6 @@ var AddNewCompanyComponent = function (props) {
6123
5750
  var _k = useState(false), loadingList = _k[0], setLoadingList = _k[1];
6124
5751
  var _l = useState([]), regionsList = _l[0], setRegionsList = _l[1];
6125
5752
  var _m = useState((_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.companyRole), companyRole = _m[0], setCompanyRole = _m[1];
6126
- var _o = useState(""), selectedMinistry = _o[0], setSelectedMinistry = _o[1];
6127
- var _p = useState([]), existgovDep = _p[0], setexistGovdep = _p[1];
6128
- var selectedGovDepatments = sectoralScopes$1[selectedMinistry];
6129
- if (existgovDep && existgovDep.length > 0) {
6130
- selectedGovDepatments = selectedGovDepatments.filter(function (x) { return !existgovDep.includes(x); });
6131
- }
6132
- var onChangeMinistry = function (val) { return __awaiter(void 0, void 0, void 0, function () {
6133
- var key, response, existDep, i, departName;
6134
- return __generator(this, function (_a) {
6135
- switch (_a.label) {
6136
- case 0:
6137
- formOne.resetFields(["govDep"]);
6138
- key = Object.keys(Ministry)[Object.values(Ministry).indexOf(val)];
6139
- setSelectedMinistry(String(key));
6140
- return [4 /*yield*/, post("national/organisation/query", {
6141
- page: 1,
6142
- size: 10,
6143
- filterAnd: [
6144
- {
6145
- key: "companyRole",
6146
- operation: "=",
6147
- value: "Ministry",
6148
- },
6149
- {
6150
- key: "ministry",
6151
- operation: "=",
6152
- value: val,
6153
- },
6154
- ],
6155
- })];
6156
- case 1:
6157
- response = _a.sent();
6158
- if (response && response.data) {
6159
- existDep = [];
6160
- for (i in response.data) {
6161
- console.log("existdata", response.data[i]);
6162
- if (response.data[i].govDep && response.data[i].govDep.length > 0) {
6163
- departName = Object.keys(GovDepartment)[Object.values(GovDepartment).indexOf(response.data[i].govDep)];
6164
- existDep.push(departName);
6165
- }
6166
- }
6167
- setexistGovdep(existDep);
6168
- }
6169
- return [2 /*return*/];
6170
- }
6171
- });
6172
- }); };
6173
5753
  var getCountryList = function () { return __awaiter(void 0, void 0, void 0, function () {
6174
5754
  var response, alpha2Names;
6175
5755
  return __generator(this, function (_a) {
@@ -6294,10 +5874,6 @@ var AddNewCompanyComponent = function (props) {
6294
5874
  logoBase64 = _c.sent();
6295
5875
  logoUrls = logoBase64.split(",");
6296
5876
  requestData.company.logo = logoUrls[1];
6297
- if (companyRole === CompanyRole.MINISTRY) {
6298
- requestData.company.name =
6299
- "Ministry of " + requestData.company.ministry;
6300
- }
6301
5877
  if (!isGuest) return [3 /*break*/, 4];
6302
5878
  return [4 /*yield*/, post("national/user/register", requestData)];
6303
5879
  case 3:
@@ -6350,7 +5926,7 @@ var AddNewCompanyComponent = function (props) {
6350
5926
  });
6351
5927
  }); };
6352
5928
  var onUpdateCompany = function () { return __awaiter(void 0, void 0, void 0, function () {
6353
- var formOneValues, values, key, logoBase64, logoUrls, response, error_3;
5929
+ var formOneValues, values, logoBase64, logoUrls, response, error_3;
6354
5930
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
6355
5931
  return __generator(this, function (_l) {
6356
5932
  switch (_l.label) {
@@ -6391,15 +5967,6 @@ var AddNewCompanyComponent = function (props) {
6391
5967
  if (((_g = state === null || state === void 0 ? void 0 : state.record) === null || _g === void 0 ? void 0 : _g.companyRole) === CompanyRole.MINISTRY) {
6392
5968
  values.sectoralScope = formOneValues.sectoralScope;
6393
5969
  values.nameOfMinister = formOneValues.nameOfMinister;
6394
- values.ministry = formOneValues.ministry;
6395
- if (formOneValues.govDep in GovDepartment) {
6396
- key = formOneValues.govDep;
6397
- values.govDep = GovDepartment[key];
6398
- }
6399
- else {
6400
- values.govDep = formOneValues.govDep;
6401
- }
6402
- values.name = "Ministry of " + formOneValues.ministry;
6403
5970
  }
6404
5971
  if (((_h = state === null || state === void 0 ? void 0 : state.record) === null || _h === void 0 ? void 0 : _h.companyRole) === CompanyRole.GOVERNMENT) {
6405
5972
  values.omgePercentage = Math.round(Number(formOneValues.omgePercentage));
@@ -6460,7 +6027,7 @@ var AddNewCompanyComponent = function (props) {
6460
6027
  setCompanyRole(value);
6461
6028
  };
6462
6029
  var CompanyDetailsForm = function () {
6463
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
6030
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
6464
6031
  var companyRoleClassName = companyRole === CompanyRole.CERTIFIER
6465
6032
  ? "certifier"
6466
6033
  : companyRole === CompanyRole.PROGRAMME_DEVELOPER
@@ -6474,7 +6041,7 @@ var AddNewCompanyComponent = function (props) {
6474
6041
  React.createElement(Row, { className: "row", gutter: [16, 16] },
6475
6042
  React.createElement(Col, { xl: 12, md: 24 },
6476
6043
  React.createElement("div", { className: "details-part-one" },
6477
- companyRole !== CompanyRole.MINISTRY && (React.createElement(Form.Item, { label: "Name", name: "name", initialValue: (_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.name, rules: [
6044
+ React.createElement(Form.Item, { label: "Name", name: "name", initialValue: (_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.name, rules: [
6478
6045
  {
6479
6046
  required: true,
6480
6047
  message: "",
@@ -6493,7 +6060,7 @@ var AddNewCompanyComponent = function (props) {
6493
6060
  }); },
6494
6061
  },
6495
6062
  ] },
6496
- React.createElement(Input, { size: "large" }))),
6063
+ React.createElement(Input, { size: "large" })),
6497
6064
  companyRole !== CompanyRole.MINISTRY
6498
6065
  ? (!isUpdate ||
6499
6066
  (isUpdate &&
@@ -6573,31 +6140,7 @@ var AddNewCompanyComponent = function (props) {
6573
6140
  },
6574
6141
  ] },
6575
6142
  React.createElement(Input, { size: "large" })),
6576
- companyRole === CompanyRole.MINISTRY && (React.createElement("div", { className: "space-container", style: { width: "100%" } },
6577
- React.createElement(Form.Item, { label: "Ministry Name", name: "ministry", initialValue: (_e = state === null || state === void 0 ? void 0 : state.record) === null || _e === void 0 ? void 0 : _e.ministry, rules: [
6578
- {
6579
- required: true,
6580
- message: "Ministry Name is required",
6581
- },
6582
- ] },
6583
- React.createElement(Select, { size: "large", onChange: onChangeMinistry }, Object.values(Ministry).map(function (ministry) { return (React.createElement(Select.Option, { value: ministry }, ministry)); }))),
6584
- React.createElement(Form.Item, { label: "Name of the Minister", name: "nameOfMinister", initialValue: (_f = state === null || state === void 0 ? void 0 : state.record) === null || _f === void 0 ? void 0 : _f.nameOfMinister, rules: [
6585
- {
6586
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
6587
- return __generator(this, function (_a) {
6588
- if (String(value).trim() === "" ||
6589
- String(value).trim() === undefined ||
6590
- value === null ||
6591
- value === undefined) {
6592
- throw new Error("Name of the Minister ".concat(t("isRequired")));
6593
- }
6594
- return [2 /*return*/];
6595
- });
6596
- }); },
6597
- },
6598
- ] },
6599
- React.createElement(Input, { size: "large" })))),
6600
- React.createElement(Form.Item, { className: "website", label: "Website", initialValue: (_h = (_g = state === null || state === void 0 ? void 0 : state.record) === null || _g === void 0 ? void 0 : _g.website) === null || _h === void 0 ? void 0 : _h.split("://")[1], name: "website", rules: [
6143
+ React.createElement(Form.Item, { className: "website", label: "Website", initialValue: (_f = (_e = state === null || state === void 0 ? void 0 : state.record) === null || _e === void 0 ? void 0 : _e.website) === null || _f === void 0 ? void 0 : _f.split("://")[1], name: "website", rules: [
6601
6144
  {
6602
6145
  required: false,
6603
6146
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
@@ -6615,23 +6158,6 @@ var AddNewCompanyComponent = function (props) {
6615
6158
  },
6616
6159
  ], getValueFromEvent: function (event) { var _a; return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value.trim(); } },
6617
6160
  React.createElement(Input, { addonBefore: "https://", size: "large" })),
6618
- companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { name: "address", label: "Address", initialValue: (_j = state === null || state === void 0 ? void 0 : state.record) === null || _j === void 0 ? void 0 : _j.address, rules: [
6619
- { required: true, message: "" },
6620
- {
6621
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
6622
- return __generator(this, function (_a) {
6623
- if (String(value).trim() === "" ||
6624
- String(value).trim() === undefined ||
6625
- value === null ||
6626
- value === undefined) {
6627
- throw new Error("Address ".concat(t("isRequired")));
6628
- }
6629
- return [2 /*return*/];
6630
- });
6631
- }); },
6632
- },
6633
- ] },
6634
- React.createElement(Input.TextArea, { rows: 3, maxLength: 100 }))),
6635
6161
  React.createElement(Form.Item, { name: "logo", label: "Organisation Logo (File Type : JPEG , PNG)", valuePropName: "fileList", getValueFromEvent: normFile, required: true, rules: [
6636
6162
  {
6637
6163
  validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
@@ -6675,12 +6201,29 @@ var AddNewCompanyComponent = function (props) {
6675
6201
  return false;
6676
6202
  }, className: "logo-upload-section", name: "logo", action: "/upload.do", listType: "picture", multiple: false, defaultFileList: fileList, maxCount: 1 },
6677
6203
  React.createElement(Button, { size: "large", icon: React.createElement(UploadOutlined, null) }, "Upload"))),
6204
+ companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { name: "address", label: "Address", initialValue: (_g = state === null || state === void 0 ? void 0 : state.record) === null || _g === void 0 ? void 0 : _g.address, rules: [
6205
+ { required: true, message: "" },
6206
+ {
6207
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
6208
+ return __generator(this, function (_a) {
6209
+ if (String(value).trim() === "" ||
6210
+ String(value).trim() === undefined ||
6211
+ value === null ||
6212
+ value === undefined) {
6213
+ throw new Error("Address ".concat(t("isRequired")));
6214
+ }
6215
+ return [2 /*return*/];
6216
+ });
6217
+ }); },
6218
+ },
6219
+ ] },
6220
+ React.createElement(Input.TextArea, { rows: 3, maxLength: 100 }))),
6678
6221
  companyRole === CompanyRole.GOVERNMENT && (React.createElement("div", { className: "space-container", style: { width: "100%" } },
6679
6222
  React.createElement(Space, { wrap: true, style: {
6680
6223
  display: "flex",
6681
6224
  marginBottom: 8,
6682
6225
  }, align: "center", size: "large" },
6683
- React.createElement(Form.Item, { style: { width: "100%" }, name: "nationalSopValue", label: "National Share of Proceeds", initialValue: (_k = state === null || state === void 0 ? void 0 : state.record) === null || _k === void 0 ? void 0 : _k.nationalSopValue, rules: [
6226
+ React.createElement(Form.Item, { style: { width: "100%" }, name: "nationalSopValue", label: "National Share of Proceeds", initialValue: (_h = state === null || state === void 0 ? void 0 : state.record) === null || _h === void 0 ? void 0 : _h.nationalSopValue, rules: [
6684
6227
  { required: true, message: "" },
6685
6228
  {
6686
6229
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
@@ -6738,45 +6281,37 @@ var AddNewCompanyComponent = function (props) {
6738
6281
  React.createElement(Radio.Button, { className: "minister", value: "Ministry" },
6739
6282
  React.createElement(AuditOutlined, { className: "role-icons" }),
6740
6283
  "Ministry")))))))),
6741
- companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { label: "Government Department", name: "govDep", initialValue: Object.keys(GovDepartment)[Object.values(GovDepartment).indexOf((_l = state === null || state === void 0 ? void 0 : state.record) === null || _l === void 0 ? void 0 : _l.govDep)], rules: [
6284
+ companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { label: "Name of the Minister", name: "nameOfMinister", initialValue: (_j = state === null || state === void 0 ? void 0 : state.record) === null || _j === void 0 ? void 0 : _j.nameOfMinister, rules: [
6742
6285
  {
6743
6286
  required: true,
6744
- message: "Government Department is required",
6287
+ message: "",
6745
6288
  },
6746
6289
  {
6747
6290
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
6748
- var val;
6749
6291
  return __generator(this, function (_a) {
6750
- val = Object.keys(GovDepartment)[Object.values(GovDepartment).indexOf(value)];
6751
- if (val &&
6752
- val.length > 0 &&
6753
- selectedGovDepatments &&
6754
- !selectedGovDepatments.includes(val)) {
6755
- throw new Error("Department not exist in Ministry");
6292
+ if (String(value).trim() === "" ||
6293
+ String(value).trim() === undefined ||
6294
+ value === null ||
6295
+ value === undefined) {
6296
+ throw new Error("Name of the Minister ".concat(t("isRequired")));
6756
6297
  }
6757
6298
  return [2 /*return*/];
6758
6299
  });
6759
6300
  }); },
6760
6301
  },
6761
6302
  ] },
6762
- React.createElement(Select, { size: "large" }, selectedGovDepatments === null || selectedGovDepatments === void 0 ? void 0 : selectedGovDepatments.map(function (val) {
6763
- if (val in GovDepartment) {
6764
- var key = val;
6765
- return (React.createElement(Select.Option, { key: GovDepartment[key], value: GovDepartment[key] }, val));
6766
- }
6767
- return null;
6768
- })))),
6303
+ React.createElement(Input, { size: "large" }))),
6769
6304
  companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { label: "Sectoral Scope", name: "sectoralScope", rules: [
6770
6305
  {
6771
6306
  required: true,
6772
6307
  message: "Sectoral Scope ".concat(t("isRequired")),
6773
6308
  },
6774
- ], initialValue: (_m = state === null || state === void 0 ? void 0 : state.record) === null || _m === void 0 ? void 0 : _m.sectoralScope },
6309
+ ], initialValue: (_k = state === null || state === void 0 ? void 0 : state.record) === null || _k === void 0 ? void 0 : _k.sectoralScope },
6775
6310
  React.createElement(Select, { mode: "multiple", size: "large", maxTagCount: 2, allowClear: true }, Object.entries(SectoralScope).map(function (_a) {
6776
6311
  var key = _a[0], value = _a[1];
6777
6312
  return (React.createElement(Select.Option, { key: value, value: value }, key));
6778
6313
  })))),
6779
- React.createElement(Form.Item, { name: "phoneNo", label: "Phone Number", initialValue: (_o = state === null || state === void 0 ? void 0 : state.record) === null || _o === void 0 ? void 0 : _o.phoneNo, rules: [
6314
+ React.createElement(Form.Item, { name: "phoneNo", label: "Phone Number", initialValue: (_l = state === null || state === void 0 ? void 0 : state.record) === null || _l === void 0 ? void 0 : _l.phoneNo, rules: [
6780
6315
  {
6781
6316
  required: true,
6782
6317
  message: "",
@@ -6807,14 +6342,14 @@ var AddNewCompanyComponent = function (props) {
6807
6342
  },
6808
6343
  ] },
6809
6344
  React.createElement(PhoneInput, { placeholder: "Phone number", international: true, value: formatPhoneNumberIntl(contactNoInput), defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries })),
6810
- regionField && (React.createElement(Form.Item, { label: t("region"), name: "regions", initialValue: (_p = state === null || state === void 0 ? void 0 : state.record) === null || _p === void 0 ? void 0 : _p.regions, rules: [
6345
+ regionField && (React.createElement(Form.Item, { label: t("region"), name: "regions", initialValue: (_m = state === null || state === void 0 ? void 0 : state.record) === null || _m === void 0 ? void 0 : _m.regions, rules: [
6811
6346
  {
6812
6347
  required: true,
6813
6348
  message: "".concat(t("region"), " ").concat(t("isRequired")),
6814
6349
  },
6815
6350
  ] },
6816
6351
  React.createElement(Select, { mode: "multiple", size: "large", maxTagCount: 2, onChange: onChangeRegion, loading: loadingList, allowClear: true }, regionsList.map(function (region) { return (React.createElement(Select.Option, { value: region }, region)); })))),
6817
- companyRole !== CompanyRole.MINISTRY && (React.createElement(Form.Item, { name: "address", label: "Address", initialValue: (_q = state === null || state === void 0 ? void 0 : state.record) === null || _q === void 0 ? void 0 : _q.address, rules: [
6352
+ companyRole !== CompanyRole.MINISTRY && (React.createElement(Form.Item, { name: "address", label: "Address", initialValue: (_o = state === null || state === void 0 ? void 0 : state.record) === null || _o === void 0 ? void 0 : _o.address, rules: [
6818
6353
  { required: true, message: "" },
6819
6354
  {
6820
6355
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
@@ -6837,7 +6372,7 @@ var AddNewCompanyComponent = function (props) {
6837
6372
  display: "flex",
6838
6373
  marginBottom: 8,
6839
6374
  }, align: "center", size: "large" },
6840
- React.createElement(Form.Item, { style: { width: "100%" }, name: "omgePercentage", label: "Overall Mitigation in Global Emissions (OMGE) Account", initialValue: (_r = state === null || state === void 0 ? void 0 : state.record) === null || _r === void 0 ? void 0 : _r.omgePercentage, rules: [
6375
+ React.createElement(Form.Item, { style: { width: "100%" }, name: "omgePercentage", label: "Overall Mitigation in Global Emissions (OMGE) Account", initialValue: (_p = state === null || state === void 0 ? void 0 : state.record) === null || _p === void 0 ? void 0 : _p.omgePercentage, rules: [
6841
6376
  { required: true, message: "" },
6842
6377
  {
6843
6378
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
@@ -7344,16 +6879,6 @@ var CompanyProfileComponent = function (props) {
7344
6879
  React.createElement(Col, { span: 12, className: "field-value" }, companyDetails.nameOfMinister
7345
6880
  ? companyDetails.nameOfMinister
7346
6881
  : "-")),
7347
- React.createElement(Row, { className: "field" },
7348
- React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:ministryName")),
7349
- React.createElement(Col, { span: 12, className: "field-value" }, companyDetails.ministry
7350
- ? companyDetails.ministry
7351
- : "-")),
7352
- React.createElement(Row, { className: "field" },
7353
- React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:govDepName")),
7354
- React.createElement(Col, { span: 12, className: "field-value" }, companyDetails.govDep
7355
- ? Object.keys(GovDepartment)[Object.values(GovDepartment).indexOf(companyDetails.govDep)]
7356
- : "-")),
7357
6882
  React.createElement(Row, { className: "field" },
7358
6883
  React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:sectoralScope")),
7359
6884
  React.createElement(Col, { span: 12, className: "field-value" }, companyDetails.sectoralScope
@@ -27130,622 +26655,891 @@ var RegistryDashboardComponent = function (props) {
27130
26655
  lastUpdateTransferLocations))))))))) : ("")));
27131
26656
  };
27132
26657
 
27133
- var EditableContext = React.createContext(null);
27134
- var EditableRow = function (_a) {
27135
- _a.index; var props = __rest(_a, ["index"]);
27136
- var form = Form.useForm()[0];
27137
- return (React.createElement(Form, { form: form, component: false },
27138
- React.createElement(EditableContext.Provider, { value: form },
27139
- React.createElement("tr", __assign({}, props)))));
27140
- };
26658
+ React.createContext(null);
27141
26659
  var EditableCell = function (_a) {
27142
- var title = _a.title, editable = _a.editable, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, restProps = __rest(_a, ["title", "editable", "children", "dataIndex", "record", "handleSave"]);
27143
- var _b = useState(false), editing = _b[0], setEditing = _b[1];
27144
- var inputRef = useRef(null);
27145
- var form = useContext(EditableContext);
27146
- useEffect(function () {
27147
- if (editing) {
27148
- inputRef.current.focus();
27149
- }
27150
- }, [editing]);
27151
- var toggleEdit = function () {
27152
- var _a;
27153
- setEditing(!editing);
27154
- form.setFieldsValue((_a = {}, _a[dataIndex] = record[dataIndex], _a));
27155
- };
27156
- var save = function () { return __awaiter(void 0, void 0, void 0, function () {
27157
- var values, errInfo_1;
27158
- return __generator(this, function (_a) {
27159
- switch (_a.label) {
27160
- case 0:
27161
- _a.trys.push([0, 2, , 3]);
27162
- return [4 /*yield*/, form.validateFields()];
27163
- case 1:
27164
- values = _a.sent();
27165
- toggleEdit();
27166
- handleSave(__assign(__assign({}, record), values));
27167
- return [3 /*break*/, 3];
27168
- case 2:
27169
- errInfo_1 = _a.sent();
27170
- console.log("Save failed:", errInfo_1);
27171
- return [3 /*break*/, 3];
27172
- case 3: return [2 /*return*/];
27173
- }
27174
- });
27175
- }); };
27176
- var childNode = children;
27177
- if (editable) {
27178
- childNode = editing ? (React.createElement(Form.Item, { style: { margin: 0 }, name: dataIndex, rules: [
27179
- {
27180
- required: true,
27181
- message: "".concat(title, " is required."),
27182
- },
27183
- ] },
27184
- React.createElement(Input, { ref: inputRef, onPressEnter: save, onBlur: save }))) : (React.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24, minWidth: "100px", minHeight: "20px" }, onClick: toggleEdit }, children));
27185
- }
27186
- return React.createElement("td", __assign({}, restProps), childNode);
26660
+ var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title; _a.inputType; var record = _a.record; _a.index; var children = _a.children, onBlurHandler = _a.onBlurHandler, t = _a.t, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children", "onBlurHandler", "t"]);
26661
+ return (React.createElement("td", __assign({}, restProps), editing && dataIndex === "nationalPlanObjective" ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26662
+ {
26663
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26664
+ var trimValue;
26665
+ return __generator(this, function (_a) {
26666
+ trimValue = typeof value === "string" ? value.trim() : value;
26667
+ if (!trimValue) {
26668
+ throw new Error("".concat(title, " ").concat(t("ndc:isRequired")));
26669
+ }
26670
+ return [2 /*return*/];
26671
+ });
26672
+ }); },
26673
+ },
26674
+ ] },
26675
+ React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }))) : editing && dataIndex === "kpi" ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26676
+ {
26677
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26678
+ var trimValue;
26679
+ return __generator(this, function (_a) {
26680
+ trimValue = typeof value === "string" ? value.trim() : value;
26681
+ if (trimValue) {
26682
+ if (isNaN(+trimValue)) {
26683
+ throw new Error(t("ndc:kpiInvalidFormat"));
26684
+ }
26685
+ else if (+trimValue <= 0) {
26686
+ throw new Error(t("ndc:kpiGreaterThanZero"));
26687
+ }
26688
+ else if (trimValue.toString().length > 7) {
26689
+ throw new Error(t("ndc:kpiMaxLength"));
26690
+ }
26691
+ }
26692
+ else {
26693
+ throw new Error("".concat(title, " ").concat(t("ndc:isRequired")));
26694
+ }
26695
+ return [2 /*return*/];
26696
+ });
26697
+ }); },
26698
+ },
26699
+ ] },
26700
+ React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }))) : (children)));
27187
26701
  };
27188
26702
 
27189
- var css_248z$4 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n";
26703
+ var css_248z$4 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n\n.ndc-details tbody {\n vertical-align: top; }\n\n.ndc-details td .ant-space-item {\n margin-top: 5px; }\n\n.ndc-details .btn-danger {\n color: #ff4d4f !important;\n border-color: #ff8183 !important; }\n";
27190
26704
  styleInject(css_248z$4);
27191
26705
 
27192
- var NdcActionType;
27193
- (function (NdcActionType) {
27194
- NdcActionType[NdcActionType["main"] = 0] = "main";
27195
- NdcActionType[NdcActionType["sub"] = 1] = "sub";
27196
- })(NdcActionType || (NdcActionType = {}));
26706
+ var NdcDetailsActionType;
26707
+ (function (NdcDetailsActionType) {
26708
+ NdcDetailsActionType["MainAction"] = "MainAction";
26709
+ NdcDetailsActionType["SubAction"] = "SubAction";
26710
+ })(NdcDetailsActionType || (NdcDetailsActionType = {}));
26711
+ var NdcDetailsActionStatus;
26712
+ (function (NdcDetailsActionStatus) {
26713
+ NdcDetailsActionStatus["New"] = "New";
26714
+ NdcDetailsActionStatus["Pending"] = "Pending";
26715
+ NdcDetailsActionStatus["Approved"] = "Approved";
26716
+ NdcDetailsActionStatus["Rejected"] = "Rejected";
26717
+ })(NdcDetailsActionStatus || (NdcDetailsActionStatus = {}));
26718
+ var getNdcActionStatusEnumVal = function (value) {
26719
+ var index = Object.keys(NdcDetailsActionStatus).indexOf(value);
26720
+ if (index < 0) {
26721
+ return value;
26722
+ }
26723
+ return Object.values(NdcDetailsActionStatus)[index];
26724
+ };
26725
+ var getNdcActionStatusTagType = function (status) {
26726
+ switch (getNdcActionStatusEnumVal(status)) {
26727
+ case NdcDetailsActionStatus.Rejected:
26728
+ return "error";
26729
+ case NdcDetailsActionStatus.Pending:
26730
+ return "processing";
26731
+ case NdcDetailsActionStatus.Approved:
26732
+ return "success";
26733
+ default:
26734
+ return "default";
26735
+ }
26736
+ };
26737
+
27197
26738
  var NdcDetailsComponent = function (props) {
27198
- var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
26739
+ var t = props.t, useConnection = props.useConnection, useUserContext = props.useUserContext;
27199
26740
  var RangePicker = DatePicker.RangePicker;
27200
- var _a = useState([]), ndcDetailsData = _a[0], setNdcDetailsData = _a[1];
27201
- var _b = useState(false), loading = _b[0]; _b[1];
27202
- var periodItemsRef = useRef([]);
26741
+ var _a = useState([]), ndcActionsList = _a[0], setNdcActionsList = _a[1];
26742
+ var _b = useState(false), loading = _b[0], setLoading = _b[1];
27203
26743
  var _c = useState([]), periodItems = _c[0], setPeriodItems = _c[1];
27204
- var _d = useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
27205
- var selectedPeriod = useRef({});
27206
- var addedNdcDetailId = useRef(0);
27207
- var selectedNdcDetail = useRef({});
26744
+ var _d = useState({}), selectedPeriod = _d[0], setSelectedPeriod = _d[1];
26745
+ var selectedDateRangeRef = useRef({});
27208
26746
  var _e = useState(0), tableKey = _e[0], setTableKey = _e[1];
26747
+ var _f = useConnection(), get = _f.get, post = _f.post, put = _f.put;
26748
+ var _g = useState([]), ministryOrgList = _g[0], setMinistryOrgList = _g[1];
26749
+ var _h = useState({}), actionInfo = _h[0], setActionInfo = _h[1];
26750
+ var _j = useState(false), openConfirmationModal = _j[0], setOpenConfirmationModal = _j[1];
26751
+ var form = Form.useForm()[0];
26752
+ var _k = useState(null), editingKey = _k[0], setEditingKey = _k[1];
26753
+ var _l = useState(0), nextAvailableActionId = _l[0], setNextAvailableActionId = _l[1];
26754
+ var _m = useState([]), expandedRowKeys = _m[0], setExpandedRowKeys = _m[1];
26755
+ var _o = useState([]), subNdcActionsForPeriod = _o[0], setSubNdcActionsForPeriod = _o[1];
26756
+ var _p = useState(1), currentPage = _p[0], setCurrentPage = _p[1];
26757
+ var _q = useState(10), pageSize = _q[0], setPageSize = _q[1];
26758
+ var isEditing = function (record) { return record.id === editingKey; };
26759
+ var isMainActionInEditMode = function () {
26760
+ if (editingKey) {
26761
+ var action = ndcActionsList.find(function (item) { return item.id === editingKey; });
26762
+ if (action && action.actionType === NdcDetailsActionType.MainAction) {
26763
+ return true;
26764
+ }
26765
+ }
26766
+ return false;
26767
+ };
27209
26768
  var userInfoState = useUserContext().userInfoState;
27210
- var isAddRangeVisible = function () {
27211
- return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
27212
- (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT) &&
26769
+ useEffect(function () {
26770
+ if (expandedRowKeys && expandedRowKeys.length > 0) {
26771
+ var expandedKey = expandedRowKeys[0];
26772
+ setNdcSubActionsForMainAction(expandedKey);
26773
+ }
26774
+ }, ndcActionsList);
26775
+ var loginMinistry = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT
26776
+ ? process.env.REACT_APP_GOVERNMENT_MINISTRY
26777
+ ? process.env.REACT_APP_GOVERNMENT_MINISTRY
26778
+ : "Ministry Of Environment"
26779
+ : (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY
26780
+ ? userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName
26781
+ : undefined;
26782
+ var isGovernmentUser = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26783
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
26784
+ var isMainNdcActionsEditable = !selectedPeriod.finalized &&
26785
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26786
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
26787
+ var isSubNdcActionsEditable = function (record) {
26788
+ return (!selectedPeriod.finalized &&
26789
+ record.status !== NdcDetailsActionStatus.Approved &&
26790
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26791
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY &&
26792
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName) === record.ministryName)) &&
27213
26793
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
27214
26794
  };
27215
- var isAddNdcActionVisible = function () {
27216
- return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26795
+ var checkSubNdcActionCreatePermission = function () {
26796
+ return (!selectedPeriod.finalized &&
26797
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26798
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) &&
27217
26799
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
27218
26800
  };
26801
+ var isNdcActionEditable = function (record) {
26802
+ if (record.actionType === NdcDetailsActionType.MainAction) {
26803
+ return isMainNdcActionsEditable;
26804
+ }
26805
+ else if (record.actionType === NdcDetailsActionType.SubAction) {
26806
+ return isSubNdcActionsEditable(record);
26807
+ }
26808
+ };
26809
+ var ndcMainDetailsForPeriod = selectedPeriod.key !== "add_new"
26810
+ ? ndcActionsList.filter(function (ndcDetail) {
26811
+ return (ndcDetail.periodId === parseInt(selectedPeriod.key) &&
26812
+ ndcDetail.actionType === NdcDetailsActionType.MainAction);
26813
+ })
26814
+ : [];
26815
+ var setNdcSubActionsForMainAction = function (mainActionId) {
26816
+ var subNdcDetails = ndcActionsList.filter(function (ndcDetail) {
26817
+ return (ndcDetail.parentActionId === mainActionId &&
26818
+ ndcDetail.actionType === NdcDetailsActionType.SubAction);
26819
+ });
26820
+ var emptySubNdcRow = {
26821
+ id: nextAvailableActionId,
26822
+ actionType: NdcDetailsActionType.SubAction,
26823
+ nationalPlanObjective: "",
26824
+ kpi: "",
26825
+ ministryName: loginMinistry,
26826
+ status: NdcDetailsActionStatus.New,
26827
+ parentActionId: mainActionId,
26828
+ };
26829
+ if (checkSubNdcActionCreatePermission()) {
26830
+ subNdcDetails = __spreadArray(__spreadArray([], subNdcDetails, true), [emptySubNdcRow], false);
26831
+ setEditingKey(nextAvailableActionId);
26832
+ setNextAvailableActionId(function (value) { return value + 1; });
26833
+ form.setFieldsValue({
26834
+ nationalPlanObjective: "",
26835
+ kpi: "",
26836
+ });
26837
+ }
26838
+ setSubNdcActionsForPeriod(subNdcDetails);
26839
+ };
27219
26840
  var inRange = function (num, min, max) {
27220
26841
  return num >= min && num <= max;
27221
26842
  };
27222
- function onAddNewSubNdcDetail() {
27223
- var range = selectedTab.split("-");
27224
- var ndcDetail = ndcDetailsData.find(function (item) { return item.key === selectedNdcDetail.current.key; });
27225
- var ndcDetailItemIndex = ndcDetailsData.findIndex(function (item) { return item.key === selectedNdcDetail.current.key; });
27226
- if (ndcDetail) {
27227
- addedNdcDetailId.current = addedNdcDetailId.current + 1;
27228
- var newData = {
27229
- key: addedNdcDetailId.current,
27230
- startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
27231
- endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
27232
- ndcActionId: ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.key,
27233
- nationalPlanObj: "",
27234
- kpi: "",
27235
- ministry: "",
27236
- };
27237
- if (!ndcDetail.subNdcDetails) {
27238
- ndcDetail.subNdcDetails = [];
27239
- }
27240
- ndcDetail.subNdcDetails.push(newData);
27241
- }
27242
- ndcDetailsData[ndcDetailItemIndex] = ndcDetail;
27243
- setNdcDetailsData(ndcDetailsData);
27244
- setTableKey(function (key) { return key + 1; });
27245
- }
27246
- var handleSave = function (row) {
27247
- setNdcDetailsData(function (prevData) {
27248
- var newData = JSON.parse(JSON.stringify(prevData));
27249
- if (row.type === NdcActionType.main) {
27250
- var index = newData.findIndex(function (item) { return row.key === item.key; });
27251
- if (index !== -1) {
27252
- newData[index] = __assign(__assign({}, newData[index]), row);
27253
- }
27254
- }
27255
- else {
27256
- var parentIndex = newData.findIndex(function (item) { return row.ndcActionId === item.key; });
27257
- var parentItem = newData[parentIndex];
27258
- if (parentItem) {
27259
- if (parentItem.subNdcDetails) {
27260
- var itemIndex = parentItem.subNdcDetails.findIndex(function (item) { return row.key === item.key; });
27261
- if (itemIndex === -1) {
27262
- parentItem.subNdcDetails.push(row);
27263
- }
27264
- else {
27265
- parentItem.subNdcDetails[itemIndex] = __assign({}, row);
27266
- }
26843
+ var ClearEditMode = function () {
26844
+ var unsavedMainActions = ndcActionsList.filter(function (item) {
26845
+ return item.status === NdcDetailsActionStatus.New &&
26846
+ item.actionType === NdcDetailsActionType.MainAction;
26847
+ });
26848
+ if (unsavedMainActions && unsavedMainActions.length) {
26849
+ var updatedActions = ndcActionsList.filter(function (item) { return !unsavedMainActions.includes(item); });
26850
+ setNdcActionsList(updatedActions);
26851
+ }
26852
+ setEditingKey(null);
26853
+ };
26854
+ var handleSave = function (row) { return __awaiter(void 0, void 0, void 0, function () {
26855
+ var updatedFields, updatedItem, exception_2;
26856
+ return __generator(this, function (_a) {
26857
+ switch (_a.label) {
26858
+ case 0:
26859
+ _a.trys.push([0, 9, , 10]);
26860
+ updatedFields = void 0;
26861
+ _a.label = 1;
26862
+ case 1:
26863
+ _a.trys.push([1, 3, , 4]);
26864
+ return [4 /*yield*/, form.validateFields()];
26865
+ case 2:
26866
+ updatedFields = (_a.sent());
26867
+ return [3 /*break*/, 4];
26868
+ case 3:
26869
+ _a.sent();
26870
+ return [2 /*return*/];
26871
+ case 4:
26872
+ if (!updatedFields) {
26873
+ ClearEditMode();
26874
+ return [2 /*return*/];
26875
+ }
26876
+ else if (updatedFields.kpi === row.kpi &&
26877
+ updatedFields.nationalPlanObjective === row.nationalPlanObjective) {
26878
+ ClearEditMode();
26879
+ return [2 /*return*/];
26880
+ }
26881
+ updatedItem = __assign(__assign({}, row), updatedFields);
26882
+ if (!(updatedItem.status === NdcDetailsActionStatus.New)) return [3 /*break*/, 6];
26883
+ if (isGovernmentUser &&
26884
+ updatedItem.actionType === NdcDetailsActionType.SubAction) {
26885
+ updatedItem.status = NdcDetailsActionStatus.Approved;
27267
26886
  }
27268
26887
  else {
27269
- parentItem.subNdcDetails = [row];
26888
+ updatedItem.status = NdcDetailsActionStatus.Pending;
27270
26889
  }
27271
- }
27272
- newData[parentIndex] = __assign({}, parentItem);
27273
- setTableKey(function (key) { return key + 1; });
26890
+ return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26891
+ case 5:
26892
+ _a.sent();
26893
+ return [3 /*break*/, 8];
26894
+ case 6:
26895
+ updatedItem.status = NdcDetailsActionStatus.Pending;
26896
+ return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26897
+ case 7:
26898
+ _a.sent();
26899
+ _a.label = 8;
26900
+ case 8:
26901
+ fetchNdcDetailActions();
26902
+ ClearEditMode();
26903
+ return [3 /*break*/, 10];
26904
+ case 9:
26905
+ exception_2 = _a.sent();
26906
+ ClearEditMode();
26907
+ message.open({
26908
+ type: "error",
26909
+ content: exception_2.message,
26910
+ duration: 3,
26911
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26912
+ });
26913
+ return [3 /*break*/, 10];
26914
+ case 10: return [2 /*return*/];
27274
26915
  }
27275
- return newData;
27276
26916
  });
27277
- };
27278
- var getNdcDetailsForPeriod = function () {
27279
- var range = selectedTab.split("-");
27280
- if (range.length > 1) {
27281
- var filteredData = ndcDetailsData.filter(function (item) {
27282
- return inRange(Number(moment(item.startDate).year()), Number(range[0]), Number(range[1]));
27283
- });
27284
- return filteredData;
26917
+ }); };
26918
+ var actionMenu = function (record) {
26919
+ if (record.status === NdcDetailsActionStatus.Pending &&
26920
+ isGovernmentUser &&
26921
+ !selectedPeriod.finalized) {
26922
+ return (React.createElement(List, { className: "action-menu", size: "small", dataSource: [
26923
+ {
26924
+ text: t("ndc:approve"),
26925
+ icon: React.createElement(Icon.BoxArrowInDown, null),
26926
+ style: "color-primary",
26927
+ click: function () {
26928
+ setActionInfo({
26929
+ action: "Approve",
26930
+ headerText: t("ndc:actionApproveTitle"),
26931
+ type: "primary",
26932
+ icon: React.createElement(Icon.BoxArrowInDown, null),
26933
+ recordId: record.id,
26934
+ });
26935
+ setOpenConfirmationModal(true);
26936
+ },
26937
+ },
26938
+ {
26939
+ text: t("ndc:reject"),
26940
+ icon: React.createElement(Icon.XOctagon, null),
26941
+ style: "color-error",
26942
+ click: function () {
26943
+ setActionInfo({
26944
+ action: "Reject",
26945
+ headerText: t("ndc:rejectApproveTitle"),
26946
+ type: "danger",
26947
+ icon: React.createElement(Icon.XOctagon, null),
26948
+ recordId: record.id,
26949
+ });
26950
+ setOpenConfirmationModal(true);
26951
+ },
26952
+ },
26953
+ ], renderItem: function (item) { return (React.createElement(List.Item, { onClick: item.click },
26954
+ React.createElement(Typography.Text, { className: "action-icon ".concat(item.style) }, item.icon),
26955
+ React.createElement("span", null, item.text))); } }));
27285
26956
  }
27286
26957
  else {
27287
- return [];
27288
- }
27289
- };
27290
- var getSubNdcDetails = function (key) {
27291
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
27292
- var ndcDetail = ndcDetailsData.find(function (item) { return item.key === key; });
27293
- if (ndcDetail) {
27294
- if (((_b = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_a = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _a === void 0 ? void 0 : _a.length) - 1]) === null || _b === void 0 ? void 0 : _b.ministry.trim()) !== "" &&
27295
- ((_d = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_c = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _c === void 0 ? void 0 : _c.length) - 1]) === null || _d === void 0 ? void 0 : _d.ministry) &&
27296
- ((_f = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_e = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _e === void 0 ? void 0 : _e.length) - 1]) === null || _f === void 0 ? void 0 : _f.nationalPlanObj.trim()) !== "" &&
27297
- ((_h = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_g = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _g === void 0 ? void 0 : _g.length) - 1]) === null || _h === void 0 ? void 0 : _h.nationalPlanObj) &&
27298
- String((_k = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_j = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _j === void 0 ? void 0 : _j.length) - 1]) === null || _k === void 0 ? void 0 : _k.kpi).trim() !== "" &&
27299
- String((_m = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_l = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _l === void 0 ? void 0 : _l.length) - 1]) === null || _m === void 0 ? void 0 : _m.kpi)) {
27300
- onAddNewSubNdcDetail();
27301
- }
27302
- return ndcDetail.subNdcDetails;
27303
- }
27304
- else {
27305
- return [];
26958
+ return null;
27306
26959
  }
27307
26960
  };
27308
26961
  var defaultColumns = [
27309
26962
  {
27310
26963
  title: t("ndc:ndcColumnsNationalPlanObj"),
27311
- dataIndex: "nationalPlanObj",
27312
- key: "nationalPlanObj",
26964
+ dataIndex: "nationalPlanObjective",
26965
+ key: "nationalPlanObjective",
27313
26966
  align: "left",
26967
+ width: 400,
27314
26968
  editable: true,
27315
- width: "50%",
27316
- render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
27317
- React.createElement("span", null, record.nationalPlanObj))) : (React.createElement("input", { placeholder: "Please add Programmes", className: "ant-input", type: "text" })))); },
26969
+ render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement(Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26970
+ React.createElement("span", null, record.nationalPlanObjective))) : (React.createElement(Input, { placeholder: t("ndc:nationalPlanObjectivePlaceHolder") })))); },
27318
26971
  },
27319
26972
  {
27320
26973
  title: t("ndc:ndcColumnsKpi"),
27321
26974
  dataIndex: "kpi",
27322
26975
  key: "kpi",
27323
26976
  align: "left",
26977
+ width: 100,
27324
26978
  editable: true,
27325
- width: "10%",
27326
- render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
27327
- React.createElement("span", null, record.kpi))) : (React.createElement("input", { placeholder: "Enter Kpi", className: "ant-input", type: "text" })))); },
26979
+ render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.kpi ? (React.createElement(Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26980
+ React.createElement("span", null, record.kpi))) : (React.createElement(Input, { placeholder: "Enter Kpi" })))); },
27328
26981
  },
27329
26982
  {
27330
- title: "Government Department",
27331
- dataIndex: "ministry",
27332
- key: "ministry",
26983
+ title: t("ndc:ndcColumnsMinistry"),
26984
+ dataIndex: "ministryName",
26985
+ key: "ministryName",
27333
26986
  align: "left",
27334
- editable: true,
27335
- width: "40%",
27336
- render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
27337
- React.createElement("span", null, record.ministry))) : (React.createElement("input", { placeholder: "Please add the Government Department", className: "ant-input", type: "text" })))); },
26987
+ width: 300,
26988
+ editable: false,
26989
+ render: function (_, record) { return (React.createElement(Tooltip, { title: isSubNdcActionsEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26990
+ React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
26991
+ record.ministryName = option.label;
26992
+ handleSave(record);
26993
+ }, options: ministryOrgList }))); },
26994
+ },
26995
+ {
26996
+ title: t("ndc:ndcColumnsStatus"),
26997
+ dataIndex: "status",
26998
+ key: "status",
26999
+ align: "left",
27000
+ width: 200,
27001
+ editable: false,
27002
+ render: function (_, record) {
27003
+ var menu = actionMenu(record);
27004
+ return (React.createElement("div", { onClick: function (event) { return event.stopPropagation(); } },
27005
+ record.actionType === NdcDetailsActionType.SubAction &&
27006
+ record.status !== NdcDetailsActionStatus.New ? (React.createElement(Tooltip, { title: record.status, color: TooltipColor, key: TooltipColor },
27007
+ React.createElement(Tag, { className: "clickable", color: getNdcActionStatusTagType(record.status) }, addSpaces(record.status)))) : (""),
27008
+ record.actionType === NdcDetailsActionType.SubAction && menu ? (React.createElement(Popover, { placement: "bottomRight", content: menu, trigger: "click" },
27009
+ React.createElement(EllipsisOutlined, { rotate: 90, style: {
27010
+ fontWeight: 600,
27011
+ fontSize: "1rem",
27012
+ cursor: "pointer",
27013
+ } }))) : (React.createElement("span", null))));
27014
+ },
27338
27015
  },
27339
27016
  ];
27340
27017
  var columns = defaultColumns.map(function (col) {
27341
27018
  if (!col.editable) {
27342
27019
  return col;
27343
27020
  }
27344
- return __assign(__assign({}, col), { onCell: function (record) { return ({
27345
- record: record,
27346
- editable: col.editable,
27347
- dataIndex: col.dataIndex,
27348
- title: col.title,
27349
- handleSave: handleSave,
27350
- }); } });
27021
+ return __assign(__assign({}, col), { onCell: function (record) {
27022
+ return {
27023
+ record: record,
27024
+ editing: isEditing(record),
27025
+ dataIndex: col.dataIndex,
27026
+ title: col.title,
27027
+ onBlurHandler: function (record) {
27028
+ if (isEditing(record)) {
27029
+ handleSave(record);
27030
+ }
27031
+ },
27032
+ t: t,
27033
+ };
27034
+ } });
27351
27035
  });
27352
- function onAddNewNdcDetail() {
27353
- var range = selectedTab.split("-");
27354
- var ndcActionId = ++addedNdcDetailId.current;
27355
- var newData = {
27356
- key: ndcActionId,
27357
- type: NdcActionType.main,
27358
- startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
27359
- endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
27360
- nationalPlanObj: "",
27361
- kpi: "",
27362
- ministry: "",
27363
- subNdcDetails: [
27364
- {
27365
- key: ++addedNdcDetailId.current,
27366
- ndcActionId: ndcActionId,
27367
- type: NdcActionType.sub,
27368
- startDate: new Date("2019-03-25"),
27369
- endDate: new Date("2020-03-25"),
27370
- nationalPlanObj: "",
27371
- kpi: "",
27372
- ministry: "",
27373
- },
27374
- ],
27375
- };
27376
- setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
27036
+ function onClickedAddNewNdcDetail() {
27037
+ return __awaiter(this, void 0, void 0, function () {
27038
+ var periodId, newData_1, lastPage;
27039
+ return __generator(this, function (_a) {
27040
+ if (selectedPeriod.key !== "add_new") {
27041
+ form.setFieldsValue({
27042
+ nationalPlanObjective: "",
27043
+ kpi: "",
27044
+ });
27045
+ periodId = parseInt(selectedPeriod.key);
27046
+ newData_1 = {
27047
+ id: nextAvailableActionId,
27048
+ actionType: NdcDetailsActionType.MainAction,
27049
+ nationalPlanObjective: "",
27050
+ kpi: "",
27051
+ ministryName: loginMinistry,
27052
+ periodId: periodId,
27053
+ status: NdcDetailsActionStatus.New,
27054
+ };
27055
+ setEditingKey(nextAvailableActionId);
27056
+ setNextAvailableActionId(function (value) { return value + 1; });
27057
+ setNdcActionsList(function (ndcActionsList) { return __spreadArray(__spreadArray([], ndcActionsList, true), [
27058
+ newData_1,
27059
+ ], false); });
27060
+ setTableKey(function (key) { return key + 1; });
27061
+ if (ndcMainDetailsForPeriod.length + 1 > pageSize) {
27062
+ lastPage = Math.ceil(ndcMainDetailsForPeriod.length / pageSize);
27063
+ setCurrentPage(lastPage);
27064
+ }
27065
+ }
27066
+ return [2 /*return*/];
27067
+ });
27068
+ });
27377
27069
  }
27378
27070
  var components = {
27379
27071
  body: {
27380
- row: EditableRow,
27381
27072
  cell: EditableCell,
27382
27073
  },
27383
27074
  };
27384
- //commented because rendering issue
27385
- function ndcDetailsTableContent() {
27386
- return (React.createElement("div", null)
27387
- // <div>
27388
- // <Button
27389
- // onClick={onAddNewNdcDetail}
27390
- // type="primary"
27391
- // style={{
27392
- // marginBottom: 16,
27393
- // }}
27394
- // >
27395
- // Add a row
27396
- // </Button>
27397
- // <Table
27398
- // components={components}
27399
- // rowClassName={() => 'editable-row'}
27400
- // bordered
27401
- // dataSource={ndcDetailsData}
27402
- // columns={columns}
27403
- // />
27404
- // </div>
27405
- );
27406
- }
27407
- var onCancelPeriod = function () { };
27408
- var onAddNewPeriod = function () {
27409
- if (selectedPeriod &&
27410
- selectedPeriod.current &&
27411
- selectedPeriod.current.start &&
27412
- selectedPeriod.current.end) {
27413
- var newPeriodItem_1 = {
27414
- key: "".concat(selectedPeriod.current.start, "-").concat(selectedPeriod.current.end),
27415
- label: "".concat(selectedPeriod.current.start, "-").concat(selectedPeriod.current.end),
27416
- start: selectedPeriod.current.start,
27417
- end: selectedPeriod.current.end,
27418
- children: ndcDetailsTableContent(),
27419
- };
27420
- var existingIndex = periodItemsRef.current.findIndex(function (item) {
27421
- return inRange(newPeriodItem_1.start, item.start, item.end) ||
27422
- inRange(newPeriodItem_1.end, item.start, item.end);
27075
+ var onClickedDeletePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
27076
+ return __generator(this, function (_a) {
27077
+ setActionInfo({
27078
+ action: "Delete",
27079
+ headerText: t("ndc:periodDeleteConfirmTitle"),
27080
+ type: "danger",
27081
+ icon: React.createElement(Icon.XCircle, null),
27082
+ recordId: selectedPeriod.key,
27423
27083
  });
27424
- if (existingIndex === -1) {
27425
- setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [newPeriodItem_1], false); });
27426
- periodItemsRef.current = __spreadArray(__spreadArray([], periodItemsRef.current, true), [newPeriodItem_1], false);
27084
+ setOpenConfirmationModal(true);
27085
+ return [2 /*return*/];
27086
+ });
27087
+ }); };
27088
+ var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
27089
+ var isPendingActionAvailable;
27090
+ return __generator(this, function (_a) {
27091
+ if (ndcMainDetailsForPeriod.length === 0) {
27092
+ message.open({
27093
+ type: "error",
27094
+ content: t("ndc:finalizeNdcEmptyErrorText"),
27095
+ duration: 3,
27096
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27097
+ });
27098
+ return [2 /*return*/];
27427
27099
  }
27428
- else {
27100
+ isPendingActionAvailable = false;
27101
+ ndcMainDetailsForPeriod.forEach(function (mainAction) {
27102
+ var pendingActions = ndcActionsList.filter(function (action) {
27103
+ return (action.status === NdcDetailsActionStatus.Pending &&
27104
+ action.actionType === NdcDetailsActionType.SubAction &&
27105
+ action.parentActionId === mainAction.id);
27106
+ });
27107
+ if (pendingActions && pendingActions.length > 0) {
27108
+ isPendingActionAvailable = true;
27109
+ return;
27110
+ }
27111
+ });
27112
+ if (isPendingActionAvailable) {
27429
27113
  message.open({
27430
27114
  type: "error",
27431
- content: t("ndc:rangeAlreadyExists"),
27115
+ content: t("ndc:finalizeErrorText"),
27432
27116
  duration: 3,
27433
27117
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27434
27118
  });
27435
27119
  }
27120
+ else {
27121
+ setActionInfo({
27122
+ action: "Finalize",
27123
+ headerText: t("ndc:finalizeApproveTitle"),
27124
+ text: t("ndc:finalizeApproveSubTitle"),
27125
+ type: "primary",
27126
+ icon: React.createElement(Icon.Clipboard2Check, null),
27127
+ recordId: selectedPeriod.key,
27128
+ });
27129
+ setOpenConfirmationModal(true);
27130
+ }
27131
+ return [2 /*return*/];
27132
+ });
27133
+ }); };
27134
+ var onMainTableRowExpand = function (expanded, record) {
27135
+ var keys = [];
27136
+ if (expanded) {
27137
+ keys.push(record.id);
27436
27138
  }
27437
- };
27438
- useEffect(function () {
27439
- if (periodItems && periodItems.length > 3) {
27440
- setSelectedTab(periodItems[periodItems.length - 1].key);
27441
- }
27442
- }, [periodItems]);
27443
- var onDateRangeChanged = function (range) {
27444
- var period = {
27445
- start: Number(moment(range[0]).year()),
27446
- end: Number(moment(range[1]).year()),
27447
- };
27448
- selectedPeriod.current = period;
27139
+ setExpandedRowKeys(keys);
27140
+ setNdcSubActionsForMainAction(record.id);
27449
27141
  };
27450
27142
  function addNewPeriodContent() {
27451
27143
  return (React.createElement("div", null,
27452
- React.createElement(Row, null,
27453
- React.createElement(RangePicker, { onChange: onDateRangeChanged, picker: "year" })),
27454
- React.createElement(Row, { className: "mg-top-1" },
27455
- React.createElement("div", { className: "ndc-steps-actions" },
27456
- React.createElement(Button, { type: "primary", onClick: onAddNewPeriod, htmlType: "submit", loading: loading }, t("ndc:submit")),
27457
- React.createElement(Button, { className: "back-btn", onClick: onCancelPeriod, loading: loading }, t("ndc:back"))))));
27458
- }
27459
- function getSubNdcActionContent(record) {
27460
- selectedNdcDetail.current = record;
27461
- return (React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getSubNdcDetails(record.key), columns: columns, showHeader: false, pagination: false }));
27144
+ React.createElement(Row, { justify: "start", align: "middle", gutter: [16, 16] },
27145
+ React.createElement(Col, { flex: "340px" },
27146
+ React.createElement(RangePicker, { disabledDate: function (current) { return moment(current).year() < 1900; }, onChange: onDateRangeChanged, picker: "year" })),
27147
+ React.createElement(Col, { flex: "auto" },
27148
+ React.createElement(Button, { type: "primary", onClick: onAddNewPeriod, htmlType: "submit", loading: loading }, t("ndc:submit"))))));
27462
27149
  }
27463
- var onTabChange = function (key) {
27464
- setSelectedTab(key);
27150
+ var onChange = function (page, size) {
27151
+ setCurrentPage(page);
27152
+ setPageSize(size);
27465
27153
  };
27466
- useEffect(function () {
27467
- var defaultNdcDetails = [
27468
- {
27469
- key: 1,
27470
- type: NdcActionType.main,
27471
- startDate: new Date("2019-03-25"),
27472
- endDate: new Date("2020-03-25"),
27473
- nationalPlanObj: "Enhance value addition in key growth opportunities",
27474
- kpi: 25,
27475
- ministry: "Ministry of Environment",
27476
- subNdcDetails: [
27477
- {
27478
- key: 6,
27479
- ndcActionId: 1,
27480
- type: NdcActionType.sub,
27481
- startDate: new Date("2019-03-25"),
27482
- endDate: new Date("2020-03-25"),
27483
- nationalPlanObj: "Enhance value addition in key growth opportunities sub details",
27484
- kpi: 25,
27485
- ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
27486
- },
27487
- {
27488
- key: 7,
27489
- ndcActionId: 1,
27490
- type: NdcActionType.sub,
27491
- startDate: new Date("2019-03-25"),
27492
- endDate: new Date("2020-03-25"),
27493
- nationalPlanObj: "",
27494
- kpi: "",
27495
- ministry: "",
27496
- },
27497
- ],
27498
- },
27499
- {
27500
- key: 2,
27501
- type: NdcActionType.main,
27502
- startDate: new Date("2019-03-25"),
27503
- endDate: new Date("2019-08-25"),
27504
- nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
27505
- kpi: 10500,
27506
- ministry: "Ministry of Environment",
27507
- subNdcDetails: [
27508
- {
27509
- key: 8,
27510
- ndcActionId: 2,
27511
- type: NdcActionType.sub,
27512
- startDate: new Date("2019-03-25"),
27513
- endDate: new Date("2020-03-25"),
27514
- nationalPlanObj: "",
27515
- kpi: "",
27516
- ministry: "",
27517
- },
27518
- ],
27519
- },
27520
- {
27521
- key: 12,
27522
- type: NdcActionType.main,
27523
- startDate: new Date("2019-03-25"),
27524
- endDate: new Date("2019-08-25"),
27525
- nationalPlanObj: "Other",
27526
- kpi: 10500,
27527
- ministry: "Ministry of Environment",
27528
- subNdcDetails: [
27529
- {
27530
- key: 8,
27531
- ndcActionId: 12,
27532
- type: NdcActionType.sub,
27533
- startDate: new Date("2019-03-25"),
27534
- endDate: new Date("2020-03-25"),
27535
- nationalPlanObj: "",
27536
- kpi: "",
27537
- ministry: "",
27538
- },
27539
- ],
27540
- },
27541
- {
27542
- key: 3,
27543
- type: NdcActionType.main,
27544
- startDate: new Date("2021-03-25"),
27545
- endDate: new Date("2022-03-25"),
27546
- nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
27547
- kpi: 48,
27548
- ministry: "Ministry of Environment",
27549
- subNdcDetails: [
27550
- {
27551
- key: 9,
27552
- ndcActionId: 3,
27553
- type: NdcActionType.sub,
27554
- startDate: new Date("2019-03-25"),
27555
- endDate: new Date("2020-03-25"),
27556
- nationalPlanObj: "",
27557
- kpi: "",
27558
- ministry: "",
27559
- },
27560
- ],
27561
- },
27562
- {
27563
- key: 4,
27564
- type: NdcActionType.main,
27565
- startDate: new Date("2022-03-25"),
27566
- endDate: new Date("2022-05-25"),
27567
- nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
27568
- kpi: 20,
27569
- ministry: "Ministry of Environment",
27570
- subNdcDetails: [
27571
- {
27572
- key: 10,
27573
- ndcActionId: 4,
27574
- type: NdcActionType.sub,
27575
- startDate: new Date("2019-03-25"),
27576
- endDate: new Date("2020-03-25"),
27577
- nationalPlanObj: "",
27578
- kpi: "",
27579
- ministry: "",
27580
- },
27581
- ],
27582
- },
27583
- {
27584
- key: 5,
27585
- type: NdcActionType.main,
27586
- startDate: new Date("2022-03-25"),
27587
- endDate: new Date("2023-03-25"),
27588
- nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
27589
- kpi: 10,
27590
- ministry: "Ministry of Environment",
27591
- subNdcDetails: [
27592
- {
27593
- key: 11,
27594
- ndcActionId: 5,
27595
- type: NdcActionType.sub,
27596
- startDate: new Date("2019-03-25"),
27597
- endDate: new Date("2020-03-25"),
27598
- nationalPlanObj: "",
27599
- kpi: "",
27600
- ministry: "",
27601
- },
27602
- ],
27603
- },
27604
- {
27605
- key: 13,
27606
- type: NdcActionType.main,
27607
- startDate: new Date("2022-03-25"),
27608
- endDate: new Date("2023-03-25"),
27609
- nationalPlanObj: "Convert to solar energy",
27610
- kpi: 50000,
27611
- ministry: "Ministry of Environment",
27612
- subNdcDetails: [
27613
- {
27614
- key: 11,
27615
- ndcActionId: 13,
27616
- type: NdcActionType.sub,
27617
- startDate: new Date("2019-03-25"),
27618
- endDate: new Date("2020-03-25"),
27619
- nationalPlanObj: "Convert to solar energy",
27620
- kpi: "3000",
27621
- ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
27622
- },
27623
- {
27624
- key: 14,
27625
- ndcActionId: 13,
27626
- type: NdcActionType.sub,
27627
- startDate: new Date("2019-03-25"),
27628
- endDate: new Date("2020-03-25"),
27629
- nationalPlanObj: "",
27630
- kpi: "",
27631
- ministry: "",
27632
- },
27633
- ],
27634
- },
27635
- {
27636
- key: 15,
27637
- type: NdcActionType.main,
27638
- startDate: new Date("2022-03-25"),
27639
- endDate: new Date("2023-03-25"),
27640
- nationalPlanObj: "Strengthen the private sector to create jobs",
27641
- kpi: 10000,
27642
- ministry: "Ministry of Environment",
27643
- subNdcDetails: [
27644
- {
27645
- key: 16,
27646
- ndcActionId: 15,
27647
- type: NdcActionType.sub,
27648
- startDate: new Date("2019-03-25"),
27649
- endDate: new Date("2020-03-25"),
27650
- nationalPlanObj: "Strengthen the private sector to create jobs",
27651
- kpi: "7200",
27652
- ministry: "Ministry of Tourism (MoT)",
27653
- },
27654
- {
27655
- key: 17,
27656
- ndcActionId: 15,
27657
- type: NdcActionType.sub,
27658
- startDate: new Date("2019-03-25"),
27659
- endDate: new Date("2020-03-25"),
27660
- nationalPlanObj: "",
27661
- kpi: "",
27662
- ministry: "",
27663
- },
27664
- ],
27665
- },
27666
- {
27667
- key: 18,
27668
- type: NdcActionType.main,
27669
- startDate: new Date("2022-03-25"),
27670
- endDate: new Date("2023-03-25"),
27671
- nationalPlanObj: "Other",
27672
- kpi: "",
27673
- ministry: "Ministry of Environment",
27674
- subNdcDetails: [
27675
- {
27676
- key: 19,
27677
- ndcActionId: 18,
27678
- type: NdcActionType.sub,
27679
- startDate: new Date("2019-03-25"),
27680
- endDate: new Date("2020-03-25"),
27681
- nationalPlanObj: "Strengthen the private sector to create jobs",
27682
- kpi: "",
27683
- ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
27154
+ function mainNdcActionTableContent() {
27155
+ return (React.createElement("div", null,
27156
+ React.createElement(Row, null,
27157
+ React.createElement(Col, { span: 24 },
27158
+ React.createElement(Form, { form: form, component: false },
27159
+ React.createElement(Table, { tableLayout: "fixed", key: tableKey, className: "common-table-class", rowKey: "id", pagination: {
27160
+ current: currentPage,
27161
+ pageSize: pageSize,
27162
+ total: ndcMainDetailsForPeriod.length,
27163
+ showQuickJumper: true,
27164
+ showSizeChanger: true,
27165
+ onChange: onChange,
27166
+ }, components: components, rowClassName: function () { return "editable-row"; }, bordered: true, loading: loading, dataSource: ndcMainDetailsForPeriod, columns: columns, expandedRowKeys: expandedRowKeys, onExpand: onMainTableRowExpand, expandable: {
27167
+ expandedRowRender: function (record) {
27168
+ return subNdcActionTableContent();
27169
+ },
27170
+ columnWidth: 40,
27171
+ }, onRow: function (record, rowIndex) {
27172
+ return {
27173
+ onClick: function (event) {
27174
+ if (record.id &&
27175
+ isNdcActionEditable(record) &&
27176
+ !isEditing(record)) {
27177
+ form.setFieldsValue(__assign({}, record));
27178
+ setEditingKey(record.id);
27179
+ }
27180
+ },
27181
+ onMouseLeave: function () {
27182
+ if (isEditing(record)) {
27183
+ handleSave(record);
27184
+ }
27185
+ },
27186
+ };
27187
+ }, footer: function () {
27188
+ return isGovernmentUser &&
27189
+ !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
27190
+ React.createElement(Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27191
+ } })))),
27192
+ isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" },
27193
+ React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", disabled: isMainActionInEditMode(), loading: loading }, t("ndc:delete")),
27194
+ React.createElement(Button, { className: "mg-left-1 footer-btns", type: "primary", onClick: onClickedFinalizePeriod, disabled: isMainActionInEditMode(), htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27195
+ }
27196
+ function subNdcActionTableContent(record) {
27197
+ return (React.createElement(Table, { tableLayout: "fixed", rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, className: "common-table-class", bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
27198
+ return {
27199
+ onClick: function (event) {
27200
+ if (record.id &&
27201
+ isNdcActionEditable(record) &&
27202
+ !isEditing(record)) {
27203
+ form.setFieldsValue(__assign({}, record));
27204
+ setEditingKey(record.id);
27205
+ }
27684
27206
  },
27685
- {
27686
- key: 20,
27687
- ndcActionId: 18,
27688
- type: NdcActionType.sub,
27689
- startDate: new Date("2019-03-25"),
27690
- endDate: new Date("2020-03-25"),
27691
- nationalPlanObj: "",
27692
- kpi: "",
27693
- ministry: "",
27207
+ onMouseLeave: function () {
27208
+ if (isEditing(record)) {
27209
+ handleSave(record);
27210
+ }
27694
27211
  },
27695
- ],
27696
- },
27697
- ];
27698
- var initialPeriods = [
27699
- {
27700
- key: "2019-2020",
27701
- label: "2019-2020",
27702
- start: 2019,
27703
- end: 2020,
27704
- children: ndcDetailsTableContent(),
27705
- },
27706
- {
27707
- key: "2021-2023",
27708
- label: "2021-2023",
27709
- start: 2021,
27710
- end: 2021,
27711
- children: ndcDetailsTableContent(),
27712
- },
27713
- ];
27714
- if (isAddRangeVisible()) {
27715
- initialPeriods.unshift({
27716
- key: "add_new",
27717
- label: "Add New",
27718
- start: 0,
27719
- end: 0,
27720
- children: addNewPeriodContent(),
27721
- });
27212
+ };
27213
+ }, columns: columns, showHeader: false, pagination: false }));
27214
+ }
27215
+ var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
27216
+ var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1, exception_3;
27217
+ return __generator(this, function (_a) {
27218
+ switch (_a.label) {
27219
+ case 0:
27220
+ _a.trys.push([0, 4, , 5]);
27221
+ if (!(selectedDateRangeRef &&
27222
+ selectedDateRangeRef.current &&
27223
+ selectedDateRangeRef.current.startYear &&
27224
+ selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
27225
+ periodItem_1 = {
27226
+ startYear: selectedDateRangeRef.current.startYear,
27227
+ endYear: selectedDateRangeRef.current.endYear,
27228
+ finalized: false,
27229
+ };
27230
+ existingIndex = periodItems.findIndex(function (item) {
27231
+ return inRange(periodItem_1.startYear, item.startYear, item.endYear) ||
27232
+ inRange(periodItem_1.endYear, item.startYear, item.endYear);
27233
+ });
27234
+ if (!(existingIndex === -1)) return [3 /*break*/, 2];
27235
+ return [4 /*yield*/, post("national/programme/addNdcDetailsPeriod", __assign({}, periodItem_1))];
27236
+ case 1:
27237
+ response = _a.sent();
27238
+ if (response && response.data) {
27239
+ addedPeriodItem = response.data;
27240
+ updatedPeriodItem_1 = __assign(__assign({}, addedPeriodItem), { key: addedPeriodItem.id, label: "".concat(addedPeriodItem.startYear, "-").concat(addedPeriodItem.endYear) });
27241
+ setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
27242
+ setSelectedPeriod(updatedPeriodItem_1);
27243
+ }
27244
+ return [3 /*break*/, 3];
27245
+ case 2:
27246
+ message.open({
27247
+ type: "error",
27248
+ content: t("ndc:rangeAlreadyExists"),
27249
+ duration: 3,
27250
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27251
+ });
27252
+ _a.label = 3;
27253
+ case 3: return [3 /*break*/, 5];
27254
+ case 4:
27255
+ exception_3 = _a.sent();
27256
+ message.open({
27257
+ type: "error",
27258
+ content: exception_3.message,
27259
+ duration: 3,
27260
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27261
+ });
27262
+ return [3 /*break*/, 5];
27263
+ case 5: return [2 /*return*/];
27264
+ }
27265
+ });
27266
+ }); };
27267
+ var onDateRangeChanged = function (range) {
27268
+ if (range) {
27269
+ var period = {
27270
+ startYear: Number(moment(range[0]).year()),
27271
+ endYear: Number(moment(range[1]).year()),
27272
+ };
27273
+ if (period.startYear === period.endYear) {
27274
+ message.open({
27275
+ type: "error",
27276
+ content: t("ndc:sameStartEndDates"),
27277
+ duration: 3,
27278
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27279
+ });
27280
+ }
27281
+ else {
27282
+ selectedDateRangeRef.current = period;
27283
+ }
27284
+ }
27285
+ };
27286
+ var onTabChange = function (key) {
27287
+ var selectedPeriod = periodItems.find(function (item) { return item.key === key; });
27288
+ if (selectedPeriod) {
27289
+ setSelectedPeriod(selectedPeriod);
27722
27290
  }
27723
- addedNdcDetailId.current = 20;
27724
- setPeriodItems(initialPeriods);
27725
- periodItemsRef.current = initialPeriods;
27726
- setNdcDetailsData(defaultNdcDetails);
27291
+ };
27292
+ var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
27293
+ var actionResponse, exception_4;
27294
+ return __generator(this, function (_a) {
27295
+ switch (_a.label) {
27296
+ case 0:
27297
+ setLoading(true);
27298
+ _a.label = 1;
27299
+ case 1:
27300
+ _a.trys.push([1, 10, , 11]);
27301
+ if (!(actionInfo.action === "Approve")) return [3 /*break*/, 3];
27302
+ return [4 /*yield*/, post("national/programme/approveNdcDetailsAction", {
27303
+ id: actionInfo.recordId,
27304
+ })];
27305
+ case 2:
27306
+ actionResponse = _a.sent();
27307
+ return [3 /*break*/, 9];
27308
+ case 3:
27309
+ if (!(actionInfo.action === "Reject")) return [3 /*break*/, 5];
27310
+ return [4 /*yield*/, post("national/programme/rejectNdcDetailsAction", {
27311
+ id: actionInfo.recordId,
27312
+ })];
27313
+ case 4:
27314
+ actionResponse = _a.sent();
27315
+ return [3 /*break*/, 9];
27316
+ case 5:
27317
+ if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
27318
+ return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
27319
+ id: selectedPeriod.key,
27320
+ })];
27321
+ case 6:
27322
+ actionResponse = _a.sent();
27323
+ return [3 /*break*/, 9];
27324
+ case 7:
27325
+ if (!(actionInfo.action === "Delete")) return [3 /*break*/, 9];
27326
+ return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
27327
+ id: selectedPeriod.key,
27328
+ })];
27329
+ case 8:
27330
+ actionResponse = _a.sent();
27331
+ _a.label = 9;
27332
+ case 9: return [3 /*break*/, 11];
27333
+ case 10:
27334
+ exception_4 = _a.sent();
27335
+ message.open({
27336
+ type: "error",
27337
+ content: exception_4.message,
27338
+ duration: 3,
27339
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27340
+ });
27341
+ return [3 /*break*/, 11];
27342
+ case 11:
27343
+ if (actionResponse) {
27344
+ if (actionInfo.action === "Delete") {
27345
+ message.open({
27346
+ type: "success",
27347
+ content: t("ndc:deletePeriodSuccessMsg"),
27348
+ duration: 3,
27349
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27350
+ });
27351
+ fetchNdcDetailPeriods();
27352
+ }
27353
+ else if (actionInfo.action === "Finalize") {
27354
+ message.open({
27355
+ type: "success",
27356
+ content: t("ndc:finalizeSuccessMsg"),
27357
+ duration: 3,
27358
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27359
+ });
27360
+ fetchNdcDetailPeriods();
27361
+ setExpandedRowKeys([]);
27362
+ ClearEditMode();
27363
+ }
27364
+ else if (actionInfo.action === "Approve") {
27365
+ message.open({
27366
+ type: "success",
27367
+ content: t("ndc:approveSuccessMsg"),
27368
+ duration: 3,
27369
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27370
+ });
27371
+ fetchNdcDetailActions();
27372
+ }
27373
+ else if (actionInfo.action === "Reject") {
27374
+ message.open({
27375
+ type: "success",
27376
+ content: t("ndc:rejectSuccessMsg"),
27377
+ duration: 3,
27378
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27379
+ });
27380
+ fetchNdcDetailActions();
27381
+ }
27382
+ }
27383
+ setOpenConfirmationModal(false);
27384
+ setLoading(false);
27385
+ return [2 /*return*/];
27386
+ }
27387
+ });
27388
+ }); };
27389
+ var onActionCanceled = function () {
27390
+ setOpenConfirmationModal(false);
27391
+ };
27392
+ var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
27393
+ var periods, addNewTab, response, exception_5;
27394
+ return __generator(this, function (_a) {
27395
+ switch (_a.label) {
27396
+ case 0:
27397
+ setLoading(true);
27398
+ _a.label = 1;
27399
+ case 1:
27400
+ _a.trys.push([1, 3, 4, 5]);
27401
+ periods = [];
27402
+ addNewTab = {
27403
+ key: "add_new",
27404
+ label: "Add New",
27405
+ startYear: 0,
27406
+ endYear: 0,
27407
+ finalized: false,
27408
+ deleted: false,
27409
+ };
27410
+ return [4 /*yield*/, get("national/programme/queryNdcDetailsPeriod")];
27411
+ case 2:
27412
+ response = _a.sent();
27413
+ if (response && response.data) {
27414
+ periods = response.data.map(function (period) {
27415
+ return __assign(__assign({}, period), { key: period.id, label: period.finalized ? (React.createElement("span", null,
27416
+ React.createElement(LockOutlined, null),
27417
+ " ",
27418
+ period.startYear,
27419
+ "-",
27420
+ period.endYear,
27421
+ " ")) : ("".concat(period.startYear, "-").concat(period.endYear)) });
27422
+ });
27423
+ }
27424
+ if (isGovernmentUser) {
27425
+ periods.unshift(addNewTab);
27426
+ }
27427
+ setPeriodItems(periods);
27428
+ if (isGovernmentUser) {
27429
+ setSelectedPeriod(addNewTab);
27430
+ }
27431
+ else {
27432
+ setSelectedPeriod(periods[0]);
27433
+ }
27434
+ setLoading(false);
27435
+ return [3 /*break*/, 5];
27436
+ case 3:
27437
+ exception_5 = _a.sent();
27438
+ message.open({
27439
+ type: "error",
27440
+ content: exception_5.message,
27441
+ duration: 3,
27442
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27443
+ });
27444
+ return [3 /*break*/, 5];
27445
+ case 4:
27446
+ setLoading(false);
27447
+ return [7 /*endfinally*/];
27448
+ case 5: return [2 /*return*/];
27449
+ }
27450
+ });
27451
+ }); };
27452
+ var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
27453
+ var response, maxActionId, exception_6;
27454
+ return __generator(this, function (_a) {
27455
+ switch (_a.label) {
27456
+ case 0:
27457
+ setLoading(true);
27458
+ _a.label = 1;
27459
+ case 1:
27460
+ _a.trys.push([1, 3, 4, 5]);
27461
+ return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
27462
+ case 2:
27463
+ response = _a.sent();
27464
+ if (response && response.data) {
27465
+ maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
27466
+ setNextAvailableActionId(maxActionId + 1);
27467
+ setNdcActionsList(response.data);
27468
+ }
27469
+ setLoading(false);
27470
+ return [3 /*break*/, 5];
27471
+ case 3:
27472
+ exception_6 = _a.sent();
27473
+ message.open({
27474
+ type: "error",
27475
+ content: exception_6.message,
27476
+ duration: 3,
27477
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27478
+ });
27479
+ return [3 /*break*/, 5];
27480
+ case 4:
27481
+ setLoading(false);
27482
+ return [7 /*endfinally*/];
27483
+ case 5: return [2 /*return*/];
27484
+ }
27485
+ });
27486
+ }); };
27487
+ var fetchMinistries = function () { return __awaiter(void 0, void 0, void 0, function () {
27488
+ var response, ministryOrgDetails, exception_7;
27489
+ return __generator(this, function (_a) {
27490
+ switch (_a.label) {
27491
+ case 0:
27492
+ setLoading(true);
27493
+ _a.label = 1;
27494
+ case 1:
27495
+ _a.trys.push([1, 3, 4, 5]);
27496
+ return [4 /*yield*/, get("national/organisation/getMinistries")];
27497
+ case 2:
27498
+ response = _a.sent();
27499
+ if (response && response.data) {
27500
+ ministryOrgDetails = response.data.map(function (value) {
27501
+ return {
27502
+ value: value.company_companyId,
27503
+ label: value.company_name,
27504
+ };
27505
+ });
27506
+ setMinistryOrgList(ministryOrgDetails);
27507
+ }
27508
+ setLoading(false);
27509
+ return [3 /*break*/, 5];
27510
+ case 3:
27511
+ exception_7 = _a.sent();
27512
+ message.open({
27513
+ type: "error",
27514
+ content: exception_7.message,
27515
+ duration: 3,
27516
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27517
+ });
27518
+ return [3 /*break*/, 5];
27519
+ case 4:
27520
+ setLoading(false);
27521
+ return [7 /*endfinally*/];
27522
+ case 5: return [2 /*return*/];
27523
+ }
27524
+ });
27525
+ }); };
27526
+ useEffect(function () {
27527
+ fetchNdcDetailPeriods();
27528
+ fetchNdcDetailActions();
27529
+ fetchMinistries();
27727
27530
  }, []);
27728
- return (React.createElement("div", { className: "ndc-management content-container" },
27531
+ return (React.createElement("div", { className: "ndc-details content-container" },
27729
27532
  React.createElement("div", { className: "title-bar" },
27730
27533
  React.createElement(Row, { justify: "space-between", align: "middle" },
27731
27534
  React.createElement(Col, { span: 20 },
27732
27535
  React.createElement("div", { className: "body-title" }, t("ndc:ndcTitle")),
27733
27536
  React.createElement("div", { className: "body-sub-title" }, t("ndc:ndcSubTitle"))))),
27734
27537
  React.createElement("div", null,
27735
- React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
27736
- selectedTab !== "add_new" && (React.createElement("div", null,
27737
- React.createElement("div", null,
27738
- React.createElement(Table, { key: tableKey, components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, expandable: {
27739
- expandedRowRender: function (record) { return getSubNdcActionContent(record); },
27740
- indentSize: 0,
27741
- defaultExpandedRowKeys: [selectedNdcDetail.current.key],
27742
- }, footer: function () {
27743
- return isAddNdcActionVisible() && (React.createElement(Row, { justify: "center" },
27744
- React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
27745
- marginBottom: 16,
27746
- width: "100%",
27747
- } }, t("ndc:addNdcAction"))));
27748
- } }))))));
27538
+ React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedPeriod.key, onChange: onTabChange })),
27539
+ React.createElement("div", null, selectedPeriod.key === "add_new"
27540
+ ? addNewPeriodContent()
27541
+ : mainNdcActionTableContent()),
27542
+ React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onActionConfirmed, onActionCanceled: onActionCanceled, openModal: openConfirmationModal, errorMsg: "", loading: loading })));
27749
27543
  };
27750
27544
 
27751
27545
  var ImgWithFallback = function (_a) {
@@ -29455,5 +29249,5 @@ var TimelineBody = function (props) {
29455
29249
  React.createElement("div", { className: "remark-body" }, remark)))));
29456
29250
  };
29457
29251
 
29458
- export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, EnergyGenerationUnits, FormElementType, GovBGColor, GovColor, GovDepartment, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentCreationType, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, Ministry, MitigationSubTypes, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, NdcDetailsComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, StasticCard, StatsCardsTypes, SubTypeOfMitigation, SupportCreationComponent, SupportManagementComponent, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound, addNdcDesc, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, getValidNdcActions, isBase64, landAreaUnitList, methodologyOptions, mitigationSubTypeList, mitigationSubTypesListMapped, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList };
29252
+ export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, EnergyGenerationUnits, FormElementType, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentCreationType, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationSubTypes, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, NdcDetailsComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, StasticCard, StatsCardsTypes, SubTypeOfMitigation, SupportCreationComponent, SupportManagementComponent, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound, addNdcDesc, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal$1 as getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, getValidNdcActions, isBase64, landAreaUnitList, methodologyOptions, mitigationSubTypeList, mitigationSubTypesListMapped, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList };
29459
29253
  //# sourceMappingURL=index.js.map