From d5cbda28debcb481cc45c15a2507cc22305532ba Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Mon, 18 Nov 2024 13:56:38 -0800 Subject: [PATCH] fix(SILVA-502): fixing map on silviculture search screen (#472) --- .../oracle/service/OpeningServiceTest.java | 2 +- .../oracle/V003__oracle_test_data.sql | 21 +- .../oracle/V004__test_data_101017.sql | 357 ++++++++++++++++++ .../oracle/V005__test_data_1009974.sql | 290 ++++++++++++++ .../Openings/OpeningSearchTab.test.tsx | 56 +++ .../Openings/SearchScreenDataTable.test.tsx | 42 ++- .../src/components/FriendlyDate/index.tsx | 4 +- frontend/src/components/OpeningsMap/index.tsx | 197 ++++------ .../src/components/OpeningsMapEntry/index.tsx | 54 +++ frontend/src/components/OpeningsTab/index.tsx | 1 + .../Openings/OpeningsSearchTab/index.tsx | 7 +- .../Openings/SearchScreenDataTable/index.tsx | 35 +- 12 files changed, 906 insertions(+), 160 deletions(-) create mode 100644 backend/src/test/resources/migration/oracle/V004__test_data_101017.sql create mode 100644 backend/src/test/resources/migration/oracle/V005__test_data_1009974.sql create mode 100644 frontend/src/components/OpeningsMapEntry/index.tsx diff --git a/backend/src/test/java/ca/bc/gov/restapi/results/oracle/service/OpeningServiceTest.java b/backend/src/test/java/ca/bc/gov/restapi/results/oracle/service/OpeningServiceTest.java index 2cea819a..976c5cb8 100644 --- a/backend/src/test/java/ca/bc/gov/restapi/results/oracle/service/OpeningServiceTest.java +++ b/backend/src/test/java/ca/bc/gov/restapi/results/oracle/service/OpeningServiceTest.java @@ -86,7 +86,7 @@ void getRecentOpenings_fetchNoUserPaginated_shouldSucceed() { Assertions.assertNotNull(paginatedResult); Assertions.assertEquals(1, paginatedResult.getPageIndex()); - Assertions.assertEquals(3, paginatedResult.getTotalPages()); + Assertions.assertEquals(5, paginatedResult.getTotalPages()); Assertions.assertFalse(paginatedResult.getData().isEmpty()); Assertions.assertEquals(1, paginatedResult.getData().size()); } diff --git a/backend/src/test/resources/migration/oracle/V003__oracle_test_data.sql b/backend/src/test/resources/migration/oracle/V003__oracle_test_data.sql index 06427a81..07c1b3df 100644 --- a/backend/src/test/resources/migration/oracle/V003__oracle_test_data.sql +++ b/backend/src/test/resources/migration/oracle/V003__oracle_test_data.sql @@ -151,24 +151,9 @@ INSERT INTO THE.RESULTS_AUDIT_EVENT ENTRY_USERID, ENTRY_TIMESTAMP ) -VALUES(1, 101, NULL, NULL, 'SUB', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Forest Cover 0000000', NULL, 'Y', 101, 101, 'TEST\OTTOMATED', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS')); -INSERT INTO THE.RESULTS_AUDIT_EVENT -( - RESULTS_AUDIT_EVENT_ID, - OPENING_ID, - STANDARDS_REGIME_ID, - SILVICULTURE_PROJECT_ID, - RESULTS_AUDIT_ACTION_CODE, - ACTION_DATE, - DESCRIPTION, - USER_ID, - EMAIL_SENT_IND, - XML_SUBMISSION_ID, - OPENING_AMENDMENT_NUMBER, - ENTRY_USERID, - ENTRY_TIMESTAMP -) -VALUES(2, 102, NULL, NULL, 'SUB', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Forest Cover 0000000', NULL, 'Y', 102, 102, 'IDIR@TEST', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS')); +VALUES +(1, 101, NULL, NULL, 'SUB', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Forest Cover 0000000', NULL, 'Y', 101, 101, 'TEST\OTTOMATED', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS')), +(2, 102, NULL, NULL, 'SUB', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Forest Cover 0000000', NULL, 'Y', 102, 102, 'IDIR@TEST', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO THE.ACTIVITY_TREATMENT_UNIT ( diff --git a/backend/src/test/resources/migration/oracle/V004__test_data_101017.sql b/backend/src/test/resources/migration/oracle/V004__test_data_101017.sql new file mode 100644 index 00000000..215b4c21 --- /dev/null +++ b/backend/src/test/resources/migration/oracle/V004__test_data_101017.sql @@ -0,0 +1,357 @@ +insert into THE.FOREST_CLIENT ( + CLIENT_NUMBER, + CLIENT_TYPE_CODE, + CLIENT_NAME, + LEGAL_FIRST_NAME, + LEGAL_MIDDLE_NAME, + CLIENT_STATUS_CODE, + BIRTHDATE, + REGISTRY_COMPANY_TYPE_CODE, + CORP_REGN_NMBR, + CLIENT_ACRONYM, + CLIENT_ID_TYPE_CODE, + CLIENT_IDENTIFICATION, + WCB_FIRM_NUMBER, + OCG_SUPPLIER_NMBR, + CLIENT_COMMENT, + ADD_TIMESTAMP, + ADD_USERID, + ADD_ORG_UNIT, + UPDATE_TIMESTAMP, + UPDATE_USERID, + UPDATE_ORG_UNIT, + REVISION_COUNT +) +values +('00000003', 'C', 'THE CONTINENTAL', null, null, 'ACT', null, 'BC', '0000003', null, null, null, null, null, null, CURRENT_TIMESTAMP(6), 'IDIR\BOWERY', 1, CURRENT_TIMESTAMP(6), 'IDIR\BOWERY', 1, 3), +('00000004', 'C', 'PARABELLUM', null, null, 'ACT', null, 'BC', '0000004', null, null, null, null, null, null, CURRENT_TIMESTAMP(6), 'IDIR\BOWERY', 1, CURRENT_TIMESTAMP(6), 'IDIR\BOWERY', 1, 3), +('00000005', 'C', 'BALLERINA', null, null, 'ACT', null, 'BC', '0000005', null, null, null, null, null, null, CURRENT_TIMESTAMP(6), 'IDIR\BOWERY', 1, CURRENT_TIMESTAMP(6), 'IDIR\BOWERY', 1, 3); + +INSERT INTO THE.RESULTS_ELECTRONIC_SUBMISSION +( + RESULTS_SUBMISSION_ID, + SUBMISSION_TIMESTAMP, + SUBMITTED_BY, + CLIENT_NUMBER, + CLIENT_LOCN_CODE, + ORG_UNIT_NO, + USER_FILENAME, + USER_REFERENCE, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES +(7050, TIMESTAMP '2004-06-09 00:00:00.000000', 'BCEID\JWICK', '00000003', '13', 1, 'ACTIVITY_2004-06-09_12_45_45_PM.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000', 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000', 1), +(73674, TIMESTAMP '2005-05-18 00:00:00.000000', 'BCEID\JWICK', NULL, NULL, 1, 'original file name', NULL, 'BCEID\JWICK', TIMESTAMP '2005-05-18 14:17:38.000000', 'BCEID\JWICK', TIMESTAMP '2005-05-18 14:17:38.000000', 1), +(108276, TIMESTAMP '2005-08-16 00:00:00.000000', 'BCEID\JWICK', NULL, NULL, 1, 'original file name', NULL, 'BCEID\JWICK', TIMESTAMP '2005-08-16 14:09:39.000000', 'BCEID\JWICK', TIMESTAMP '2005-08-16 14:09:39.000000', 1), +(181939, TIMESTAMP '2006-03-10 00:00:00.000000', 'BCEID\JWICK', NULL, NULL, 1, 'ACTIVITY_2006-03-10_01_14_07_PM.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2006-03-10 13:14:53.000000', 'BCEID\JWICK', TIMESTAMP '2006-03-10 13:14:53.000000', 1), +(245827, TIMESTAMP '2006-08-08 00:00:00.000000', 'BCEID\JWICK', NULL, NULL, 1, 'ACTIVITY_2006_08_08-10_46_02.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2006-08-08 10:47:37.000000', 'BCEID\JWICK', TIMESTAMP '2006-08-08 10:47:37.000000', 1), +(245854, TIMESTAMP '2006-08-08 00:00:00.000000', 'BCEID\JWICK', NULL, NULL, 1, 'ACTIVITY_2006_08_08-11_38_05.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2006-08-08 11:39:39.000000', 'BCEID\JWICK', TIMESTAMP '2006-08-08 11:39:39.000000', 1), +(520772, TIMESTAMP '2008-12-04 00:00:00.000000', 'BCEID\JWICK', '00000004', '00', 1, 'Quadra activity.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:20.000000', 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:20.000000', 1), +(788660, TIMESTAMP '2010-02-01 00:00:00.000000', 'BCEID\JWICK', '00000004', '00', 1, 'Quadra activity 2010-02-01.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:26.000000', 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:26.000000', 1), +(876882, TIMESTAMP '2011-01-24 00:00:00.000000', 'BCEID\JWICK', '00000004', '00', 1, 'JS activity 2011-01-24.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:47:41.000000', 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:47:41.000000', 1), +(908604, TIMESTAMP '2011-05-02 00:00:00.000000', 'BCEID\JWICK', '00000004', '00', 1, 'disturbance May 2011-05-02.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2011-05-02 08:39:01.000000', 'BCEID\JWICK', TIMESTAMP '2011-05-02 08:39:01.000000', 1), +(1101086, TIMESTAMP '2012-03-27 00:00:00.000000', 'BCEID\JWICK', '00000005', '00', 1, 'Quadra Activities 2012-03-27.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2012-03-27 12:54:59.000000', 'BCEID\JWICK', TIMESTAMP '2012-03-27 12:54:59.000000', 1), +(1127146, TIMESTAMP '2012-07-06 00:00:00.000000', 'BCEID\JWICK', '00000005', '00', 1, 'Quadra Activity July 2012-07-06.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2012-07-06 10:24:51.000000', 'BCEID\JWICK', TIMESTAMP '2012-07-06 10:24:51.000000', 1), +(1170543, TIMESTAMP '2012-12-21 00:00:00.000000', 'BCEID\JWICK', '00000005', '00', 1, 'December 2012-12-21.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2012-12-21 10:59:05.000000', 'BCEID\JWICK', TIMESTAMP '2012-12-21 10:59:05.000000', 1), +(1307933, TIMESTAMP '2014-04-02 00:00:00.000000', 'BCEID\JWICK', '00000005', '00', 1, 'cones chonat 2014-04-02.xml', NULL, 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 1); + +INSERT INTO THE.SILV_ADMIN_ZONE +(DIST_ADMIN_ZONE, ORG_UNIT_NO, ADMIN_ZONE_DESC, REVISION_COUNT) +VALUES('ER', 1, 'ZONE R', 1); + +INSERT INTO THE.OPENING +( + OPENING_ID, + GEO_DISTRICT_NO, + ADMIN_DISTRICT_NO, + MAPSHEET_GRID, + MAPSHEET_LETTER, + MAPSHEET_SQUARE, + MAPSHEET_QUAD, + MAPSHEET_SUB_QUAD, + OPENING_NUMBER, + OPENING_LOCN_NAME, + OPEN_CATEGORY_CODE, + LICENSEE_OPENING_ID, + TSB_NUMBER_CODE, + OPENING_STATUS_CODE, + ORG_UNIT_NO, + DIST_ADMIN_ZONE, + MAX_ALLOW_PERMNT_ACCESS_PCT, + PREV_AGE_CLASS_CODE, + PREV_SITE_INDEX, + PREV_SITE_INDEX_SOURCE_CODE, + PREV_HEIGHT_CLASS_CODE, + PREV_SITE_CLASS_CODE, + PREV_STOCKING_CLASS_CODE, + PREV_STOCKING_STATUS_CODE, + PREV_TREE_SPP1_CODE, + PREV_TREE_SPP2_CODE, + APP_ENT_BY_USERID, + APPROVE_DATE, + AMENDMENT_IND, + RESULTS_SUBMISSION_ID, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES(101017, 1, 1, ' 92', 'K', '014', '0', '0', ' 514', 'QUADRA ISLAND', 'FTML', NULL, NULL, 'FG', 1, 'ER', 7.8, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'WICKJ', TIMESTAMP '2001-05-21 00:00:00.000000', 'A', NULL, 'BABAYAGA', TIMESTAMP '2001-06-07 16:13:16.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 19); + +INSERT INTO THE.CUT_BLOCK_OPEN_ADMIN +( + CUT_BLOCK_OPEN_ADMIN_ID, + FOREST_FILE_ID, + TIMBER_MARK, + CUT_BLOCK_ID, + CUTTING_PERMIT_ID, + DISTURBANCE_GROSS_AREA, + DISTURBANCE_START_DATE, + DISTURBANCE_END_DATE, + OPENING_ID, + OPENING_GROSS_AREA, + PLANNED_HARVEST_DATE, + PLANNED_GROSS_BLOCK_AREA, + PLANNED_NET_BLOCK_AREA, + OPENING_PRIME_LICENCE_IND, + CB_SKEY, + REVISION_COUNT, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP +) +VALUES(131854, 'TFL47', '47/12K', '12-11', '12K', 16.6, TIMESTAMP '2001-09-18 00:00:00.000000', TIMESTAMP '2002-04-30 00:00:00.000000', 101017, 16.6, TIMESTAMP '2001-07-03 00:00:00.000000', 16.6, 9, 'Y', 189922, 2, 'RESULTS_CONV', TIMESTAMP '9999-12-31 00:00:00.000000', 'FTA 4.0 DATA CONVERSION', TIMESTAMP '2007-06-02 11:17:23.000000'); + +INSERT INTO THE.OPENING_AMENDMENT_HISTORY +( + OPENING_ID, + OPENING_AMENDMENT_NUMBER, + AMENDMENT_USERID, + AMENDMENT_DATE, + SUBMITTED_BY_USERID, + SUBMITTED_DATE, + APP_ENT_BY_USERID, + APPROVE_DATE, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES(101017, 1, 'BABAYAGA', TIMESTAMP '2002-04-16 00:00:00.000000', 'The baba yaga', TIMESTAMP '2003-11-15 18:27:56.000000', 'BABAYAGA', TIMESTAMP '2002-03-08 00:00:00.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 18:27:56.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 18:27:56.000000', 1); + +INSERT INTO THE.STOCKING_EVENT_HISTORY +( + STOCKING_EVENT_HISTORY_ID, + OPENING_ID, + OPENING_AMENDMENT_ID, + OPENING_AMENDMENT_NUMBER, + RESULTS_AUDIT_ACTION_CODE, + SUBMITTED_USERID, + RESULTS_SUBMISSION_ID, + AMEND_EVENT_TIMESTAMP, + ENTRY_USERID, + ENTRY_TIMESTAMP, + REVISION_COUNT +) +VALUES(1297119, 101017, 101017, 1, 'O', 'Results data conversion', NULL, TIMESTAMP '2008-03-11 14:31:00.000000', 'Results data conversion', TIMESTAMP '2008-03-11 14:31:00.000000', 1); + +INSERT INTO THE.RESULTS_AUDIT_EVENT +( + RESULTS_AUDIT_EVENT_ID, + OPENING_ID, + STANDARDS_REGIME_ID, + SILVICULTURE_PROJECT_ID, + RESULTS_AUDIT_ACTION_CODE, + ACTION_DATE, + DESCRIPTION, + USER_ID, + EMAIL_SENT_IND, + XML_SUBMISSION_ID, + OPENING_AMENDMENT_NUMBER, + ENTRY_USERID, + ENTRY_TIMESTAMP +) +VALUES +(29121, 101017, NULL, NULL, 'SUB', TIMESTAMP '2004-06-09 12:49:59.000000', 'Inserting Activity: Activity Id = 1614524, Activity Base = ''PC''', NULL, 'Y', 7050, NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000'), +(29122, 101017, NULL, NULL, 'SUB', TIMESTAMP '2004-06-09 12:49:59.000000', 'Inserting Activity: Activity Id = 1614525, Activity Base = ''PL''', NULL, 'Y', 7050, NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000'), +(29123, 101017, NULL, NULL, 'SUB', TIMESTAMP '2004-06-09 12:49:59.000000', 'Inserting Activity: Activity Id = 1614526, Activity Base = ''SU''', NULL, 'Y', 7050, NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000'), +(61757, 101017, NULL, NULL, 'ES', TIMESTAMP '2004-11-29 10:08:00.000000', 'Forest Cover 1021182', NULL, 'Y', 23925, NULL, 'IDIR\BOWERY', TIMESTAMP '2004-11-29 10:08:00.000000'), +(61758, 101017, NULL, NULL, 'ES', TIMESTAMP '2004-11-29 10:08:00.000000', 'Forest Cover 1021183', NULL, 'Y', 23925, NULL, 'IDIR\BOWERY', TIMESTAMP '2004-11-29 10:08:00.000000'), +(61759, 101017, NULL, NULL, 'ES', TIMESTAMP '2004-11-29 10:08:00.000000', 'Forest Cover 1021184', NULL, 'Y', 23925, NULL, 'IDIR\BOWERY', TIMESTAMP '2004-11-29 10:08:00.000000'), +(61760, 101017, NULL, NULL, 'ES', TIMESTAMP '2004-11-29 10:08:00.000000', 'Forest Cover 1021185', NULL, 'Y', 23925, NULL, 'IDIR\BOWERY', TIMESTAMP '2004-11-29 10:08:00.000000'), +(61761, 101017, NULL, NULL, 'ES', TIMESTAMP '2004-11-29 10:08:00.000000', 'Forest Cover 1021186', NULL, 'Y', 23925, NULL, 'IDIR\BOWERY', TIMESTAMP '2004-11-29 10:08:00.000000'), +(61762, 101017, NULL, NULL, 'ES', TIMESTAMP '2004-11-29 10:08:00.000000', 'Forest Cover 1021187', NULL, 'Y', 23925, NULL, 'IDIR\BOWERY', TIMESTAMP '2004-11-29 10:08:00.000000'), +(199964, 101017, NULL, NULL, 'ES', TIMESTAMP '2005-05-18 14:17:38.000000', 'Inserting Activity: Activity Id = 1688846, Activity Base = ''PL''', NULL, 'Y', 73674, NULL, 'BCEID\JWICK', TIMESTAMP '2005-05-18 14:17:38.000000'), +(1765472, 101017, NULL, NULL, 'ES', TIMESTAMP '2010-02-01 15:21:35.000000', 'Inserting Activity: Activity Id = 2394795, Activity Base = ''BR''', NULL, 'Y', 788660, NULL, 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:35.000000'), +(277496, 101017, NULL, NULL, 'ES', TIMESTAMP '2005-08-16 14:09:39.000000', 'Inserting Activity: Activity Id = 1717514, Activity Base = ''BR''', NULL, 'Y', 108276, NULL, 'BCEID\JWICK', TIMESTAMP '2005-08-16 14:09:39.000000'), +(459780, 101017, NULL, NULL, 'ES', TIMESTAMP '2006-03-10 13:14:53.000000', 'Inserting Activity: Activity Id = 1760811, Activity Base = ''SU''', NULL, 'Y', 181939, NULL, 'BCEID\JWICK', TIMESTAMP '2006-03-10 13:14:53.000000'), +(614917, 101017, NULL, NULL, 'ES', TIMESTAMP '2006-08-08 10:47:37.000000', 'Inserting Activity: Activity Id = 1806920, Activity Base = ''BR''', NULL, 'Y', 245827, NULL, 'BCEID\JWICK', TIMESTAMP '2006-08-08 10:47:37.000000'), +(615012, 101017, NULL, NULL, 'ES', TIMESTAMP '2006-08-08 11:39:40.000000', 'Inserting Activity: Activity Id = 1806987, Activity Base = ''PL''', NULL, 'Y', 245854, NULL, 'BCEID\JWICK', TIMESTAMP '2006-08-08 11:39:40.000000'), +(1316170, 101017, NULL, NULL, 'ES', TIMESTAMP '2008-12-04 13:27:23.000000', 'Inserting Activity: Activity Id = 2200184, Activity Base = ''PC''', NULL, 'Y', 520772, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000'), +(1316171, 101017, NULL, NULL, 'ES', TIMESTAMP '2008-12-04 13:27:23.000000', 'Inserting Activity: Activity Id = 2200185, Activity Base = ''BR''', NULL, 'Y', 520772, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000'), +(1316172, 101017, NULL, NULL, 'ES', TIMESTAMP '2008-12-04 13:27:23.000000', 'Inserting Activity: Activity Id = 2200186, Activity Base = ''BR''', NULL, 'Y', 520772, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000'), +(1316173, 101017, NULL, NULL, 'ES', TIMESTAMP '2008-12-04 13:27:23.000000', 'Inserting Activity: Activity Id = 2200187, Activity Base = ''BR''', NULL, 'Y', 520772, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000'), +(1765471, 101017, NULL, NULL, 'ES', TIMESTAMP '2010-02-01 15:21:35.000000', 'Inserting Activity: Activity Id = 2394794, Activity Base = ''PC''', NULL, 'Y', 788660, NULL, 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:35.000000'), +(2499368, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-05-02 10:41:30.000000', 'Forest Cover Polygon No. 2 (Id=2648985)', NULL, 'Y', 1110983, NULL, 'BCEID\JWICK', TIMESTAMP '2012-05-02 10:41:30.000000'), +(2066156, 101017, NULL, NULL, 'ES', TIMESTAMP '2011-01-24 15:49:27.000000', 'Inserting Activity: Activity Id = 2541614, Activity Base = ''PC''', NULL, 'Y', 876882, NULL, 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:49:27.000000'), +(2066157, 101017, NULL, NULL, 'ES', TIMESTAMP '2011-01-24 15:49:27.000000', 'Inserting Activity: Activity Id = 2541615, Activity Base = ''BR''', NULL, 'Y', 876882, NULL, 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:49:27.000000'), +(2193943, 101017, NULL, NULL, 'ES', TIMESTAMP '2011-05-02 08:39:03.000000', 'Inserting Activity: Activity Id = 2598871, Activity Base = ''SU''', NULL, 'Y', 908604, NULL, 'BCEID\JWICK', TIMESTAMP '2011-05-02 08:39:03.000000'), +(2464881, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-03-27 12:55:03.000000', 'Inserting Activity: Activity Id = 2744529, Activity Base = ''BR''', NULL, 'Y', 1101086, NULL, 'BCEID\JWICK', TIMESTAMP '2012-03-27 12:55:03.000000'), +(2497525, 101017, NULL, NULL, 'MIL', TIMESTAMP '2012-04-30 14:40:19.000000', 'Milestone was modified.', NULL, 'N', NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2012-04-30 14:40:19.000000'), +(2497527, 101017, NULL, NULL, 'MIL', TIMESTAMP '2012-04-30 14:41:30.000000', 'Milestone was modified.', NULL, 'N', NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2012-04-30 14:41:30.000000'), +(2499365, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-05-02 10:41:30.000000', 'Forest Cover Polygon No. A1 (Id=2648982)', NULL, 'Y', 1110983, NULL, 'BCEID\JWICK', TIMESTAMP '2012-05-02 10:41:30.000000'), +(2499366, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-05-02 10:41:30.000000', 'Forest Cover Polygon No. B2 (Id=2648983)', NULL, 'Y', 1110983, NULL, 'BCEID\JWICK', TIMESTAMP '2012-05-02 10:41:30.000000'), +(2499367, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-05-02 10:41:30.000000', 'Forest Cover Polygon No. 1 (Id=2648984)', NULL, 'Y', 1110983, NULL, 'BCEID\JWICK', TIMESTAMP '2012-05-02 10:41:30.000000'), +(2499369, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-05-02 10:41:30.000000', 'Forest Cover Polygon No. 3 (Id=2648986)', NULL, 'Y', 1110983, NULL, 'BCEID\JWICK', TIMESTAMP '2012-05-02 10:41:30.000000'), +(3080031, 101017, NULL, NULL, 'ES', TIMESTAMP '2014-04-02 11:37:09.000000', 'Inserting Activity: Activity Id = 3094188, Activity Base = ''PC''', NULL, 'Y', 1307933, NULL, 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000'), +(2544310, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-07-06 10:24:55.000000', 'Inserting Activity: Activity Id = 2787017, Activity Base = ''SU''', NULL, 'Y', 1127146, NULL, 'BCEID\JWICK', TIMESTAMP '2012-07-06 10:24:55.000000'), +(2651122, 101017, NULL, NULL, 'ES', TIMESTAMP '2012-12-21 10:59:21.000000', 'Inserting Activity: Activity Id = 2871301, Activity Base = ''BR''', NULL, 'Y', 1170543, NULL, 'BCEID\JWICK', TIMESTAMP '2012-12-21 10:59:21.000000'); + + +INSERT INTO THE.ACTIVITY_TREATMENT_UNIT +( + ACTIVITY_TREATMENT_UNIT_ID, + ACTIVITY_TU_SEQ_NO, + ORG_UNIT_NO, + OPENING_ID, + SILVICULTURE_PROJECT_ID, + PROJECT_UNIT_ID, + SILV_BASE_CODE, + SILV_TECHNIQUE_CODE, + SILV_METHOD_CODE, + SILV_OBJECTIVE_CODE_1, + SILV_OBJECTIVE_CODE_2, + SILV_OBJECTIVE_CODE_3, + SILV_FUND_SRCE_CODE, + SILV_ACTIVITY_MEASUREMENT_CODE, + ACTIVITY_LICENSEE_ID, + TREATMENT_AMOUNT, + ACTUAL_TREATMENT_COST, + ACT_PLANTED_NO, + PLAN_SILV_TECHNIQUE_CODE, + PLAN_SILV_METHOD_CODE, + PLAN_SILV_FUND_SRCE_CODE, + PLANNED_DATE, + PLANNED_TREATMENT_AMOUNT, + PLANNED_TREATMENT_COST, + PLAN_SILV_OBJECTIVE_CODE_1, + PLAN_SILV_OBJECTIVE_CODE_2, + PLAN_SILV_OBJECTIVE_CODE_3, + TARGET_PREPARED_SPOTS, + PRUNING_MIN_CROWN_PCT, + PRUNE_HEIGHT, + STEMS_TO_PRUNE, + MIN_ACCEPTABLE_DENSITY, + TOTAL_STEMS_PER_HA, + INTER_TREE_TARGET_DISTANCE, + INTER_TREE_VARIATION, + INTER_TREE_MIN_DISTANCE, + MAX_TREES_PER_PLOT, + MAX_TREES_PER_HA, + SURVEY_PLANNED_NUM_PLOTS, + SURVEY_ACTUAL_NUM_PLOTS, + SURVEY_MIN_PLOTS_PER_STRATUM, + SILV_TREE_SPECIES_CODE, + ATU_START_DATE, + ATU_COMPLETION_DATE, + RESULTS_IND, + UNIT_BID_PRICE, + FIA_PROJECT_ID, + RESULTS_SUBMISSION_ID, + DISTURBANCE_CODE, + SILV_SYSTEM_CODE, + SILV_SYSTEM_VARIANT_CODE, + SILV_CUT_PHASE_CODE, + CUT_BLOCK_OPEN_ADMIN_ID, + DISTURBANCE_COMPLETED_IND, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES +(891373, 2, 1, 101017, NULL, NULL, 'PL', 'PL', 'CTAIN', 'CGE', NULL, NULL, 'IA', 'HA', NULL, 3.4, NULL, 3460, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2002-04-04 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2002-07-30 08:21:17.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(891374, 3, 1, 101017, NULL, NULL, 'PL', 'CG', 'BAGS', 'CGE', NULL, NULL, 'IA', 'HA', NULL, 3, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2002-04-04 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2002-07-30 08:21:19.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(891375, 4, 1, 101017, NULL, NULL, 'PL', 'SE', 'GROCO', 'CE', NULL, NULL, 'IA', 'HA', NULL, 0.5, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2002-04-04 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2002-07-30 08:21:20.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(951118, 5, 1, 101017, NULL, NULL, 'PC', 'SE', 'REPEL', 'A', NULL, NULL, 'IA', 'HA', NULL, 8.1, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2003-05-02 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2003-05-29 15:11:03.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(1688846, 13, 1, 101017, NULL, NULL, 'PL', 'SE', 'CONE', 'CE', NULL, NULL, 'IA', 'HA', '08819 08819', 0.1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2005-03-03 00:00:00.000000', 'Y', NULL, NULL, 73674, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2005-05-18 14:17:38.000000', 'BCEID\JWICK', TIMESTAMP '2005-05-18 14:17:38.000000', 2), +(956614, 6, 1, 101017, NULL, NULL, 'SP', 'MA', 'POWER', 'CE', NULL, NULL, 'IA', 'HA', NULL, 0.9, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2003-03-20 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2003-06-20 10:09:19.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(881032, 1, 1, 101017, NULL, NULL, 'DN', 'HV', NULL, NULL, NULL, NULL, 'IA', 'HA', NULL, 16.6, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2001-09-18 00:00:00.000000', TIMESTAMP '2002-04-30 00:00:00.000000', 'Y', NULL, NULL, NULL, 'L', 'CLEAR', NULL, 'REMOV', NULL, NULL, 'MLSEDT', TIMESTAMP '2002-05-31 13:41:47.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(958915, 7, 1, 101017, NULL, NULL, 'SU', 'RG', 'WALK', 'RG', NULL, NULL, 'IA', 'HA', NULL, 0.5, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2003-06-23 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2003-07-07 08:57:59.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 2), +(961024, 8, 1, 101017, NULL, NULL, 'FE', 'CG', 'GRANU', 'CGE', NULL, NULL, 'FIV', 'HA', NULL, 5.7, NULL, 0, 'CG', 'GRANU', 'FIV', TIMESTAMP '2003-03-01 00:00:00.000000', 5.7, NULL, 'CGE', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2003-03-16 00:00:00.000000', 'Y', NULL, '0006080004', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'ISISFIA', TIMESTAMP '2003-07-11 12:55:29.000000', 'ISISFIA', TIMESTAMP '2003-07-11 12:55:53.000000', 2), +(977091, 9, 1, 101017, NULL, NULL, 'SP', 'BU', 'PBURN', 'CE', NULL, NULL, 'IA', 'HA', NULL, 0.2, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2002-11-12 00:00:00.000000', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'MLSEDT', TIMESTAMP '2003-10-09 12:55:41.000000', 'MLSEDT', TIMESTAMP '2003-10-09 12:55:41.000000', 1), +(2394795, 23, 1, 101017, NULL, NULL, 'BR', 'MA', 'MANSB', NULL, NULL, NULL, 'IA', 'HA', '547484', 1.4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2009-06-09 00:00:00.000000', 'Y', NULL, NULL, 788660, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:35.000000', 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:35.000000', 1), +(1717514, 14, 1, 101017, NULL, NULL, 'BR', 'MA', 'STAKE', 'CGE', NULL, NULL, 'IA', 'HA', '09152 09152', 0.6, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2005-07-08 00:00:00.000000', 'Y', NULL, NULL, 108276, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2005-08-16 14:09:39.000000', 'BCEID\JWICK', TIMESTAMP '2005-08-16 14:09:39.000000', 2), +(2541614, 24, 1, 101017, NULL, NULL, 'PC', 'SE', 'MAINT', NULL, NULL, NULL, 'IA', 'HA', '549851', 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2010-12-02 00:00:00.000000', 'Y', NULL, NULL, 876882, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:49:27.000000', 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:49:27.000000', 1), +(2541615, 25, 1, 101017, NULL, NULL, 'BR', 'MA', 'MANSB', NULL, NULL, NULL, 'IA', 'HA', '549850', 1.3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2010-06-14 00:00:00.000000', 'Y', NULL, NULL, 876882, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:49:27.000000', 'BCEID\JWICK', TIMESTAMP '2011-01-24 15:49:27.000000', 1), +(1614524, 10, 1, 101017, NULL, NULL, 'PC', 'SE', 'REPEL', 'A', NULL, NULL, 'IA', 'HA', NULL, 8.1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2004-04-26 00:00:00.000000', 'Y', NULL, NULL, 7050, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000', 'DATAFIX77247', TIMESTAMP '2004-10-22 16:04:28.000000', 2), +(1614525, 11, 1, 101017, NULL, NULL, 'PL', 'FP', 'CTAIN', 'CE', NULL, NULL, 'IA', 'HA', NULL, 7.2, NULL, 3240, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2004-04-07 00:00:00.000000', 'Y', NULL, NULL, 7050, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000', 'DATAFIX77247', TIMESTAMP '2004-10-22 16:04:28.000000', 2), +(1614526, 12, 1, 101017, NULL, NULL, 'SU', 'RG', 'PLOT', 'RG', 'SU', 'BR', 'IA', 'HA', NULL, 8.1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2004-02-20 00:00:00.000000', 'Y', NULL, NULL, 7050, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2004-06-09 12:49:59.000000', 'DATAFIX77247', TIMESTAMP '2004-10-22 16:04:21.000000', 2), +(1806920, 16, 1, 101017, NULL, NULL, 'BR', 'MA', 'MANCT', 'CGE', NULL, NULL, 'IA', 'HA', '09986 09986', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2006-07-12 00:00:00.000000', 'Y', NULL, NULL, 245827, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2006-08-08 10:47:38.000000', 'BCEID\JWICK', TIMESTAMP '2006-08-08 10:47:38.000000', 2), +(1806987, 17, 1, 101017, NULL, NULL, 'PL', 'FP', 'CTAIN', 'CE', NULL, NULL, 'IA', 'HA', '10006 02534', 0.7, NULL, 250, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2006-03-24 00:00:00.000000', 'Y', NULL, NULL, 245854, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2006-08-08 11:39:40.000000', 'BCEID\JWICK', TIMESTAMP '2006-08-08 11:39:41.000000', 2), +(2394794, 22, 1, 101017, NULL, NULL, 'PC', 'SE', 'MAINT', NULL, NULL, NULL, 'IA', 'HA', '547485', 1.7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2009-10-27 00:00:00.000000', 'Y', NULL, NULL, 788660, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:35.000000', 'BCEID\JWICK', TIMESTAMP '2010-02-01 15:21:35.000000', 1), +(2598871, 26, 1, 101017, NULL, NULL, 'SU', 'RA', 'WALK', NULL, NULL, NULL, 'IA', 'HA', '550167', 8.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2010-10-01 00:00:00.000000', 'Y', NULL, NULL, 908604, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2011-05-02 08:39:03.000000', 'BCEID\JWICK', TIMESTAMP '2011-05-02 08:39:03.000000', 1), +(1760811, 15, 1, 101017, NULL, NULL, 'SU', 'RA', 'PLOT', 'RA', NULL, NULL, 'IA', 'HA', '09703 09703', 8.1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2006-01-12 00:00:00.000000', 'Y', NULL, 'L', 181939, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2006-03-10 13:14:53.000000', 'BCEID\JWICK', TIMESTAMP '2006-03-10 13:14:53.000000', 2), +(2200184, 18, 1, 101017, NULL, NULL, 'PC', 'SE', 'MAINT', NULL, NULL, NULL, 'IA', 'HA', '544440', 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2008-10-24 00:00:00.000000', 'Y', NULL, NULL, 520772, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 1), +(2200185, 19, 1, 101017, NULL, NULL, 'BR', 'MA', 'MANSB', NULL, NULL, NULL, 'IA', 'HA', '544439', 2.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2008-07-06 00:00:00.000000', 'Y', NULL, NULL, 520772, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 1), +(2200186, 20, 1, 101017, NULL, NULL, 'BR', 'MA', 'POWER', 'CGE', NULL, NULL, 'IA', 'HA', '496924', 5.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2008-11-13 00:00:00.000000', 'Y', NULL, NULL, 520772, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 1), +(2200187, 21, 1, 101017, NULL, NULL, 'BR', 'MA', 'MANGI', NULL, NULL, NULL, 'IA', 'HA', '544438', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2008-11-07 00:00:00.000000', 'Y', NULL, NULL, 520772, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 'BCEID\JWICK', TIMESTAMP '2008-12-04 13:27:23.000000', 1), +(3094188, 30, 1, 101017, NULL, NULL, 'PC', 'SE', 'MAINT', NULL, NULL, NULL, 'IA', 'HA', '560342', 1.3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2013-10-24 00:00:00.000000', 'Y', NULL, NULL, 1307933, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 1), +(2744529, 27, 1, 101017, NULL, NULL, 'BR', 'MA', 'POWER', NULL, NULL, NULL, 'IA', 'HA', '553249', 4.8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2011-05-24 00:00:00.000000', 'Y', NULL, NULL, 1101086, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2012-03-27 12:55:03.000000', 'BCEID\JWICK', TIMESTAMP '2012-03-27 12:55:03.000000', 1), +(2787017, 28, 1, 101017, NULL, NULL, 'SU', 'FG', 'PLOT', NULL, NULL, NULL, 'IA', 'HA', '545767', 8.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2012-01-06 00:00:00.000000', 'Y', NULL, NULL, 1127146, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2012-07-06 10:24:55.000000', 'BCEID\JWICK', TIMESTAMP '2012-07-06 10:24:55.000000', 1), +(2871301, 29, 1, 101017, NULL, NULL, 'BR', 'MA', 'MANSB', NULL, NULL, NULL, 'IA', 'HA', '556415', 0.7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2012-06-22 00:00:00.000000', 'Y', NULL, NULL, 1170543, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\JWICK', TIMESTAMP '2012-12-21 10:59:21.000000', 'BCEID\JWICK', TIMESTAMP '2012-12-21 10:59:21.000000', 1); + +INSERT INTO THE.STOCKING_STANDARD_UNIT +( + STOCKING_STANDARD_UNIT_ID, + OPENING_ID, + STANDARDS_UNIT_ID, + STANDARDS_REGIME_ID, + NET_AREA, + MAX_ALLOW_SOIL_DISTURBANCE_PCT, + VARIANCE_IND, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES +(194833, 101017, 'A', NULL, 7.9, 5, NULL, 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:46:23.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:46:23.000000', 4), +(194837, 101017, 'B', NULL, 1.1, 0, NULL, 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:46:23.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:46:23.000000', 4); + +INSERT INTO THE.STOCKING_MILESTONE +( + STOCKING_STANDARD_UNIT_ID, + SILV_MILESTONE_TYPE_CODE, + RESULTS_SUBMISSION_ID, + DECLARED_DATE, + DECLARED_USERID, + DECLARE_IND, + DECLARATION_SUBMITTED_DATE, + EARLY_OFFSET_YEARS, + LATE_OFFSET_YEARS, + DUE_EARLY_DATE, + DUE_LATE_DATE, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT, + EXTENT_FEASIBLE_DECLARED_IND +) +VALUES +(194833, 'FG', NULL, TIMESTAMP '2012-04-30 00:00:00.000000', 'BCEID\JWICK', 'Y', TIMESTAMP '2012-04-30 14:40:19.000000', 8, 11, TIMESTAMP '2009-09-18 00:00:00.000000', TIMESTAMP '2012-09-18 00:00:00.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:45:06.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 31, 'N'), +(194833, 'PH', NULL, NULL, NULL, 'N', NULL, NULL, NULL, NULL, NULL, 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:45:06.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 30, 'N'), +(194833, 'RG', NULL, NULL, NULL, 'N', NULL, NULL, 3, NULL, TIMESTAMP '2004-09-18 00:00:00.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:45:06.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 30, 'N'), +(194837, 'FG', NULL, TIMESTAMP '2012-04-30 00:00:00.000000', 'BCEID\JWICK', 'Y', TIMESTAMP '2012-04-30 14:41:30.000000', 0, 0, TIMESTAMP '2001-09-18 00:00:00.000000', TIMESTAMP '2001-09-18 00:00:00.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:45:06.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 31, 'N'), +(194837, 'PH', NULL, NULL, NULL, 'N', NULL, NULL, NULL, NULL, NULL, 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:45:06.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 30, 'N'), +(194837, 'RG', NULL, NULL, NULL, 'N', NULL, NULL, 0, NULL, TIMESTAMP '2001-09-18 00:00:00.000000', 'RESULTS_CONV', TIMESTAMP '2003-11-15 19:45:06.000000', 'BCEID\JWICK', TIMESTAMP '2014-04-02 11:37:09.000000', 30, 'N'); \ No newline at end of file diff --git a/backend/src/test/resources/migration/oracle/V005__test_data_1009974.sql b/backend/src/test/resources/migration/oracle/V005__test_data_1009974.sql new file mode 100644 index 00000000..ed30dc87 --- /dev/null +++ b/backend/src/test/resources/migration/oracle/V005__test_data_1009974.sql @@ -0,0 +1,290 @@ +INSERT INTO THE.FOREST_CLIENT ( + CLIENT_NUMBER, + CLIENT_TYPE_CODE, + CLIENT_NAME, + LEGAL_FIRST_NAME, + LEGAL_MIDDLE_NAME, + CLIENT_STATUS_CODE, + BIRTHDATE, + REGISTRY_COMPANY_TYPE_CODE, + CORP_REGN_NMBR, + CLIENT_ACRONYM, + CLIENT_ID_TYPE_CODE, + CLIENT_IDENTIFICATION, + WCB_FIRM_NUMBER, + OCG_SUPPLIER_NMBR, + CLIENT_COMMENT, + ADD_TIMESTAMP, + ADD_USERID, + ADD_ORG_UNIT, + UPDATE_TIMESTAMP, + UPDATE_USERID, + UPDATE_ORG_UNIT, + REVISION_COUNT +) +values ('00000002', 'C', 'SKYWALKERS RANCH', null, null, 'ACT', null, 'BC', '0000002', null, null, null, null, null, null, CURRENT_TIMESTAMP(6), 'BCEID\ASKYWALKER', 1, CURRENT_TIMESTAMP(6), 'BCEID\ASKYWALKER', 1, 1); + +INSERT INTO THE.RESULTS_ELECTRONIC_SUBMISSION +( + RESULTS_SUBMISSION_ID, + SUBMISSION_TIMESTAMP, + SUBMITTED_BY, + CLIENT_NUMBER, + CLIENT_LOCN_CODE, + ORG_UNIT_NO, + USER_FILENAME, + USER_REFERENCE, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES +(68659, TIMESTAMP '2005-05-04 00:00:00.000000', 'BCEID\ASKYWALKER', NULL, NULL, 1, 'original file name', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 16:21:21.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 16:21:21.000000', 1), +(67773, TIMESTAMP '2005-05-02 00:00:00.000000', 'BCEID\ASKYWALKER', NULL, NULL, 1, 'original file name', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:56:12.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:56:12.000000', 1), +(68609, TIMESTAMP '2005-05-04 00:00:00.000000', 'BCEID\ASKYWALKER', NULL, NULL, 1, 'original file name', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000', 1), +(215305, TIMESTAMP '2006-05-16 00:00:00.000000', 'BCEID\ASKYWALKER', NULL, NULL, 1, '904226_SitePrep.xml', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2006-05-16 08:36:41.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2006-05-16 08:36:41.000000', 1), +(343491, TIMESTAMP '2007-05-24 00:00:00.000000', 'BCEID\ASKYWALKER', NULL, NULL, 1, 'AE_Plant4_May07.xml', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2007-05-24 11:33:28.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2007-05-24 11:33:28.000000', 1), +(1311633, TIMESTAMP '2014-04-14 00:00:00.000000', 'BCEID\ASKYWALKER', '00000002', '03', 1, '904226 GP_Silv_2014-04-14.xml', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:01.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:01.000000', 1), +(1738902, TIMESTAMP '2018-01-26 09:32:08.000000', 'BCEID\ASKYWALKER', '00000002', '03', 1, '904226_silv_act_2018-01-26.xml', NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:00.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:00.000000', 1); + +INSERT INTO THE.OPENING +( + OPENING_ID, + GEO_DISTRICT_NO, + ADMIN_DISTRICT_NO, + MAPSHEET_GRID, + MAPSHEET_LETTER, + MAPSHEET_SQUARE, + MAPSHEET_QUAD, + MAPSHEET_SUB_QUAD, + OPENING_NUMBER, + OPENING_LOCN_NAME, + OPEN_CATEGORY_CODE, + LICENSEE_OPENING_ID, + TSB_NUMBER_CODE, + OPENING_STATUS_CODE, + ORG_UNIT_NO, + DIST_ADMIN_ZONE, + MAX_ALLOW_PERMNT_ACCESS_PCT, + PREV_AGE_CLASS_CODE, + PREV_SITE_INDEX, + PREV_SITE_INDEX_SOURCE_CODE, + PREV_HEIGHT_CLASS_CODE, + PREV_SITE_CLASS_CODE, + PREV_STOCKING_CLASS_CODE, + PREV_STOCKING_STATUS_CODE, + PREV_TREE_SPP1_CODE, + PREV_TREE_SPP2_CODE, + APP_ENT_BY_USERID, + APPROVE_DATE, + AMENDMENT_IND, + RESULTS_SUBMISSION_ID, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES(1009974, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'Tatooine', 'FTML', '012345678', NULL, 'FG', 1, NULL, 7, '9', 26, 'E', '4', NULL, '1', 'MAT', 'CW', 'HW', NULL, TIMESTAMP '2005-05-02 15:56:26.000000', 'Y', 68659, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000', 'IDIR\OKENOBI', TIMESTAMP '2018-10-09 11:29:23.000000', 16); + +INSERT INTO THE.CUT_BLOCK_OPEN_ADMIN +( + CUT_BLOCK_OPEN_ADMIN_ID, + FOREST_FILE_ID, + TIMBER_MARK, + CUT_BLOCK_ID, + CUTTING_PERMIT_ID, + DISTURBANCE_GROSS_AREA, + DISTURBANCE_START_DATE, + DISTURBANCE_END_DATE, + OPENING_ID, + OPENING_GROSS_AREA, + PLANNED_HARVEST_DATE, + PLANNED_GROSS_BLOCK_AREA, + PLANNED_NET_BLOCK_AREA, + OPENING_PRIME_LICENCE_IND, + CB_SKEY, + REVISION_COUNT, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP +) +VALUES(242521, 'TFL44', '44/270', '904226', '270', 25.5, TIMESTAMP '2004-01-19 00:00:00.000000', TIMESTAMP '2004-05-28 00:00:00.000000', 1009974, 38.7, TIMESTAMP '2003-11-19 00:00:00.000000', 38.7655, 24.3, 'Y', 214031, 10, 'DATAFIX', TIMESTAMP '2004-06-02 08:13:36.000000', 'FTA 4.0 DATA CONVERSION', TIMESTAMP '2007-06-02 11:17:23.000000'); + +INSERT INTO THE.STOCKING_EVENT_HISTORY +( + STOCKING_EVENT_HISTORY_ID, + OPENING_ID, + OPENING_AMENDMENT_ID, + OPENING_AMENDMENT_NUMBER, + RESULTS_AUDIT_ACTION_CODE, + SUBMITTED_USERID, + RESULTS_SUBMISSION_ID, + AMEND_EVENT_TIMESTAMP, + ENTRY_USERID, + ENTRY_TIMESTAMP, + REVISION_COUNT +) +VALUES(1262610, 1009974, NULL, NULL, 'O', 'Results data conversion', NULL, TIMESTAMP '2008-03-11 14:28:06.000000', 'Results data conversion', TIMESTAMP '2008-03-11 14:28:06.000000', 1); + +INSERT INTO THE.RESULTS_AUDIT_EVENT +( + RESULTS_AUDIT_EVENT_ID, + OPENING_ID, + STANDARDS_REGIME_ID, + SILVICULTURE_PROJECT_ID, + RESULTS_AUDIT_ACTION_CODE, + ACTION_DATE, + DESCRIPTION, + USER_ID, + EMAIL_SENT_IND, + XML_SUBMISSION_ID, + OPENING_AMENDMENT_NUMBER, + ENTRY_USERID, + ENTRY_TIMESTAMP +) +VALUES +(184401, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-02 15:56:26.000000', 'Opening: Ministry = 1619', NULL, 'Y', 67655, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000'), +(184402, 1009974, 36109, NULL, 'ES', TIMESTAMP '2005-05-02 15:56:26.000000', 'Standard was changed.', NULL, 'N', NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000'), +(184778, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-02 16:53:21.000000', 'Opening: Ministry = 1619', NULL, 'Y', 67759, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:53:21.000000'), +(187617, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 15:03:21.000000', 'Forest Cover 1106510', NULL, 'Y', 68609, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000'), +(184809, 1009974, NULL, NULL, 'VAR', TIMESTAMP '2005-05-02 16:53:58.000000', 'Opening/related details were modified.', NULL, 'N', NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:53:58.000000'), +(184831, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-02 16:56:12.000000', 'Inserting Activity: Activity Id = 1683934, Activity Base = ''SP''', NULL, 'Y', 67773, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:56:12.000000'), +(187614, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 15:03:21.000000', 'Creating Disturbance Activity: Activity Id = 1684733', NULL, 'Y', 68609, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000'), +(187615, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 15:03:21.000000', 'Forest Cover 1106508', NULL, 'Y', 68609, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000'), +(187616, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 15:03:21.000000', 'Forest Cover 1106509', NULL, 'Y', 68609, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000'), +(187618, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 15:03:21.000000', 'Forest Cover 1106511', NULL, 'Y', 68609, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000'), +(187619, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 15:03:21.000000', 'Milestones modified', NULL, 'Y', 68609, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000'), +(3088641, 1009974, NULL, NULL, 'ES', TIMESTAMP '2014-04-14 10:09:03.000000', 'Inserting Activity: Activity Id = 3098702, Activity Base = ''SU''', NULL, 'Y', 1311633, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:03.000000'), +(187806, 1009974, NULL, NULL, 'ES', TIMESTAMP '2005-05-04 16:21:21.000000', 'Opening: Ministry = 1619', NULL, 'Y', 68659, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 16:21:21.000000'), +(543349, 1009974, NULL, NULL, 'ES', TIMESTAMP '2006-05-16 08:36:41.000000', 'Inserting Activity: Activity Id = 1785961, Activity Base = ''SP''', NULL, 'Y', 215305, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2006-05-16 08:36:41.000000'), +(828298, 1009974, NULL, NULL, 'ES', TIMESTAMP '2007-05-24 11:33:37.000000', 'Inserting Activity: Activity Id = 1915482, Activity Base = ''PL''', NULL, 'Y', 343491, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2007-05-24 11:33:37.000000'), +(1257172, 1009974, NULL, NULL, 'ES', TIMESTAMP '2008-09-12 14:02:42.000000', 'Forest Cover Polygon No. X (Id=1860799)', NULL, 'Y', 501684, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2008-09-12 14:02:42.000000'), +(1257173, 1009974, NULL, NULL, 'ES', TIMESTAMP '2008-09-12 14:02:42.000000', 'Forest Cover Polygon No. A (Id=1860800)', NULL, 'Y', 501684, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2008-09-12 14:02:42.000000'), +(1257174, 1009974, NULL, NULL, 'ES', TIMESTAMP '2008-09-12 14:02:42.000000', 'Forest Cover Polygon No. T (Id=1860801)', NULL, 'Y', 501684, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2008-09-12 14:02:42.000000'), +(1257175, 1009974, NULL, NULL, 'ES', TIMESTAMP '2008-09-12 14:02:42.000000', 'Forest Cover Polygon No. W (Id=1860802)', NULL, 'Y', 501684, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2008-09-12 14:02:42.000000'), +(1257176, 1009974, NULL, NULL, 'MIL', TIMESTAMP '2008-09-12 14:02:43.000000', 'Milestone was modified', NULL, 'Y', 501684, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2008-09-12 14:02:43.000000'), +(3088642, 1009974, NULL, NULL, 'ES', TIMESTAMP '2014-04-14 10:09:03.000000', 'Inserting Activity: Activity Id = 3098703, Activity Base = ''SU''', NULL, 'Y', 1311633, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:03.000000'), +(4097410, 1009974, NULL, NULL, 'MIL', TIMESTAMP '2018-01-26 09:33:01.000000', 'Milestone was modified', NULL, 'Y', 1738903, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:02.000000'), +(4097405, 1009974, NULL, NULL, 'ES', TIMESTAMP '2018-01-26 09:33:00.000000', 'Inserting Activity: Activity Id = 3499621, Activity Base = ''SU''', NULL, 'Y', 1738902, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:00.000000'), +(4097406, 1009974, NULL, NULL, 'ES', TIMESTAMP '2018-01-26 09:33:01.000000', 'Forest Cover Polygon No. X (Id=3679043)', NULL, 'Y', 1738903, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:01.000000'), +(4097407, 1009974, NULL, NULL, 'ES', TIMESTAMP '2018-01-26 09:33:01.000000', 'Forest Cover Polygon No. T (Id=3679044)', NULL, 'Y', 1738903, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:01.000000'), +(4097408, 1009974, NULL, NULL, 'ES', TIMESTAMP '2018-01-26 09:33:01.000000', 'Forest Cover Polygon No. W (Id=3679045)', NULL, 'Y', 1738903, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:01.000000'), +(4097409, 1009974, NULL, NULL, 'ES', TIMESTAMP '2018-01-26 09:33:01.000000', 'Forest Cover Polygon No. A (Id=3679046)', NULL, 'Y', 1738903, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:01.000000'), +(4265454, 1009974, NULL, NULL, 'UPD', TIMESTAMP '2018-10-09 11:29:23.000000', 'Opening/related details were modified.', NULL, 'N', NULL, NULL, 'IDIR\OKENOBI', TIMESTAMP '2018-10-09 11:29:23.000000'); + +INSERT INTO THE.ACTIVITY_TREATMENT_UNIT +( + ACTIVITY_TREATMENT_UNIT_ID, + ACTIVITY_TU_SEQ_NO, + ORG_UNIT_NO, + OPENING_ID, + SILVICULTURE_PROJECT_ID, + PROJECT_UNIT_ID, + SILV_BASE_CODE, + SILV_TECHNIQUE_CODE, + SILV_METHOD_CODE, + SILV_OBJECTIVE_CODE_1, + SILV_OBJECTIVE_CODE_2, + SILV_OBJECTIVE_CODE_3, + SILV_FUND_SRCE_CODE, + SILV_ACTIVITY_MEASUREMENT_CODE, + ACTIVITY_LICENSEE_ID, + TREATMENT_AMOUNT, + ACTUAL_TREATMENT_COST, + ACT_PLANTED_NO, + PLAN_SILV_TECHNIQUE_CODE, + PLAN_SILV_METHOD_CODE, + PLAN_SILV_FUND_SRCE_CODE, + PLANNED_DATE, + PLANNED_TREATMENT_AMOUNT, + PLANNED_TREATMENT_COST, + PLAN_SILV_OBJECTIVE_CODE_1, + PLAN_SILV_OBJECTIVE_CODE_2, + PLAN_SILV_OBJECTIVE_CODE_3, + TARGET_PREPARED_SPOTS, + PRUNING_MIN_CROWN_PCT, + PRUNE_HEIGHT, + STEMS_TO_PRUNE, + MIN_ACCEPTABLE_DENSITY, + TOTAL_STEMS_PER_HA, + INTER_TREE_TARGET_DISTANCE, + INTER_TREE_VARIATION, + INTER_TREE_MIN_DISTANCE, + MAX_TREES_PER_PLOT, + MAX_TREES_PER_HA, + SURVEY_PLANNED_NUM_PLOTS, + SURVEY_ACTUAL_NUM_PLOTS, + SURVEY_MIN_PLOTS_PER_STRATUM, + SILV_TREE_SPECIES_CODE, + ATU_START_DATE, + ATU_COMPLETION_DATE, + RESULTS_IND, + UNIT_BID_PRICE, + FIA_PROJECT_ID, + RESULTS_SUBMISSION_ID, + DISTURBANCE_CODE, + SILV_SYSTEM_CODE, + SILV_SYSTEM_VARIANT_CODE, + SILV_CUT_PHASE_CODE, + CUT_BLOCK_OPEN_ADMIN_ID, + DISTURBANCE_COMPLETED_IND, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES +(1683934, 1, 1, 1009974, NULL, NULL, 'SP', 'ME', 'PILE', NULL, NULL, NULL, 'IA', 'HA', '715011423', 0.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2004-06-10 00:00:00.000000', 'Y', NULL, NULL, 67773, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:56:12.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 16:56:12.000000', 2), +(1684733, 2, 1, 1009974, NULL, NULL, 'DN', 'HV', NULL, NULL, NULL, NULL, NULL, 'HA', '710000501', 25.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2004-01-19 00:00:00.000000', TIMESTAMP '2004-05-28 00:00:00.000000', 'Y', NULL, NULL, 68609, 'L', 'RETEN', NULL, 'REMOV', 242521, 'N', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 15:03:21.000000', 1), +(3098703, 6, 1, 1009974, NULL, NULL, 'SU', 'RA', 'WALK', NULL, NULL, NULL, 'IA', 'HA', '715042147', 25.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2013-06-07 00:00:00.000000', 'Y', NULL, NULL, 1311633, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:03.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:03.000000', 1), +(1915482, 4, 1, 1009974, NULL, NULL, 'PL', 'PL', 'CTAIN', NULL, NULL, NULL, 'IA', 'HA', '715000033', 25.5, NULL, 23410, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2006-09-23 00:00:00.000000', 'Y', NULL, NULL, 343491, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2007-05-24 11:33:37.000000', 'IDIR\OKENOBI', TIMESTAMP '2018-10-09 11:29:23.000000', 6), +(1785961, 3, 1, 1009974, NULL, NULL, 'SP', 'BU', 'RPILE', NULL, NULL, NULL, 'IA', 'HA', '715010357', 0.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2005-11-03 00:00:00.000000', 'Y', NULL, NULL, 215305, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2006-05-16 08:36:41.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2006-05-16 08:36:41.000000', 2), +(3499621, 7, 1, 1009974, NULL, NULL, 'SU', 'FG', 'PLOT', NULL, NULL, NULL, 'IA', 'HA', '715000035', 25.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2017-05-30 00:00:00.000000', 'Y', NULL, NULL, 1738902, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:00.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2018-01-26 09:33:00.000000', 1), +(3098702, 5, 1, 1009974, NULL, NULL, 'SU', 'SU', 'PLOT', NULL, NULL, NULL, 'IA', 'HA', '715000034', 24.5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '2007-06-14 00:00:00.000000', 'Y', NULL, NULL, 1311633, NULL, NULL, NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:03.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2014-04-14 10:09:03.000000', 1); + +INSERT INTO THE.STOCKING_STANDARD_UNIT +( + STOCKING_STANDARD_UNIT_ID, + OPENING_ID, + STANDARDS_UNIT_ID, + STANDARDS_REGIME_ID, + NET_AREA, + MAX_ALLOW_SOIL_DISTURBANCE_PCT, + VARIANCE_IND, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT +) +VALUES(1013720, 1009974, 'A', 36109, 25.5, 5, 'Y', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-04 16:21:21.000000', 3); + +INSERT INTO THE.STOCKING_MILESTONE +( + STOCKING_STANDARD_UNIT_ID, + SILV_MILESTONE_TYPE_CODE, + RESULTS_SUBMISSION_ID, + DECLARED_DATE, + DECLARED_USERID, + DECLARE_IND, + DECLARATION_SUBMITTED_DATE, + EARLY_OFFSET_YEARS, + LATE_OFFSET_YEARS, + DUE_EARLY_DATE, + DUE_LATE_DATE, + ENTRY_USERID, + ENTRY_TIMESTAMP, + UPDATE_USERID, + UPDATE_TIMESTAMP, + REVISION_COUNT, + EXTENT_FEASIBLE_DECLARED_IND +) +VALUES +(1013720, 'FG', 1738903, TIMESTAMP '2017-05-30 00:00:00.000000', 'BCEID\ASKYWALKER', 'Y', TIMESTAMP '2018-01-26 09:33:02.000000', 11, 14, TIMESTAMP '2015-01-19 00:00:00.000000', TIMESTAMP '2018-01-19 00:00:00.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000', 'IDIR\OKENOBI', TIMESTAMP '2018-10-09 11:29:23.000000', 19, 'N'), +(1013720, 'PH', 68609, TIMESTAMP '2005-01-24 00:00:00.000000', 'BCEID\ASKYWALKER', 'Y', TIMESTAMP '2005-05-04 16:21:21.000000', NULL, NULL, NULL, NULL, 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000', 'IDIR\OKENOBI', TIMESTAMP '2018-10-09 11:29:23.000000', 19, 'N'), +(1013720, 'RG', 501684, TIMESTAMP '2007-06-15 00:00:00.000000', 'BCEID\ASKYWALKER', 'Y', TIMESTAMP '2008-09-12 14:02:43.000000', NULL, 6, NULL, TIMESTAMP '2010-01-19 00:00:00.000000', 'BCEID\ASKYWALKER', TIMESTAMP '2005-05-02 15:56:26.000000', 'IDIR\OKENOBI', TIMESTAMP '2018-10-09 11:29:23.000000', 19, 'N'); \ No newline at end of file diff --git a/frontend/src/__test__/components/SilvicultureSearch/Openings/OpeningSearchTab.test.tsx b/frontend/src/__test__/components/SilvicultureSearch/Openings/OpeningSearchTab.test.tsx index ed5e13d7..f2f7f008 100644 --- a/frontend/src/__test__/components/SilvicultureSearch/Openings/OpeningSearchTab.test.tsx +++ b/frontend/src/__test__/components/SilvicultureSearch/Openings/OpeningSearchTab.test.tsx @@ -138,4 +138,60 @@ describe('OpeningSearchTab', () => { await act(async () => (await screen.findByTestId('search-button')).click()); expect(screen.getByText('There are no openings to show yet')).toBeInTheDocument(); }); + + it('should display spatial/map view when the spatial toggle is clicked', async () => { + (useOpeningsQuery as vi.Mock).mockReturnValue({ data, isFetching: false }); + + await act(async() => render( + + + + + + + + + + + + )); + const searchInput = screen.getByPlaceholderText('Search by opening ID, opening number, timber mark or file ID'); + await act(async () => await userEvent.type(searchInput, 'test')); + await act(async () => (await screen.findByTestId('search-button')).click()); + await act(async () => await screen.findByText('Actions')); + const spatialToggle = screen.getByTestId('toggle-spatial'); + await act(async () => fireEvent.click(spatialToggle)); + expect(screen.getByTestId('openings-map')).toBeInTheDocument(); + }); + + it('should display more or less columns when checkboxes are clicked', async () => { + (useOpeningsQuery as vi.Mock).mockReturnValue({ data, isFetching: false }); + + let container; + await act(async() => ({ container } = render( + + + + + + + + + + + + ))); + + const searchInput = screen.getByPlaceholderText('Search by opening ID, opening number, timber mark or file ID'); + await act(async () => await userEvent.type(searchInput, 'test')); + await act(async () => (await screen.findByTestId('search-button')).click()); + await act(async () => await screen.findByText('Actions')); + expect(screen.getByTestId('Opening Id')).toBeInTheDocument(); + const editColumnsBtn = screen.getByTestId('edit-columns'); + await act(async () => fireEvent.click(editColumnsBtn)); + const checkbox = container.querySelector('input[type="checkbox"]#checkbox-label-openingId'); + await act(async () => fireEvent.click(checkbox)); + expect(screen.queryByTestId('Opening Id')).not.toBeInTheDocument(); + + }); }); \ No newline at end of file diff --git a/frontend/src/__test__/components/SilvicultureSearch/Openings/SearchScreenDataTable.test.tsx b/frontend/src/__test__/components/SilvicultureSearch/Openings/SearchScreenDataTable.test.tsx index 7b8108dc..7bd3adfe 100644 --- a/frontend/src/__test__/components/SilvicultureSearch/Openings/SearchScreenDataTable.test.tsx +++ b/frontend/src/__test__/components/SilvicultureSearch/Openings/SearchScreenDataTable.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { render, screen } from '@testing-library/react'; +import { render, screen, fireEvent } from '@testing-library/react'; import { describe, expect, it, vi } from 'vitest'; import SearchScreenDataTable from '../../../../components/SilvicultureSearch/Openings/SearchScreenDataTable'; import { columns } from '../../../../components/SilvicultureSearch/Openings/SearchScreenDataTable/headerData'; @@ -11,6 +11,7 @@ import { OpeningsSearchProvider } from '../../../../contexts/search/OpeningsSear const handleCheckboxChange = vi.fn(); const toggleSpatial = vi.fn(); +const setOpeningIds = vi.fn((openingIds: number[]) => {}); const queryClient = new QueryClient(); export const rows:any = [ @@ -259,6 +260,7 @@ describe('Search Screen Data table test', () => { handleCheckboxChange={handleCheckboxChange} toggleSpatial={toggleSpatial} totalItems={rows.length} + setOpeningIds={setOpeningIds} /> @@ -289,6 +291,7 @@ describe('Search Screen Data table test', () => { handleCheckboxChange={handleCheckboxChange} toggleSpatial={toggleSpatial} totalItems={0} + setOpeningIds={setOpeningIds} /> @@ -303,7 +306,7 @@ describe('Search Screen Data table test', () => { expect(container.querySelector('.total-search-results')).toContainHTML('0'); }); - it('should render the checkbox for showSPatial being true', () => { + it('should render the checkbox for showSpatial being true', () => { render( @@ -318,6 +321,7 @@ describe('Search Screen Data table test', () => { handleCheckboxChange={handleCheckboxChange} toggleSpatial={toggleSpatial} totalItems={0} + setOpeningIds={setOpeningIds} /> @@ -329,6 +333,40 @@ describe('Search Screen Data table test', () => { expect(checkbox).toBeInTheDocument(); }); + + it('should check the checkbox for showSpatial', () => { + render( + + + + + + + + + + + + ); + const checkboxGroup = document.querySelector('.cds--checkbox-group'); + expect(checkboxGroup).toBeInTheDocument(); + + expect(screen.getByTestId(`checkbox-${rows[0].openingId}`)).toBeInTheDocument(); + const checkbox = screen.getByTestId(`checkbox-${rows[0].openingId}`); + fireEvent.click(checkbox); + expect(checkbox).toBeChecked(); + expect(setOpeningIds).toHaveBeenCalledWith([parseFloat(rows[0].openingId)]); + + }); }); \ No newline at end of file diff --git a/frontend/src/components/FriendlyDate/index.tsx b/frontend/src/components/FriendlyDate/index.tsx index bac54091..9cea4de9 100644 --- a/frontend/src/components/FriendlyDate/index.tsx +++ b/frontend/src/components/FriendlyDate/index.tsx @@ -60,9 +60,7 @@ const FriendlyDate: React.FC = ({ date }) => { const formattedDate = isFuture(parsedDate) ? formatFutureDateAtlassianStyle(parsedDate) : formatDateAtlassianStyle(parsedDate); - - if(cleanDate === formattedDate) - console.log(`cleanDate: ${cleanDate} formattedDate: ${formattedDate}`); + return ( <> {(cleanDate === formattedDate) ? ({formattedDate}) : ( diff --git a/frontend/src/components/OpeningsMap/index.tsx b/frontend/src/components/OpeningsMap/index.tsx index 2e03535b..64d769b2 100644 --- a/frontend/src/components/OpeningsMap/index.tsx +++ b/frontend/src/components/OpeningsMap/index.tsx @@ -1,8 +1,8 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { OpeningPolygon } from '../../types/OpeningPolygon'; -import { createPopupFromProps, getOpeningsPolygonFromWfs } from '../../map-services/BcGwWfsApi'; -import { BaseMapLayer, MapLayer } from '../../types/MapLayer'; -import { allBaseMaps, allLayers } from './constants'; +import { createPopupFromProps } from '../../map-services/BcGwWfsApi'; +import { MapLayer } from '../../types/MapLayer'; +import { allLayers } from './constants'; import axios from 'axios'; import { getAuthIdToken } from '../../services/AuthService'; import { env } from '../../env'; @@ -10,45 +10,37 @@ import { shiftBcGwLngLat2LatLng } from '../../map-services/BcGwLatLongUtils'; import { LayersControl, MapContainer, - Polygon, - Popup, TileLayer, - useMap, - useMapEvents, WMSTileLayer } from 'react-leaflet'; import { LatLngExpression } from 'leaflet'; +import OpeningsMapEntry from '../OpeningsMapEntry'; + const backendUrl = env.VITE_BACKEND_URL; interface MapProps { + openingIds: number[] | null; openingId: number | null; - setOpeningPolygonNotFound: Function; + setOpeningPolygonNotFound: (value: boolean) => void; } const OpeningsMap: React.FC = ({ + openingIds, openingId, - setOpeningPolygonNotFound, + setOpeningPolygonNotFound }) => { - const lastClickedLayerRef = useRef(null); // Replace 'any' with the specific type if known + const [selectedOpeningIds, setSelectedOpeningIds] = useState([]); const [openings, setOpenings] = useState([]); - const [position, setPosition] = useState([48.43737, -123.35883]); - const [reloadMap, setReloadMap] = useState(false); + const [position, setPosition] = useState([48.43737, -123.35883]); const [layers, setLayers] = useState([]); - const [baseMaps, setBaseMaps] = useState([]); const authToken = getAuthIdToken(); const [zoomLevel, setZoomLevel] = useState(13); - const resultsStyle = { - color: 'black' - }; - - const getOpeningPolygonAndProps = async (openingId: number | null): Promise => { - const urlApi = `/api/feature-service/polygon-and-props/${openingId}`; + const getOpeningPolygonAndProps = async (selectedOpeningId: number | null): Promise => { + const urlApi = `/api/feature-service/polygon-and-props/${selectedOpeningId}`; const response = await axios.get(backendUrl.concat(urlApi), { - headers: { - Authorization: `Bearer ${authToken}` - } + headers: { Authorization: `Bearer ${authToken}` } }); const { data } = response; @@ -81,91 +73,80 @@ const OpeningsMap: React.FC = ({ return null; }; - useEffect(() => { - setOpeningPolygonNotFound(false); + const callBcGwApi = async (currentOpeningId: number) : Promise => { + return await getOpeningPolygonAndProps(currentOpeningId); + }; - const callBcGwApi = async () => { - const opening: OpeningPolygon | null = await getOpeningPolygonAndProps(openingId); - if (opening) { - setOpenings([opening]); + const getUserLocation = async () => { + if (navigator.geolocation) { + const options = { + enableHighAccuracy: true, + timeout: 5000, + maximumAge: 0 + }; + + const requestCurrentLocation = () =>{ + navigator.geolocation.getCurrentPosition((currentPosition: GeolocationPosition) => { + setPosition({lat: currentPosition.coords.latitude,lng: currentPosition.coords.longitude}); + setZoomLevel(8); + }, (error: GeolocationPositionError) => { + setPosition({lat: 51.339506220208065,lng: -121.40991210937501}); + setZoomLevel(6); + }, options); + }; - const positionLatLng: LatLngExpression = [opening.positionLat, opening.positionLong]; - setPosition(positionLatLng); - } else { - setOpeningPolygonNotFound(true); + const permissionResult = await navigator.permissions.query({name:'geolocation'}); + if (permissionResult.state === "granted" || permissionResult.state === "prompt") { + requestCurrentLocation(); } - setReloadMap(true); - }; + + } + + }; + + const loadOpeniningPolygons = async (providedIds: number[]) : Promise => { + setOpeningPolygonNotFound(false); + if(providedIds?.length) { + const results = await Promise.all(providedIds.map(callBcGwApi)); + setOpenings(results.filter((opening) => opening !== null)); - if (openingId) { - callBcGwApi(); - } else if (openingId === 0) { + } else { + setOpeningPolygonNotFound(true); setOpenings([]); - setReloadMap(true); } const filtered = allLayers.filter(l => l.name.length > 0); if (filtered.length) { setLayers(filtered); } + } - const getUserLocation = () => { - if (navigator.geolocation) { - const options = { - enableHighAccuracy: true, - timeout: 5000, - maximumAge: 0, - }; - - navigator.geolocation.getCurrentPosition((position: GeolocationPosition) => { - setPosition({ - lat: position.coords.latitude, - lng: position.coords.longitude, - }); - setZoomLevel(8); - }, (error: GeolocationPositionError) => { - console.error(`${error.code}: ${error.message}`); - // Set the province location, if user denied - // north east - lat = 54.76267040025495, lng = -103.46923828125 - // south east - lat = 47.91634204016118, lng = -139.35058593750003 - setPosition({ - lat: 51.339506220208065, - lng: -121.40991210937501 - }); - setZoomLevel(6); - }, options); - } + useEffect(() => { + setSelectedOpeningIds(openingId ? [openingId] : []); + if(!openingId){ + (async () => { + await getUserLocation(); + })(); } - - setBaseMaps(allBaseMaps); - getUserLocation(); }, [openingId]); - useEffect(() => {}, [openings, reloadMap]); - - const RecenterAutomatically = ({latLong}: {latLong: LatLngExpression}) => { - const map = useMap(); - const zoom = zoomLevel; - useEffect(() => { - map.setView(latLong, zoom); - }, [latLong]); - return null; - }; + useEffect(() => { + setSelectedOpeningIds(openingIds || []); + if (!openingIds?.length) { + (async () => { + await getUserLocation(); + })(); + } + }, [openingIds]); - // Use this function to investigate/play with map click - // Just add inside below - /* - function LocationMarker() { - const map = useMapEvents({ - click() { - console.log('click, bounds:', map.getBounds()); - console.log('click, zoom:', map.getZoom()); - } - }); - return null; - } - */ + useEffect(() => { loadOpeniningPolygons(selectedOpeningIds); }, [selectedOpeningIds]); + useEffect(() => { + (async () => { + await getUserLocation(); + })(); + },[]) + return ( = ({ attribution="Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community" zIndex={-10000} /> - {/* Add base maps, if any - - {baseMaps.map((base: BaseMapLayer) => ( - - - - ))} - - */} - + {/* Display Opening polygons, if any */} - {openings.length ? ( - openings.map((opening: OpeningPolygon) => ( - - - {opening.popup} - - - )) - ) : null } + - {/* Centers the map automatically when a different opening get selected. */} - {position && ( - - )} - {/* Default layers */} {layers.length && ( diff --git a/frontend/src/components/OpeningsMapEntry/index.tsx b/frontend/src/components/OpeningsMapEntry/index.tsx new file mode 100644 index 00000000..51906d66 --- /dev/null +++ b/frontend/src/components/OpeningsMapEntry/index.tsx @@ -0,0 +1,54 @@ +import React, { useEffect } from 'react'; +import { Polygon, useMap, Popup } from 'react-leaflet'; +import L,{LatLngExpression} from 'leaflet'; +import { OpeningPolygon } from '../../types/OpeningPolygon'; + +interface OpeningsMapEntryProps { + polygons: OpeningPolygon[]; + defaultLocation: LatLngExpression; + defaultZoom: number; +} + +const resultsStyle = { + color: 'black' +}; + +const OpeningsMapEntry: React.FC = ({ + polygons, + defaultLocation, + defaultZoom +}) => { + const map = useMap(); + + useEffect(() => { + if (polygons.length > 0) { + // Calculate bounds to include all polygons + // This is to make sure the map resizes for the correct view + const bounds = L.latLngBounds( + polygons.flatMap((polygon) => polygon.bounds.flat()) + ); + map.fitBounds(bounds, { padding: [20, 20] }); + }else { + // If no polygons are found, set the map to the default location + map.setView(defaultLocation, defaultZoom); + } + }, [polygons, map]); + + return ( + <> + {polygons.map((polygon) => ( + + + {polygon.popup} + + + ))} + + ); +}; + +export default OpeningsMapEntry; diff --git a/frontend/src/components/OpeningsTab/index.tsx b/frontend/src/components/OpeningsTab/index.tsx index 7df1bc3e..69cfeb5b 100644 --- a/frontend/src/components/OpeningsTab/index.tsx +++ b/frontend/src/components/OpeningsTab/index.tsx @@ -47,6 +47,7 @@ const OpeningsTab: React.FC = ({ showSpatial, setShowSpatial }) => {
diff --git a/frontend/src/components/SilvicultureSearch/Openings/OpeningsSearchTab/index.tsx b/frontend/src/components/SilvicultureSearch/Openings/OpeningsSearchTab/index.tsx index 4424c9e8..916192dd 100644 --- a/frontend/src/components/SilvicultureSearch/Openings/OpeningsSearchTab/index.tsx +++ b/frontend/src/components/SilvicultureSearch/Openings/OpeningsSearchTab/index.tsx @@ -21,6 +21,7 @@ const OpeningsSearchTab: React.FC = () => { const [isSearchTriggered, setIsSearchTriggered] = useState(false); // Trigger state for search const [isNoFilterSearch, setIsNoFilterSearch] = useState(false); // Handles the notification for no filters applied const { currentPage, itemsPerPage } = useContext(PaginationContext); + const [selectedOpeningIds,setSelectedOpeningIds] = useState([]); const [headers, setHeaders] = useState(columns); @@ -38,7 +39,6 @@ const OpeningsSearchTab: React.FC = () => { const hasFilters = countActiveFilters(filters) > 0 || searchTerm.length > 0; - const handleSearch = () => { setIsNoFilterSearch(!hasFilters); @@ -128,9 +128,11 @@ const OpeningsSearchTab: React.FC = () => { onSearchClick={handleSearch} /> {showSpatial ? ( -
+
@@ -151,6 +153,7 @@ const OpeningsSearchTab: React.FC = () => { toggleSpatial={toggleSpatial} showSpatial={showSpatial} totalItems={(data?.perPage ?? 0) * (data?.totalPages ?? 0)} + setOpeningIds={setSelectedOpeningIds} /> )} diff --git a/frontend/src/components/SilvicultureSearch/Openings/SearchScreenDataTable/index.tsx b/frontend/src/components/SilvicultureSearch/Openings/SearchScreenDataTable/index.tsx index 19566c8e..cad42289 100644 --- a/frontend/src/components/SilvicultureSearch/Openings/SearchScreenDataTable/index.tsx +++ b/frontend/src/components/SilvicultureSearch/Openings/SearchScreenDataTable/index.tsx @@ -55,6 +55,7 @@ interface ISearchScreenDataTable { toggleSpatial: () => void; showSpatial: boolean; totalItems: number; + setOpeningIds: (openingIds: number[]) => void; } interface ICellRefs { @@ -68,7 +69,8 @@ const SearchScreenDataTable: React.FC = ({ handleCheckboxChange, toggleSpatial, showSpatial, - totalItems + totalItems, + setOpeningIds }) => { const { handlePageChange, @@ -110,14 +112,19 @@ const SearchScreenDataTable: React.FC = ({ }, [rows, totalItems]); // Function to handle row selection changes - const handleRowSelectionChanged = (rowId: string) => { + + const handleRowSelectionChanged = (openingId: string) => { setSelectedRows((prevSelectedRows) => { - if (prevSelectedRows.includes(rowId)) { + if (prevSelectedRows.includes(openingId)) { // If the row is already selected, remove it from the selected rows - return prevSelectedRows.filter((id) => id !== rowId); + const selectedValues = prevSelectedRows.filter((id) => id !== openingId); + setOpeningIds(selectedValues.map(parseFloat)); + return selectedValues; } else { - // If the row is not selected, add it to the selected rows - return [...prevSelectedRows, rowId]; + // If the row is not selected, add it to the selected rows + const selectedValues = [...prevSelectedRows, openingId]; + setOpeningIds(selectedValues.map(parseFloat)); + return selectedValues; } }); }; @@ -175,6 +182,7 @@ const SearchScreenDataTable: React.FC = ({