@opengeoweb/taf 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/index.esm.js +376 -257
  2. package/index.umd.js +397 -272
  3. package/lib/components/TafForm/TafForm.d.ts +2 -1
  4. package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.d.ts +11 -0
  5. package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.spec.d.ts +1 -0
  6. package/lib/components/TafForm/TafFormRow/types.d.ts +3 -2
  7. package/lib/components/TafForm/TafFormWrapper.stories.d.ts +20 -0
  8. package/lib/components/TafForm/utils.d.ts +4 -2
  9. package/lib/components/TafLayout/LocationTabs/LocationTabs.d.ts +10 -0
  10. package/lib/components/TafLayout/LocationTabs/LocationTabs.spec.d.ts +1 -0
  11. package/lib/components/TafLayout/LocationTabs/LocationTabs.stories.d.ts +13 -0
  12. package/lib/components/TafLayout/LocationTabs/index.d.ts +1 -0
  13. package/lib/components/TafLayout/StatusIcon.d.ts +8 -0
  14. package/lib/components/TafLayout/StatusIcon.spec.d.ts +1 -0
  15. package/lib/components/TafLayout/TabPanel/TabPanel.d.ts +8 -0
  16. package/lib/components/TafLayout/TabPanel/TabPanel.spec.d.ts +1 -0
  17. package/lib/components/TafLayout/TabPanel/index.d.ts +1 -0
  18. package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +9 -0
  19. package/lib/components/TafLayout/TacOverview/TacContainer.spec.d.ts +1 -0
  20. package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +9 -0
  21. package/lib/components/TafLayout/TacOverview/TacOverview.spec.d.ts +1 -0
  22. package/lib/components/TafLayout/TacOverview/TacOverview.stories.d.ts +13 -0
  23. package/lib/components/TafLayout/TacOverview/index.d.ts +1 -0
  24. package/lib/components/TafLayout/TafHeader.d.ts +6 -0
  25. package/lib/components/TafLayout/TafHeader.spec.d.ts +1 -0
  26. package/lib/components/TafLayout/TafLayout.d.ts +7 -0
  27. package/lib/components/TafLayout/TafLayout.stories.d.ts +7 -0
  28. package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +11 -0
  29. package/lib/components/TafLayout/TopTabs/TopTabs.spec.d.ts +1 -0
  30. package/lib/components/TafLayout/TopTabs/TopTabs.stories.d.ts +13 -0
  31. package/lib/components/TafLayout/TopTabs/index.d.ts +1 -0
  32. package/lib/components/TafLayout/utils.d.ts +18 -0
  33. package/lib/components/TafLayout/utils.spec.d.ts +1 -0
  34. package/lib/components/TafList/TafListAccordion.d.ts +1 -1
  35. package/lib/components/TafList/TafListButtons.d.ts +2 -1
  36. package/lib/types.d.ts +15 -0
  37. package/lib/utils/testUtils.d.ts +8 -0
  38. package/package.json +5 -5
  39. package/lib/components/TafForm/TafForm.styles.d.ts +0 -1
