Skip to content

Commit 6d00010

Browse files
committed
Update UI to make HS tariff number field required
1 parent b4ca946 commit 6d00010

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Customs/WooShippingCustomsItem.swift

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,29 @@ struct WooShippingCustomsItem: View {
106106
.subheadlineStyle()
107107
.padding(.top, Layout.collapsibleViewVerticalSpacing)
108108

109-
TextField(Localization.HSTariffNumberPlaceholder, text: $viewModel.hsTariffNumber)
110-
.keyboardType(.numberPad)
111-
.padding(Layout.extraPadding)
112-
.roundedBorder(cornerRadius: Layout.borderCornerRadius, lineColor: Color(.separator), lineWidth: Layout.borderLineWidth)
109+
/// HS tariff number
110+
TextField(
111+
viewModel.isHSTariffNumberRequired ? "" : Localization.HSTariffNumberPlaceholder,
112+
text: $viewModel.hsTariffNumber
113+
)
114+
.keyboardType(.numberPad)
115+
.padding(Layout.extraPadding)
116+
.roundedBorder(
117+
cornerRadius: Layout.borderCornerRadius,
118+
lineColor: (viewModel.isHSTariffNumberRequired && viewModel.hsTariffNumber.isEmpty) ? warningRedColor : Color(.separator),
119+
lineWidth: Layout.borderLineWidth
120+
)
121+
122+
Text(Localization.valueRequiredWarningText)
123+
.foregroundColor(warningRedColor)
124+
.footnoteStyle()
125+
.renderedIf(viewModel.isHSTariffNumberRequired && viewModel.hsTariffNumber.isEmpty)
113126

114127
Text(Localization.tariffNumberRulesWarningText)
115128
.foregroundColor(warningRedColor)
116129
.footnoteStyle()
117130
.renderedIf(!viewModel.isValidTariffNumber)
131+
///
118132

119133
Button {
120134
isShowingHSTarrifInfoWebView = true

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Customs/WooShippingCustomsItemViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final class WooShippingCustomsItemViewModel: ObservableObject {
7171
///
7272
/// Introduced to enforce tariff validation
7373
/// if `true` then `hsTariffNumber` must be valid for `requiredInformationIsEntered` to be `true`
74-
@Published private var isHSTariffNumberRequired: Bool = false
74+
@Published private(set) var isHSTariffNumberRequired: Bool = false
7575

7676
init(itemName: String,
7777
itemProductID: Int64,

0 commit comments

Comments
 (0)