-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- #2641 Todo: - [x] A `DeliveryArea` may have a delivery fee as a percentage - [x] `Orders` to a `DeliveryArea` with a Percentage Fee calculate the fee correctly. - [x] `Shoppers` see a description of the Delivery Fee when building their Order. April has adjusted her fee schedule, and catering orders are now 12% and regular orders are $10 flat. This simplifies things quite a bit; hooray! But alas, we had already built out stuff to support different fees for every vendor and across regions (i.e. SF it's $20, Oakland it's $10) I think it's probably for the best to leave that flexibility in for now, and have updated it so we now have another attribute for how to calculate fees. I've made the Executive Decision to treat these fees as cumulative (i.e. $10 plus 12%) if both the `DeliveryArea#price` and the `DeliveryArea#fee_as_percentage` are set; rather than trying to figure out how to break ties or validate only one is set or whatever. This may be a poor decision.
- Loading branch information
Showing
18 changed files
with
171 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
</div> | ||
|
||
<div class="text-right mt-3"> | ||
<%= price %> | ||
<%= fee_description %> | ||
</div> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<% required = local_assigns[:required] || false %> | ||
<% min = local_assigns[:min] || 0 %> | ||
<% step = local_assigns[:step] || 0.01 %> | ||
<div> | ||
<%= form.label attribute, class: "block font-medium text-gray-700"%> | ||
<div class="relative mt-1 rounded-md shadow-sm"> | ||
<%= form.number_field attribute, class: "block w-full rounded-md border-gray-300 !pl-7 !pr-12 focus:border-indigo-500 focus:ring-indigo-500", step: step, min: min, required: required %> | ||
<div class="pointer-events-none absolute bottom-0 right-0 flex items-center pt-3 pr-3"> | ||
<span class="text-gray-500">%</span> | ||
</div> | ||
</div> | ||
<%= render partial: "error", locals: { model: form.object, attribute: attribute } %> | ||
</div> |
5 changes: 5 additions & 0 deletions
5
db/migrate/20241010004915_marketplace_add_fee_as_percentage_to_delivery_areas.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class MarketplaceAddFeeAsPercentageToDeliveryAreas < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :marketplace_delivery_areas, :fee_as_percentage, :integer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters