diff --git a/public/index.html b/public/index.html index e1dcf0356..4e1df8813 100644 --- a/public/index.html +++ b/public/index.html @@ -30,7 +30,7 @@
diff --git a/public/testdata/partnerNetwork/businessPartnersAPIResult.json b/public/testdata/partnerNetwork/businessPartnersAPIResult.json index 0c2430d27..05b03867b 100644 --- a/public/testdata/partnerNetwork/businessPartnersAPIResult.json +++ b/public/testdata/partnerNetwork/businessPartnersAPIResult.json @@ -1,352 +1,180 @@ { - "totalElements": 6, + "totalElements": 2, "totalPages": 1, "page": 0, - "contentSize": 6, + "contentSize": 2, "content": [ { - "score": 1, - "businessPartner": { - "bpn": "BPNL00000000B44P", - "identifiers": [ - { - "uuid": "4e05ce63-6e69-417e-b2f1-410e97440acc", - "value": "BPNL00000000B44P", - "type": { - "technicalKey": "BPN", - "name": "Business Partner Number", - "url": "" - }, - "issuingBody": { - "technicalKey": "CATENAX", - "name": "Catena-X", - "url": "" - }, - "status": { - "technicalKey": "UNKNOWN", - "name": "Unknown" - } - }, - { - "uuid": "be6c2ab7-9602-4a68-8735-7c17b5974736", - "value": "CX.POOL:623DA23B6E73054B143D4AAE0", - "type": { - "technicalKey": "CX_POOL_ID", - "name": "", - "url": null - }, - "issuingBody": null, - "status": null + "score": 0.0, + "legalName": "Test1", + "bpnl": "BPNL0000000001YN", + "identifiers": [], + "legalShortName": "Test1", + "legalForm": null, + "states": [], + "classifications": [], + "relations": [], + "currentness": "2023-08-04T12:13:54.461889Z", + "createdAt": "2023-08-04T12:13:54.662482Z", + "updatedAt": "2023-08-04T12:13:54.662496Z", + "legalAddress": { + "bpna": "BPNA0000000004WK", + "name": null, + "states": [], + "identifiers": [], + "physicalPostalAddress": { + "geographicCoordinates": null, + "country": { + "technicalKey": "DE", + "name": "Germany" }, - { - "uuid": "e3ea74fe-a964-4c4e-887f-f61d400e8836", - "value": "80606650000114", - "type": { - "technicalKey": "BR_CNPJ", - "name": "Cadastro Nacional de Pessoa Jurídica", - "url": "https://meta.cdq.com/CNPJ_number_(Brazil)" - }, - "issuingBody": null, - "status": null + "postalCode": "00001", + "city": "Munich", + "street": { + "name": "Street", + "houseNumber": "5", + "milestone": null, + "direction": null }, - { - "uuid": "a5e1e71d-1a48-4453-b911-a50f1c6bb0ea", - "value": "62457a3f3fd2374f924ef9c9", - "type": { - "technicalKey": "CDQID", - "name": "CDQ Identifier", - "url": "" - }, - "issuingBody": { - "technicalKey": "CDQ", - "name": "CDQ AG", - "url": "" - }, - "status": { - "technicalKey": "CDQ_IMPORTED", - "name": "Imported from CDQ but not synchronized" - } + "administrativeAreaLevel1": null, + "administrativeAreaLevel2": null, + "administrativeAreaLevel3": null, + "district": null, + "companyPostalCode": null, + "industrialZone": null, + "building": null, + "floor": null, + "door": null + }, + "alternativePostalAddress": null, + "bpnLegalEntity": "BPNL0000000001YN", + "isLegalAddress": true, + "bpnSite": null, + "isMainAddress": false, + "createdAt": "2023-08-04T12:13:54.658695Z", + "updatedAt": "2023-08-04T12:13:54.665740Z" + } + }, + { + "score": 0.0, + "legalName": "Part 2", + "bpnl": "BPNL000000000001", + "identifiers": [ + { + "value": "56459977000126", + "type": { + "technicalKey": "EU_VAT_ID_DE", + "name": "Value added tax identification number" }, - { - "uuid": "dbfb27a3-d72a-4d35-bf90-b5d38e92077f", - "value": "8010445060", - "type": { - "technicalKey": "BR_TAX_STATE", - "name": "Inscrição Estadual", - "url": "https://meta.cdq.com/State_tax_number_(Brazil)" - }, - "issuingBody": null, - "status": null + "issuingBody": "CUSTOM_ISSUE_BODY" + } + ], + "legalShortName": "NoC", + "legalForm": { + "technicalKey": "CUSTOM_LEGAL_FORM", + "name": "Custom Legal Form for Testing", + "abbreviation": null + }, + "states": [ + { + "description": null, + "validFrom": "2020-12-16T05:54:48.942", + "validTo": "2023-06-05T07:31:01.213", + "type": { + "technicalKey": "ACTIVE", + "name": "Active" } - ], - "names": [ + } + ], + "classifications": [ + { + "value": "Farming of cattle, dairy farming", + "code": "01.21", + "type": { + "technicalKey": "NACE", + "name": "NACE" + } + } + ], + "relations": [], + "currentness": "2023-08-04T12:56:41.450550Z", + "createdAt": "2023-06-27T13:11:18.539048Z", + "updatedAt": "2023-08-04T12:56:41.556514Z", + "legalAddress": { + "bpna": "BPNA000000000001", + "name": "WESTERN_LATIN_STANDARD", + "states": [ { - "uuid": "65a4569d-5e0b-4735-bd22-857f764ace2f", - "value": "POSTO DO CUNHADO LTDA", - "shortName": null, + "description": "WESTERN_LATIN_STANDARD", + "validFrom": "2020-12-16T05:54:48.942", + "validTo": "2023-06-05T07:31:01.213", "type": { - "technicalKey": "LOCAL", - "name": "The business partner name identifies a business partner in a given context, e.g. a country or region.", - "url": "" - }, - "language": { - "technicalKey": "undefined", - "name": "Undefined" + "technicalKey": "ACTIVE", + "name": "Active" } } ], - "legalForm": null, - "status": null, - "addresses": [ - { - "uuid": "bdcb0ea8-12d5-42ff-8908-e8f3e3288ad6", - "version": { - "characterSet": { - "technicalKey": "LATIN", - "name": "Latin" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - }, - "careOf": null, - "contexts": [], - "country": { - "technicalKey": "BR", - "name": "Brazil" - }, - "administrativeAreas": [], - "postCodes": [ - { - "uuid": "114fdd6a-141a-40c7-9bb0-bf06668383d4", - "value": "87300-010", - "type": { - "technicalKey": "OTHER", - "name": "Other type", - "url": "" - } - } - ], - "localities": [ - { - "uuid": "9ecff242-d701-4a8b-8036-79fef7adc029", - "value": "CAMPO MOURAO", - "shortName": null, - "type": { - "technicalKey": "OTHER", - "name": "Other", - "url": "" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - } - ], - "thoroughfares": [ - { - "uuid": "baf57f9c-8916-47a8-ac94-45d337c36a92", - "value": "AV.IRMAOS PEREIRA 1330", - "name": null, - "shortName": null, - "number": "1330", - "direction": null, - "type": { - "technicalKey": "OTHER", - "name": "Other type", - "url": "" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - } - ], - "premises": [], - "postalDeliveryPoints": [], - "geographicCoordinates": null, - "types": [] - } - ], - "profileClassifications": [], - "types": [], - "bankAccounts": [], - "roles": [], - "relations": [] - } - }, - { - "score": 1, - "businessPartner": { - "bpn": "BPNL00000000B540", "identifiers": [ { - "uuid": "d38cc9b0-e9c8-4a65-a61f-f65fdc89c0d0", - "value": "BPNL00000000B540", + "value": "12345678910", "type": { - "technicalKey": "BPN", - "name": "Business Partner Number", - "url": "" - }, - "issuingBody": { - "technicalKey": "CATENAX", - "name": "Catena-X", - "url": "" - }, - "status": { - "technicalKey": "UNKNOWN", - "name": "Unknown" + "technicalKey": "CUSTOM_ADD_ID_TYPE", + "name": "Custom Identifier Test Type" } + } + ], + "physicalPostalAddress": { + "geographicCoordinates": { + "longitude": 0.0, + "latitude": 0.0, + "altitude": 0.0 }, - { - "uuid": "7542c3b2-ea4a-43a1-91a9-4a66cbf5b4f5", - "value": "62457a3f3fd2374f924ef9ca", - "type": { - "technicalKey": "CDQID", - "name": "CDQ Identifier", - "url": "" - }, - "issuingBody": { - "technicalKey": "CDQ", - "name": "CDQ AG", - "url": "" - }, - "status": { - "technicalKey": "CDQ_IMPORTED", - "name": "Imported from CDQ but not synchronized" - } + "country": { + "technicalKey": "DE", + "name": "Germany" }, - { - "uuid": "9ed0083d-fbe0-4045-83a0-38b1a511e2c1", - "value": "456017659110", - "type": { - "technicalKey": "BR_TAX_STATE", - "name": "Inscrição Estadual", - "url": "https://meta.cdq.com/State_tax_number_(Brazil)" - }, - "issuingBody": null, - "status": null + "postalCode": "70546", + "city": "Stuttgart", + "street": { + "name": "Neue Strasse", + "houseNumber": "1", + "milestone": "Neue Strasse 1", + "direction": "Neue Str." }, - { - "uuid": "b6fdea61-020c-40ad-bc0c-cf02d2cb18b2", - "value": "CX.POOL:623DA24246722D36980EC1A10", - "type": { - "technicalKey": "CX_POOL_ID", - "name": "", - "url": null - }, - "issuingBody": null, - "status": null + "administrativeAreaLevel1": null, + "administrativeAreaLevel2": "test1", + "administrativeAreaLevel3": "test2", + "district": "Stuttgart", + "companyPostalCode": "GM01", + "industrialZone": "HEADQUARTER", + "building": "Building A", + "floor": "A", + "door": "test" + }, + "alternativePostalAddress": { + "geographicCoordinates": { + "longitude": 0.0, + "latitude": 0.0, + "altitude": 0.0 }, - { - "uuid": "bb50eff2-76aa-4ad0-a24e-210b2d9f6f65", - "value": "56459977000126", - "type": { - "technicalKey": "BR_CNPJ", - "name": "Cadastro Nacional de Pessoa Jurídica", - "url": "https://meta.cdq.com/CNPJ_number_(Brazil)" - }, - "issuingBody": null, - "status": null - } - ], - "names": [ - { - "uuid": "1ae51fea-171d-4245-9106-7be09c62e63a", - "value": "PEREIRA & PEREIRA MEDIC. LTDA - ME", - "shortName": null, - "type": { - "technicalKey": "LOCAL", - "name": "The business partner name identifies a business partner in a given context, e.g. a country or region.", - "url": "" - }, - "language": { - "technicalKey": "undefined", - "name": "Undefined" - } - } - ], - "legalForm": null, - "status": null, - "addresses": [ - { - "uuid": "af68ea4d-8db6-4994-85a0-c49127304e55", - "version": { - "characterSet": { - "technicalKey": "LATIN", - "name": "Latin" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - }, - "careOf": null, - "contexts": [], - "country": { - "technicalKey": "BR", - "name": "Brazil" - }, - "administrativeAreas": [], - "postCodes": [ - { - "uuid": "3a13e2a4-437c-4ba1-b7db-5c3ed461101c", - "value": "13800-470", - "type": { - "technicalKey": "OTHER", - "name": "Other type", - "url": "" - } - } - ], - "localities": [ - { - "uuid": "61184f57-1d91-4f95-945c-da1898ba71b2", - "value": "Moji Mirim", - "shortName": null, - "type": { - "technicalKey": "OTHER", - "name": "Other", - "url": "" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - } - ], - "thoroughfares": [ - { - "uuid": "481958dc-099a-424f-888d-0e07e3d3870f", - "value": "R RIO DE JANEIRO , 421", - "name": null, - "shortName": null, - "number": null, - "direction": null, - "type": { - "technicalKey": "OTHER", - "name": "Other type", - "url": "" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - } - ], - "premises": [], - "postalDeliveryPoints": [], - "geographicCoordinates": null, - "types": [] - } - ], - "profileClassifications": [], - "types": [], - "bankAccounts": [], - "roles": [], - "relations": [] + "country": { + "technicalKey": "DE", + "name": "Germany" + }, + "postalCode": "1234", + "city": "Stuttgart 1", + "administrativeAreaLevel1": null, + "deliveryServiceNumber": "1234", + "deliveryServiceType": "PO_BOX", + "deliveryServiceQualifier": "test" + }, + "bpnLegalEntity": "BPNL000000000001", + "isLegalAddress": true, + "bpnSite": null, + "isMainAddress": false, + "createdAt": "2023-06-27T13:11:18.530737Z", + "updatedAt": "2023-06-27T13:14:46.458756Z" } } ] -} +} \ No newline at end of file diff --git a/public/testdata/partnerNetwork/businessPartnersDataGrid.json b/public/testdata/partnerNetwork/businessPartnersDataGrid.json index e59d4a71d..95f16e82c 100644 --- a/public/testdata/partnerNetwork/businessPartnersDataGrid.json +++ b/public/testdata/partnerNetwork/businessPartnersDataGrid.json @@ -1,128 +1,174 @@ [ { - "bpn": "BPNL00000000B44P", - "name": "POSTO DO CUNHADO LTDA", - "legalForm": "", - "country": "Brazil", - "street": "AV.IRMAOS PEREIRA 1330", - "zipCode": "87300-010", - "city": "CAMPO MOURAO", - "cxmember": false, - "identifiers": [ - { - "uuid": "4e05ce63-6e69-417e-b2f1-410e97440acc", - "value": "BPNL00000000B44P", - "type": { - "technicalKey": "BPN", - "name": "Business Partner Number", - "url": "" + "score": 0.0, + "legalName": "Test1", + "bpnl": "BPNL0000000001YN", + "identifiers": [], + "legalShortName": "Test1", + "legalForm": null, + "states": [], + "classifications": [], + "relations": [], + "currentness": "2023-08-04T12:13:54.461889Z", + "createdAt": "2023-08-04T12:13:54.662482Z", + "updatedAt": "2023-08-04T12:13:54.662496Z", + "legalAddress": { + "bpna": "BPNA0000000004WK", + "name": null, + "states": [], + "identifiers": [], + "physicalPostalAddress": { + "geographicCoordinates": null, + "country": { + "technicalKey": "DE", + "name": "Germany" }, - "issuingBody": { - "technicalKey": "CATENAX", - "name": "Catena-X", - "url": "" + "postalCode": "00001", + "city": "Munich", + "street": { + "name": "Street", + "houseNumber": "5", + "milestone": null, + "direction": null }, - "status": { - "technicalKey": "UNKNOWN", - "name": "Unknown" - } - }, - { - "uuid": "be6c2ab7-9602-4a68-8735-7c17b5974736", - "value": "CX.POOL:623DA23B6E73054B143D4AAE0", - "type": { - "technicalKey": "CX_POOL_ID", - "name": "", - "url": null - }, - "issuingBody": null, - "status": null + "administrativeAreaLevel1": null, + "administrativeAreaLevel2": null, + "administrativeAreaLevel3": null, + "district": null, + "companyPostalCode": null, + "industrialZone": null, + "building": null, + "floor": null, + "door": null }, + "alternativePostalAddress": null, + "bpnLegalEntity": "BPNL0000000001YN", + "isLegalAddress": true, + "bpnSite": null, + "isMainAddress": false, + "createdAt": "2023-08-04T12:13:54.658695Z", + "updatedAt": "2023-08-04T12:13:54.665740Z" + } + }, + { + "score": 0.0, + "legalName": "Part 2", + "bpnl": "BPNL000000000001", + "identifiers": [ { - "uuid": "e3ea74fe-a964-4c4e-887f-f61d400e8836", - "value": "80606650000114", + "value": "56459977000126", "type": { - "technicalKey": "BR_CNPJ", - "name": "Cadastro Nacional de Pessoa Jurídica", - "url": "https://meta.cdq.com/CNPJ_number_(Brazil)" + "technicalKey": "EU_VAT_ID_DE", + "name": "Value added tax identification number" }, - "issuingBody": null, - "status": null - }, + "issuingBody": "CUSTOM_ISSUE_BODY" + } + ], + "legalShortName": "NoC", + "legalForm": { + "technicalKey": "CUSTOM_LEGAL_FORM", + "name": "Custom Legal Form for Testing", + "abbreviation": null + }, + "states": [ { - "uuid": "dbfb27a3-d72a-4d35-bf90-b5d38e92077f", - "value": "8010445060", + "description": null, + "validFrom": "2020-12-16T05:54:48.942", + "validTo": "2023-06-05T07:31:01.213", "type": { - "technicalKey": "BR_TAX_STATE", - "name": "Inscrição Estadual", - "url": "https://meta.cdq.com/State_tax_number_(Brazil)" - }, - "issuingBody": null, - "status": null + "technicalKey": "ACTIVE", + "name": "Active" + } } - ] - }, - { - "bpn": "BPNL00000000B540", - "name": "PEREIRA & PEREIRA MEDIC. LTDA - ME", - "legalForm": "", - "country": "Brazil", - "street": "R RIO DE JANEIRO , 421", - "zipCode": "13800-470", - "city": "Moji Mirim", - "cxmember": true, - "identifiers": [ + ], + "classifications": [ { - "uuid": "d38cc9b0-e9c8-4a65-a61f-f65fdc89c0d0", - "value": "BPNL00000000B540", + "value": "Farming of cattle, dairy farming", + "code": "01.21", "type": { - "technicalKey": "BPN", - "name": "Business Partner Number", - "url": "" + "technicalKey": "NACE", + "name": "NACE" + } + } + ], + "relations": [], + "currentness": "2023-08-04T12:56:41.450550Z", + "createdAt": "2023-06-27T13:11:18.539048Z", + "updatedAt": "2023-08-04T12:56:41.556514Z", + "legalAddress": { + "bpna": "BPNA000000000001", + "name": "WESTERN_LATIN_STANDARD", + "states": [ + { + "description": "WESTERN_LATIN_STANDARD", + "validFrom": "2020-12-16T05:54:48.942", + "validTo": "2023-06-05T07:31:01.213", + "type": { + "technicalKey": "ACTIVE", + "name": "Active" + } + } + ], + "identifiers": [ + { + "value": "12345678910", + "type": { + "technicalKey": "CUSTOM_ADD_ID_TYPE", + "name": "Custom Identifier Test Type" + } + } + ], + "physicalPostalAddress": { + "geographicCoordinates": { + "longitude": 0.0, + "latitude": 0.0, + "altitude": 0.0 }, - "issuingBody": { - "technicalKey": "CATENAX", - "name": "Catena-X", - "url": "" + "country": { + "technicalKey": "DE", + "name": "Germany" }, - "status": { - "technicalKey": "UNKNOWN", - "name": "Unknown" - } - }, - { - "uuid": "9ed0083d-fbe0-4045-83a0-38b1a511e2c1", - "value": "456017659110", - "type": { - "technicalKey": "BR_TAX_STATE", - "name": "Inscrição Estadual", - "url": "https://meta.cdq.com/State_tax_number_(Brazil)" + "postalCode": "70546", + "city": "Stuttgart", + "street": { + "name": "Neue Strasse", + "houseNumber": "1", + "milestone": "Neue Strasse 1", + "direction": "Neue Str." }, - "issuingBody": null, - "status": null + "administrativeAreaLevel1": null, + "administrativeAreaLevel2": "test1", + "administrativeAreaLevel3": "test2", + "district": "Stuttgart", + "companyPostalCode": "GM01", + "industrialZone": "HEADQUARTER", + "building": "Building A", + "floor": "A", + "door": "test" }, - { - "uuid": "b6fdea61-020c-40ad-bc0c-cf02d2cb18b2", - "value": "CX.POOL:623DA24246722D36980EC1A10", - "type": { - "technicalKey": "CX_POOL_ID", - "name": "", - "url": null + "alternativePostalAddress": { + "geographicCoordinates": { + "longitude": 0.0, + "latitude": 0.0, + "altitude": 0.0 }, - "issuingBody": null, - "status": null - }, - { - "uuid": "bb50eff2-76aa-4ad0-a24e-210b2d9f6f65", - "value": "56459977000126", - "type": { - "technicalKey": "BR_CNPJ", - "name": "Cadastro Nacional de Pessoa Jurídica", - "url": "https://meta.cdq.com/CNPJ_number_(Brazil)" + "country": { + "technicalKey": "DE", + "name": "Germany" }, - "issuingBody": null, - "status": null - } - ] + "postalCode": "1234", + "city": "Stuttgart 1", + "administrativeAreaLevel1": null, + "deliveryServiceNumber": "1234", + "deliveryServiceType": "PO_BOX", + "deliveryServiceQualifier": "test" + }, + "bpnLegalEntity": "BPNL000000000001", + "isLegalAddress": true, + "bpnSite": null, + "isMainAddress": false, + "createdAt": "2023-06-27T13:11:18.530737Z", + "updatedAt": "2023-06-27T13:14:46.458756Z" + } } -] +] \ No newline at end of file diff --git a/public/testdata/partnerNetwork/businessPartnersSingleDataGrid.json b/public/testdata/partnerNetwork/businessPartnersSingleDataGrid.json index 60d12fa0f..5367f878d 100644 --- a/public/testdata/partnerNetwork/businessPartnersSingleDataGrid.json +++ b/public/testdata/partnerNetwork/businessPartnersSingleDataGrid.json @@ -1,51 +1,51 @@ { - "bpn": "BPNL0000000001YN", - "name": "AFT Automatisierungs- und Fördertechnik GmbH & Co.KG", - "legalForm": "", - "country": "Germany", - "street": "An der Wiese 14", - "zipCode": "79650", - "city": "Schopfheim", - "identifiers": [ - { - "uuid": "fa59a765-d9c4-4d92-810f-e49bce3dd57c", - "value": "DE813155579", - "type": { - "technicalKey": "EU_VAT_ID_DE", - "name": "Umsatzsteuer-Identifikationsnummer", - "url": "https://meta.cdq.com/European_value_added_tax_identifier_(Germany)" + "score": 0.0, + "legalName": "Test1", + "bpnl": "BPNL0000000001YN", + "identifiers": [], + "legalShortName": "Test1", + "legalForm": null, + "states": [], + "classifications": [], + "relations": [], + "currentness": "2023-08-04T12:13:54.461889Z", + "createdAt": "2023-08-04T12:13:54.662482Z", + "updatedAt": "2023-08-04T12:13:54.662496Z", + "legalAddress": { + "bpna": "BPNA0000000004WK", + "name": null, + "states": [], + "identifiers": [], + "physicalPostalAddress": { + "geographicCoordinates": null, + "country": { + "technicalKey": "DE", + "name": "Germany" }, - "issuingBody": null, - "status": null - }, - { - "uuid": "7854bfb0-1661-44e3-910c-1e775affa3e2", - "value": "BPNL0000000001YN", - "type": { - "technicalKey": "BPN", - "name": "Business Partner Number", - "url": "" - }, - "issuingBody": { - "technicalKey": "CATENAX", - "name": "Catena-X", - "url": "" + "postalCode": "00001", + "city": "Munich", + "street": { + "name": "Street", + "houseNumber": "5", + "milestone": null, + "direction": null }, - "status": { - "technicalKey": "UNKNOWN", - "name": "Unknown" - } + "administrativeAreaLevel1": null, + "administrativeAreaLevel2": null, + "administrativeAreaLevel3": null, + "district": null, + "companyPostalCode": null, + "industrialZone": null, + "building": null, + "floor": null, + "door": null }, - { - "uuid": "6602110a-7512-495a-941d-d4904966ccee", - "value": "316622612", - "type": { - "technicalKey": "DUNS_ID", - "name": "DUNS Number", - "url": "https://meta.cdq.com/D-U-N-S" - }, - "issuingBody": null, - "status": null - } - ] -} + "alternativePostalAddress": null, + "bpnLegalEntity": "BPNL0000000001YN", + "isLegalAddress": true, + "bpnSite": null, + "isMainAddress": false, + "createdAt": "2023-08-04T12:13:54.658695Z", + "updatedAt": "2023-08-04T12:13:54.665740Z" + } +} \ No newline at end of file diff --git a/public/testdata/partnerNetwork/businessPartnersSingleResult.json b/public/testdata/partnerNetwork/businessPartnersSingleResult.json index 9b0703490..5367f878d 100644 --- a/public/testdata/partnerNetwork/businessPartnersSingleResult.json +++ b/public/testdata/partnerNetwork/businessPartnersSingleResult.json @@ -1,158 +1,51 @@ { - "bpn": "BPNL0000000001YN", - "identifiers": [ - { - "uuid": "fa59a765-d9c4-4d92-810f-e49bce3dd57c", - "value": "DE813155579", - "type": { - "technicalKey": "EU_VAT_ID_DE", - "name": "Umsatzsteuer-Identifikationsnummer", - "url": "https://meta.cdq.com/European_value_added_tax_identifier_(Germany)" - }, - "issuingBody": null, - "status": null - }, - { - "uuid": "7854bfb0-1661-44e3-910c-1e775affa3e2", - "value": "BPNL0000000001YN", - "type": { - "technicalKey": "BPN", - "name": "Business Partner Number", - "url": "" - }, - "issuingBody": { - "technicalKey": "CATENAX", - "name": "Catena-X", - "url": "" - }, - "status": { - "technicalKey": "UNKNOWN", - "name": "Unknown" - } - }, - { - "uuid": "c5794afe-8661-4b6a-a4cf-9dcb23262e07", - "value": "61c0969c780a205a1c6cafe7", - "type": { - "technicalKey": "CDQID", - "name": "CDQ Identifier", - "url": "" - }, - "issuingBody": { - "technicalKey": "CDQ", - "name": "CDQ AG", - "url": "" - }, - "status": { - "technicalKey": "CDQ_SYNCHRONIZED", - "name": "Synchronized with CDQ" - } - }, - { - "uuid": "6602110a-7512-495a-941d-d4904966ccee", - "value": "316622612", - "type": { - "technicalKey": "DUNS_ID", - "name": "DUNS Number", - "url": "https://meta.cdq.com/D-U-N-S" - }, - "issuingBody": null, - "status": null - } - ], - "names": [ - { - "uuid": "97ec2b1a-0f9a-4e8f-b32a-82b79e6b5edf", - "value": "AFT Automatisierungs- und Fördertechnik GmbH & Co.KG", - "shortName": null, - "type": { - "technicalKey": "LOCAL", - "name": "The business partner name identifies a business partner in a given context, e.g. a country or region.", - "url": "" - }, - "language": { - "technicalKey": "undefined", - "name": "Undefined" - } - } - ], + "score": 0.0, + "legalName": "Test1", + "bpnl": "BPNL0000000001YN", + "identifiers": [], + "legalShortName": "Test1", "legalForm": null, - "status": null, - "addresses": [ - { - "uuid": "bc51d6fe-38c0-4eaf-b687-7e573672963c", - "version": { - "characterSet": { - "technicalKey": "LATIN", - "name": "Latin" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - }, - "careOf": null, - "contexts": [], + "states": [], + "classifications": [], + "relations": [], + "currentness": "2023-08-04T12:13:54.461889Z", + "createdAt": "2023-08-04T12:13:54.662482Z", + "updatedAt": "2023-08-04T12:13:54.662496Z", + "legalAddress": { + "bpna": "BPNA0000000004WK", + "name": null, + "states": [], + "identifiers": [], + "physicalPostalAddress": { + "geographicCoordinates": null, "country": { "technicalKey": "DE", "name": "Germany" }, - "administrativeAreas": [], - "postCodes": [ - { - "uuid": "69b57366-876c-4af1-9770-39be8658fff7", - "value": "79650", - "type": { - "technicalKey": "OTHER", - "name": "Other type", - "url": "" - } - } - ], - "localities": [ - { - "uuid": "32ff3582-9d3e-4ee2-9a66-72e452abcab2", - "value": "Schopfheim", - "shortName": null, - "type": { - "technicalKey": "OTHER", - "name": "Other", - "url": "" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - } - ], - "thoroughfares": [ - { - "uuid": "1927935d-a966-4f21-b29d-7ad5cdf3bbbb", - "value": "An der Wiese 14", - "name": null, - "shortName": null, - "number": null, - "direction": null, - "type": { - "technicalKey": "OTHER", - "name": "Other type", - "url": "" - }, - "language": { - "technicalKey": "en", - "name": "English" - } - } - ], - "premises": [], - "postalDeliveryPoints": [], - "geographicCoordinates": null, - "types": [] - } - ], - "profileClassifications": [], - "types": [], - "bankAccounts": [], - "roles": [], - "relations": [] -} + "postalCode": "00001", + "city": "Munich", + "street": { + "name": "Street", + "houseNumber": "5", + "milestone": null, + "direction": null + }, + "administrativeAreaLevel1": null, + "administrativeAreaLevel2": null, + "administrativeAreaLevel3": null, + "district": null, + "companyPostalCode": null, + "industrialZone": null, + "building": null, + "floor": null, + "door": null + }, + "alternativePostalAddress": null, + "bpnLegalEntity": "BPNL0000000001YN", + "isLegalAddress": true, + "bpnSite": null, + "isMainAddress": false, + "createdAt": "2023-08-04T12:13:54.658695Z", + "updatedAt": "2023-08-04T12:13:54.665740Z" + } +} \ No newline at end of file diff --git a/scripts/inject-dynamic-env.sh b/scripts/inject-dynamic-env.sh index 215d2323a..92cf0c55b 100644 --- a/scripts/inject-dynamic-env.sh +++ b/scripts/inject-dynamic-env.sh @@ -20,7 +20,7 @@ ############################################################### custom_env_vars='{PORTAL_ASSETS_URL:"'$PORTAL_ASSETS_URL'",PORTAL_BACKEND_URL:"'$PORTAL_BACKEND_URL'",CENTRALIDP_URL:"'$CENTRALIDP_URL'",BPDM_API_URL:"'$BPDM_API_URL'",SEMANTICS_URL:"'$SEMANTICS_URL'",MANAGED_IDENTITY_WALLETS_NEW_URL:"'$MANAGED_IDENTITY_WALLETS_NEW_URL'"}' -custom_env_vars_anchor='{PORTAL_ASSETS_URL:"http://localhost:3000/assets",PORTAL_BACKEND_URL:"https://portal-backend.dev.demo.catena-x.net",CENTRALIDP_URL:"https://centralidp.dev.demo.catena-x.net/auth",BPDM_API_URL:"https://partners-pool.dev.demo.catena-x.net/api",SEMANTICS_URL:"https://semantics.dev.demo.catena-x.net",MANAGED_IDENTITY_WALLETS_NEW_URL:"https://managed-identity-wallets-new.dev.demo.catena-x.net"}' +custom_env_vars_anchor='{PORTAL_ASSETS_URL:"http://localhost:3000/assets",PORTAL_BACKEND_URL:"https://portal-backend.dev.demo.catena-x.net",CENTRALIDP_URL:"https://centralidp.dev.demo.catena-x.net/auth",BPDM_API_URL:"https://business-partners.dev.demo.catena-x.net/pool/api",SEMANTICS_URL:"https://semantics.dev.demo.catena-x.net",MANAGED_IDENTITY_WALLETS_NEW_URL:"https://managed-identity-wallets-new.dev.demo.catena-x.net"}' index_html_reference=`cat /usr/share/nginx/html/index.html.reference` index_html=${index_html_reference//$custom_env_vars_anchor/$custom_env_vars} echo "$index_html" > /usr/share/nginx/html/index.html diff --git a/src/components/pages/Home/components/BusinessApplicationsSection/index.tsx b/src/components/pages/Home/components/BusinessApplicationsSection/index.tsx index ea18ef019..79a2a9f94 100644 --- a/src/components/pages/Home/components/BusinessApplicationsSection/index.tsx +++ b/src/components/pages/Home/components/BusinessApplicationsSection/index.tsx @@ -81,7 +81,6 @@ export default function BusinessApplicationsSection() { data .map((app: AppMarketplaceApp) => { const card = appToCard(app) - console.log(card) return card }) .map((item) => ( diff --git a/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetail.tsx b/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetail.tsx index e3f3fde26..9cb57d914 100644 --- a/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetail.tsx +++ b/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetail.tsx @@ -18,20 +18,24 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { useEffect } from 'react' -import { useDispatch } from 'react-redux' -import { getOneBusinessPartner } from 'features/partnerNetwork/actions' +import { useFetchBusinessPartnersQuery } from 'features/newPartnerNetwork/partnerNetworkApiSlice' import BusinessPartnerDetailContent from './BusinessPartnerDetailContent' -import { AppDispatch } from 'features/store' const BusinessPartnerDetail = ({ id }: { id: string }) => { - const dispatch = useDispatch() + const { data } = useFetchBusinessPartnersQuery({ + page: 0, + args: { + expr: id, + }, + }) - useEffect(() => { - dispatch(getOneBusinessPartner({ bpn: id })) - }, [dispatch, id]) - - return + return ( + <> + {data?.content?.length && ( + + )} + + ) } export default BusinessPartnerDetail diff --git a/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetailContent.tsx b/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetailContent.tsx index 962419f1a..10d159f35 100644 --- a/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetailContent.tsx +++ b/src/components/pages/PartnerNetwork/components/BusinessPartnerDetailOverlay/BusinessPartnerDetailContent.tsx @@ -18,21 +18,23 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { useSelector } from 'react-redux' -import { partnerNetworkSelector } from 'features/partnerNetwork/slice' import { Box, Grid, useTheme } from '@mui/material' import { useTranslation } from 'react-i18next' import { Typography } from '@catena-x/portal-shared-components' -import { BpdmTypeUUIDKeyPair } from 'features/partnerNetwork/types' +import { + BpdmTypeUUIDKeyPair, + BusinessPartner, +} from 'features/partnerNetwork/types' import DetailGridRow from './DetailGridRow' -const BusinessPartnerDetailContent = () => { +const BusinessPartnerDetailContent = ({ + selectedRowBPN, +}: { + selectedRowBPN: BusinessPartner +}) => { const { t } = useTranslation() const theme = useTheme() const { spacing } = theme - const details = useSelector(partnerNetworkSelector) - const selectedRowBPN = details.mappedPartnerList[0] - return ( <> {selectedRowBPN && ( @@ -54,14 +56,14 @@ const BusinessPartnerDetailContent = () => { key={t('content.partnernetwork.columns.name') as string} {...{ variableName: `${t('content.partnernetwork.columns.name')}`, - value: selectedRowBPN.name, + value: selectedRowBPN.legalName ?? '', }} /> {selectedRowBPN.legalForm && ( @@ -71,7 +73,7 @@ const BusinessPartnerDetailContent = () => { variableName: `${t( 'content.partnernetwork.overlay.legalform' )}`, - value: selectedRowBPN.legalForm, + value: selectedRowBPN.legalForm?.name ?? '', }} /> )} @@ -87,18 +89,28 @@ const BusinessPartnerDetailContent = () => { @@ -96,27 +92,29 @@ const BusinessPartnerDetailOverlay = ({ key="Country" {...{ variableName: t('content.partnernetwork.columns.address'), - value: selectedRowBPN.legalEntity - ? selectedRowBPN.legalEntity.legalAddress.country.name - : '', + value: + selectedRowBPN?.legalAddress?.physicalPostalAddress?.country + ?.name ?? + selectedRowBPN?.legalAddress?.alternativePostalAddress?.country + ?.name ?? + '', }} /> - {selectedRowBPN.legalEntity && - selectedRowBPN.legalEntity.identifiers?.map( - (identifier: BpdmTypeUUIDKeyPair) => { - return ( - - ) - } - )} + {selectedRowBPN?.identifiers?.map( + (identifier: BpdmTypeUUIDKeyPair) => { + return ( + + ) + } + )} diff --git a/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx b/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx deleted file mode 100644 index e0b0eb21c..000000000 --- a/src/components/pages/PartnerNetwork/components/PartnerList/PartnerNetworksBPNTableColumns.tsx +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 Mercedes-Benz Group AG and BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -import { GridColDef } from '@mui/x-data-grid' -import { IconButton } from '@catena-x/portal-shared-components' -import ArrowForwardIcon from '@mui/icons-material/ArrowForward' -import { BusinessPartner } from 'features/newPartnerNetwork/types' -import { Box } from '@mui/material' -import smallLogo from '../../../../../assets/logo/cx-logo-short.svg' -import { OVERLAYS } from 'types/Constants' -import { show } from 'features/control/overlay' -import { useDispatch } from 'react-redux' - -// Columns definitions of Partner Network page Data Grid -export const PartnerNetworksBPNTableColumns = ( - translationHook: any -): Array => { - const { t } = translationHook() - const dispatch = useDispatch() - - return [ - { - field: 'names', - headerName: t('content.partnernetwork.columns.name'), - flex: 2, - sortable: false, - valueGetter: ({ row }: { row: BusinessPartner }) => - row.names ? row.names[0].value : null, - }, - { - field: 'bpn', - headerName: t('content.partnernetwork.columns.bpn'), - flex: 2, - sortable: false, - valueGetter: ({ row }: { row: BusinessPartner }) => row.bpn, - }, - { - field: 'cxmember', // Temporary field, doesnt exists yet - headerName: t('content.partnernetwork.columns.cxparticipant'), - flex: 1.5, - sortable: false, - renderCell: (params) => - params && params.row && params.row.member ? ( - - ) : ( - '' - ), - }, - { - field: 'country', - headerName: t('content.partnernetwork.columns.country'), - flex: 1.5, - sortable: false, - valueGetter: ({ row }: { row: BusinessPartner }) => - row ? row.legalAddress?.country?.name : '', - }, - { - field: 'detail', - headerName: 'Detail', - headerAlign: 'center', - flex: 0.8, - align: 'center', - renderCell: (params) => - params && params.row && params.row.bpn ? ( - dispatch(show(OVERLAYS.PARTNER, params.row.bpn))} - > - - - ) : ( - <> - ), - }, - ] -} diff --git a/src/components/pages/PartnerNetwork/components/PartnerList/helper.ts b/src/components/pages/PartnerNetwork/components/PartnerList/helper.ts index efdcb1e25..611f7a7e6 100644 --- a/src/components/pages/PartnerNetwork/components/PartnerList/helper.ts +++ b/src/components/pages/PartnerNetwork/components/PartnerList/helper.ts @@ -26,8 +26,9 @@ export const isContentPresent = (data: any) => data && data.content export const addCountryAttribute = (finalObj: any, payload: any) => { finalObj.forEach((x: any) => { payload.forEach((y: any) => { - if (x.legalEntity.bpn === y.legalEntity) { - x.legalEntity.legalAddress = y.legalAddress + if (x.bpnl === y.bpnLegalEntity) { + x.legalAddress.alternativePostalAddress = y.alternativePostalAddress + x.legalAddress.physicalPostalAddress = y.physicalPostalAddress } }) }) @@ -37,7 +38,7 @@ export const addCountryAttribute = (finalObj: any, payload: any) => { export const addMemberAttribute = (finalObj: any, queryData: any) => { if (queryData) { finalObj.forEach((x: any) => { - x.legalEntity.member = queryData.includes(x.legalEntity.bpn) + x.member = queryData.includes(x.bpnl) }) } return finalObj diff --git a/src/components/pages/PartnerNetwork/index.tsx b/src/components/pages/PartnerNetwork/index.tsx index e6d79a874..46d08c0bc 100644 --- a/src/components/pages/PartnerNetwork/index.tsx +++ b/src/components/pages/PartnerNetwork/index.tsx @@ -24,24 +24,20 @@ import { useFetchBusinessPartnersQuery, useFetchBusinessPartnerAddressMutation, } from 'features/newPartnerNetwork/partnerNetworkApiSlice' -import { - PageHeader, - PageLoadingTable, -} from '@catena-x/portal-shared-components' +import { PageHeader } from '@catena-x/portal-shared-components' import { useSelector } from 'react-redux' -import { useEffect, useState } from 'react' +import { useState } from 'react' import { updatePartnerSelector } from 'features/control/updates' import { PartnerNetworksTableColumns } from 'components/pages/PartnerNetwork/partnerNetworkTableColumns' import { BusinessPartner } from 'features/newPartnerNetwork/types' import Patterns from 'types/Patterns' -import { PartnerNetworksBPNTableColumns } from './components/PartnerList/PartnerNetworksBPNTableColumns' import { useFetchMemberCompaniesQuery } from 'features/newPartnerNetwork/partnerNetworkPortalApiSlice' import { isContentPresent, - isQueryDataPresent, addCountryAttribute, addMemberAttribute, } from './components/PartnerList/helper' +import { PageLoadingTable } from 'components/shared/basic/PageLoadingTable' const PartnerNetwork = () => { const { t } = useTranslation() @@ -49,17 +45,12 @@ const PartnerNetwork = () => { const [refresh, setRefresh] = useState(0) const searchInputData = useSelector(updatePartnerSelector) const columns = PartnerNetworksTableColumns(useTranslation) - const bpnColumns = PartnerNetworksBPNTableColumns(useTranslation) - const [showBPNColumn, setShowBPNColumn] = useState(false) const [mutationRequest] = useFetchBusinessPartnerAddressMutation() const { data } = useFetchMemberCompaniesQuery() const validateSearchText = (text: string): boolean => Patterns.SEARCH.test(text.trim()) - const checkIfBPNLNumber = (text: string): boolean => - Patterns.BPN.test(text.trim()) - const [allItems, setAllItems] = useState({}) const fetchAndApply = async (cData: any) => { @@ -68,43 +59,21 @@ const PartnerNetwork = () => { setAllItems([]) return } - if (isContentPresent(cData)) { - const result = cData.content.map((x: any) => x.legalEntity.bpn) - await mutationRequest(result) - .unwrap() - .then((payload: any) => { - //new country attribute && member attributes based on the response - let finalObj = JSON.parse(JSON.stringify(cData?.content)) - finalObj = addCountryAttribute(finalObj, payload) - finalObj = addMemberAttribute(finalObj, data) - setAllItems(finalObj) - }) - .catch(() => { - setAllItems([]) - }) - } else { - const result = [cData.bpn] - await mutationRequest(result) - .unwrap() - .then((payload: any) => { - //update for country attribute && update member info - let finalObj = JSON.parse(JSON.stringify(cData)) - finalObj.legalAddress = payload[0].legalAddress - if (isQueryDataPresent(data)) { - finalObj.member = data && data.includes(finalObj.bpn) - } - setAllItems([finalObj]) - }) - .catch(() => { - setAllItems([]) - }) - } + const result = cData.content.map((x: any) => x.bpnl) + await mutationRequest(result) + .unwrap() + .then((payload: any) => { + //new country attribute && member attributes based on the response + let finalObj = JSON.parse(JSON.stringify(cData?.content)) + finalObj = addCountryAttribute(finalObj, payload) + finalObj = addMemberAttribute(finalObj, data) + setAllItems(finalObj) + }) + .catch(() => { + setAllItems([]) + }) } - useEffect(() => { - if (allItems?.length) setShowBPNColumn(checkIfBPNLNumber(expr)) - }, [allItems, expr]) - return (
{ >
- + searchExpr={expr} toolbarVariant={'ultimate'} hasBorder={false} @@ -132,10 +101,8 @@ const PartnerNetwork = () => { fetchHook={useFetchBusinessPartnersQuery} fetchHookArgs={{ expr }} fetchHookRefresh={refresh} - getRowId={(row: { legalEntity: any }) => - row && row.legalEntity ? row.legalEntity.bpn : '' - } - columns={!showBPNColumn ? columns : bpnColumns} + getRowId={(row: { bpnl: string }) => row.bpnl ?? ''} + columns={columns} callbackToPage={fetchAndApply} allItems={allItems} /> diff --git a/src/components/pages/PartnerNetwork/partnerNetworkTableColumns.tsx b/src/components/pages/PartnerNetwork/partnerNetworkTableColumns.tsx index 51a07decf..cf5f8c867 100644 --- a/src/components/pages/PartnerNetwork/partnerNetworkTableColumns.tsx +++ b/src/components/pages/PartnerNetwork/partnerNetworkTableColumns.tsx @@ -21,7 +21,7 @@ import { GridColDef } from '@mui/x-data-grid' import { IconButton } from '@catena-x/portal-shared-components' import ArrowForwardIcon from '@mui/icons-material/ArrowForward' -import { BusinessPartnerSearchResponse } from 'features/newPartnerNetwork/types' +import { BusinessPartner } from 'features/newPartnerNetwork/types' import { Box } from '@mui/material' import smallLogo from '../../../assets/logo/cx-logo-short.svg' import { OVERLAYS } from 'types/Constants' @@ -41,20 +41,14 @@ export const PartnerNetworksTableColumns = ( headerName: t('content.partnernetwork.columns.name'), flex: 2, sortable: false, - valueGetter: ({ row }: { row: BusinessPartnerSearchResponse }) => - row?.legalEntity && - row?.legalEntity?.names && - row?.legalEntity?.names?.length - ? row.legalEntity.names[0].value - : '', + valueGetter: ({ row }: { row: BusinessPartner }) => row?.legalName ?? '', }, { field: 'legalEntity.bpn', headerName: t('content.partnernetwork.columns.bpn'), flex: 2, sortable: false, - valueGetter: ({ row }: { row: BusinessPartnerSearchResponse }) => - row?.legalEntity ? row.legalEntity.bpn : '', + valueGetter: ({ row }: { row: BusinessPartner }) => row?.bpnl ?? '', }, { field: 'cxmember', // Temporary field, doesnt exists yet @@ -62,10 +56,7 @@ export const PartnerNetworksTableColumns = ( flex: 1.5, sortable: false, renderCell: (params) => - params && - params.row && - params.row.legalEntity && - params.row.legalEntity.member ? ( + params?.row?.member ? ( - row?.legalEntity ? row.legalEntity.legalAddress?.country?.name : '', + valueGetter: ({ row }: { row: BusinessPartner }) => + row?.legalAddress?.physicalPostalAddress?.country?.name ?? + row?.legalAddress?.alternativePostalAddress?.country?.name ?? + '', }, { field: 'detail', @@ -94,14 +87,12 @@ export const PartnerNetworksTableColumns = ( flex: 0.8, align: 'center', renderCell: (params) => - params && params.row && params.row.legalEntity ? ( + params?.row?.bpnl ? ( - dispatch(show(OVERLAYS.PARTNER, params.row.legalEntity.bpn)) - } + onClick={() => dispatch(show(OVERLAYS.PARTNER, params.row.bpnl))} > diff --git a/src/components/shared/basic/PageLoadingTable/helper.ts b/src/components/shared/basic/PageLoadingTable/helper.ts new file mode 100644 index 000000000..e20d60fad --- /dev/null +++ b/src/components/shared/basic/PageLoadingTable/helper.ts @@ -0,0 +1,27 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +export const hasMorePages = (data: { + meta: { page: number; totalPages: number } +}) => { + return data?.meta?.page < data?.meta?.totalPages - 1 +} + +export const getMaxRows = (data: { meta: { totalElements: number } }) => { + return data?.meta?.totalElements ?? 0 +} diff --git a/src/components/shared/basic/PageLoadingTable/index.tsx b/src/components/shared/basic/PageLoadingTable/index.tsx new file mode 100644 index 000000000..2e1688454 --- /dev/null +++ b/src/components/shared/basic/PageLoadingTable/index.tsx @@ -0,0 +1,150 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +import { + LoadMoreButton, + Table, + TableProps, + PaginFetchArgs, +} from '@catena-x/portal-shared-components' +import { Box } from '@mui/material' +import { useState, useEffect } from 'react' +import { getMaxRows, hasMorePages } from './helper' + +export interface PaginMeta { + totalElements: number + totalPages: number + page: number + contentSize: number +} + +export interface PaginResult { + meta: PaginMeta + content: Array +} + +export interface PageLoadingTableProps + extends Omit { + loadLabel: string + fetchHook: (paginArgs: PaginFetchArgs) => any + fetchHookArgs?: Args + fetchHookRefresh?: number + allItems?: Array + callbackToPage?: (data: PaginResult) => void +} + +export const PageLoadingTable = function ({ + loadLabel, + fetchHook, + fetchHookArgs, + fetchHookRefresh = 0, + allItems, + callbackToPage, + ...props +}: PageLoadingTableProps) { + const [page, setPage] = useState(0) + const [clear, setClear] = useState(true) + const [loaded, setLoaded] = useState(0) + const [items, setItems] = useState>([]) + const { data, isFetching, isSuccess, error, refetch } = fetchHook({ + page, + args: { + ...fetchHookArgs, + v: loaded, + }, + }) + const [loading, setLoading] = useState(true) + + function nextPage() { + setPage(page + 1) + } + const hasMore = hasMorePages(data) + const maxRows = getMaxRows(data) + + useEffect(() => { + if (!allItems) { + return + } + if (allItems?.length > 0) { + setLoading(false) + setItems((i) => i.concat(allItems)) + } else if (allItems?.length === 0) { + setLoading(false) + setItems([]) + } + }, [allItems]) + + useEffect(() => { + if (loaded !== fetchHookRefresh) { + setLoaded(fetchHookRefresh) + setPage(0) + setClear(true) + } + }, [fetchHookRefresh, loaded]) + + useEffect(() => { + // reset loading + if (isFetching && !loading) { + setLoading(true) + } + if (isSuccess && !isFetching && data && data.content) { + if (clear) { + setItems([]) + setClear(false) + } else if (callbackToPage) { + callbackToPage(data) + } else { + setLoading(false) + data.content + ? setItems((i) => i.concat(data.content)) + : setItems([data]) // Search for legal entity based on BPN responses with an object. No content or meta properties available + } + } + if (error) { + setLoading(false) + } + }, [isSuccess, isFetching, data, clear, loaded]) + + return ( + <> + + {items.length > 0 && hasMore && ( + + + + )} + + ) +} diff --git a/src/features/info/search/actions.ts b/src/features/info/search/actions.ts index 78983d9c2..30e4162d1 100644 --- a/src/features/info/search/actions.ts +++ b/src/features/info/search/actions.ts @@ -178,9 +178,7 @@ const fetchSearch = createAsyncThunk( : item.name?.match(searchExpr) || item.provider.match(searchExpr) ) .map((item: AppMarketplaceApp) => appToSearchItem(item)), - partners.content.map((item: { businessPartner: BusinessPartner }) => - businessPartnerToSearchItem(item.businessPartner) - ), + partners.content.map((item: any) => businessPartnerToSearchItem(item)), news .filter( (item: CardItems) => diff --git a/src/features/info/search/mapper.ts b/src/features/info/search/mapper.ts index 9f201f57e..19bd142dd 100644 --- a/src/features/info/search/mapper.ts +++ b/src/features/info/search/mapper.ts @@ -52,10 +52,10 @@ export const appToSearchItem = (item: AppMarketplaceApp): SearchItem => ({ export const businessPartnerToSearchItem = ( item: BusinessPartner ): SearchItem => ({ - id: item.bpn, + id: item.bpnl, category: SearchCategory.PARTNER, - title: item.names[0]?.value, - description: item.bpn, + title: item.legalName, + description: item.bpnl, }) export const newsToSearchItem = (item: CardItems): SearchItem => ({ diff --git a/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts b/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts index 1112482a2..a106fc0e7 100644 --- a/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts +++ b/src/features/newPartnerNetwork/partnerNetworkApiSlice.ts @@ -21,9 +21,9 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' import { apiBpdmQuery } from 'utils/rtkUtil' import { PaginResult, PaginFetchArgs } from '@catena-x/portal-shared-components' -import { BusinessPartnerSearchResponse } from './types' +import { BusinessPartner } from './types' import Patterns from 'types/Patterns' -import { BusinessPartnerResponse } from 'features/partnerNetwork/types' +import { BusinessPartnerAddressResponse } from 'features/partnerNetwork/types' const checkIfBPNLNumber = (text: string): boolean => Patterns.BPN.test(text.trim()) @@ -33,7 +33,7 @@ export const apiSlice = createApi({ baseQuery: fetchBaseQuery(apiBpdmQuery()), endpoints: (builder) => ({ fetchBusinessPartnerAddress: builder.mutation< - PaginResult, + PaginResult, any >({ query: (arry) => ({ @@ -43,7 +43,7 @@ export const apiSlice = createApi({ }), }), fetchBusinessPartners: builder.query< - PaginResult, + PaginResult, PaginFetchArgs >({ query: (fetchArgs) => { @@ -57,6 +57,29 @@ export const apiSlice = createApi({ return `/catena/legal-entities?page=${fetchArgs.page}&size=10` } }, + transformResponse: (response: any) => { + if (response.content) { + return { + ...response, + meta: { + contentSize: response.contentSize, + page: response.page, + totalElements: response.totalElements, + totalPages: response.totalPages, + }, + } + } else { + return { + content: [response], + meta: { + contentSize: response.contentSize, + page: response.page, + totalElements: response.totalElements, + totalPages: response.totalPages, + }, + } + } + }, }), }), }) diff --git a/src/features/newPartnerNetwork/types.ts b/src/features/newPartnerNetwork/types.ts index f9e5569e0..260f4a6ef 100644 --- a/src/features/newPartnerNetwork/types.ts +++ b/src/features/newPartnerNetwork/types.ts @@ -1,17 +1,17 @@ /******************************************************************************** - * Copyright (c) 2021, 2023 Mercedes-Benz Group AG and BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * Copyright (c) 2021 2023 Mercedes-Benz Group AG and BMW Group AG + * Copyright (c) 2021 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at + * terms of the Apache License Version 2.0 which is available at * https://www.apache.org/licenses/LICENSE-2.0. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * Unless required by applicable law or agreed to in writing software + * distributed under the License is distributed on an AS IS BASIS WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * @@ -19,34 +19,44 @@ ********************************************************************************/ import { - BpdmBusinessStatus, BpdmLegalFormObject, - BpdmProfileClassification, BpdmTypeRelation, - BpdmTypeBankAccount, - BpdmTypeCommonKeyValuePair, BpdmTypeUUIDKeyPair, - BpdmTypeLanguagePair, - BpdmAddresses, + BpdmLegalAddressObject, } from '../partnerNetwork/types' export interface BusinessPartner { - bpn: string // Unique identifier + score?: number + legalName: string + bpnl: string + member?: boolean identifiers: Array - names: Array + legalShortName: string legalForm: BpdmLegalFormObject - status: BpdmBusinessStatus - addresses: Array - profileClassifications: Array - types: Array - bankAccounts: Array - roles: Array + states: [ + { + description: string + validFrom: string + validTo: string + type: { + technicalKey: string + name: string + } + } + ] + classifications: [ + { + value: string + code: string + type: { + technicalKey: string + name: string + } + } + ] relations: Array - legalAddress?: any - member?: boolean -} - -export interface BusinessPartnerSearchResponse { - score: number - legalEntity: BusinessPartner + currentness: string + createdAt: string + updatedAt: string + legalAddress: BpdmLegalAddressObject } diff --git a/src/features/partnerNetwork/api.ts b/src/features/partnerNetwork/api.ts index eed8eb13f..a5b7b9942 100644 --- a/src/features/partnerNetwork/api.ts +++ b/src/features/partnerNetwork/api.ts @@ -49,7 +49,7 @@ export class PartnerNetworkApi extends HttpClient { public getBusinessPartnerByBpn = (bpn: string) => this.instance.get( - `/catena/business-partner/${bpn}?idType=BPN`, + `/catena/legal-entities/${bpn}`, getHeaders() ) diff --git a/src/features/partnerNetwork/types.ts b/src/features/partnerNetwork/types.ts index 9fd7cf25e..8001c2b32 100644 --- a/src/features/partnerNetwork/types.ts +++ b/src/features/partnerNetwork/types.ts @@ -120,23 +120,46 @@ export interface BpdmBusinessStatus { } //endregion +export interface LegalFormType { + technicalKey: string + name: string + abbreviation: string +} + export interface BusinessPartner { - bpn: string // Unique identifier + score?: number + legalName: string + bpnl: string + member?: boolean identifiers: Array - names: Array - legalForm: BpdmLegalFormObject - status: BpdmBusinessStatus - addresses: Array - profileClassifications: Array - types: Array - bankAccounts: Array - roles: Array + legalShortName: string + legalForm: any + states: [ + { + description: string + validFrom: string + validTo: string + type: { + technicalKey: string + name: string + } + } + ] + classifications: [ + { + value: string + code: string + type: { + technicalKey: string + name: string + } + } + ] relations: Array -} - -export interface BusinessPartnerSearchResponse { - score: number - businessPartner: BusinessPartner + currentness: string + createdAt: string + updatedAt: string + legalAddress: BpdmLegalAddressObject } export interface BusinessPartnerResponse { @@ -144,7 +167,15 @@ export interface BusinessPartnerResponse { totalPages: number page: number contentSize: number - content: Array + content: Array +} + +export interface BusinessPartnerAddressResponse { + alternativePostalAddress: any + bpnLegalEntity: string + createdAt: string + updatedAt: string + physicalPostalAddress: PhysicalPostalAddressType } export interface PaginationData { @@ -162,12 +193,97 @@ export interface PartnerNetworkInitialState { } export interface PartnerNetworkDataGrid { - bpn: string - name: string - legalForm: string - country: string - street: string - zipCode: string - city: string + bpnl: string + legalName: string + legalForm: any + legalAddress: any identifiers: Array } + +export interface BpdmLegalAddressStatesObject { + description: string + validFrom: string + validTo: string + type: { + technicalKey: string + name: string + } +} + +export interface AlternatePostalAddressType { + geographicCoordinates: { + longitude: 0 + latitude: 0 + altitude: 0 + } + country: { + technicalKey: string + name: string + } + postalCode: string + city: string + administrativeAreaLevel1: { + countryCode: string + regionCode: string + regionName: string + } + deliveryServiceNumber: string + deliveryServiceType: string + deliveryServiceQualifier: string +} + +export interface PhysicalPostalAddressType { + geographicCoordinates: { + longitude: 0 + latitude: 0 + altitude: 0 + } + country: { + technicalKey: string + name: string + } + postalCode: string + city: string + street: { + name: string + houseNumber: string + milestone: string + direction: string + } + administrativeAreaLevel1: { + countryCode: string + regionCode: string + regionName: string + } + administrativeAreaLevel2: string + administrativeAreaLevel3: string + district: string + companyPostalCode: string + industrialZone: string + building: string + floor: string + door: string +} + +export interface BpdmLegalAddressObject { + bpna: string + name: string + states: Array + identifiers: [ + { + value: string + type: { + technicalKey: string + name: string + } + } + ] + physicalPostalAddress: PhysicalPostalAddressType + alternativePostalAddress: AlternatePostalAddressType + bpnLegalEntity: string + bpnSite: string + createdAt: string + updatedAt: string + isMainAddress: boolean + isLegalAddress: boolean +} diff --git a/src/utils/dataMapper.test.ts b/src/utils/dataMapper.test.ts index d7b46e65a..2b884c48a 100644 --- a/src/utils/dataMapper.test.ts +++ b/src/utils/dataMapper.test.ts @@ -27,10 +27,8 @@ import TestSingleData from '../../public/testdata/partnerNetwork/businessPartner import TestDataGridData from '../../public/testdata/partnerNetwork/businessPartnersDataGrid.json' import TestMembershipData from '../../public/testdata/partnerNetwork/membershipData.json' import TestSingleDataGridData from '../../public/testdata/partnerNetwork/businessPartnersSingleDataGrid.json' -import { - BusinessPartner, - BusinessPartnerResponse, -} from 'features/partnerNetwork/types' +import { BusinessPartner } from 'features/newPartnerNetwork/types' +import { BusinessPartnerResponse } from 'features/partnerNetwork/types' describe('DataMapperTest', () => { it('mapBusinessPartnerToDataGrid maps correctly', () => { diff --git a/src/utils/dataMapper.ts b/src/utils/dataMapper.ts index e71aba1f6..bfeb8bf52 100644 --- a/src/utils/dataMapper.ts +++ b/src/utils/dataMapper.ts @@ -18,67 +18,28 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { - BusinessPartner, - BusinessPartnerResponse, - BusinessPartnerSearchResponse, - PartnerNetworkDataGrid, -} from 'features/partnerNetwork/types' +import { BusinessPartnerResponse } from 'features/partnerNetwork/types' import { RegistrationRequest, RegistrationRequestDataGrid, } from 'features/admin/registration/types' -import { cloneDeep } from 'lodash' +import { BusinessPartner } from 'features/newPartnerNetwork/types' // Temporary solution for mapping api response to DataGrid component type const mapBusinessPartnerToDataGrid = ( bpResponse: BusinessPartnerResponse, membershipData: string[] -): Array => { - return bpResponse?.content?.map((bp: BusinessPartnerSearchResponse) => { - const bpAddress = bp.businessPartner.addresses[0] - return { - bpn: bp.businessPartner.bpn, - legalForm: bp.businessPartner.legalForm?.name || '', - cxmember: membershipData.includes(bp.businessPartner.bpn), - name: bp.businessPartner.names.filter( - (name) => - name.type.technicalKey === 'INTERNATIONAL' || - name.type.technicalKey === 'LOCAL' - )[0].value, - country: bpAddress.country.name, - street: bpAddress.thoroughfares[0].value, - zipCode: bpAddress.postCodes[0].value, - city: bpAddress.localities[0].value, - identifiers: bp.businessPartner.identifiers?.filter( - (identifier) => identifier.type.technicalKey !== 'CDQID' - ), - } as PartnerNetworkDataGrid +): Array => { + return bpResponse?.content?.map((bp: BusinessPartner) => { + return bp }) } const mapSingleBusinessPartnerToDataGrid = ( bp: BusinessPartner -): PartnerNetworkDataGrid => { - const bpAddress = bp.addresses[0] - const names = cloneDeep(bp.names) - return { - bpn: bp.bpn, - name: names.length - ? names.sort((a, b) => - a.type.technicalKey.localeCompare(b.type.technicalKey) - )[0].value - : '-', //value can be INTERNATIONAL < LOCAL < OTHER - legalForm: bp.legalForm?.name || '', - country: bpAddress.country.name, - street: bpAddress.thoroughfares[0].value, - zipCode: bpAddress.postCodes[0].value, - city: bpAddress.localities[0].value, - identifiers: bp.identifiers?.filter( - (identifier) => identifier.type.technicalKey !== 'CDQID' - ), - } as PartnerNetworkDataGrid +): BusinessPartner => { + return bp } const mapRegistrationRequestResponseToDataGrid = (