package/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@mui/styles/makeStyles'), require('moment'), require('@opengeoweb/shared'), require('@mui/icons-material'), require('@opengeoweb/api'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-sortablejs')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@mui/styles/makeStyles', 'moment', '@opengeoweb/shared', '@mui/icons-material', '@opengeoweb/api', '@opengeoweb/form-fields', 'react-hook-form', 'react-sortablejs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.makeStyles, global.moment, global.shared, global.iconsMaterial, global.api, global.formFields, global.reactHookForm, global.reactSortablejs));
5
- })(this, (function (exports, React, material, makeStyles, moment, shared, iconsMaterial, api, formFields, reactHookForm, reactSortablejs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@mui/styles/makeStyles'), require('moment'), require('@opengeoweb/shared'), require('@mui/icons-material'), require('@opengeoweb/api'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-sortablejs'), require('lodash')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@mui/styles/makeStyles', 'moment', '@opengeoweb/shared', '@mui/icons-material', '@opengeoweb/api', '@opengeoweb/form-fields', 'react-hook-form', 'react-sortablejs', 'lodash'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.makeStyles, global.moment, global.shared, global.iconsMaterial, global.api, global.formFields, global.reactHookForm, global.reactSortablejs, global.lodash));
5
+ })(this, (function (exports, React, material, makeStyles, moment, shared, iconsMaterial, api, formFields, reactHookForm, reactSortablejs, lodash) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -172,32 +172,47 @@
172
172
  var locations = {
173
173
  EHAM: {
174
174
  validity_duration: 30,
175
- activity_period: 6
175
+ activity_period: 6,
176
+ label: "Schiphol"
176
177
  },
177
178
  EHRD: {
178
179
  validity_duration: 30,
179
- activity_period: 6
180
+ activity_period: 6,
181
+ label: "Rotterdam"
180
182
  },
181
183
  EHGG: {
182
184
  validity_duration: 30,
183
- activity_period: 6
185
+ activity_period: 6,
186
+ label: "Eelde"
184
187
  },
185
188
  EHBK: {
186
189
  validity_duration: 30,
187
- activity_period: 6
190
+ activity_period: 6,
191
+ label: "Maastricht"
188
192
  },
189
193
  EHLE: {
190
194
  validity_duration: 30,
191
- activity_period: 6
195
+ activity_period: 6,
196
+ label: "Lelystad"
192
197
  },
193
198
  TNCB: {
194
199
  validity_duration: 30,
195
- activity_period: 6
200
+ activity_period: 6,
201
+ label: "Bonaire"
196
202
  }
197
203
  };
204
+ var locationOrder = [
205
+ "EHAM",
206
+ "EHRD",
207
+ "EHLE",
208
+ "EHGG",
209
+ "EHBK",
210
+ "TNCB"
211
+ ];
198
212
  var tafConfig = {
199
213
  location_indicator_mwo: location_indicator_mwo,
200
- locations: locations
214
+ locations: locations,
215
+ locationOrder: locationOrder
201
216
  };
202
217
 
203
218
  function _typeof(obj) {
@@ -2459,12 +2474,24 @@
2459
2474
  if (action === 'AMEND') return 'This TAF is an amendment';
2460
2475
  if (action === 'CORRECT') return 'This TAF is a correction';
2461
2476
  return 'Cancel TAF';
2477
+ }; // Check if the amended/corrected TAF has been changed. Only compare the fields users are able to fill in
2478
+ // (i.e. exclude baseforecast valid time as that gets updated when doing an amendment automatically outside of the users influence)
2479
+
2480
+ var isTafAmendedCorrectedChanged = function isTafAmendedCorrectedChanged(isFormDirty, originalTaf, currentTaf) {
2481
+ var originalBaseF = originalTaf.baseForecast,
2482
+ originalChG = originalTaf.changeGroups;
2483
+ var currentBaseF = currentTaf.baseForecast,
2484
+ currentChG = currentTaf.changeGroups;
2485
+
2486
+ originalBaseF.valid;
2487
+ var originalNoValid = __rest(originalBaseF, ["valid"]);
2488
+
2489
+ currentBaseF.valid;
2490
+ var currentNoValid = __rest(currentBaseF, ["valid"]);
2491
+
2492
+ return isFormDirty && (!lodash.isEqual(originalNoValid, currentNoValid) || !lodash.isEqual(originalChG, currentChG));
2462
2493
  };
2463
2494
  var getConfirmationDialogContent = function getConfirmationDialogContent(action, isFormDirty) {
2464
- if (isFormDirty === void 0) {
2465
- isFormDirty = true;
2466
- }
2467
-
2468
2495
  switch (action) {
2469
2496
  case 'DISCARD':
2470
2497
  return 'Are you sure you would like to discard this TAF? Any changes made will be lost';
@@ -2474,7 +2501,7 @@
2474
2501
 
2475
2502
  case 'AMEND':
2476
2503
  case 'CORRECT':
2477
- return isFormDirty ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
2504
+ return isFormDirty() ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
2478
2505
 
2479
2506
  default:
2480
2507
  return 'Are you sure you want to cancel this TAF?';
@@ -2494,83 +2521,6 @@
2494
2521
  }
2495
2522
  };
2496
2523
 
2497
- var useStyles$9 = makeStyles__default["default"](function (theme) {
2498
- return {
2499
- textFieldGridItem: {
2500
- marginRight: 4
2501
- },
2502
- textFieldRoot: {
2503
- '&.Mui-disabled::before': {
2504
- borderBottom: 'none'
2505
- },
2506
- '&:after': {
2507
- borderBottomColor: '#3f51b5'
2508
- }
2509
- },
2510
- textFieldInput: {
2511
- fontSize: '14px',
2512
- paddingLeft: 1,
2513
- paddingRight: 1,
2514
- color: '#051039',
2515
- WebkitTextFillColor: '#051039',
2516
- '&.Mui-disabled': {
2517
- backgroundColor: 'white'
2518
- }
2519
- },
2520
- textFieldLabel: {
2521
- fontSize: '14px'
2522
- },
2523
- textFieldLabelShrink: {
2524
- transform: 'translate(2px, 10px) scale(0.75) !important'
2525
- },
2526
- formRow: {
2527
- marginTop: 8,
2528
- backgroundColor: theme.palette.common.white,
2529
- position: 'relative',
2530
- '&.sortable-chosen': {
2531
- boxShadow: theme.shadows[1]
2532
- },
2533
- '&.sortable-ghost': {
2534
- opacity: 0.5
2535
- }
2536
- },
2537
- tacTitle: {
2538
- fontSize: '20px',
2539
- fontWeight: 500
2540
- },
2541
- tacText: {
2542
- fontSize: '14px',
2543
- color: '#000000'
2544
- },
2545
- tacLine: {
2546
- margin: '0',
2547
- padding: '.1em .1em .1em 0.8em',
2548
- textIndent: '-0.7em',
2549
- borderRadius: '3px'
2550
- },
2551
- addButton: {
2552
- marginRight: '48px'
2553
- },
2554
- lifecycleButtons: {
2555
- marginTop: '40px',
2556
- marginBottom: '16px'
2557
- },
2558
- actionButton: {
2559
- marginRight: '16px'
2560
- },
2561
- lastButton: {
2562
- marginRight: '90px'
2563
- },
2564
- backdrop: {
2565
- zIndex: 1500,
2566
- color: '#fff'
2567
- },
2568
- emptyButtonContainer: {
2569
- minWidth: 96
2570
- }
2571
- };
2572
- });
2573
-
2574
2524
  var getTafErrors = function getTafErrors(name, errors) {
2575
2525
  var nameAsArray = name.split('.');
2576
2526
 
@@ -2591,15 +2541,48 @@
2591
2541
  var getDisplayValue = function getDisplayValue(value, disabled) {
2592
2542
  return disabled && !value ? '-' : value;
2593
2543
  };
2544
+ var useStyles$8 = makeStyles__default["default"](function (theme) {
2545
+ return {
2546
+ textFieldInput: {
2547
+ height: 46,
2548
+ width: 56,
2549
+ textAlign: 'center',
2550
+ fontSize: 10,
2551
+ fontWeight: 500,
2552
+ paddingLeft: 0,
2553
+ paddingRight: 0,
2554
+ marginBotom: '2px',
2555
+ '&.Mui-disabled': {
2556
+ '-webkit-text-fill-color': theme.palette.geowebColors.typographyAndIcons.text,
2557
+ color: theme.palette.geowebColors.typographyAndIcons.text,
2558
+ '&:before': {
2559
+ border: 'none'
2560
+ }
2561
+ }
2562
+ },
2563
+ textFieldLabel: {
2564
+ fontSize: '10px',
2565
+ '&.Mui-disabled': {
2566
+ color: theme.palette.geowebColors.captions.captionStatus.rgba
2567
+ },
2568
+ whiteSpace: 'nowrap',
2569
+ maxWidth: '100%'
2570
+ },
2571
+ textFieldLabelShrink: {
2572
+ transform: 'translate(2px, 10px) scale(0.75) !important',
2573
+ letterSpacing: '0.33px'
2574
+ }
2575
+ };
2576
+ });
2594
2577
  var BaseTextField = /*#__PURE__*/React__default["default"].memo(function (props) {
2595
- var classes = useStyles$9();
2578
+ var classes = useStyles$8();
2596
2579
  return /*#__PURE__*/React__default["default"].createElement(material.TextField, __assign({
2597
2580
  type: "text",
2598
2581
  variant: "filled",
2599
2582
  InputProps: {
2600
2583
  classes: {
2601
- input: classes.textFieldInput,
2602
- root: classes.textFieldRoot
2584
+ root: classes.textFieldInput,
2585
+ input: classes.textFieldInput
2603
2586
  }
2604
2587
  },
2605
2588
  InputLabelProps: {
@@ -2607,6 +2590,10 @@
2607
2590
  root: classes.textFieldLabel,
2608
2591
  shrink: classes.textFieldLabelShrink
2609
2592
  }
2593
+ },
2594
+ sx: {
2595
+ marginRight: '2px',
2596
+ marginBottom: '2px'
2610
2597
  }
2611
2598
  }, props));
2612
2599
  }, function (prevProps, nextProps) {
@@ -2632,7 +2619,6 @@
2632
2619
  autoComplete = _h === void 0 ? [] : _h,
2633
2620
  _j = _a.autoFocus,
2634
2621
  autoFocus = _j === void 0 ? false : _j;
2635
- var classes = useStyles$9();
2636
2622
 
2637
2623
  var _k = reactHookForm.useFormContext(),
2638
2624
  control = _k.control,
@@ -2688,11 +2674,7 @@
2688
2674
  inputRef.current.disabled = false;
2689
2675
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
2690
2676
  }, []);
2691
- return /*#__PURE__*/React__default["default"].createElement(material.Grid, {
2692
- item: true,
2693
- xs: true,
2694
- className: classes.textFieldGridItem
2695
- }, /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
2677
+ return /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
2696
2678
  render: function render(_props) {
2697
2679
  var displayValue = formatter ? formatter(_props.value) : getDisplayValue(_props.value, disabled);
2698
2680
  return /*#__PURE__*/React__default["default"].createElement(BaseTextField, {
@@ -2720,7 +2702,7 @@
2720
2702
  defaultValue: defaultValue,
2721
2703
  rules: rules,
2722
2704
  onFocus: onFocusField
2723
- }));
2705
+ });
2724
2706
  };
