diff --git a/migrations/app/ddl_migrations/ddl_tables/20250221195354_tbl_alter_entitlements_B-22651.up.sql b/migrations/app/ddl_migrations/ddl_tables/20250221195354_tbl_alter_entitlements_B-22651.up.sql new file mode 100644 index 00000000000..1ca9d4a3d88 --- /dev/null +++ b/migrations/app/ddl_migrations/ddl_tables/20250221195354_tbl_alter_entitlements_B-22651.up.sql @@ -0,0 +1,5 @@ +--B-22651 Maria Traskowsky Add ub_weight_restriction column to entitlements table +ALTER TABLE entitlements +ADD COLUMN IF NOT EXISTS ub_weight_restriction int; +COMMENT ON COLUMN entitlements.weight_restriction IS 'The weight restriction of the entitlement.'; +COMMENT ON COLUMN entitlements.ub_weight_restriction IS 'The UB weight restriction of the entitlement.'; diff --git a/migrations/app/ddl_tables_manifest.txt b/migrations/app/ddl_tables_manifest.txt index 0cde9a9e6f9..d769d9dfae5 100644 --- a/migrations/app/ddl_tables_manifest.txt +++ b/migrations/app/ddl_tables_manifest.txt @@ -1,5 +1,6 @@ # This is the tables migrations manifest. # If a migration is not recorded here, then it will error. # Naming convention: tbl_some_table.up.sql running will create this file. +20250221195354_tbl_alter_entitlements_B-22651.up.sql 20250224200700_tbl_ppm_shipments.up.sql 20250227211221_tbl_re_country_prn_divisions.up.sql diff --git a/pkg/gen/ghcapi/embedded_spec.go b/pkg/gen/ghcapi/embedded_spec.go index 2b0f92b64a8..a1e4e130a28 100644 --- a/pkg/gen/ghcapi/embedded_spec.go +++ b/pkg/gen/ghcapi/embedded_spec.go @@ -7440,6 +7440,12 @@ func init() { "x-nullable": true, "example": 500 }, + "ubWeightRestriction": { + "description": "Indicates the UB weight restriction for the move to a particular location.", + "type": "integer", + "x-nullable": true, + "example": 1500 + }, "weightRestriction": { "description": "Indicates the weight restriction for a move to a particular location.", "type": "integer", @@ -8657,6 +8663,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "description": "Indicates the UB weight restriction for the move to a particular location.", + "type": "integer", + "x-nullable": true, + "example": 1500 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", @@ -14575,6 +14587,12 @@ func init() { "x-nullable": true, "example": 500 }, + "ubWeightRestriction": { + "description": "Indicates the UB weight restriction for the move to a particular location.", + "type": "integer", + "x-nullable": true, + "example": 1500 + }, "weightRestriction": { "description": "Indicates the weight restriction for the move to a particular location.", "type": "integer", @@ -24976,6 +24994,12 @@ func init() { "x-nullable": true, "example": 500 }, + "ubWeightRestriction": { + "description": "Indicates the UB weight restriction for the move to a particular location.", + "type": "integer", + "x-nullable": true, + "example": 1500 + }, "weightRestriction": { "description": "Indicates the weight restriction for a move to a particular location.", "type": "integer", @@ -26193,6 +26217,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "description": "Indicates the UB weight restriction for the move to a particular location.", + "type": "integer", + "x-nullable": true, + "example": 1500 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", @@ -32243,6 +32273,12 @@ func init() { "x-nullable": true, "example": 500 }, + "ubWeightRestriction": { + "description": "Indicates the UB weight restriction for the move to a particular location.", + "type": "integer", + "x-nullable": true, + "example": 1500 + }, "weightRestriction": { "description": "Indicates the weight restriction for the move to a particular location.", "type": "integer", diff --git a/pkg/gen/ghcmessages/counseling_update_allowance_payload.go b/pkg/gen/ghcmessages/counseling_update_allowance_payload.go index 5f8c46ecd7b..665e28228c9 100644 --- a/pkg/gen/ghcmessages/counseling_update_allowance_payload.go +++ b/pkg/gen/ghcmessages/counseling_update_allowance_payload.go @@ -68,6 +68,10 @@ type CounselingUpdateAllowancePayload struct { // Example: 500 UbAllowance *int64 `json:"ubAllowance,omitempty"` + // Indicates the UB weight restriction for the move to a particular location. + // Example: 1500 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // Indicates the weight restriction for a move to a particular location. // Example: 1500 WeightRestriction *int64 `json:"weightRestriction,omitempty"` diff --git a/pkg/gen/ghcmessages/entitlements.go b/pkg/gen/ghcmessages/entitlements.go index e856534cc33..13ff7255e31 100644 --- a/pkg/gen/ghcmessages/entitlements.go +++ b/pkg/gen/ghcmessages/entitlements.go @@ -87,6 +87,10 @@ type Entitlements struct { // Example: 500 TotalWeight int64 `json:"totalWeight,omitempty"` + // Indicates the UB weight restriction for the move to a particular location. + // Example: 1500 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage. // Example: 3 UnaccompaniedBaggageAllowance *int64 `json:"unaccompaniedBaggageAllowance,omitempty"` diff --git a/pkg/gen/ghcmessages/update_allowance_payload.go b/pkg/gen/ghcmessages/update_allowance_payload.go index 2c37d3a7944..386aad8cea0 100644 --- a/pkg/gen/ghcmessages/update_allowance_payload.go +++ b/pkg/gen/ghcmessages/update_allowance_payload.go @@ -68,6 +68,10 @@ type UpdateAllowancePayload struct { // Example: 500 UbAllowance *int64 `json:"ubAllowance,omitempty"` + // Indicates the UB weight restriction for the move to a particular location. + // Example: 1500 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // Indicates the weight restriction for the move to a particular location. // Example: 1500 WeightRestriction *int64 `json:"weightRestriction,omitempty"` diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index ac5b2533fc5..414c6510ea5 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -1861,6 +1861,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-formatting": "weight", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", @@ -7416,6 +7422,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-formatting": "weight", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", diff --git a/pkg/gen/primemessages/entitlements.go b/pkg/gen/primemessages/entitlements.go index 65870bfa8e6..fb93c9a5050 100644 --- a/pkg/gen/primemessages/entitlements.go +++ b/pkg/gen/primemessages/entitlements.go @@ -76,6 +76,10 @@ type Entitlements struct { // Example: 500 TotalWeight int64 `json:"totalWeight,omitempty"` + // ub weight restriction + // Example: 1200 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage. // Example: 3 UnaccompaniedBaggageAllowance *int64 `json:"unaccompaniedBaggageAllowance,omitempty"` diff --git a/pkg/gen/primev2api/embedded_spec.go b/pkg/gen/primev2api/embedded_spec.go index 85afde7f3e3..a009ce7a9ba 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -1059,6 +1059,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-formatting": "weight", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", @@ -5040,6 +5046,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-formatting": "weight", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", diff --git a/pkg/gen/primev2messages/entitlements.go b/pkg/gen/primev2messages/entitlements.go index 58280696ab1..cc64b5c36ed 100644 --- a/pkg/gen/primev2messages/entitlements.go +++ b/pkg/gen/primev2messages/entitlements.go @@ -76,6 +76,10 @@ type Entitlements struct { // Example: 500 TotalWeight int64 `json:"totalWeight,omitempty"` + // ub weight restriction + // Example: 1200 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage. // Example: 3 UnaccompaniedBaggageAllowance *int64 `json:"unaccompaniedBaggageAllowance,omitempty"` diff --git a/pkg/gen/primev3api/embedded_spec.go b/pkg/gen/primev3api/embedded_spec.go index 582a95400fd..4dee77abfb4 100644 --- a/pkg/gen/primev3api/embedded_spec.go +++ b/pkg/gen/primev3api/embedded_spec.go @@ -1221,6 +1221,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-formatting": "weight", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", @@ -5912,6 +5918,12 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-formatting": "weight", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", diff --git a/pkg/gen/primev3messages/entitlements.go b/pkg/gen/primev3messages/entitlements.go index 2ef73ccfbf5..fbfbaa7447f 100644 --- a/pkg/gen/primev3messages/entitlements.go +++ b/pkg/gen/primev3messages/entitlements.go @@ -76,6 +76,10 @@ type Entitlements struct { // Example: 500 TotalWeight int64 `json:"totalWeight,omitempty"` + // ub weight restriction + // Example: 1200 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage. // Example: 3 UnaccompaniedBaggageAllowance *int64 `json:"unaccompaniedBaggageAllowance,omitempty"` diff --git a/pkg/gen/supportapi/embedded_spec.go b/pkg/gen/supportapi/embedded_spec.go index 3c46242150b..144144bcbb4 100644 --- a/pkg/gen/supportapi/embedded_spec.go +++ b/pkg/gen/supportapi/embedded_spec.go @@ -1178,6 +1178,11 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", @@ -4151,6 +4156,11 @@ func init() { "x-formatting": "weight", "example": 500 }, + "ubWeightRestriction": { + "type": "integer", + "x-nullable": true, + "example": 1200 + }, "unaccompaniedBaggageAllowance": { "description": "The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage.", "type": "integer", diff --git a/pkg/gen/supportmessages/entitlement.go b/pkg/gen/supportmessages/entitlement.go index f1fd0f5f8c9..64029c204a2 100644 --- a/pkg/gen/supportmessages/entitlement.go +++ b/pkg/gen/supportmessages/entitlement.go @@ -78,6 +78,10 @@ type Entitlement struct { // Example: 500 TotalWeight int64 `json:"totalWeight,omitempty"` + // ub weight restriction + // Example: 1200 + UbWeightRestriction *int64 `json:"ubWeightRestriction,omitempty"` + // The amount of weight in pounds that the move is entitled for shipment types of Unaccompanied Baggage. // Example: 3 UnaccompaniedBaggageAllowance *int64 `json:"unaccompaniedBaggageAllowance,omitempty"` diff --git a/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go b/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go index d384f326414..a8ec0b7b2d0 100644 --- a/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go +++ b/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go @@ -751,6 +751,10 @@ func Entitlement(entitlement *models.Entitlement) *ghcmessages.Entitlements { if entitlement.WeightRestriction != nil { weightRestriction = models.Int64Pointer(int64(*entitlement.WeightRestriction)) } + var ubWeightRestriction *int64 + if entitlement.UBWeightRestriction != nil { + ubWeightRestriction = models.Int64Pointer(int64(*entitlement.UBWeightRestriction)) + } return &ghcmessages.Entitlements{ ID: strfmt.UUID(entitlement.ID.String()), @@ -769,9 +773,10 @@ func Entitlement(entitlement *models.Entitlement) *ghcmessages.Entitlements { AccompaniedTour: accompaniedTour, UnaccompaniedBaggageAllowance: ubAllowance, OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment, - GunSafe: gunSafe, - WeightRestriction: weightRestriction, - ETag: etag.GenerateEtag(entitlement.UpdatedAt), + GunSafe: gunSafe, + WeightRestriction: weightRestriction, + UbWeightRestriction: ubWeightRestriction, + ETag: etag.GenerateEtag(entitlement.UpdatedAt), } } diff --git a/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go b/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go index 5ffd6055a9c..9210cc3a5a5 100644 --- a/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go +++ b/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go @@ -669,6 +669,7 @@ func (suite *PayloadsSuite) TestEntitlement() { authorizedWeight := 8000 ubAllowance := 300 weightRestriction := 1000 + ubWeightRestriction := 1200 entitlement := &models.Entitlement{ ID: entitlementID, @@ -687,6 +688,7 @@ func (suite *PayloadsSuite) TestEntitlement() { UpdatedAt: time.Now(), UBAllowance: &ubAllowance, WeightRestriction: &weightRestriction, + UBWeightRestriction: &ubWeightRestriction, } returnedEntitlement := Entitlement(entitlement) @@ -709,6 +711,7 @@ func (suite *PayloadsSuite) TestEntitlement() { suite.Equal(dependentsUnderTwelve, int(*returnedEntitlement.DependentsUnderTwelve)) suite.Equal(dependentsTwelveAndOver, int(*returnedEntitlement.DependentsTwelveAndOver)) suite.Equal(weightRestriction, int(*returnedEntitlement.WeightRestriction)) + suite.Equal(ubWeightRestriction, int(*returnedEntitlement.UbWeightRestriction)) } func (suite *PayloadsSuite) TestCreateCustomer() { diff --git a/pkg/handlers/ghcapi/orders.go b/pkg/handlers/ghcapi/orders.go index 5604477ffad..d4b7df3fe04 100644 --- a/pkg/handlers/ghcapi/orders.go +++ b/pkg/handlers/ghcapi/orders.go @@ -291,6 +291,7 @@ func (h CreateOrderHandler) Handle(params orderop.CreateOrderParams) middleware. } var weightRestriction *int + var ubWeightRestriction *int entitlement := models.Entitlement{ DependentsAuthorized: payload.HasDependents, @@ -303,6 +304,7 @@ func (h CreateOrderHandler) Handle(params orderop.CreateOrderParams) middleware. DependentsTwelveAndOver: dependentsTwelveAndOver, UBAllowance: &weightAllotment.UnaccompaniedBaggageAllowance, WeightRestriction: weightRestriction, + UBWeightRestriction: ubWeightRestriction, } if saveEntitlementErr := appCtx.DB().Save(&entitlement); saveEntitlementErr != nil { diff --git a/pkg/handlers/primeapi/payloads/model_to_payload.go b/pkg/handlers/primeapi/payloads/model_to_payload.go index 5f5106e6569..f431e21a47d 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload.go @@ -266,6 +266,10 @@ func Entitlement(entitlement *models.Entitlement) *primemessages.Entitlements { if entitlement.WeightRestriction != nil { weightRestriction = int64(*entitlement.WeightRestriction) } + var ubWeightRestriction int64 + if entitlement.UBWeightRestriction != nil { + ubWeightRestriction = int64(*entitlement.UBWeightRestriction) + } return &primemessages.Entitlements{ ID: strfmt.UUID(entitlement.ID.String()), AuthorizedWeight: authorizedWeight, @@ -278,11 +282,12 @@ func Entitlement(entitlement *models.Entitlement) *primemessages.Entitlements { ProGearWeightSpouse: int64(entitlement.ProGearWeightSpouse), RequiredMedicalEquipmentWeight: int64(entitlement.RequiredMedicalEquipmentWeight), OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment, - StorageInTransit: sit, - TotalDependents: totalDependents, - TotalWeight: totalWeight, - WeightRestriction: &weightRestriction, - ETag: etag.GenerateEtag(entitlement.UpdatedAt), + StorageInTransit: sit, + TotalDependents: totalDependents, + TotalWeight: totalWeight, + WeightRestriction: &weightRestriction, + UbWeightRestriction: &ubWeightRestriction, + ETag: etag.GenerateEtag(entitlement.UpdatedAt), } } diff --git a/pkg/handlers/primeapi/payloads/model_to_payload_test.go b/pkg/handlers/primeapi/payloads/model_to_payload_test.go index 3ec3fda6327..37934198c4a 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload_test.go @@ -352,6 +352,7 @@ func (suite *PayloadsSuite) TestEntitlement() { CreatedAt: time.Now(), UpdatedAt: time.Now(), WeightRestriction: models.IntPointer(1000), + UBWeightRestriction: models.IntPointer(1200), } // TotalWeight needs to read from the internal weightAllotment, in this case 7000 lbs w/o dependents and @@ -375,6 +376,7 @@ func (suite *PayloadsSuite) TestEntitlement() { suite.Equal(int64(1000), payload.ProGearWeight) suite.Equal(int64(750), payload.ProGearWeightSpouse) suite.Equal(int64(1000), *payload.WeightRestriction) + suite.Equal(int64(1200), *payload.UbWeightRestriction) suite.NotEmpty(payload.ETag) suite.Equal(etag.GenerateEtag(entitlement.UpdatedAt), payload.ETag) }) diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload.go b/pkg/handlers/primeapiv2/payloads/model_to_payload.go index 7b39c88c803..4ab1ada8a06 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload.go @@ -195,6 +195,10 @@ func Entitlement(entitlement *models.Entitlement) *primev2messages.Entitlements if entitlement.WeightRestriction != nil { weightRestriction = int64(*entitlement.WeightRestriction) } + var ubWeightRestriction int64 + if entitlement.UBWeightRestriction != nil { + ubWeightRestriction = int64(*entitlement.UBWeightRestriction) + } return &primev2messages.Entitlements{ ID: strfmt.UUID(entitlement.ID.String()), AuthorizedWeight: authorizedWeight, @@ -207,11 +211,12 @@ func Entitlement(entitlement *models.Entitlement) *primev2messages.Entitlements ProGearWeightSpouse: int64(entitlement.ProGearWeightSpouse), RequiredMedicalEquipmentWeight: int64(entitlement.RequiredMedicalEquipmentWeight), OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment, - StorageInTransit: sit, - TotalDependents: totalDependents, - TotalWeight: totalWeight, - WeightRestriction: &weightRestriction, - ETag: etag.GenerateEtag(entitlement.UpdatedAt), + StorageInTransit: sit, + TotalDependents: totalDependents, + TotalWeight: totalWeight, + WeightRestriction: &weightRestriction, + UbWeightRestriction: &ubWeightRestriction, + ETag: etag.GenerateEtag(entitlement.UpdatedAt), } } diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go b/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go index ec53f8a3457..f81d43a4b44 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go @@ -304,6 +304,7 @@ func (suite *PayloadsSuite) TestEntitlement() { CreatedAt: time.Now(), UpdatedAt: time.Now(), WeightRestriction: models.IntPointer(1000), + UBWeightRestriction: models.IntPointer(1200), } payload := Entitlement(&entitlement) @@ -327,6 +328,7 @@ func (suite *PayloadsSuite) TestEntitlement() { suite.Equal(int64(0), payload.TotalWeight) suite.Equal(int64(0), *payload.UnaccompaniedBaggageAllowance) suite.Equal(int64(1000), *payload.WeightRestriction) + suite.Equal(int64(1200), *payload.UbWeightRestriction) }) suite.Run("Success - Returns the entitlement payload with all optional fields populated", func() { diff --git a/pkg/handlers/primeapiv3/payloads/model_to_payload.go b/pkg/handlers/primeapiv3/payloads/model_to_payload.go index b7338ffc04a..d4d2a17d1be 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload.go @@ -226,6 +226,10 @@ func Entitlement(entitlement *models.Entitlement) *primev3messages.Entitlements if entitlement.WeightRestriction != nil { weightRestriction = int64(*entitlement.WeightRestriction) } + var ubWeightRestriction int64 + if entitlement.UBWeightRestriction != nil { + ubWeightRestriction = int64(*entitlement.UBWeightRestriction) + } return &primev3messages.Entitlements{ ID: strfmt.UUID(entitlement.ID.String()), AuthorizedWeight: authorizedWeight, @@ -237,11 +241,12 @@ func Entitlement(entitlement *models.Entitlement) *primev3messages.Entitlements ProGearWeightSpouse: int64(entitlement.ProGearWeightSpouse), RequiredMedicalEquipmentWeight: int64(entitlement.RequiredMedicalEquipmentWeight), OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment, - StorageInTransit: sit, - TotalDependents: totalDependents, - TotalWeight: totalWeight, - WeightRestriction: &weightRestriction, - ETag: etag.GenerateEtag(entitlement.UpdatedAt), + StorageInTransit: sit, + TotalDependents: totalDependents, + TotalWeight: totalWeight, + WeightRestriction: &weightRestriction, + UbWeightRestriction: &ubWeightRestriction, + ETag: etag.GenerateEtag(entitlement.UpdatedAt), } } diff --git a/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go b/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go index dec88a480cb..f0716cf32c7 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go @@ -561,6 +561,7 @@ func (suite *PayloadsSuite) TestEntitlement() { CreatedAt: time.Now(), UpdatedAt: time.Now(), WeightRestriction: models.IntPointer(1000), + UBWeightRestriction: models.IntPointer(1200), } payload := Entitlement(&entitlement) @@ -584,6 +585,7 @@ func (suite *PayloadsSuite) TestEntitlement() { suite.Equal(int64(0), payload.TotalWeight) suite.Equal(int64(0), *payload.UnaccompaniedBaggageAllowance) suite.Equal(int64(1000), *payload.WeightRestriction) + suite.Equal(int64(1200), *payload.UbWeightRestriction) }) suite.Run("Success - Returns the entitlement payload with all optional fields populated", func() { diff --git a/pkg/models/ghc_entitlements.go b/pkg/models/ghc_entitlements.go index f56c915ad19..c9036767722 100644 --- a/pkg/models/ghc_entitlements.go +++ b/pkg/models/ghc_entitlements.go @@ -35,6 +35,7 @@ type Entitlement struct { ProGearWeight int `db:"pro_gear_weight"` ProGearWeightSpouse int `db:"pro_gear_weight_spouse"` WeightRestriction *int `db:"weight_restriction"` + UBWeightRestriction *int `db:"ub_weight_restriction"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` } diff --git a/pkg/services/order/order_updater.go b/pkg/services/order/order_updater.go index 3dab6939b5e..4e3893a0e86 100644 --- a/pkg/services/order/order_updater.go +++ b/pkg/services/order/order_updater.go @@ -496,6 +496,13 @@ func allowanceFromTOOPayload(appCtx appcontext.AppContext, existingOrder models. order.Entitlement.WeightRestriction = nil } + if payload.UbWeightRestriction != nil { + ubWeightRestriction := int(*payload.UbWeightRestriction) + order.Entitlement.UBWeightRestriction = &ubWeightRestriction + } else { + order.Entitlement.UBWeightRestriction = nil + } + if payload.AccompaniedTour != nil { order.Entitlement.AccompaniedTour = payload.AccompaniedTour } @@ -602,6 +609,13 @@ func allowanceFromCounselingPayload(appCtx appcontext.AppContext, existingOrder order.Entitlement.WeightRestriction = nil } + if payload.UbWeightRestriction != nil { + ubWeightRestriction := int(*payload.UbWeightRestriction) + order.Entitlement.UBWeightRestriction = &ubWeightRestriction + } else { + order.Entitlement.UBWeightRestriction = nil + } + if payload.AccompaniedTour != nil { order.Entitlement.AccompaniedTour = payload.AccompaniedTour } diff --git a/pkg/services/order/order_updater_test.go b/pkg/services/order/order_updater_test.go index 25674eb620f..fe91426d7f6 100644 --- a/pkg/services/order/order_updater_test.go +++ b/pkg/services/order/order_updater_test.go @@ -678,6 +678,32 @@ func (suite *OrderServiceSuite) TestUpdateAllowanceAsTOO() { suite.Nil(updatedOrder.Entitlement.WeightRestriction) }) + suite.Run("Updates the UB allowance when ubWeightRestriction is null", func() { + moveRouter := move.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) + orderUpdater := NewOrderUpdater(moveRouter) + order := factory.BuildNeedsServiceCounselingMove(suite.DB(), []factory.Customization{ + { + Model: models.Entitlement{ + UBWeightRestriction: models.IntPointer(1200), + }, + }, + }, nil).Orders + + eTag := etag.GenerateEtag(order.UpdatedAt) + + payload := ghcmessages.UpdateAllowancePayload{ + UbWeightRestriction: nil, + } + + updatedOrder, _, err := orderUpdater.UpdateAllowanceAsTOO(suite.AppContextForTest(), order.ID, payload, eTag) + suite.NoError(err) + + var orderInDB models.Order + err = suite.DB().Find(&orderInDB, order.ID) + suite.NoError(err) + suite.Nil(updatedOrder.Entitlement.UBWeightRestriction) + }) + suite.Run("Updates the allowance when all fields are valid with dependents", func() { moveRouter := move.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) orderUpdater := NewOrderUpdater(moveRouter) @@ -772,6 +798,7 @@ func (suite *OrderServiceSuite) TestUpdateAllowanceAsCounselor() { DependentsTwelveAndOver: models.Int64Pointer(1), DependentsUnderTwelve: models.Int64Pointer(2), WeightRestriction: models.Int64Pointer(0), + UbWeightRestriction: models.Int64Pointer(0), } updatedOrder, _, err := orderUpdater.UpdateAllowanceAsCounselor(suite.AppContextForTest(), order.ID, payload, eTag) @@ -800,6 +827,7 @@ func (suite *OrderServiceSuite) TestUpdateAllowanceAsCounselor() { rmeWeight := models.Int64Pointer(10000) eTag := etag.GenerateEtag(order.UpdatedAt) weightRestriction := models.Int64Pointer(5000) + ubWeightRestriction := models.Int64Pointer(2000) payload := ghcmessages.CounselingUpdateAllowancePayload{ Agency: &affiliation, @@ -809,6 +837,7 @@ func (suite *OrderServiceSuite) TestUpdateAllowanceAsCounselor() { ProGearWeightSpouse: proGearWeightSpouse, RequiredMedicalEquipmentWeight: rmeWeight, WeightRestriction: weightRestriction, + UbWeightRestriction: ubWeightRestriction, } updatedOrder, _, err := orderUpdater.UpdateAllowanceAsCounselor(suite.AppContextForTest(), order.ID, payload, eTag) @@ -829,6 +858,7 @@ func (suite *OrderServiceSuite) TestUpdateAllowanceAsCounselor() { suite.EqualValues(payload.Agency, fetchedSM.Affiliation) suite.Equal(*updatedOrder.Entitlement.DBAuthorizedWeight, 16000) suite.Equal(*payload.WeightRestriction, int64(*updatedOrder.Entitlement.WeightRestriction)) + suite.Equal(*payload.UbWeightRestriction, int64(*updatedOrder.Entitlement.UBWeightRestriction)) }) suite.Run("Updates the allowance when weightRestriction is null", func() { @@ -857,6 +887,32 @@ func (suite *OrderServiceSuite) TestUpdateAllowanceAsCounselor() { suite.Nil(updatedOrder.Entitlement.WeightRestriction) }) + suite.Run("Updates the UB allowance when ubWeightRestriction is null", func() { + moveRouter := move.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) + orderUpdater := NewOrderUpdater(moveRouter) + order := factory.BuildNeedsServiceCounselingMove(suite.DB(), []factory.Customization{ + { + Model: models.Entitlement{ + UBWeightRestriction: models.IntPointer(1200), + }, + }, + }, nil).Orders + + eTag := etag.GenerateEtag(order.UpdatedAt) + + payload := ghcmessages.CounselingUpdateAllowancePayload{ + UbWeightRestriction: nil, + } + + updatedOrder, _, err := orderUpdater.UpdateAllowanceAsCounselor(suite.AppContextForTest(), order.ID, payload, eTag) + suite.NoError(err) + + var orderInDB models.Order + err = suite.DB().Find(&orderInDB, order.ID) + suite.NoError(err) + suite.Nil(updatedOrder.Entitlement.UBWeightRestriction) + }) + suite.Run("Updates the allowance when all fields are valid with dependents present and authorized", func() { moveRouter := move.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) orderUpdater := NewOrderUpdater(moveRouter) diff --git a/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.jsx b/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.jsx index 9f15de8621a..3bd62b2ac71 100644 --- a/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.jsx +++ b/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.jsx @@ -23,6 +23,9 @@ const AllowancesDetailForm = ({ header, entitlements, branchOptions, formIsDisab ); const { values, setFieldValue } = useFormikContext(); const [isAdminWeightLocationChecked, setIsAdminWeightLocationChecked] = useState(entitlements?.weightRestriction > 0); + const [isAdminUBWeightLocationChecked, setIsAdminUBWeightLocationChecked] = useState( + entitlements?.ubWeightRestriction > 0, + ); useEffect(() => { // Functional component version of "componentDidMount" // By leaving the dependency array empty this will only run once @@ -41,6 +44,12 @@ const AllowancesDetailForm = ({ header, entitlements, branchOptions, formIsDisab } }, [setFieldValue, values.weightRestriction, isAdminWeightLocationChecked]); + useEffect(() => { + if (!isAdminUBWeightLocationChecked) { + setFieldValue('ubWeightRestriction', `${values.ubWeightRestriction}`); + } + }, [setFieldValue, values.ubWeightRestriction, isAdminUBWeightLocationChecked]); + const handleAdminWeightLocationChange = (e) => { const isChecked = e.target.checked; setIsAdminWeightLocationChecked(isChecked); @@ -54,6 +63,19 @@ const AllowancesDetailForm = ({ header, entitlements, branchOptions, formIsDisab } }; + const handleAdminUBWeightLocationChange = (e) => { + const isChecked = e.target.checked; + setIsAdminUBWeightLocationChecked(isChecked); + + if (!isChecked) { + setFieldValue('ubWeightRestriction', `${values.ubWeightRestriction}`); + } else if (isChecked && values.ubWeightRestriction) { + setFieldValue('ubWeightRestriction', `${values.ubWeightRestriction}`); + } else { + setFieldValue('ubWeightRestriction', null); + } + }; + return (
{header &&

{header}

} @@ -215,6 +237,40 @@ const AllowancesDetailForm = ({ header, entitlements, branchOptions, formIsDisab isDisabled={formIsDisabled} /> )} +
+ +
+ {isAdminUBWeightLocationChecked && ( + + )} +
+ +
); }; diff --git a/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.test.jsx b/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.test.jsx index 3b0e5dbe29e..969adc839e3 100644 --- a/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.test.jsx +++ b/src/components/Office/AllowancesDetailForm/AllowancesDetailForm.test.jsx @@ -13,6 +13,7 @@ const initialValues = { requiredMedicalEquipmentWeight: '1000', organizationalClothingAndIndividualEquipment: true, weightRestriction: '500', + ubWeightRestriction: '400', }; const initialValuesOconusAdditions = { @@ -83,6 +84,7 @@ const entitlements = { totalWeight: 11000, totalDependents: 2, weightRestriction: 500, + ubWeightRestriction: '400', }; const entitlementOconusAdditions = { @@ -203,6 +205,37 @@ describe('AllowancesDetailForm additional tests', () => { expect(screen.queryByTestId('weightRestrictionInput')).not.toBeInTheDocument(); }); + it('renders admin UB weight location section with conditional UB weight restriction field', async () => { + render( + + + , + ); + + const adminUBWeightCheckbox = await screen.findByTestId('adminUBWeightLocation'); + expect(adminUBWeightCheckbox).toBeInTheDocument(); + expect(screen.getByLabelText('Admin restricted UB weight location')).toBeChecked(); + + const ubWeightRestrictionInput = screen.getByTestId('ubWeightRestrictionInput'); + expect(ubWeightRestrictionInput).toBeInTheDocument(); + expect(ubWeightRestrictionInput).toHaveValue('400'); + }); + + it('does not render the admin UB weight location section when the ubWeightRestriction entitlement is null', async () => { + render( + + + , + ); + + const adminUBWeightCheckbox = await screen.findByTestId('adminUBWeightLocation'); + expect(adminUBWeightCheckbox).toBeInTheDocument(); + expect(screen.queryByTestId('ubWeightRestrictionInput')).not.toBeInTheDocument(); + }); + it('displays the total weight allowance correctly', async () => { render( diff --git a/src/components/Office/DefinitionLists/AllowancesList.jsx b/src/components/Office/DefinitionLists/AllowancesList.jsx index a61b2e45882..d6b0a5083fa 100644 --- a/src/components/Office/DefinitionLists/AllowancesList.jsx +++ b/src/components/Office/DefinitionLists/AllowancesList.jsx @@ -103,13 +103,26 @@ const AllowancesList = ({ info, showVisualCues }) => {
Admin Weight Restricted Location
{info.weightRestriction > 0 ? 'Yes' : 'No'}
- + {info.weightRestriction > 0 && ( +
+
Weight Restriction
+
+ {info.weightRestriction ? formatWeight(info.weightRestriction) : DEFAULT_EMPTY_VALUE} +
+
+ )}
-
Weight Restriction
-
- {info.weightRestriction ? formatWeight(info.weightRestriction) : DEFAULT_EMPTY_VALUE} -
+
Admin Restricted UB Weight Location
+
{info.ubWeightRestriction > 0 ? 'Yes' : 'No'}
+ {info.ubWeightRestriction > 0 && ( +
+
UB Weight Restriction
+
+ {info.ubWeightRestriction ? formatWeight(info.ubWeightRestriction) : DEFAULT_EMPTY_VALUE} +
+
+ )} ); diff --git a/src/components/Office/DefinitionLists/AllowancesList.test.jsx b/src/components/Office/DefinitionLists/AllowancesList.test.jsx index 073665f6d70..3448b3898f9 100644 --- a/src/components/Office/DefinitionLists/AllowancesList.test.jsx +++ b/src/components/Office/DefinitionLists/AllowancesList.test.jsx @@ -20,6 +20,7 @@ const info = { organizationalClothingAndIndividualEquipment: true, ubAllowance: 400, weightRestriction: 1500, + ubWeightRestriction: 1100, }; const initialValuesOconusAdditions = { @@ -170,4 +171,9 @@ describe('AllowancesList', () => { render(); expect(screen.getByTestId('weightRestriction').textContent).toEqual('1,500 lbs'); }); + it('renders UB weight restriction', () => { + const adminRestrictedUBWtLoc = { ...info, adminrestrictedUBWeightLocation: true }; + render(); + expect(screen.getByTestId('ubWeightRestriction').textContent).toEqual('1,100 lbs'); + }); }); diff --git a/src/constants/MoveHistory/Database/BooleanFields.js b/src/constants/MoveHistory/Database/BooleanFields.js index c14cb67f56c..cedb8ed7540 100644 --- a/src/constants/MoveHistory/Database/BooleanFields.js +++ b/src/constants/MoveHistory/Database/BooleanFields.js @@ -13,6 +13,7 @@ export default { organizational_clothing_and_individual_equipment: 'organizational_clothing_and_individual_equipment', gun_safe: 'gun_safe', admin_restricted_weight_location: 'admin_restricted_weight_location', + admin_restricted_ub_weight_location: 'admin_restricted_ub_weight_location', email_is_preferred: 'email_is_preferred', phone_is_preferred: 'phone_is_preferred', uses_external_vendor: 'uses_external_vendor', diff --git a/src/constants/MoveHistory/Database/FieldMappings.js b/src/constants/MoveHistory/Database/FieldMappings.js index 53724afcd8a..0b1c82ace06 100644 --- a/src/constants/MoveHistory/Database/FieldMappings.js +++ b/src/constants/MoveHistory/Database/FieldMappings.js @@ -40,7 +40,9 @@ export default { organizational_clothing_and_individual_equipment: 'OCIE', gun_safe: 'Gun Safe', admin_restricted_weight_location: 'Admin restricted weight location', + admin_restricted_ub_weight_location: 'Admin restricted UB weight location', weight_restriction: 'Weight restriction', + ub_weight_restriction: 'UB weight restriction', requested_pickup_date: 'Requested pickup date', grade: 'Pay grade', shipment_type: 'Shipment type', diff --git a/src/pages/Office/MoveAllowances/MoveAllowances.jsx b/src/pages/Office/MoveAllowances/MoveAllowances.jsx index a09f22e87de..e56ea8437da 100644 --- a/src/pages/Office/MoveAllowances/MoveAllowances.jsx +++ b/src/pages/Office/MoveAllowances/MoveAllowances.jsx @@ -55,6 +55,18 @@ const validationSchema = Yup.object({ otherwise: (schema) => schema.notRequired().nullable(), }), adminRestrictedWeightLocation: Yup.boolean().notRequired(), + ubWeightRestriction: Yup.number() + .transform((value) => (Number.isNaN(value) ? 0 : value)) + .when('adminRestrictedUBWeightLocation', { + is: true, + then: (schema) => + schema + .min(1, 'UB weight restriction must be greater than 0') + .max(2000, 'UB weight restriction cannot exceed 2,000 lbs') + .required('UB weight restriction is required when Admin Restricted UB Weight Location is enabled'), + otherwise: (schema) => schema.notRequired().nullable(), + }), + adminRestrictedUBWeightLocation: Yup.boolean().notRequired(), }); const MoveAllowances = () => { @@ -111,6 +123,8 @@ const MoveAllowances = () => { gunSafe, adminRestrictedWeightLocation, weightRestriction, + adminRestrictedUBWeightLocation, + ubWeightRestriction, accompaniedTour, dependentsTwelveAndOver, dependentsUnderTwelve, @@ -132,6 +146,7 @@ const MoveAllowances = () => { storageInTransit: Number(storageInTransit), gunSafe, weightRestriction: adminRestrictedWeightLocation && weightRestriction ? Number(weightRestriction) : null, + ubWeightRestriction: adminRestrictedUBWeightLocation && ubWeightRestriction ? Number(ubWeightRestriction) : null, accompaniedTour, dependentsTwelveAndOver: Number(dependentsTwelveAndOver), dependentsUnderTwelve: Number(dependentsUnderTwelve), @@ -148,6 +163,7 @@ const MoveAllowances = () => { organizationalClothingAndIndividualEquipment, gunSafe, weightRestriction, + ubWeightRestriction, storageInTransit, dependentsUnderTwelve, dependentsTwelveAndOver, @@ -164,6 +180,8 @@ const MoveAllowances = () => { gunSafe, adminRestrictedWeightLocation: weightRestriction > 0, weightRestriction: weightRestriction ? `${weightRestriction}` : '0', + adminRestrictedUBWeightLocation: ubWeightRestriction > 0, + ubWeightRestriction: ubWeightRestriction ? `${ubWeightRestriction}` : '0', storageInTransit: `${storageInTransit}`, accompaniedTour, dependentsUnderTwelve: `${dependentsUnderTwelve}`, diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 40da8de8aa9..c25b14ef98b 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -449,6 +449,7 @@ const MoveDetails = ({ organizationalClothingAndIndividualEquipment: allowances.organizationalClothingAndIndividualEquipment, gunSafe: allowances.gunSafe, weightRestriction: allowances.weightRestriction, + ubWeightRestriction: allowances.ubWeightRestriction, dependentsUnderTwelve: allowances.dependentsUnderTwelve, dependentsTwelveAndOver: allowances.dependentsTwelveAndOver, accompaniedTour: allowances.accompaniedTour, diff --git a/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.jsx b/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.jsx index e5cb77fb576..f740f8b5140 100644 --- a/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.jsx +++ b/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.jsx @@ -53,6 +53,18 @@ const validationSchema = Yup.object({ otherwise: (schema) => schema.notRequired().nullable(), }), adminRestrictedWeightLocation: Yup.boolean().notRequired(), + ubWeightRestriction: Yup.number() + .transform((value) => (Number.isNaN(value) ? 0 : value)) + .when('adminRestrictedUBWeightLocation', { + is: true, + then: (schema) => + schema + .min(1, 'UB weight restriction must be greater than 0') + .max(2000, 'UB weight restriction cannot exceed 2,000 lbs') + .required('UB weight restriction is required when Admin Restricted UB Weight Location is enabled'), + otherwise: (schema) => schema.notRequired().nullable(), + }), + adminRestrictedUBWeightLocation: Yup.boolean().notRequired(), }); const ServicesCounselingMoveAllowances = () => { const { moveCode } = useParams(); @@ -98,6 +110,8 @@ const ServicesCounselingMoveAllowances = () => { gunSafe, adminRestrictedWeightLocation, weightRestriction, + adminRestrictedUBWeightLocation, + ubWeightRestriction, accompaniedTour, dependentsTwelveAndOver, dependentsUnderTwelve, @@ -118,6 +132,7 @@ const ServicesCounselingMoveAllowances = () => { organizationalClothingAndIndividualEquipment, gunSafe, weightRestriction: adminRestrictedWeightLocation && weightRestriction ? Number(weightRestriction) : null, + ubWeightRestriction: adminRestrictedUBWeightLocation && ubWeightRestriction ? Number(ubWeightRestriction) : null, accompaniedTour, dependentsTwelveAndOver: Number(dependentsTwelveAndOver), dependentsUnderTwelve: Number(dependentsUnderTwelve), @@ -133,6 +148,7 @@ const ServicesCounselingMoveAllowances = () => { organizationalClothingAndIndividualEquipment, gunSafe, weightRestriction, + ubWeightRestriction, storageInTransit, dependentsUnderTwelve, dependentsTwelveAndOver, @@ -149,6 +165,8 @@ const ServicesCounselingMoveAllowances = () => { gunSafe, adminRestrictedWeightLocation: weightRestriction > 0, weightRestriction: weightRestriction ? `${weightRestriction}` : '0', + adminRestrictedUBWeightLocation: ubWeightRestriction > 0, + ubWeightRestriction: ubWeightRestriction ? `${ubWeightRestriction}` : '0', organizationalClothingAndIndividualEquipment, accompaniedTour, dependentsUnderTwelve: `${dependentsUnderTwelve}`, diff --git a/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.test.jsx b/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.test.jsx index 2b2ec3b1820..e3b895f7294 100644 --- a/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveAllowances/ServicesCounselingMoveAllowances.test.jsx @@ -68,6 +68,7 @@ const useOrdersDocumentQueriesReturnValue = { totalDependents: 1, totalWeight: 5000, weightRestriction: 500, + ubWeightRestriction: 400, }, first_name: 'Leo', grade: 'E_1', @@ -176,6 +177,7 @@ describe('MoveAllowances page', () => { expect(screen.getByLabelText('OCIE authorized (Army only)')).toBeChecked(); expect(screen.getByTestId('weightAllowance')).toHaveTextContent('5,000 lbs'); + // admin restricted weight location const adminWeightCheckbox = await screen.findByTestId('adminWeightLocation'); expect(adminWeightCheckbox).toBeChecked(); const weightRestrictionInput = screen.getByTestId('weightRestrictionInput'); @@ -197,6 +199,28 @@ describe('MoveAllowances page', () => { screen.getByText(/Weight restriction is required when Admin Restricted Weight Location is enabled/i), ).toBeInTheDocument(); }); + // admin restricted UB weight location + const adminUBWeightCheckbox = await screen.findByTestId('adminUBWeightLocation'); + expect(adminUBWeightCheckbox).toBeChecked(); + const ubWeightRestrictionInput = screen.getByTestId('ubWeightRestrictionInput'); + expect(ubWeightRestrictionInput).toHaveValue('400'); + + await userEvent.click(ubWeightRestrictionInput); + await userEvent.clear(ubWeightRestrictionInput); + await userEvent.type(ubWeightRestrictionInput, '0'); + fireEvent.blur(ubWeightRestrictionInput); + + await waitFor(() => { + expect(screen.getByText(/UB Weight restriction must be greater than 0/i)).toBeInTheDocument(); + }); + + await userEvent.clear(ubWeightRestrictionInput); + + await waitFor(() => { + expect( + screen.getByText(/UB weight restriction is required when Admin Restricted UB Weight Location is enabled/i), + ).toBeInTheDocument(); + }); }); }); }); diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx index b04dc26995b..7570127f361 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx @@ -387,6 +387,7 @@ const ServicesCounselingMoveDetails = ({ organizationalClothingAndIndividualEquipment: allowances.organizationalClothingAndIndividualEquipment, gunSafe: allowances.gunSafe, weightRestriction: allowances.weightRestriction, + ubWeightRestriction: allowances.ubWeightRestriction, dependentsUnderTwelve: allowances.dependentsUnderTwelve, dependentsTwelveAndOver: allowances.dependentsTwelveAndOver, accompaniedTour: allowances.accompaniedTour, diff --git a/src/pages/PrimeUI/MoveTaskOrder/MoveDetails.jsx b/src/pages/PrimeUI/MoveTaskOrder/MoveDetails.jsx index 42216ae631f..2b2543850b1 100644 --- a/src/pages/PrimeUI/MoveTaskOrder/MoveDetails.jsx +++ b/src/pages/PrimeUI/MoveTaskOrder/MoveDetails.jsx @@ -216,6 +216,14 @@ const MoveDetails = ({ setFlashMessage }) => { : 'no'} +
+
Admin Restricted UB Weight:
+
+ {moveTaskOrder.order.entitlement.ubWeightRestriction > 0 + ? formatWeight(moveTaskOrder.order.entitlement.ubWeightRestriction) + : 'no'} +
+