Skip to content

Commit

Permalink
Taxes (#1289)
Browse files Browse the repository at this point in the history
* initial commit tax-rebase plugin

Initial commit for issue #972

* split providers to plugins/included

* Griddle updates

- fork MeteorGriddle into core/ui-grid
- move fetchTI
- add i18n taxSettings

* initial grid editing

* add taxSettings labels

* initial custom add / edit tax rates

- initial working forms, edit toggling.. bit rough..

* rename tax-base to taxes

* updated custom grid

 - adds row selection

* add custom rate form reset

* updated custom settings

* add cart hooks to trigger taxes/calculate

* update hooks, taxes/deleteRate

- also adds taxes/deleteRate

* migrate schemas to plugins

- also set taxCloud jobs to not run by default

* add custom tax rates calculation

- add taxes, tax to cart schema
- taxes not published to client
- updates global cartTotal helpers

* check for shipping

* migrate settings to plugins

* add tax hooks to plugins

 -abort idea on “provides” as a package property

* Avalara Tax Lookup

 - adds taxes/setRate method

* comment unused fields

- comment out first implementation unused fields

These are fields that will be used future enhancements to taxes.  They
are commented out for now.

* logger cleanup

- move info to debug

* updated product data with default taxable items

- add taxCode placeholder to schema

* taxCloud tax rate calculations

* disable taxjar, check for packages

- disable while module is not functional
- WIP fetch rates and api configuration

* custom rate ui cleanup

* taxes method test

- a weak attempt at a test but gets the ball rolling and actually fixes
a todo

* updated test, versions

- add done to test
- updated meteor package versions

* remove unused template registry entries

- final cleanup, ready for PR to development
- pending tests
- pending docs

* avoid running country-data unless address exists

* add tax rate delete

- adds delete and confirm to edit form

* linted griddle.js

* remove unused import

* fix display of taxes in order workflow

perhaps this should be updated to “tax”, instead of taxes in the
invoice object.

* line item calculations

- added for custom rates
- added for avalara

rates are calculated by individual line items but on a general rate for
the cart.

* update case linted

* updated variant methods

- update products/updateProductField to handle boolean
- kludge update of childVariants when parentVariant is updated
- remove default value from form
- small cleanups
  • Loading branch information
Aaron Judd authored and kieckhafer committed Aug 18, 2016
1 parent 3fa9c37 commit 2dece38
Show file tree
Hide file tree
Showing 79 changed files with 2,204 additions and 189 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ raix:ui-dropped-event
risul:moment-timezone
tmeasday:publish-counts
vsivsi:job-collection
react-meteor-data

# Testing packages
dburles:factory
Expand Down
2 changes: 2 additions & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>
{{/if}}

{{#if condition tax 'gt' 0}}
{{#if condition taxes 'gt' 0}}
<div class="row">
<div class="col-xs-7 text-right">
<span data-i18n='cartSubTotals.tax'>Tax</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div class="form-group order-summary-form-group">
<label class="form-control-label reason" for="" data-i18n="cartSubTotals.tax">Tax</label>
<div class="amount">
{{> React (numericInputProps "discount" invoice.tax false)}}
{{> React (numericInputProps "discount" invoice.taxes false)}}
</div>
</div>

Expand Down
4 changes: 4 additions & 0 deletions imports/plugins/core/taxes/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import "./settings/custom.html";
import "./settings/custom.js";
import "./settings/settings.html";
import "./settings/settings.js";
97 changes: 97 additions & 0 deletions imports/plugins/core/taxes/client/settings/custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<template name="customTaxRates">
<div>
{{> React taxGrid }}
</div>

<div class="pull-right">
{{> React editButton }}
</div>

{{#if instance.state.get 'isEditing'}}
<div>
{{#if instance.state.get 'editingId'}}

{{#autoForm
schema=taxSchema
type="method-update"
meteormethod="taxes/addRate"
doc=taxRate
id="customTaxRates-update-form"
resetOnSuccess=true
}}
<div>
<!-- {{> afQuickField name='taxCode' options=taxCodes class='form-control'}}
{{> afQuickField name='cartMethod' options="allowed" class='form-control'}}
{{> afQuickField name='taxLocale' options="allowed" class='form-control'}}
{{> afQuickField name='taxShipping'}}
{{> afQuickField name='taxIncluded'}}
{{> afQuickField name='discountsIncluded'}} -->
{{> afQuickField name='country' options=countryOptions class='form-control'}}

<label class="control-label">{{afFieldLabelText name='region'}}</label>
{{#if statesForCountry}}
{{>afFieldInput name="region" value=region options=statesForCountry class='form-control'}}
{{else}}
{{>afFieldInput name="region" value=region class='form-control'}}
{{/if}}
{{#if afFieldIsInvalid name="region"}}
<span class="help-block">{{afFieldMessage name="region"}}</span>
{{/if}}

{{> afQuickField name='postal' class='form-control' placeholder="Postal Code"}}
{{> afQuickField name='rate' class='form-control' placeholder="Rate as a percentage"}}
</div>
{{> taxSettingsSubmitButton instance=instance}}
{{/autoForm}}

{{else}}

{{#autoForm
schema=taxSchema
type="method"
meteormethod="taxes/addRate"
id="customTaxRates-insert-form"
doc=taxRate
resetOnSuccess=true
}}
<div>
<!-- {{> afQuickField name='taxCode' options=taxCodes class='form-control'}}
{{> afQuickField name='cartMethod' options="allowed" class='form-control'}}
{{> afQuickField name='taxLocale' options="allowed" class='form-control'}}
{{> afQuickField name='taxShipping'}}
{{> afQuickField name='taxIncluded'}}
{{> afQuickField name='discountsIncluded'}} -->
{{> afQuickField name='country' options=countryOptions class='form-control'}}

<label class="control-label">{{afFieldLabelText name='region'}}</label>
{{#if statesForCountry}}
{{>afFieldInput name="region" value=region options=statesForCountry class='form-control'}}
{{else}}
{{>afFieldInput name="region" value=region class='form-control'}}
{{/if}}
{{#if afFieldIsInvalid name="region"}}
<span class="help-block">{{afFieldMessage name="region" placeholder="State/Region/Province"}}</span>
{{/if}}

{{> afQuickField name='postal' class='form-control' placeholder="Postal Code"}}
{{> afQuickField name='rate' class='form-control' placeholder="Rate as a percentage"}}
</div>
{{> taxSettingsSubmitButton instance=instance}}
{{/autoForm}}
{{/if}}
</div>
{{/if}}
</template>


<template name="taxSettingsSubmitButton">
<div class="clearfix">
<div class="pull-right">
<button type="button" class="btn btn-primary cancel" data-i18n="app.cancel">Cancel</button>
{{#if instance.state.get 'editingId'}}
<button type="button" class="btn btn-primary delete" data-i18n="app.delete">Delete</button>
{{/if}}
<button type="submit" class="btn btn-primary" data-i18n="app.saveChanges">Save Changes</button>
</div>
</div>
</template>
Loading

0 comments on commit 2dece38

Please sign in to comment.