2725
2707
 
2726
2708
  /* *
@@ -2784,6 +2766,70 @@
2784
2766
  return isValid ? true : invalidProbabilityMessage;
2785
2767
  };
2786
2768
 
2769
+ /* *
2770
+ * Licensed under the Apache License, Version 2.0 (the "License");
2771
+ * you may not use this file except in compliance with the License.
2772
+ * You may obtain a copy of the License at
2773
+ *
2774
+ * http://www.apache.org/licenses/LICENSE-2.0
2775
+ *
2776
+ * Unless required by applicable law or agreed to in writing, software
2777
+ * distributed under the License is distributed on an "AS IS" BASIS,
2778
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2779
+ * See the License for the specific language governing permissions and
2780
+ * limitations under the License.
2781
+ *
2782
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2783
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
2784
+ * */
2785
+ var AddIcon = /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("path", {
2786
+ d: "M10.647 10.647h6.82a1.276 1.276 0 1 0 0-2.552h-6.82v-6.82a1.276 1.276 0 1 0-2.552 0v6.82h-6.82a1.276 1.276 0 1 0 0 2.552h6.82v6.82a1.274 1.274 0 0 0 1.276 1.275c.705 0 1.276-.571 1.276-1.276v-6.82z"
2787
+ }));
2788
+ var DeleteIcon = /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("path", {
2789
+ d: "M17.504 8.228c.588 0 1.027.48.973 1.066l-.876 9.64A1.197 1.197 0 0 1 16.434 20H8.41c-.59 0-1.115-.48-1.167-1.066l-.877-9.64a.962.962 0 0 1 .973-1.066zm-2.115 1.228a.82.82 0 0 0-.819.82v7.674a.818.818 0 0 0 1.638 0v-7.675a.819.819 0 0 0-.819-.819zm-2.968 0a.819.819 0 0 0-.819.82v7.674a.818.818 0 1 0 1.638 0v-7.675a.82.82 0 0 0-.82-.819zm-2.968 0a.819.819 0 0 0-.818.82v7.674a.818.818 0 1 0 1.637 0v-7.675a.82.82 0 0 0-.82-.819zM13.432 4c.21 0 .404.168.436.376l.107.758 3.256-.01a1.606 1.606 0 0 1 1.61 1.6l.001.535-12.841.038L6 6.76a1.605 1.605 0 0 1 1.6-1.61l3.262-.008.103-.758a.454.454 0 0 1 .434-.38z"
2790
+ }));
2791
+ var CrossIcon = /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("path", {
2792
+ d: "m13.805 12 4.821-4.822a1.276 1.276 0 1 0-1.804-1.804L12 10.195 7.178 5.374a1.276 1.276 0 1 0-1.804 1.804L10.196 12l-4.822 4.822a1.276 1.276 0 1 0 1.804 1.805L12 13.805l4.822 4.822a1.274 1.274 0 0 0 1.804 0c.499-.5.499-1.306 0-1.805L13.805 12z"
2793
+ }));
2794
+
2795
+ var TafFormOptionsButton = function TafFormOptionsButton(_a) {
2796
+ var isChangeGroup = _a.isChangeGroup,
2797
+ addChangeGroupBelow = _a.addChangeGroupBelow,
2798
+ addChangeGroupAbove = _a.addChangeGroupAbove,
2799
+ removeChangeGroup = _a.removeChangeGroup,
2800
+ clearRow = _a.clearRow,
2801
+ index = _a.index;
2802
+ var insertAbove = {
2803
+ text: 'Insert 1 row above',
2804
+ icon: AddIcon,
2805
+ action: addChangeGroupAbove
2806
+ };
2807
+ var insertBelow = {
2808
+ text: 'Insert 1 row below',
2809
+ icon: AddIcon,
2810
+ action: addChangeGroupBelow
2811
+ };
2812
+ var deleteRow = {
2813
+ text: 'Delete row',
2814
+ icon: DeleteIcon,
2815
+ action: removeChangeGroup
2816
+ };
2817
+ var clear = {
2818
+ text: 'Clear row',
2819
+ icon: CrossIcon,
2820
+ action: clearRow
2821
+ };
2822
+ var menuItemsBaseForecast = [insertBelow, clear];
2823
+ var menuItemsChangeGroup = [insertAbove, insertBelow, deleteRow, clear];
2824
+ return /*#__PURE__*/React__namespace.createElement(shared.ToggleMenu, {
2825
+ buttonTestId: "tafFormOptions[" + index + "]",
2826
+ buttonSx: {
2827
+ margin: '14px 10px'
2828
+ },
2829
+ menuItems: isChangeGroup ? menuItemsChangeGroup : menuItemsBaseForecast
2830
+ });
2831
+ };
2832
+
2787
2833
  var getDefaultValue = function getDefaultValue(fieldName, data) {
2788
2834
  if (!data) {
2789
2835
  return '';
@@ -2804,30 +2850,29 @@
2804
2850
  disabled = _c === void 0 ? false : _c,
2805
2851
  _d = _a.index,
2806
2852
  index = _d === void 0 ? -1 : _d,
2807
- _e = _a.lastRow,
2808
- lastRow = _e === void 0 ? false : _e,
2809
2853
  onRemoveChangeGroup = _a.onRemoveChangeGroup,
2810
- _f = _a.field,
2811
- field = _f === void 0 ? null : _f,
2812
- _g = _a.dragHandle,
2813
- dragHandle = _g === void 0 ? null : _g,
2814
- onAddChangeGroup = _a.onAddChangeGroup,
2815
- props = __rest(_a, ["isChangeGroup", "disabled", "index", "lastRow", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroup"]);
2816
-
2817
- var classes = useStyles$9();
2854
+ _e = _a.field,
2855
+ field = _e === void 0 ? null : _e,
2856
+ _f = _a.dragHandle,
2857
+ dragHandle = _f === void 0 ? null : _f,
2858
+ onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
2859
+ onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
2860
+ onClearRow = _a.onClearRow,
2861
+ props = __rest(_a, ["isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
2862
+
2818
2863
  var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[" + index + "]";
2819
2864
  var fieldNames = getFieldNames(isChangeGroup, index);
2820
2865
 
2821
- var _h = reactHookForm.useFormContext(),
2822
- getValues = _h.getValues,
2823
- trigger = _h.trigger;
2866
+ var _g = reactHookForm.useFormContext(),
2867
+ getValues = _g.getValues,
2868
+ trigger = _g.trigger;
2824
2869
 
2825
2870
  var isNotRequiredForAction = shared.useDraftFormHelpers().isRequired; // cross-field required validation
2826
2871
 
2827
- var _j = __read(getRequiredCrossFields(fieldNames), 3),
2828
- mainFields = _j[0],
2829
- mainOptionalFields = _j[1],
2830
- subFields = _j[2];
2872
+ var _h = __read(getRequiredCrossFields(fieldNames), 3),
2873
+ mainFields = _h[0],
2874
+ mainOptionalFields = _h[1],
2875
+ subFields = _h[2];
2831
2876
 
2832
2877
  var hasFieldsValue = function hasFieldsValue(fields) {
2833
2878
  return fields.map(getValues).find(function (field) {
@@ -2925,14 +2970,38 @@
2925
2970
  return validFields;
2926
2971
  };
2927
2972
 
2928
- var addChangeGroup = React__default["default"].useCallback(function () {
2929
- onAddChangeGroup(index);
2930
- }, [onAddChangeGroup, index]);
2973
+ var addChangeGroupBelow = React__default["default"].useCallback(function () {
2974
+ onAddChangeGroupBelow(index);
2975
+ }, [onAddChangeGroupBelow, index]);
2976
+ var addChangeGroupAbove = React__default["default"].useCallback(function () {
2977
+ onAddChangeGroupAbove(index);
2978
+ }, [onAddChangeGroupAbove, index]);
2979
+ var clearRow = React__default["default"].useCallback(function () {
2980
+ onClearRow(index);
2981
+ }, [onClearRow, index]);
2931
2982
  return /*#__PURE__*/React__default["default"].createElement(material.Grid, __assign({
2983
+ sx: {
2984
+ marginTop: '8px',
2985
+ backgroundColor: 'geowebColors.cards.cardContainer',
2986
+ position: 'relative',
2987
+ '&.sortable-chosen': {
2988
+ boxShadow: 1
2989
+ },
2990
+ '&.sortable-ghost': {
2991
+ opacity: 0.5
2992
+ }
2993
+ },
2994
+ justifyContent: "flex-start",
2932
2995
  "data-testid": "row-" + namePrefix,
2933
2996
  container: true,
2934
2997
  ref: ref
2935
- }, props), !isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
2998
+ }, props), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
2999
+ item: true,
3000
+ xs: 11
3001
+ }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3002
+ container: true,
3003
+ justifyContent: "flex-end"
3004
+ }, !isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
2936
3005
  label: "Type",
2937
3006
  name: fieldNames.messageType,
2938
3007
  disabled: true
@@ -2945,13 +3014,12 @@
2945
3014
  label: "Issue time",
2946
3015
  name: "issueDate",
2947
3016
  disabled: true
2948
- })), isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
2949
- item: true,
2950
- xs: true,
2951
- style: {
2952
- display: 'flex'
3017
+ })), isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Box, {
3018
+ sx: {
3019
+ width: 56,
3020
+ marginRight: '2px'
2953
3021
  }
2954
- }, dragHandle), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
3022
+ }, !disabled && dragHandle), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
2955
3023
  label: "Prob",
