Skip to content

Commit 498edc7

Browse files
committed
Update UI to make HS tariff number field required
1 parent 581a649 commit 498edc7

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
@@ -105,15 +105,29 @@ struct WooShippingCustomsItem: View {
105105
.subheadlineStyle()
106106
.padding(.top, Layout.collapsibleViewVerticalSpacing)
107107

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

113126
Text(Localization.tariffNumberRulesWarningText)
114127
.foregroundColor(warningRedColor)
115128
.footnoteStyle()
116129
.renderedIf(!viewModel.isValidTariffNumber)
130+
///
117131

118132
Button {
119133
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
@@ -69,7 +69,7 @@ final class WooShippingCustomsItemViewModel: ObservableObject {
6969
///
7070
/// Introduced to enforce tariff validation
7171
/// if `true` then `hsTariffNumber` must be valid for `requiredInformationIsEntered` to be `true`
72-
@Published private var isHSTariffNumberRequired: Bool = false
72+
@Published private(set) var isHSTariffNumberRequired: Bool = false
7373

7474
init(itemName: String,
7575
itemProductID: Int64,

0 commit comments

Comments
 (0)