2956
3024
  name: fieldNames.probability,
2957
3025
  disabled: disabled,
@@ -3189,33 +3257,19 @@
3189
3257
  }
3190
3258
  }
3191
3259
  }
3192
- }), (!isChangeGroup || disabled) && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3193
- className: classes.emptyButtonContainer,
3260
+ }))), !disabled && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3194
3261
  item: true,
3195
- xs: true
3196
- }, !disabled && /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
3197
- "aria-label": "add",
3198
- "data-testid": "add-changeGroup",
3199
- onClick: addChangeGroup,
3200
- size: "large"
3201
- }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Add, null))), isChangeGroup && !disabled && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3202
- item: true
3203
- }, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
3204
- "aria-label": "add",
3205
- "data-testid": "add-changeGroup",
3206
- onClick: addChangeGroup,
3207
- size: "large"
3208
- }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Add, null)), /*#__PURE__*/React__default["default"].createElement(material.IconButton, __assign({
3209
- "aria-label": "delete",
3210
- "data-testid": "remove-changeGroup",
3211
- onClick: function onClick() {
3262
+ xs: 1
3263
+ }, /*#__PURE__*/React__default["default"].createElement(TafFormOptionsButton, {
3264
+ isChangeGroup: isChangeGroup,
3265
+ addChangeGroupBelow: addChangeGroupBelow,
3266
+ addChangeGroupAbove: addChangeGroupAbove,
3267
+ removeChangeGroup: function removeChangeGroup() {
3212
3268
  return onRemoveChangeGroup(index);
3213
- }
3214
- }, lastRow ? {
3215
- tabIndex: -1
3216
- } : {}, {
3217
- size: "large"
3218
- }), /*#__PURE__*/React__default["default"].createElement(iconsMaterial.Delete, null))));
3269
+ },
3270
+ clearRow: clearRow,
3271
+ index: index
3272
+ })));
3219
3273
  });
3220
3274
 
3221
3275
  var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
@@ -3247,7 +3301,8 @@
3247
3301
  },
3248
3302
  '&:focus': {
3249
3303
  backgroundColor: buttonColor
3250
- }
3304
+ },
3305
+ fontSize: 12
3251
3306
  };
3252
3307
  };
3253
3308
 
@@ -3303,7 +3358,7 @@
3303
3358
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3304
3359
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
3305
3360
  * */
3306
- var useStyles$8 = makeStyles__default["default"]({
3361
+ var useStyles$7 = makeStyles__default["default"]({
3307
3362
  paneContent: {
3308
3363
  marginTop: '16px',
3309
3364
  marginLeft: '24px'
@@ -3383,15 +3438,15 @@
3383
3438
  handleClose = _a.handleClose,
3384
3439
  _b = _a.errorList,
3385
3440
  errorList = _b === void 0 ? [] : _b;
3386
- var classes = useStyles$8();
3441
+ var classes = useStyles$7();
3387
3442
  return /*#__PURE__*/React__namespace.createElement(shared.ToolContainerDraggable, {
3388
3443
  startSize: {
3389
3444
  width: '577px',
3390
3445
  height: '200px'
3391
3446
  },
3392
3447
  startPosition: {
3393
- left: 370,
3394
- top: 570
3448
+ right: 20,
3449
+ top: 50
3395
3450
  },
3396
3451
  minWidth: 300,
3397
3452
  onClose: handleClose,
@@ -3480,7 +3535,6 @@
3480
3535
  var TafFormButtons = function TafFormButtons(_a) {
3481
3536
  var tafAction = _a.tafAction,
3482
3537
  onTafFormButtonPress = _a.onTafFormButtonPress;
3483
- var classes = useStyles$9();
3484
3538
  var errors = reactHookForm.useFormContext().errors;
3485
3539
  var errorList = filterDuplicateErrors(getErrors(errors));
3486
3540
 
@@ -3496,30 +3550,35 @@
3496
3550
  container: true,
3497
3551
  justifyContent: "space-between",
3498
3552
  alignItems: "center",
3499
- className: classes.lifecycleButtons
3553
+ sx: {
3554
+ margin: '10px 0px 22px 0px'
3555
+ }
3500
3556
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3501
3557
  item: true
3502
3558
  }, /*#__PURE__*/React__default["default"].createElement(IssuesButton, {
3503
3559
  sumOfErrors: errorList.length,
3504
3560
  togglePane: toggleIssuesPane
3505
- })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3561
+ }))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3562
+ container: true,
3563
+ justifyContent: "flex-end",
3564
+ sx: {
3565
+ paddingRight: '28px'
3566
+ }
3567
+ }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3506
3568
  item: true
3507
3569
  }, /*#__PURE__*/React__default["default"].createElement(material.Button, {
3508
3570
  "data-testid": "discardtaf",
3509
- variant: "outlined",
3510
- color: "secondary",
3511
- type: "button",
3512
- className: classes.actionButton,
3571
+ variant: "tertiary",
3513
3572
  onClick: function onClick() {
3514
3573
  // Simply discard the changes and close the dialog.
3515
3574
  onTafFormButtonPress('DISCARD');
3516
3575
  }
3517
3576
  }, "Discard"), /*#__PURE__*/React__default["default"].createElement(material.Button, {
3518
3577
  "data-testid": "savedrafttaf",
3519
- variant: "outlined",
3520
- color: "secondary",
3521
- type: "button",
3522
- className: classes.actionButton,
3578
+ variant: "tertiary",
3579
+ sx: {
3580
+ margin: '0px 10px'
3581
+ },
3523
3582
  onClick: function onClick() {
3524
3583
  /* Save the TAF as draft:
3525
3584
  if action NEW or DRAFT - new status will be DRAFT -- default
@@ -3546,10 +3605,7 @@
3546
3605
  }
3547
3606
  }, "Save"), /*#__PURE__*/React__default["default"].createElement(material.Button, {
3548
3607
  "data-testid": "publishtaf",
3549
- variant: "outlined",
3550
- color: "secondary",
3551
- type: "button",
3552
- className: classes.lastButton,
3608
+ variant: "tertiary",
3553
3609
  onClick: function onClick() {
3554
3610
  /* Publish the TAF:
3555
3611
  if action NEW or DRAFT - new status will be PUBLISHED -- default
@@ -3597,7 +3653,7 @@
3597
3653
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3598
3654
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
3599
3655
  * */
3600
- var useStyles$7 = makeStyles__default["default"](function () {
3656
+ var useStyles$6 = makeStyles__default["default"](function () {
3601
3657
  return {
3602
3658
  dragHandle: {
3603
3659
  backgroundColor: 'transparent',
@@ -3617,7 +3673,7 @@
3617
3673
  _c = _a.isDisabled,
3618
3674
  isDisabled = _c === void 0 ? false : _c,
3619
3675
  index = _a.index;
3620
- var classes = useStyles$7(isSorting);
3676
+ var classes = useStyles$6(isSorting);
3621
3677
  return /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
3622
3678
  className: classes.dragHandle + " handle",
3623
3679
  "data-testid": "dragHandle-" + index,
@@ -3627,6 +3683,62 @@
3627
3683
  }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null));
3628
3684
  };
3629
3685
 
3686
+ /* *
3687
+ * Licensed under the Apache License, Version 2.0 (the "License");
3688
+ * you may not use this file except in compliance with the License.
3689
+ * You may obtain a copy of the License at
3690
+ *
3691
+ * http://www.apache.org/licenses/LICENSE-2.0
3692
+ *
3693
+ * Unless required by applicable law or agreed to in writing, software
3694
+ * distributed under the License is distributed on an "AS IS" BASIS,
3695
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3696
+ * See the License for the specific language governing permissions and
3697
+ * limitations under the License.
3698
+ *
3699
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3700
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
3701
+ * */
3702
+
3703
+ var TafListButtons = function TafListButtons(_a) {
3704
+ var uuid = _a.uuid,
3705
+ canBe = _a.canBe,
3706
+ onClickTafActionButton = _a.onClickTafActionButton,
3707
+ _b = _a.testId,
3708
+ testId = _b === void 0 ? 'taflist-canbebuttons' : _b;
3709
+ return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3710
+ container: true,
3711
+ justifyContent: "flex-end",
3712
+ alignItems: "center",
3713
+ "data-testid": testId,
3714
+ sx: {
3715
+ margin: '10px 0px 22px 0px',
3716
+ paddingRight: '28px'
3717
+ }
3718
+ }, canBe.includes('CANCELLED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
3719
+ "data-testid": "canceltaf",
3720
+ variant: "tertiary",
3721
+ onClick: function onClick() {
3722
+ return onClickTafActionButton('CANCEL', uuid);
3723
+ }
3724
+ }, "Cancel"), canBe.includes('CORRECTED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
3725
+ "data-testid": "correctaf",
3726
+ variant: "tertiary",
3727
+ sx: {
3728
+ margin: '0px 10px'
3729
+ },
3730
+ onClick: function onClick() {
3731
+ return onClickTafActionButton('CORRECT', uuid);
3732
+ }
3733
+ }, "Correct"), canBe.includes('AMENDED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
3734
+ "data-testid": "amendtaf",
3735
+ variant: "tertiary",
3736
+ onClick: function onClick() {
3737
+ return onClickTafActionButton('AMEND', uuid);
3738
+ }
3739
+ }, "Amend"));
3740
+ };
3741
+
3630
3742
  var noop = function noop() {};
3631
3743
 
3632
3744
  var emptyChangegroup = {
@@ -3653,11 +3765,12 @@
3653
3765
  tafAction = _a.tafAction,
3654
3766
  _b = _a.staticTAC,
3655
3767
  staticTAC = _b === void 0 ? '' : _b,
3768
+ tafFromBackend = _a.tafFromBackend,
3656
3769
  _c = _a.onFormAction,
3657
3770
  onFormAction = _c === void 0 ? function () {
3658
3771
  return null;
3659
3772
  } : _c;
3660
- var classes = useStyles$9();
3773
+ var originalTaf = tafFromBackend.taf;
3661
3774
  var confirmDialog = shared.useConfirmationDialog();
3662
3775
 
3663
3776
  var _d = shared.useDraftFormHelpers(),
@@ -3673,7 +3786,8 @@
3673
3786
  watch = _e.watch,
3674
3787
  trigger = _e.trigger,
3675
3788
  formState = _e.formState,
3676
- getValues = _e.getValues;
3789
+ getValues = _e.getValues,
3790
+ setValue = _e.setValue;
3677
3791
 
3678
3792
  var isFormDirty = formState.isDirty,
3679
3793
  errors = formState.errors;
@@ -3717,7 +3831,9 @@
3717
3831
  var showConfirmDialog = function showConfirmDialog(action) {
3718
3832
  return confirmDialog({
3719
3833
  title: getConfirmationDialogTitle(action),
3720
- description: getConfirmationDialogContent(action, isFormDirty),
3834
+ description: getConfirmationDialogContent(action, function () {
3835
+ return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
3836
+ }),
3721
3837
  confirmLabel: getConfirmationDialogButtonLabel(action)
3722
3838
  });
3723
3839
  };
@@ -3755,6 +3871,15 @@
3755
3871
  })();
3756
3872
  break;
3757
3873
 
3874
+ default:
3875
+ onFormAction(action);
3876
+ break;
3877
+ }
3878
+ }; // TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/1906 hookup actions
3879
+
3880
+
3881
+ var onTafViewModeButtonPress = function onTafViewModeButtonPress(action) {
3882
+ switch (action) {
3758
3883
  default:
3759
3884
  onFormAction(action);
3760
3885
  break;
@@ -3790,25 +3915,68 @@
3790
3915
 
3791
3916
 
3792
3917
  var focusFirstInput = function focusFirstInput(rowIndex) {
3793
- var nextRowFirstInput = document.querySelector("[name=\"changeGroups[" + rowIndex + "].probability\"]");
3918
+ var selector = rowIndex === -1 ? "[name=\"baseForecast.wind\"]" : "[name=\"changeGroups[" + rowIndex + "].probability\"]";
3919
+ var nextRowFirstInput = document.querySelector(selector);
3794
3920
 
3795
3921
  if (nextRowFirstInput) {
3796
3922
  nextRowFirstInput.focus();
3797
3923
  }
3924
+ }; // adding rows and validation don't work well combined, with always skipping validation of fields of rows above the one the inserted row. A setTimeout prevents this issue
3925
+
3926
+
3927
+ var setFocusAndValidate = function setFocusAndValidate(rowIndex) {
3928
+ return setTimeout(function () {
3929
+ focusFirstInput(rowIndex);
3930
+ trigger(); // trigger all fields validation
3931
+ }, 0);
3932
+ };
3933
+
3934
+ var onAddRow = function onAddRow(rowIndex, above) {
3935
+ if (rowIndex === void 0) {
3936
+ rowIndex = -1;
3937
+ }
3938
+
3939
+ if (above === void 0) {
3940
+ above = false;
3941
+ }
3942
+
3943
+ var newRowIndex = above ? rowIndex : rowIndex + 1;
3944
+ insert(newRowIndex, emptyChangegroup, false);
3945
+ setFocusAndValidate(newRowIndex);
3798
3946
  };
3799
3947
 
3800
- var onAddRow = function onAddRow(rowIndex) {
3948
+ var _onClearRow = function onClearRow(rowIndex, isChangeGroup) {
3801
3949
  if (rowIndex === void 0) {
3802
3950
  rowIndex = -1;
3803
3951
  }
3804
3952
 
3805
- var newRowIndex = rowIndex + 1;
3806
- insert(newRowIndex, emptyChangegroup, false); // adding rows and validation don't work well combined, with always skipping validation of fields of rows above the one the inserted row. A setTimeout prevents this issue
3953
+ if (isChangeGroup === void 0) {
3954
+ isChangeGroup = false;
3955
+ }
3956
+
3957
+ confirmDialog({
3958
+ title: 'Clear row',
3959
+ description: 'Are you sure you want to clear this row?',
3960
+ confirmLabel: 'Yes'
3961
+ }).then(function () {
3962
+ if (isChangeGroup) {
3963
+ remove(rowIndex);
3964
+ insert(rowIndex, emptyChangegroup, false);
3965
+ } else {
3966
+ var baseForecastFields = getFieldNames(false, -1);
3967
+ setValue(baseForecastFields.wind, '');
3968
+ setValue(baseForecastFields.visibility, '');
3969
+ setValue(baseForecastFields.weather1, '');
3970
+ setValue(baseForecastFields.weather2, '');
3971
+ setValue(baseForecastFields.weather3, '');
3972
+ setValue(baseForecastFields.cloud1, '');
3973
+ setValue(baseForecastFields.cloud2, '');
3974
+ setValue(baseForecastFields.cloud3, '');
3975
+ setValue(baseForecastFields.cloud4, '');
3976
+ }
3807
3977
 
3808
- setTimeout(function () {
3809
- focusFirstInput(newRowIndex);
3810
- trigger(); // trigger all fields validation
3811
- }, 0);
3978
+ setFocusAndValidate(rowIndex);
3979
+ });
3812
3980
  };
3813
3981
 
3814
3982
  React__default["default"].useEffect(function () {
@@ -3822,22 +3990,34 @@
3822
3990
 
3823
3991
  }, []);
3824
3992
  return /*#__PURE__*/React__default["default"].createElement("form", {
3993
+ "data-testid": "taf-form",
3825
3994
  onSubmit: handleSubmit(onSubmit),
3826
3995
  onBlur: onFormBlur
3827
3996
  }, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
3828
- className: classes.tacTitle
3997
+ sx: {
3998
+ fontSize: '20px',
3999
+ fontWeight: 500
4000
+ }
3829
4001
  }, "TAC"), /*#__PURE__*/React__default["default"].createElement(material.Typography, {
3830
- "data-testid": "form-tac-message",
3831
- className: classes.tacText
4002
+ sx: {
4003
+ fontSize: '14px',
4004
+ margin: '8px 0px'
4005
+ },
4006
+ "data-testid": "form-tac-message"
3832
4007
  }, TAC.split('\n').map(function (line) {
3833
- return /*#__PURE__*/React__default["default"].createElement("span", {
4008
+ return /*#__PURE__*/React__default["default"].createElement(material.Box, {
4009
+ component: "span",
3834
4010
  key: line,
3835
- className: classes.tacLine,
3836
- "data-testid": "tafform-tac-message-line"
4011
+ "data-testid": "tafform-tac-message-line",
4012
+ sx: {
4013
+ textIndent: '-0.7em',
4014
+ borderRadius: '3px'
4015
+ }
3837
4016
  }, line);
3838
4017
  })), /*#__PURE__*/React__default["default"].createElement(TafFormRow, {
3839
4018
  disabled: isDisabled,
3840
- onAddChangeGroup: onAddRow
4019
+ onAddChangeGroupBelow: onAddRow,
4020
+ onClearRow: _onClearRow
3841
4021
  }), /*#__PURE__*/React__default["default"].createElement(reactSortablejs.ReactSortable, {
3842
4022
  tag: "div",
3843
4023
  list: fields,
@@ -3855,13 +4035,17 @@
3855
4035
  }, fields.map(function (item, index) {
3856
4036
  return /*#__PURE__*/React__default["default"].createElement(TafFormRow, {
3857
4037
  field: item,
3858
- className: classes.formRow,
3859
4038
  key: item.id,
3860
4039
  index: index,
3861
- lastRow: fields.length === index + 1,
3862
4040
  disabled: isDisabled,
3863
4041
  onRemoveChangeGroup: onRemoverow,
3864
- onAddChangeGroup: onAddRow,
4042
+ onAddChangeGroupBelow: onAddRow,
4043
+ onAddChangeGroupAbove: function onAddChangeGroupAbove() {
4044
+ return onAddRow(index, true);
4045
+ },
4046
+ onClearRow: function onClearRow() {
4047
+ return _onClearRow(index, true);
4048
+ },
3865
4049
  isChangeGroup: true,
3866
4050
  dragHandle: /*#__PURE__*/React__default["default"].createElement(DragHandle, {
3867
4051
  isDisabled: fields.length === 1 || isDisabled,
@@ -3869,9 +4053,15 @@
3869
4053
  index: index
3870
4054
  })
3871
4055
  });
3872
- })), !isDisabled && /*#__PURE__*/React__default["default"].createElement(TafFormButtons, {
4056
+ })), // TODO: these buttons should be combined, and the Issuesbuton should be separate
4057
+ !isDisabled ? /*#__PURE__*/React__default["default"].createElement(TafFormButtons, {
3873
4058
  tafAction: tafAction,
3874
4059
  onTafFormButtonPress: onTafButtonPress
4060
+ }) : /*#__PURE__*/React__default["default"].createElement(TafListButtons, {
4061
+ uuid: originalTaf.uuid,
4062
+ canBe: tafFromBackend.canbe,
4063
+ onClickTafActionButton: onTafViewModeButtonPress,
4064
+ testId: "newtaflist-canbebuttons"
3875
4065
  }), hiddenInputFields.map(function (field) {
3876
4066
  return /*#__PURE__*/React__default["default"].createElement(formFields.ReactHookFormHiddenInput, {
3877
4067
  name: field,
@@ -3958,11 +4148,12 @@
3958
4148
  isDisabled: isDisabled,
3959
4149
  tafAction: tafAction,
3960
4150
  staticTAC: TAC,
3961
- onFormAction: onFormAction
4151
+ onFormAction: onFormAction,
4152
+ tafFromBackend: tafFromBackend
3962
4153
  }));
3963
4154
  };
3964
4155
 
3965
- var useStyles$6 = makeStyles__default["default"]({
4156
+ var useStyles$5 = makeStyles__default["default"]({
3966
4157
  dialogHeader: {
3967
4158
  borderRadius: '3px',
3968
4159
  border: 'solid 1px #f6f5f5',
@@ -3997,7 +4188,7 @@
3997
4188
  onFormAction = _a.onFormAction,
3998
4189
  other = __rest(_a, ["open", "toggleDialogStatus", "titleComponent", "children", "onClose", "alertBanner", "onFormAction"]);
3999
4190
 
4000
- var classes = useStyles$6();
4191
+ var classes = useStyles$5();
4001
4192
  return /*#__PURE__*/React__namespace.createElement(material.Dialog, __assign({
4002
4193
  "data-testid": "contentDialog",
4003
4194
  open: open,
@@ -4090,7 +4281,7 @@
4090
4281
 
4091
4282
  return 'Draft';
4092
4283
  };
4093
- var useStyles$5 = makeStyles__default["default"]({
4284
+ var useStyles$4 = makeStyles__default["default"]({
4094
4285
  cardWrapper: {
4095
4286
  width: '100%'
4096
4287
  },
@@ -4116,7 +4307,7 @@
4116
4307
  TAC = _b === void 0 ? '' : _b,
4117
4308
  _c = _a.showTac,
4118
4309
  showTac = _c === void 0 ? false : _c;
4119
- var classes = useStyles$5();
4310
+ var classes = useStyles$4();
4120
4311
  var validTimeDate = moment__default["default"].utc(taf.validDateStart).format('DD MMM');
4121
4312
  var baseTime = moment__default["default"].utc(taf.baseTime).format('HH:mm');
4122
4313
  return /*#__PURE__*/React__default["default"].createElement(material.Card, {
@@ -4290,72 +4481,6 @@
4290
4481
  }, children);
4291
4482
  };
4292
4483
 
4293
- /* *
4294
- * Licensed under the Apache License, Version 2.0 (the "License");
4295
- * you may not use this file except in compliance with the License.
4296
- * You may obtain a copy of the License at
4297
- *
4298
- * http://www.apache.org/licenses/LICENSE-2.0
4299
- *
4300
- * Unless required by applicable law or agreed to in writing, software
4301
- * distributed under the License is distributed on an "AS IS" BASIS,
4302
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4303
- * See the License for the specific language governing permissions and
4304
- * limitations under the License.
4305
- *
4306
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4307
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
4308
- * */
4309
- var useStyles$4 = makeStyles__default["default"]({
4310
- actionButtons: {
4311
- paddingRight: '98px',
4312
- paddingTop: '40px',
4313
- paddingBottom: '16px'
4314
- }
4315
- });
4316
-
4317
- var TafListButtons = function TafListButtons(_a) {
4318
- var uuid = _a.uuid,
4319
- canBe = _a.canBe,
4320
- onClickTafActionButton = _a.onClickTafActionButton;
4321
- var classes = useStyles$4();
4322
- return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default["default"].createElement(material.Grid, {
4323
- container: true,
4324
- alignItems: "center",
4325
- justifyContent: "flex-end",
4326
- "data-testid": "taflist-canbebuttons",
4327
- spacing: 1,
4328
- className: classes.actionButtons
4329
- }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
4330
- item: true
4331
- }, canBe.includes('CANCELLED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
4332
- "data-testid": "canceltaf",
4333
- variant: "outlined",
4334
- color: "secondary",
4335
- onClick: function onClick() {
4336
- return onClickTafActionButton(uuid, 'CANCEL');
4337
- }
4338
- }, "Cancel")), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
4339
- item: true
4340
- }, canBe.includes('CORRECTED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
4341
- "data-testid": "correctaf",
4342
- variant: "outlined",
4343
- color: "secondary",
4344
- onClick: function onClick() {
4345
- return onClickTafActionButton(uuid, 'CORRECT');
4346
- }
4347
- }, "Correct")), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
4348
- item: true
4349
- }, canBe.includes('AMENDED') && /*#__PURE__*/React__default["default"].createElement(material.Button, {
4350
- "data-testid": "amendtaf",
4351
- variant: "outlined",
4352
- color: "secondary",
4353
- onClick: function onClick() {
4354
- return onClickTafActionButton(uuid, 'AMEND');
4355
- }
4356
- }, "Amend")));
4357
- };
4358
-
4359
4484
  var useStyles$3 = makeStyles__default["default"]({
4360
4485
  accordion: {
4361
4486
  marginBottom: '5px'
@@ -4414,7 +4539,7 @@
4414
4539
  } : {}, {
4415
4540
  onClick: function onClick() {
4416
4541
  if (popOut) {
4417
- onClickTafActionButton(tafListItem.taf.uuid, fromStatusToAction(tafListItem.taf.status));
4542
+ onClickTafActionButton(fromStatusToAction(tafListItem.taf.status), tafListItem.taf.uuid);
4418
4543
  }
4419
4544
  },
4420
4545
  TransitionProps: {
@@ -4736,7 +4861,7 @@
4736
4861
 
4737
4862
  }, [selectedTafId]);
4738
4863
 
4739
- var onClickTafActionButton = function onClickTafActionButton(tafUuid, action) {
4864
+ var onClickTafActionButton = function onClickTafActionButton(action, tafUuid) {
4740
4865
  if (action === 'CANCEL') {
4741
4866
  confirmDialog({
4742
4867
  title: 'Cancel TAF',