Compare commits

...

255 Commits

Author SHA1 Message Date
Maikel Linke
a56081ad5b Update translations 2023-03-31 14:59:16 +11:00
jibees
996c6d35f3 Merge pull request #10633 from openfoodfoundation/dependabot/bundler/debug-1.7.2
Bump debug from 1.7.1 to 1.7.2
2023-03-30 14:08:13 +02:00
Filipe
62cdda2ce2 Merge pull request #10523 from rioug/10431-voucher-minimum-backend
Voucher bare minimum backoffice
2023-03-29 20:21:57 +01:00
Filipe
e6123969d2 Merge pull request #10607 from mkllnk/zone-spec
Sort zones by name again, in the admin panel
2023-03-29 17:57:50 +01:00
Filipe
90ce52612d Merge pull request #10615 from mkllnk/background-report-job
Run background reports with Sidekiq, not fork
2023-03-29 17:38:48 +01:00
jibees
7e6d40f370 Merge pull request #10621 from openfoodfoundation/dependabot/bundler/valid_email2-4.0.6
Bump valid_email2 from 4.0.5 to 4.0.6
2023-03-29 17:13:34 +02:00
Filipe
b6e4ff908f Merge pull request #10566 from mkllnk/products-meta-description
Remove unused product meta description
2023-03-29 15:58:31 +01:00
Filipe
c16c1a5e62 Merge pull request #10544 from filipefurtad0/test_pdf_reports
Adds pdf comparison; removes csv, xlsx, pdf file fixtures
2023-03-29 14:03:25 +01:00
dependabot[bot]
3f5aceff99 Bump debug from 1.7.1 to 1.7.2
Bumps [debug](https://github.com/ruby/debug) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/ruby/debug/releases)
- [Commits](https://github.com/ruby/debug/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: debug
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-29 10:00:12 +00:00
dependabot[bot]
b8e9925601 Bump valid_email2 from 4.0.5 to 4.0.6
Bumps [valid_email2](https://github.com/micke/valid_email2) from 4.0.5 to 4.0.6.
- [Release notes](https://github.com/micke/valid_email2/releases)
- [Changelog](https://github.com/micke/valid_email2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micke/valid_email2/compare/v4.0.5...v4.0.6)

---
updated-dependencies:
- dependency-name: valid_email2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-29 07:51:47 +00:00
Maikel
667a514ed2 Merge pull request #10623 from jibees/10622-flaky-specservicesorder_cycle_form_specrb403
Flaky: Sort array to avoid flaky spec when comparing values
2023-03-29 16:32:44 +11:00
filipefurtad0
25108f4c70 Removes all fixture files; asserts on downloaded file
Changes helper method to assert there is one file only

load_file_txt will be useful in other spec files too, and could probably be moved to spec/support/file_helper.rb
2023-03-29 16:24:21 +11:00
Maikel Linke
6f83607aa8 Remove unused product meta description from DB 2023-03-29 14:35:16 +11:00
Maikel Linke
70aff98581 Remove unused product meta description from UI 2023-03-29 14:33:42 +11:00
Maikel
812fb974dd Merge pull request #10584 from openfoodfoundation/dependabot/bundler/devise-i18n-1.11.0
Bump devise-i18n from 1.10.3 to 1.11.0
2023-03-29 13:08:35 +11:00
filipefurtad0
0a91f3d392 Sorts all shipiping method arrays 2023-03-28 15:46:41 +02:00
Gaetan Craig-Riou
c7c19e47de Add feature toggle description 2023-03-28 13:46:51 +11:00
Gaetan Craig-Riou
e1845dddac Fix TabsAndPanelsController now that #! are removed from url
This PR https://github.com/openfoodfoundation/openfoodnetwork/pull/9729
remove #! from url. But unfortunately, AngularJs rewrite "example.com#panel"
as "example.com#/panel" thus breaking the original implementation.
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
2e10336a47 Add ability to manage voucher for enterprise user
Update spec accordingly
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
37d3c025e9 Make sure New voucher page can be accessed from voucher panel
Co-authored-by: David Cook <david@redcliffs.net>
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
6eb52aa540 TabsAndPanelsController specs, add missinrg panel scenario 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
6809198c96 Vouchers specs, remove obsolete step
Vouchers tabs now shows when returning from new voucher page,
no need to manually click on the 'vouchers' link in the menu
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
3b7aebd6da Enable vouchers feature toggle when running vouchers specs 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
7dc5bc87d1 Fix rubocop warnings 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
0c43d0f16a Put vouchers admin screen behind 'vouchers' feature toggle 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
fb1ad4c65f Remove non needed collumn from voucher list 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
04748b6e0e Move voucher value to the model
Use Spree::Money to display amount with currency
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
094fc039e9 Update tabs_and_panels to display tab and panel based on the url anchor
For Vouchers, this means the voucher tab and panel are displayed when
you come back to entreprise edit screen from the new vourcher page
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
e4f40d14b8 Fix enterprise voucher tab
Add harcoded voucher amount
Add missing translation
2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
4085aa22dc Add create voucher action and system test 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
a4add889a8 Add form on the new voucher page 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
f9f6793d10 Add template and basic controller for backoffice voucher pages 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
a62687b1a7 Fix warning : The implicit block expectation syntax is deprecated 2023-03-28 13:39:29 +11:00
Gaetan Craig-Riou
a48fd0828c Add Voucher model
A voucher belongs to an enterprise and an enterprise can have many
vouchers
2023-03-28 13:39:29 +11:00
Maikel
6cfb86e578 Link to merged feature toggle wiki page 2023-03-28 12:25:21 +11:00
Maikel
a168126cfa Merge pull request #10600 from mkllnk/features
Add all feature toggles with descriptions at boot
2023-03-28 10:58:40 +11:00
Jean-Baptiste Bellet
88c833ec83 Sort array to avoid flaky spec when comparing values 2023-03-27 15:57:46 +02:00
Konrad
c887efee54 Merge pull request #10519 from vviekk/viv/10515
Removing 'none' from shipping categories from product edit page
2023-03-27 14:01:11 +02:00
jibees
86abff224e Merge pull request #10616 from mkllnk/rails-7-schema
Update DB schema to Rails 7.0
2023-03-27 10:56:14 +02:00
vviekk
9a10c8c25a Removing none from shipping categories from product edit page 2023-03-27 11:56:10 +05:30
Maikel Linke
4461b33491 Sort zones by name again
Zones were intended to be sorted by name. But I guess that the syntax of
Ransack changed one day and we didn't notice because the spec was
creating entries in the right order already (which often reflects the
query result order without parameters). So the spec is fixed to fail if
the sorting doesn't happen and Ransack is configured to sort correctly.
The previous sort value was ignored.
2023-03-27 16:36:04 +11:00
Maikel Linke
5ae9016f09 Speed up spec by skipping additional page load
The login_as_admin helper has to load a page to log in. Providing the
page we want to go to avoids going to the default page first.
2023-03-27 16:36:04 +11:00
Maikel Linke
67ab8f63e0 Remove superfluous test setup
There are no zones at the start of the test. This is probably a
left-over from old times when specs were not encapsulated in
transactions.
2023-03-27 16:36:04 +11:00
Maikel Linke
40e64acd37 Update DB schema to Rails 7.0
This is the result of: `./bin/rails db:migrate`
2023-03-27 16:18:02 +11:00
Maikel Linke
78fea7c7f2 Run background reports with Sidekiq, not fork
Forking worked in theory but crashed the browser in system specs. It
also came with many other hurdles and isn't well known solution in the
Rails community. Sidekiq can give us better control over execution
limits as well.
2023-03-27 13:27:49 +11:00
Konrad
4c61666fc7 Merge pull request #10547 from vviekk/10419
Enable invoices config only controls Print bulk action
2023-03-26 13:53:20 +02:00
Konrad
0c6a12a6f0 Merge pull request #10241 from binarygit/provide-err-msg-when-using-text-in-var-field
Admin, edit variant: only allow numerical values for weight, height, width and depth fields
2023-03-26 13:03:20 +02:00
jibees
0da245f912 Merge pull request #10595 from jibees/10592-flaky-specservicesorder_cycle_form_specrb282
Flaky spec: Sort each array to ensure the order
2023-03-24 16:11:49 +01:00
jibees
eba0c9c4f7 Merge pull request #10609 from openfoodfoundation/dependabot/npm_and_yarn/prettier-2.8.7
Bump prettier from 2.8.6 to 2.8.7
2023-03-24 11:22:07 +01:00
dependabot[bot]
25618c009e Bump prettier from 2.8.6 to 2.8.7
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.6 to 2.8.7.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.6...2.8.7)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 09:58:19 +00:00
jibees
068ac40a76 Merge pull request #10589 from openfoodfoundation/dependabot/npm_and_yarn/webpack-dev-server-4.13.1
Bump webpack-dev-server from 4.12.0 to 4.13.1
2023-03-24 10:52:01 +01:00
dependabot[bot]
5868fd1b7c Bump webpack-dev-server from 4.12.0 to 4.13.1
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.12.0 to 4.13.1.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.12.0...v4.13.1)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 09:36:40 +00:00
jibees
540129854e Merge pull request #10603 from openfoodfoundation/dependabot/bundler/aws-sdk-s3-1.119.2
Bump aws-sdk-s3 from 1.119.1 to 1.119.2
2023-03-24 10:29:26 +01:00
jibees
f747ab568a Merge pull request #10604 from openfoodfoundation/dependabot/bundler/knapsack_pro-3.9.0
Bump knapsack_pro from 3.8.0 to 3.9.0
2023-03-24 10:23:01 +01:00
Jean-Baptiste Bellet
f9f619c036 Update all locales with the latest Transifex translations 2023-03-24 09:29:45 +01:00
Filipe
31ffeab4cd Merge pull request #10440 from mkllnk/rails7
Upgrade to Rails 7.0
2023-03-23 12:04:11 +00:00
Filipe
1673a18eb6 Merge pull request #9729 from binarygit/remove-angular-from-users
Admin, Enterprise Settings, Users tabs: remove tooltips directives + use reflex to invite user to be managers
2023-03-23 11:52:18 +00:00
Jean-Baptiste Bellet
29cdadd563 Avoid using exception but simply errors attribute contained in object
Co-Authored-By: Maikel <maikel@email.org.au>
2023-03-23 11:21:15 +01:00
Jean-Baptiste Bellet
8dffb38bf5 Sort each array to ensure the order
and then expect the right values.
2023-03-23 11:21:05 +01:00
binarygit
ecd5033efa Replace angular for when adding a new unregistered manager to an enterprise
Co-Authored-By: David Cook <david@redcliffs.net>
2023-03-23 11:21:05 +01:00
Jean-Baptiste Bellet
a13227defa Add I18N to all reflexes 2023-03-23 11:21:05 +01:00
Jean-Baptiste Bellet
465a295dfa Delete manager invitation controller 2023-03-23 11:21:05 +01:00
Jean-Baptiste Bellet
9c84a6936a Create a concern for manager invitations
Can be used elsewhere

Update manager_invitations.rb
2023-03-23 11:21:05 +01:00
dependabot[bot]
f3d687cbea Bump knapsack_pro from 3.8.0 to 3.9.0
Bumps [knapsack_pro](https://github.com/KnapsackPro/knapsack_pro-ruby) from 3.8.0 to 3.9.0.
- [Release notes](https://github.com/KnapsackPro/knapsack_pro-ruby/releases)
- [Changelog](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.8.0...v3.9.0)

---
updated-dependencies:
- dependency-name: knapsack_pro
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 10:05:23 +00:00
dependabot[bot]
6894cb5dd7 Bump aws-sdk-s3 from 1.119.1 to 1.119.2
Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.119.1 to 1.119.2.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)

---
updated-dependencies:
- dependency-name: aws-sdk-s3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 10:04:05 +00:00
Filipe
809a57dbdb Merge pull request #10437 from openfoodfoundation/10436-the-cookie-policy-modal-does-not-appear-to-use-the-language-selected-by-the-user
Translate cookie policy into languages selected by the user
2023-03-23 10:00:38 +00:00
Filipe
6b30a654a6 Merge pull request #10516 from macanudo527/fix_taxonomy
Fix Sorting entries in a taxonomy is broken
2023-03-23 09:23:16 +00:00
Filipe
9b749ee2e0 Merge pull request #10466 from dacook/report-summaries
Report summaries in JSON (API) output
2023-03-22 23:34:48 +00:00
David Cook
c27974c5a3 Add marker for summary rows
This can be enabled in the reports API with the hidden parameter `fields_to_show[]=report_row_type` to help with parsing summary row output.
2023-03-22 11:47:26 +00:00
David Cook
6f41a4168d Allow headers and footers for JSON format
You wouldn't want it by default, but it can be enabled with a parameter like display_summary_row=true
2023-03-22 11:47:26 +00:00
David Cook
db7ac904e9 Allow column formatting and header/footer stripping to be specified independently
This will allow us to change the options in the following commit.
2023-03-22 11:47:26 +00:00
David Cook
96eaec908d Remove unused mock in specs
It looks like it was expected that the price and amount columns would be formatted, but this is not currently the case. So I cleaned this up to be less ambiguous.

If any of these columns were to be configured for formatting, this line could be added back to test for unformatted output.
2023-03-22 11:47:26 +00:00
Maikel Linke
e0fd180edd DRY Flipper UI config 2023-03-22 15:45:26 +11:00
Maikel Linke
fd68cbf56d Remove on-the-fly adding of feature toggle entries
We now have a new source of truth. You shouldn't use a feature toggle
without adding it to OpenFoodNetwork::FeatureToggle first. All toggles
are added at boot time already.
2023-03-22 15:36:08 +11:00
Maikel Linke
9a1b1498bf Add all feature toggles with descriptions at boot
So you can easily inspect and activate new features without trying to
use them first. It brings more visibility and will enable us to easily
remove retired features as well.
2023-03-22 15:36:08 +11:00
Filipe
12de3ae584 Merge pull request #10509 from mkllnk/filter-shipping-methods-by-category
Filter shipping methods by category
2023-03-21 17:47:22 +00:00
Rachel Arnould
75c3bf8b56 Merge pull request #9630 from binarygit/remove-angular-from-business-details
Remove angular from business details
2023-03-21 18:31:40 +01:00
Rachel Arnould
52c12ea896 Merge pull request #10554 from mkllnk/dfc-variants
Ignore master variants exporting to DFC
2023-03-21 18:30:05 +01:00
jibees
2e4bbb7740 Merge pull request #10590 from openfoodfoundation/dependabot/npm_and_yarn/prettier-2.8.6
Bump prettier from 2.8.5 to 2.8.6
2023-03-21 15:32:45 +01:00
dependabot[bot]
1b0880e7df Bump prettier from 2.8.5 to 2.8.6
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.5 to 2.8.6.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.5...2.8.6)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-21 14:12:05 +00:00
Filipe
84f319894a Merge pull request #10594 from jibees/10593-deployment-failed-on-master
Move `webpack-*` as dependency (not devDependencies)
2023-03-21 14:09:52 +00:00
Jean-Baptiste Bellet
2a9b6f8e8c Sort each array to ensure the order
and then expect the right values.
2023-03-21 14:52:05 +01:00
Jean-Baptiste Bellet
c4e58eab3c Move webpack-* as dependency (not devDependencies) 2023-03-21 14:35:57 +01:00
Neal Chambers
920e9e65bd Merge remote-tracking branch 'origin/fix_taxonomy' into fix_taxonomy 2023-03-21 21:39:02 +09:00
David Cook
78b978efba Merge pull request #10458 from dacook/838-node-install-scripts
Node install script
2023-03-21 15:02:08 +11:00
Maikel Linke
31db35675b Add feature toggle for filtering shipping methods 2023-03-21 14:49:47 +11:00
Maikel Linke
6b25c36476 Filter ship methods by required shipping category
The products in an order may require several shipping categories like
refrigeration or express. We now filter the categories according to
their support of shipping categories.
2023-03-21 14:30:45 +11:00
Maikel Linke
73fa6295ec Simplify shipping method selection code 2023-03-21 14:30:44 +11:00
Maikel Linke
b5f43b3c1c Rename method because it's not changing the input
A common Ruby convention is to to use the bang naming `!` to mark method
which change the given parameter instead of returning a copy.
2023-03-21 14:30:44 +11:00
Maikel Linke
fcc68a0a19 Return new filtered list instead of modifying
This makes a clear distinction between the unfiltered and filtered list.
There may also be some gotchas when modifying the array of an
ActiveRecord relation. It also allows us to write shorter code without
storing a separate variable.
2023-03-21 14:30:44 +11:00
Maikel Linke
4c2d7c0d1c Rename confusing test variable
The "subject" is usually the code under test. In this spec it would be
the TagRuleApplicator and not the parameter given to it. So I renamed it
to avoid confusion here.
2023-03-21 14:30:44 +11:00
Maikel Linke
eee5e8eee7 Remove unnecessary tag rule code
The applicator converts the input to an array, even `nil` becomes an
empty array. Iterating over an empty array doesn't do anything either,
the result is the same.
2023-03-21 14:30:44 +11:00
Maikel Linke
e227cb912b Simplify tag rule spec
We don't need to know the internals. We want to know that the applicator
is not raising an error when we give `nil` or an empty collection.
2023-03-21 14:30:44 +11:00
Maikel Linke
6f3a0e8812 De-duplicate early for better performance 2023-03-21 14:30:44 +11:00
Maikel Linke
d7e4962fba Add method for easier reading 2023-03-21 14:30:44 +11:00
David Cook
7ad5181026 Merge pull request #10568 from openfoodfoundation/dependabot/npm_and_yarn/webpack-dev-server-4.12.0
Bump webpack-cli and webpack-dev-server from v3 to v4
2023-03-21 11:47:16 +11:00
jibees
c2133c8fa5 Merge pull request #10583 from openfoodfoundation/dependabot/bundler/flipper-active_record-0.26.2
Bump flipper-active_record from 0.26.0 to 0.26.2
2023-03-20 14:48:10 +01:00
dependabot[bot]
de5264138d Bump flipper-active_record from 0.26.0 to 0.26.2
Bumps [flipper-active_record](https://github.com/jnunemaker/flipper) from 0.26.0 to 0.26.2.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/main/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.26.0...v0.26.2)

---
updated-dependencies:
- dependency-name: flipper-active_record
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-20 13:30:57 +00:00
Jean-Baptiste Bellet
bfbcdba98c Modify configuration to match new version of webpacker
Error was:
```
ERROR in chunk admin [entry]
js/[name]-[contenthash].js
Cannot use [chunkhash] or [contenthash] for chunk in 'js/[name]-[contenthash].js' (use [hash] instead)
```
2023-03-20 11:34:57 +01:00
David Cook
0632553a4a Remove @webpack-cli/serve
This now gets included as a dependency of webpack-cli v4. If webpack-cli had been upgraded earlier, we never would have needed to specify this.
2023-03-20 11:34:57 +01:00
David Cook
a97d416bfd Bump webpack-cli from 3.3.12 to 4.10.0
I don't know why, but Dependabot decided not to: https://github.com/openfoodfoundation/openfoodnetwork/pull/9798#issuecomment-1288583629

This is required for webpack-dev-server v4.
2023-03-20 11:34:56 +01:00
dependabot[bot]
b306539163 Bump webpack-dev-server from 3.11.3 to 4.12.0
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.11.3 to 4.12.0.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.11.3...v4.12.0)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-20 11:33:31 +01:00
jibees
caea53ab91 Merge pull request #10582 from openfoodfoundation/dependabot/npm_and_yarn/floating-ui/dom-1.2.5
Bump @floating-ui/dom from 1.2.4 to 1.2.5
2023-03-20 11:23:56 +01:00
jibees
d7ee0ca434 Merge pull request #10580 from openfoodfoundation/dependabot/bundler/flipper-ui-0.26.2
Bump flipper-ui from 0.26.0 to 0.26.2
2023-03-20 11:20:11 +01:00
jibees
7fa4aa62f9 Merge pull request #10581 from openfoodfoundation/dependabot/npm_and_yarn/prettier-2.8.5
Bump prettier from 2.8.4 to 2.8.5
2023-03-20 11:17:14 +01:00
dependabot[bot]
ca97adb724 Bump devise-i18n from 1.10.3 to 1.11.0
Bumps [devise-i18n](https://github.com/tigrish/devise-i18n) from 1.10.3 to 1.11.0.
- [Release notes](https://github.com/tigrish/devise-i18n/releases)
- [Changelog](https://github.com/tigrish/devise-i18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tigrish/devise-i18n/compare/v1.10.3...v1.11.0)

---
updated-dependencies:
- dependency-name: devise-i18n
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-20 09:59:49 +00:00
dependabot[bot]
6295ecc7cf Bump @floating-ui/dom from 1.2.4 to 1.2.5
Bumps [@floating-ui/dom](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/dom) from 1.2.4 to 1.2.5.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/dom@1.2.5/packages/dom)

---
updated-dependencies:
- dependency-name: "@floating-ui/dom"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-20 09:58:48 +00:00
dependabot[bot]
b207d3e7fd Bump prettier from 2.8.4 to 2.8.5
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.4 to 2.8.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.4...2.8.5)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-20 09:58:31 +00:00
dependabot[bot]
b4f3655fae Bump flipper-ui from 0.26.0 to 0.26.2
Bumps [flipper-ui](https://github.com/jnunemaker/flipper) from 0.26.0 to 0.26.2.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/main/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.26.0...v0.26.2)

---
updated-dependencies:
- dependency-name: flipper-ui
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-20 09:58:17 +00:00
Jean-Baptiste Bellet
918e220557 Move $locationProvider configuration to another file
Actually the `config()` method of `admin_ofn` file did not run on `/admin/enterprises/*` pages for an unknown reason

Now those two files have the same configuration
2023-03-20 08:37:47 +01:00
binarygit
a397ba1ca9 Replace what's this tooltips
There are tooltips here that don't have a what's this?
There are many angular directives/methods being used that I haven't
looked into
Every select box is using select2
2023-03-20 08:37:47 +01:00
Maikel Linke
7cd235c84d Translate AngularJS templates in the browser
AngularJS templates are compiled as assets on deploy. Any translatable
text can't be translated in Ruby during compilation because it's static
text. It needs to be translated with an AngularJS filter in the browser.
2023-03-20 17:02:10 +11:00
Jean-Baptiste Bellet
e97cd0a1fd That particular spec is actually failing ; this must be solved 2023-03-20 16:59:19 +11:00
Jean-Baptiste Bellet
a56f061663 Prepare the spec to be factorized and to be used in different context 2023-03-20 16:59:19 +11:00
Maikel
512cb44df5 Merge pull request #10330 from mickenorlen/8909-add-balance-to-api-v1-customer-endpoint
Add balance to api v1 customers endpoint
2023-03-20 15:47:41 +11:00
Maikel
0ab8e62749 Merge pull request #10405 from jibees/upgrade-node-version
Upgrade node version
2023-03-20 10:55:41 +11:00
Mohamed ABDELLANI
008b12a75d remove "/" from the partial path to load sub-report filters 2023-03-20 10:41:28 +11:00
Maikel Linke
2e51d9be4a Include Rails version in db schema
So Rails knows which defaults to apply.
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#rails-version-is-now-included-in-the-active-record-schema-dump
2023-03-20 10:41:28 +11:00
Maikel Linke
bd20e299f3 Support old cookie encryption
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#key-generator-digest-class-changing-to-use-sha256
2023-03-20 10:41:28 +11:00
Maikel Linke
90a92421f4 Remove obsolete setting of Zeitwerk
It's the default now.
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#the-setter-config-autoloader-has-been-deleted
2023-03-20 10:41:28 +11:00
Maikel Linke
84daa046ca Update I18n spec to Rails 7 2023-03-20 10:41:28 +11:00
Maikel Linke
61259bcfc2 Bump rails from 6.1.7 to 7.0.4
Result of:

    bundle update --conservative rails railties\
     actioncable actionmailbox actionmailer actionpack actiontext\
     actionview activejob activemodel activerecord activestorage activesupport
2023-03-20 10:41:15 +11:00
Maikel Linke
4f44d50943 Omit Rails version restriction 2023-03-20 10:38:57 +11:00
Konrad
2e426c701e Merge pull request #10232 from binarygit/show-correct-error-when-user-inputs-url-as-ig-acc
[Enterprise->Create] Show correct error message when user inputs url in instagram field
2023-03-19 21:57:02 +01:00
Konrad
99b3701e17 Merge pull request #10463 from openfoodfoundation/dependabot/bundler/devise-4.9.0
Bump devise from 4.8.1 to 4.9.0
2023-03-17 18:41:03 +01:00
Filipe
8bef0f9a43 Merge pull request #10337 from jibees/9419-send-invoices-per-email-in-bulk-from-the-admin-orders-page
Admin, orders list page: send invoices per email in bulk
2023-03-17 10:58:26 +00:00
jibees
d69aa04435 Merge pull request #10577 from openfoodfoundation/dependabot/bundler/flipper-0.26.2
Bump flipper from 0.26.0 to 0.26.2
2023-03-17 11:42:23 +01:00
dependabot[bot]
0b4a243d8e Bump flipper from 0.26.0 to 0.26.2
Bumps [flipper](https://github.com/jnunemaker/flipper) from 0.26.0 to 0.26.2.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/main/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.26.0...v0.26.2)

---
updated-dependencies:
- dependency-name: flipper
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-17 10:01:35 +00:00
David Cook
ced9784fb8 Merge pull request #10576 from openfoodfoundation/revert-10474-fix-customer-can-checkout-non-matching-shipping-and-product-categories
Revert "Fix: Customers can checkout with non-matching shipping and product categories"
2023-03-17 15:41:04 +11:00
David Cook
788457618f Check ship address required based on all available methods
This check was implemented based on 'allowed' shipping methods, but we need to revert that logic. So for now, we can check all 'available' shipping methods.

This could potentially result in the same query being run twice, because load_shipping_methods also loads it. I opted to keep things simple and not try to optimise here.
2023-03-17 13:06:45 +11:00
David Cook
ef607da2c1 Revert "Fix: Customers can checkout with non-matching shipping and product categories" 2023-03-17 10:40:53 +11:00
Filipe
9ea6fa5c44 Merge pull request #9687 from dacook/9616-order-cycle-open-webhook
Add webhook triggered on Order Cycle Open
2023-03-16 17:24:22 +00:00
Konrad
a945f8f72f Merge pull request #10522 from mkllnk/flipper-upgrade
Bump flipper* from 0.20.4 to 0.26.0
2023-03-16 17:24:33 +01:00
jibees
0c3ee2e8fc Merge pull request #10574 from openfoodfoundation/dependabot/npm_and_yarn/jasmine-core-4.6.0
Bump jasmine-core from 4.5.0 to 4.6.0
2023-03-16 14:59:33 +01:00
dependabot[bot]
f6458e91c2 Bump jasmine-core from 4.5.0 to 4.6.0
Bumps [jasmine-core](https://github.com/jasmine/jasmine) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/jasmine/jasmine/releases)
- [Changelog](https://github.com/jasmine/jasmine/blob/main/RELEASE.md)
- [Commits](https://github.com/jasmine/jasmine/compare/v4.5.0...v4.6.0)

---
updated-dependencies:
- dependency-name: jasmine-core
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 09:59:04 +00:00
David Cook
4757b82a80 Update all locales with the latest Transifex translations 2023-03-16 14:15:04 +11:00
David Cook
ad9e82e973 Merge pull request #10569 from openfoodfoundation/dependabot/bundler/sidekiq-7.0.7
Bump sidekiq from 7.0.6 to 7.0.7
2023-03-16 11:47:55 +11:00
Filipe
e8430eae6d Merge pull request #10460 from jibees/10400-pagination-in-bom-not-aggregating-results-from-quick-search-field
BOM: Add a search input that search for items with pagination
2023-03-15 16:31:32 +00:00
dependabot[bot]
584b013a49 Bump sidekiq from 7.0.6 to 7.0.7
Bumps [sidekiq](https://github.com/sidekiq/sidekiq) from 7.0.6 to 7.0.7.
- [Release notes](https://github.com/sidekiq/sidekiq/releases)
- [Changelog](https://github.com/sidekiq/sidekiq/blob/main/Changes.md)
- [Commits](https://github.com/sidekiq/sidekiq/compare/v7.0.6...v7.0.7)

---
updated-dependencies:
- dependency-name: sidekiq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 10:05:08 +00:00
Maikel
f15cb01f2a Merge pull request #10520 from mkllnk/return-auth-controller-spec
Correctly include order id in return auth spec for Rails 7 compatibility
2023-03-15 14:08:16 +11:00
Maikel Linke
f1a5c46685 Remove unnecessary Flipper memoizer config
Auto-config, yay.
2023-03-15 12:54:03 +11:00
Maikel Linke
00f2f92ce0 Remove unnecessary Flipper active_record config
This is now done automatically when including flipper-active_record in
the Gemfile.
2023-03-15 12:54:03 +11:00
Maikel Linke
fdd71cff51 Remove now unnecessary flipper_id method
Flipper does it for us.
2023-03-15 12:54:02 +11:00
Maikel Linke
c9ca020f05 Bump flipper* from 0.20.4 to 0.26.0 2023-03-15 12:54:02 +11:00
David Cook
d59074dabd Tidy up spec
The best way to check if something changed or not, is with 'change' of course.
2023-03-15 12:18:17 +11:00
jibees
6a874b9527 Merge pull request #10562 from openfoodfoundation/dependabot/bundler/rails-6.1.7.3
Bump rails from 6.1.7.2 to 6.1.7.3
2023-03-14 15:02:49 +01:00
dependabot[bot]
1f08da207f Bump rails from 6.1.7.2 to 6.1.7.3
Bumps [rails](https://github.com/rails/rails) from 6.1.7.2 to 6.1.7.3.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v6.1.7.2...v6.1.7.3)

---
updated-dependencies:
- dependency-name: rails
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-14 09:59:50 +00:00
Maikel Linke
9c3bdc6b9b Remove unnecessary table join
And use Rails syntax for clarity and future extensions.
2023-03-14 14:38:25 +11:00
Maikel Linke
2105c0d0ea Ignore master variants exporting to DFC 2023-03-14 14:38:24 +11:00
Maikel Linke
6e514acc77 Spec too many variants exported to DFC 2023-03-14 14:38:24 +11:00
Maikel Linke
b8338fb9af Removing engine namespace from services
Services are usually not namespaced because they are part of the app.
This engine has an isolated namespace which means that we don't need to
separate with out own namespacing here.
2023-03-14 13:49:21 +11:00
jibees
687d4593fb Merge pull request #10550 from openfoodfoundation/dependabot/bundler/database_cleaner-2.0.2
Bump database_cleaner from 2.0.1 to 2.0.2
2023-03-13 21:12:42 +01:00
dependabot[bot]
b62f88512f Bump database_cleaner from 2.0.1 to 2.0.2
Bumps [database_cleaner](https://github.com/DatabaseCleaner/database_cleaner) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/DatabaseCleaner/database_cleaner/releases)
- [Changelog](https://github.com/DatabaseCleaner/database_cleaner/blob/main/History.rdoc)
- [Commits](https://github.com/DatabaseCleaner/database_cleaner/compare/v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: database_cleaner
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-13 15:24:41 +00:00
jibees
6bdb89d090 Merge pull request #10551 from openfoodfoundation/dependabot/bundler/rubocop-1.48.1
Bump rubocop from 1.48.0 to 1.48.1
2023-03-13 16:16:56 +01:00
jibees
a63531c8c2 Merge pull request #10549 from openfoodfoundation/dependabot/bundler/ddtrace-1.10.1
Bump ddtrace from 1.10.0 to 1.10.1
2023-03-13 16:15:06 +01:00
jibees
de2a15e3e1 Merge pull request #10548 from openfoodfoundation/dependabot/npm_and_yarn/floating-ui/dom-1.2.4
Bump @floating-ui/dom from 1.2.3 to 1.2.4
2023-03-13 16:14:00 +01:00
dependabot[bot]
e5f5d42d59 Bump rubocop from 1.48.0 to 1.48.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.48.0 to 1.48.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.48.0...v1.48.1)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-13 10:05:22 +00:00
dependabot[bot]
f23de206d9 Bump ddtrace from 1.10.0 to 1.10.1
Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-13 10:03:01 +00:00
dependabot[bot]
729bcdf291 Bump @floating-ui/dom from 1.2.3 to 1.2.4
Bumps [@floating-ui/dom](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/dom) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/dom@1.2.4/packages/dom)

---
updated-dependencies:
- dependency-name: "@floating-ui/dom"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-13 09:58:49 +00:00
vviekk
c1c0eca7c4 Enable invoices config only controls Print bulk action 2023-03-13 11:39:21 +05:30
David Cook
8f67e9839d Apply code suggestion
Avoids an error:
./script/nodenv-install.sh: line 13: brew: command not found

Co-authored-by: Maikel <maikel@email.org.au>
2023-03-10 13:38:59 +11:00
Maikel Linke
62d0ce290a Update translations 2023-03-10 11:42:36 +11:00
jibees
96ead52fcc Merge pull request #10536 from openfoodfoundation/dependabot/bundler/rack-2.2.6.3
Bump rack from 2.2.6.2 to 2.2.6.3
2023-03-09 14:55:19 +01:00
dependabot[bot]
ff708952ab Bump rack from 2.2.6.2 to 2.2.6.3
Bumps [rack](https://github.com/rack/rack) from 2.2.6.2 to 2.2.6.3.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v2.2.6.2...v2.2.6.3)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-09 02:40:19 +00:00
David Cook
fdeeab5750 Test twitter with (almost) real world example
I discovered that twitter doesn't have 'www' in the url anymore, no '@' symbol and interestingly no trailing slash. I added back the '@' just so we can test that still.

Using a regex group we can cater for optional www in a single regex.
2023-03-09 11:22:04 +11:00
David Cook
9e7e176cf9 Accept full URLs
It looks like the intention was there, so I made it work.
I've included a real world example, but added capitalisation to complete the test.
2023-03-09 11:21:52 +11:00
Konrad
2daa49406a Merge pull request #10506 from jibees/9868-product-import-empty-variant-names-recorded-differently-leads-to-variant-duplication
Product import: consider `display_name` with `null` or `empty` as value as equal
2023-03-08 16:58:32 +01:00
Konrad
125bc3d14b Merge pull request #10514 from jibees/9292-changes-to-incomingoutgoing-products-lists-triggering-failed-to-update-order-cycle-error
Do not update `estimate_price` of a variant that is not available for the shop on OrderCycle update
2023-03-08 15:45:11 +01:00
Rachel Arnould
02300d6bb6 Merge pull request #10496 from rioug/10479-split-checkout-fix-user-blocked-at-step1
[split checkout] Fix bug preventing user from reaching payment step
2023-03-08 15:44:50 +01:00
Rachel Arnould
aba3968bca Merge pull request #10447 from jibees/9148-no-bulk-delete-possible-on-bom-when-orders-have-multiple-items
Admin, BOM: can bulk delete line items of an order
2023-03-08 14:56:25 +01:00
Gaetan Craig-Riou
23c4298519 Fix bug when in specific scenario user couldn't proceed to payment step
When using a "pick up" shipping method, with a user who doesn't have a shipping address it was impossible to proceed to the payment step because shipping address was invalid.

To fix this, we ensure that "ship_address_same_as_billing" parameter is set to true when using a "pick up" shipping method.

use distributor address when shipping method doesn't require a ship address ; in doing this we follow the same logic as the legacy checkout
2023-03-08 10:49:37 +01:00
Jean-Baptiste Bellet
40a0d8e08c Improve design: make delete not a button but a link + close to file name 2023-03-08 10:38:28 +01:00
Jean-Baptiste Bellet
5cbec5521c Simplify ability
Co-Authored-By: David Cook <david@redcliffs.net>
2023-03-08 10:38:28 +01:00
Rachel Arnould
d7047bb4cc Merge pull request #10513 from jibees/10505-add-shopper-comment-to-order-detail-summary
SplitCheckout: Display special_instructions of the order as emphasized text if present on summary page
2023-03-08 10:30:40 +01:00
binarygit
8f6fdf3e31 [Admin, Enterprise Settings] Remove Angular from Business Details tab 2023-03-08 10:26:05 +01:00
Rachel Arnould
1ce029d8e4 Merge pull request #10497 from jibees/10495-split-checkout-label-of-checkbox-save-card-for-future-use-is-clickable-but-not-active
SplitCheckout: Make label clickable to check/uncheck checkbox on step 2
2023-03-08 10:20:00 +01:00
jibees
eb7d20d74d Merge pull request #10530 from mkllnk/flaky-service-spec
Stabilise spec with deterministic order
2023-03-08 09:04:29 +01:00
Maikel Linke
c4ba1e6616 Stabilise spec with deterministic order
The ids were returned in random order before.
2023-03-08 13:14:40 +11:00
Maikel
f97ccb4203 Merge pull request #10525 from openfoodfoundation/dependabot/bundler/ddtrace-1.10.0
Bump ddtrace from 1.9.0 to 1.10.0
2023-03-08 12:09:04 +11:00
Maikel
df8283661d Merge pull request #10487 from mkllnk/time-spec
Prepare caching spec for Rails 7
2023-03-08 11:37:44 +11:00
Maikel
d9ee56b4a5 Merge pull request #10524 from mkllnk/dfc-urls
Configure host for dfc_provider engine globally
2023-03-08 11:13:48 +11:00
dependabot[bot]
2230a1f179 Bump ddtrace from 1.9.0 to 1.10.0
Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-07 09:58:38 +00:00
Maikel Linke
a9c8d9f304 Configure host for dfc_provider engine globally
Passing the parameter all the time was pretty inconvenient.
2023-03-07 16:39:02 +11:00
David Cook
9d5ca2255b Apply suggestions from code review
Co-authored-by: Maikel <maikel@email.org.au>
2023-03-07 15:38:50 +11:00
David Cook
00a823b2fc 6. Add webhook endpoints to user developer settings screen
Allowing creation and deleting via the user association.
It probably won't be much effort to allow editing and multiple records, but I cut it down to the minimum needed to avoid any further delays.

I couldn't find a way to test a failure in the destroy method, but decided to keep the condition because I thought it was worth having.
2023-03-07 15:38:50 +11:00
David Cook
3d81a6e280 Prevent creating duplicate webhook notifications [migration]
Using the clever concurrency testing borrowed from SubscriptionPlacementJob, but I thought a shorter pause time (just 100ms) would be sufficient.

I considered doing this with a new 'state' field (upcoming/open/close), but decided to keep it simple.
2023-03-07 15:38:50 +11:00
David Cook
739df4be01 4. OrderCycleOpenedJob triggers webhook 2023-03-07 15:38:50 +11:00
David Cook
b91cabc510 Also send webhook payloads for distributor owners
But not supplier owners.
2023-03-07 15:38:50 +11:00
David Cook
ba152f12ee 3. Add OrderCycleWebhookService to create webhook payloads for an order cycle event 2023-03-07 15:38:50 +11:00
David Cook
778baba118 User may have many WebhookEndpoints [migration]
Although we won't be allowing multiple in the this PR, we certainly plan to in the future.

The migration helper add_reference couldn't handle the custom column name, so I had to put it together manually.
2023-03-07 15:38:50 +11:00
David Cook
85c98c6d3e 2. Add model WebhookEndpoint [migration]
This will store the URL for each user that wants a notification.

We probably don't need URL validation (it's not done on Enterprise for example). It could be validated by browser input, and anyway will be validated if the webhook actually works or not.

Inspired by Keygen: https://keygen.sh/blog/how-to-build-a-webhook-system-in-rails-using-sidekiq/
2023-03-07 15:38:50 +11:00
David Cook
de9546587a Prevent webhooks to private addresses (SSRF) [add gem]
Best reviewed with whitespace hidden.

Unfortunately the spec isn't allowed in CI. But it worked on my environment, I promise.
I chose `xit` so that it doesn't run unnecessarily. Perhaps we could use `pending` instead, which would execute, and notify us if it suddenly started working one day. But I doubt it.
2023-03-07 15:38:50 +11:00
David Cook
9741935955 Raise error on server error
And thus retry later.
I tried to test that it actually retries, or ensuring the job remained in the queue to be retried, but couldn't get it to work.
2023-03-07 15:38:50 +11:00
David Cook
9d19f37fec 1. Add WebhookDeliveryJob
This job is responsible for delivering a payload for one webhook event only. It allows the action to run asynchronously (and not slow down the calling process).
2023-03-07 15:38:50 +11:00
David Cook
718ac0ab80 Add Faraday for making HTTP requests [add gem]
It's the most popular and flexible option, so should be able to cater for our future needs best.
2023-03-07 15:38:47 +11:00
Neal Chambers
d95c5ff8a8 Use Spree Taxon Controller instead of API Taxon Controller
Add tests for reordering taxons
2023-03-07 13:22:59 +11:00
Maikel Linke
797b98d686 Remove Rails 5.0 controller spec workaround
We added a method to work around a bug. But that's not needed any more.
2023-03-07 08:46:36 +11:00
Maikel Linke
3dc3ebe584 Correctly include order id in return auth spec
The route to update a return authorization must include the order number
as id:

    /admin/orders/:order_id/return_authorizations/:id(.:format)

The spec only worked because the controller's ivars were not reset
between requests and the order was already set. But Rails 7 will reset
the ivars and it failed finding the order without a given id.
2023-03-07 08:46:36 +11:00
Jean-Baptiste Bellet
a7644f8e8b Update spec: can edit OC even if variant in subscription has been deleted 2023-03-06 17:12:09 +01:00
jibees
5dd2737811 Merge pull request #10517 from openfoodfoundation/dependabot/bundler/rubocop-1.48.0
Bump rubocop from 1.47.0 to 1.48.0
2023-03-06 15:23:25 +01:00
filipefurtad0
6d05d57846 Fixes spec when introducing invalid instagram link
It seems that only the slash at the end of the address is making it invalid, which does not correspond to the error message. This is a separate issue.
2023-03-06 15:02:49 +01:00
Jean-Baptiste Bellet
d9b534b829 + update spec as well 2023-03-06 14:52:32 +01:00
Jean-Baptiste Bellet
ac739108a2 Improve readability by generating search string for ransack 2023-03-06 11:31:36 +01:00
dependabot[bot]
a78768c291 Bump rubocop from 1.47.0 to 1.48.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.47.0 to 1.48.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.47.0...v1.48.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-06 10:02:43 +00:00
Neal Chambers
3f3ae97a40 Add tests for reordering taxons 2023-03-06 18:57:02 +09:00
binarygit
ae166ae220 Fix: User does not get stuck when going backwards while creating new ent 2023-03-06 09:29:04 +01:00
binarygit
533f7048bf [Enterprise->Create] Show correct error message when user inputs url in instagram field 2023-03-06 09:29:04 +01:00
Neal Chambers
e399e27a7d Merge remote-tracking branch 'origin/fix_taxonomy' into fix_taxonomy 2023-03-06 15:09:13 +09:00
Neal Chambers
63ba3defec Use Spree Taxon Controller instead of API Taxon Controller 2023-03-06 15:07:52 +09:00
Maikel
b9a7ff903f Merge pull request #10494 from filipefurtad0/test_xlsx_reports
Adds coverage for CSV and XLSX file download
2023-03-06 15:00:56 +11:00
Maikel
fc6b61fc87 Merge pull request #10503 from openfoodfoundation/dependabot/npm_and_yarn/floating-ui/dom-1.2.3
Bump @floating-ui/dom from 1.2.1 to 1.2.3
2023-03-06 11:52:38 +11:00
Jean-Baptiste Bellet
131772f7b2 Variant can be "not available": next and don't update its estimate price 2023-03-03 15:07:10 +01:00
Jean-Baptiste Bellet
440e776e3a fee_calculator can be retrieved outside subscription_line_items iteration 2023-03-03 15:05:07 +01:00
filipefurtad0
56b9c28955 Splits test cases into respective context blocks
Reduces code
2023-03-03 11:39:03 +00:00
Jean-Baptiste Bellet
c34942dbf0 Display special_instructions of order as emphasized text if present
+ update spec as well
2023-03-03 11:12:11 +01:00
Maikel Linke
12906d1e13 Explicitely touch instead of noop save
When calling `save!` without changing any attributes then Rails doesn't
always touch other records because nothing changed. So I changed the
spec to `touch` explicitely and it turns out that everything passes.

Tada, our code seems correct and it was only the spec which seemed
broken in Rails 7.
2023-03-03 12:51:12 +11:00
Maikel Linke
103bc50bdc Make spec robust on very fast computers
I didn't observe it but if the spec code would run within the same
millisecond then we wouldn't be able to observe a change to
`updated_at`. Time travel solves this potential problem.
2023-03-03 12:51:12 +11:00
Maikel Linke
b6cccc2e1d Mark broken specs, possible broken caching
I found this because Rails 7 converts timestamps to database precision
straight away. While we may have some broken logic in the code, most of
these cases may just be broken spec code. Watch this space.
2023-03-03 12:34:55 +11:00
Maikel Linke
918e583d01 Account for Rails 7 rounding in time spec
Storing a timestamp to the database has less accuracy than a Ruby Time
object. So `updated_at` changes after being written and loaded from the
database. Rails 7 accounts for that by rounding it in the model already
before it's written to the database. That made one spec fail.
2023-03-03 12:34:55 +11:00
Jean-Baptiste Bellet
7b8ccccdc3 display_name can actually be null or empty: consider them as equal 2023-03-02 17:15:57 +01:00
dependabot[bot]
fb01a6e244 Bump devise from 4.8.1 to 4.9.0
Bumps [devise](https://github.com/heartcombo/devise) from 4.8.1 to 4.9.0.
- [Release notes](https://github.com/heartcombo/devise/releases)
- [Changelog](https://github.com/heartcombo/devise/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heartcombo/devise/compare/v4.8.1...v4.9.0)

---
updated-dependencies:
- dependency-name: devise
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 14:47:11 +00:00
dependabot[bot]
0cae069769 Bump @floating-ui/dom from 1.2.1 to 1.2.3
Bumps [@floating-ui/dom](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/dom) from 1.2.1 to 1.2.3.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/dom@1.2.3/packages/dom)

---
updated-dependencies:
- dependency-name: "@floating-ui/dom"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 12:45:36 +00:00
binarygit
fd81429f39 Specify weight, height, width and depth as numeric field 2023-03-01 16:32:18 +01:00
filipefurtad0
b99383185b Adds coverage for PDF file download 2023-03-01 14:32:35 +00:00
filipefurtad0
66485e2e16 Adds coverage for XLSX file download 2023-03-01 14:32:35 +00:00
filipefurtad0
c1b60d88d6 Adds coverage for CSV file download 2023-03-01 14:32:28 +00:00
Jean-Baptiste Bellet
50bc48c96f Introduce some specs around searching in BOM 2023-03-01 14:54:46 +01:00
Jean-Baptiste Bellet
8ad532c41a Can search bill_address:phone, firstname, lastname and distributor:name 2023-03-01 14:54:46 +01:00
Jean-Baptiste Bellet
ebd5d706c2 Add search input
Actually this only search for `order_email` or `order_number` or `product_name` or `supplier_name`

+ Improve display by reduce each columns width
2023-03-01 14:40:12 +01:00
Jean-Baptiste Bellet
08e23023b3 Make label clickable to check/uncheck checkbox 2023-03-01 08:46:33 +01:00
Jean-Baptiste Bellet
8658b1a743 Remove quick filter that search only on displayed line items
+ remove specs as well
2023-02-28 15:39:31 +01:00
Jean-Baptiste Bellet
5208094f05 Do not bulk send invoices if order is not 'complete' or 'resumed'
+ update specs as well
2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
8926a3f08d Having a cleaner syntax a prefer using map() instead of forEach() 2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
58ea3a10e8 Invert condition on can send invoice 2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
5ca5c32da4 Factorize what could be into two methods: success and orders 2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
7a1a1286d2 Factorize two reflexes into one: BulkActionsInOrdersListReflex 2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
5e61aa8a77 Create the bulk send invoice action in order list
using the same pattern than SendConfirmationEmail action

Co-Authored-By: David Cook <david@redcliffs.net>
2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
af92b9f464 Reorganize spec by dividing into two contexts: 'admin' and 'hub manager' 2023-02-27 14:30:59 +01:00
Jean-Baptiste Bellet
ffaf4a837f Extract common behavior to BulkActionsController 2023-02-27 14:30:58 +01:00
Jean-Baptiste Bellet
c83dac58a3 Confirm line items deletion that doesn't trigger an order cancelation 2023-02-27 11:09:59 +01:00
David Cook
d377300f32 Support installations with homebrew (macOS)
The officially recommended installation for Mac is via Homebrew.
2023-02-17 10:36:10 +11:00
David Cook
b7a3f7263b Add script to install current node version
The API is conveniently exactly the same as rbenv.
2023-02-17 10:17:48 +11:00
Jean-Baptiste Bellet
e5ca8b0ee1 Delete selected line items even if does not lead to order cancellation 2023-02-15 11:49:53 +01:00
Jean-Baptiste Bellet
cf8d9c6d07 Improve spec when deleting all items of an order
- Order1 has two line items
 - Check other Order2 does not change its state
 - Prepare context for the second spec: delete one line item of an order that does not trigger any order cancellation
2023-02-15 11:38:04 +01:00
Mikael Norlén
f645f8fc79 Improve schema method get_extra_fields
Use double-splat for passing options and improve examples
2023-02-15 11:14:28 +01:00
Mikael Norlén
3d06b75892 Simplify customers_with_balance spec
Improve variable names and use multiple expectations
2023-02-15 11:14:28 +01:00
Mikael Norlén
af23375b04 Separate Structure from JsonApiSchema
Class was getting too long
2023-02-15 11:14:28 +01:00
Mikael Norlén
f15a4cc943 Add autogenerated whitespaces to swagger.yml
These whitespaces were generated by
bundle exec rails rswag.

Might be related to a new version of rswag or
developers' trim trailing whitespace settings.
2023-02-15 11:14:28 +01:00
Mikael Norlén
e95d08cae8 Add balance to api v1 customers endpoint
- customers#show: Add balance (data_type: double) to customer attributes.
- customers#index: Add balance only if specified in extra_fields
query parameter: extra_fields[customer]=balance
2023-02-15 11:14:27 +01:00
Mikael Norlén
3989843a21 Add support for extra fields in JsonApiSchemas
As we are now supporting optional extra fields,
We need to be able to construct schemas where
extra fields are optionally included.
2023-02-15 11:14:27 +01:00
Mikael Norlén
22b1dd3232 Add support for extra_fields query parameter
Api now supports optional fields.
These are included with the extra_fields query param.

Syntax: extra_fields[type]=field1,field2
2023-02-15 11:14:27 +01:00
Mikael Norlén
96c0057b03 Use Customers as argument for CustomersWithBalance
Change argument for CustomersWithBalance from
enterprise_id to Customers collection.

We have the need to calculate balance for customers in general,
not just for customers in a given enterprise.
2023-02-15 11:14:27 +01:00
Jean-Baptiste Bellet
1fb4e27064 Upgrade to latest 17.* node version 2023-02-09 14:00:19 +01:00
Jean-Baptiste Bellet
9f2a17c3e9 Upgrade to node 17 which requires a --openssl-legacy-provider option
Node 17 moved to OpenSSL3, see https://nodejs.org/en/blog/release/v17.0.0/#openssl-3-0 for more.
2023-02-09 12:54:11 +01:00
Jean-Baptiste Bellet
ac639fa283 Upgrade node to the next LTS version
(which is in maintenance mode, but let's be incremental to test)
2023-02-09 10:56:28 +01:00
220 changed files with 4379 additions and 1888 deletions

View File

@@ -1 +1 @@
14.21.2
17.9.1

View File

@@ -119,7 +119,6 @@ Layout/LineLength:
- 'spec/controllers/admin/bulk_line_items_controller_spec.rb'
- 'spec/controllers/admin/column_preferences_controller_spec.rb'
- 'spec/controllers/admin/enterprises_controller_spec.rb'
- 'spec/controllers/admin/manager_invitations_controller_spec.rb'
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
- 'spec/controllers/admin/schedules_controller_spec.rb'
- 'spec/controllers/admin/stripe_accounts_controller_spec.rb'

View File

@@ -6,7 +6,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'dotenv-rails', require: 'dotenv/rails-now' # Load ENV vars before other gems
gem 'rails', '>= 6.1.4'
gem 'rails'
# Active Storage
gem "active_storage_validations"
@@ -27,7 +27,7 @@ gem 'rails-i18n'
gem 'rails_safe_tasks', '~> 1.0'
gem "activerecord-import"
gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-6"
gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-7"
gem "fog-aws", "~> 2.0" # db2fog does not support v3
gem "mime-types" # required by fog
@@ -136,6 +136,9 @@ gem 'view_component_reflex', '3.1.14.pre9'
gem 'mini_portile2', '~> 2.8'
gem "faraday"
gem "private_address_check"
group :production, :staging do
gem 'ddtrace'
gem 'rack-timeout'

View File

@@ -1,12 +1,12 @@
GIT
remote: https://github.com/openfoodfoundation/db2fog.git
revision: 5b63343847452f52aa42f7fc169d6ab3af57cda3
branch: rails-6
revision: 6e88c0ab9eeb23d7ad9964b27becb1c04a83141f
branch: rails-7
specs:
db2fog (0.9.2)
activerecord (>= 3.2.0, < 7.0)
activerecord (>= 3.2.0)
fog-core (~> 1.0)
rails (>= 3.2.0, < 7.0)
rails (>= 3.2.0)
GIT
remote: https://github.com/openfoodfoundation/select2-rails.git
@@ -44,42 +44,49 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
actioncable (6.1.7.2)
actionpack (= 6.1.7.2)
activesupport (= 6.1.7.2)
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.2)
actionpack (= 6.1.7.2)
activejob (= 6.1.7.2)
activerecord (= 6.1.7.2)
activestorage (= 6.1.7.2)
activesupport (= 6.1.7.2)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
actionmailer (6.1.7.2)
actionpack (= 6.1.7.2)
actionview (= 6.1.7.2)
activejob (= 6.1.7.2)
activesupport (= 6.1.7.2)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.2)
actionview (= 6.1.7.2)
activesupport (= 6.1.7.2)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-action_caching (1.2.2)
actionpack (>= 4.0.0)
actiontext (6.1.7.2)
actionpack (= 6.1.7.2)
activerecord (= 6.1.7.2)
activestorage (= 6.1.7.2)
activesupport (= 6.1.7.2)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.2)
activesupport (= 6.1.7.2)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@@ -91,19 +98,19 @@ GEM
activemodel (>= 5.2.0)
activestorage (>= 5.2.0)
activesupport (>= 5.2.0)
activejob (6.1.7.2)
activesupport (= 6.1.7.2)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemerchant (1.123.0)
activesupport (>= 4.2)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (6.1.7.2)
activesupport (= 6.1.7.2)
activerecord (6.1.7.2)
activemodel (= 6.1.7.2)
activesupport (= 6.1.7.2)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activerecord-import (1.4.1)
activerecord (>= 4.2)
activerecord-postgresql-adapter (0.0.1)
@@ -114,19 +121,18 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1)
activestorage (6.1.7.2)
actionpack (= 6.1.7.2)
activejob (= 6.1.7.2)
activerecord (= 6.1.7.2)
activesupport (= 6.1.7.2)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.2)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts-as-taggable-on (9.0.1)
activerecord (>= 6.0, < 7.1)
acts_as_list (1.0.4)
@@ -151,16 +157,16 @@ GEM
awesome_nested_set (3.5.0)
activerecord (>= 4.0.0, < 7.1)
aws-eventstream (1.2.0)
aws-partitions (1.711.0)
aws-sdk-core (3.170.0)
aws-partitions (1.733.0)
aws-sdk-core (3.171.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.62.0)
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.119.1)
aws-sdk-s3 (1.119.2)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
@@ -224,24 +230,24 @@ GEM
cuprite (0.14.3)
capybara (~> 3.0)
ferrum (~> 0.13.0)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.1.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.3)
ddtrace (1.9.0)
ddtrace (1.10.1)
debase-ruby_core_source (>= 0.10.16, <= 3.2.0)
libdatadog (~> 1.0.1.1.0)
libddwaf (~> 1.5.1.0.0)
libdatadog (~> 2.0.0.1.0)
libddwaf (~> 1.6.2.0.0)
msgpack
debase-ruby_core_source (3.2.0)
debug (1.7.1)
debug (1.7.2)
irb (>= 1.5.0)
reline (>= 0.3.1)
debugger-linecache (1.2.0)
devise (4.8.1)
devise (4.9.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
@@ -249,8 +255,8 @@ GEM
warden (~> 1.2.3)
devise-encryptable (0.2.0)
devise (>= 2.1.0)
devise-i18n (1.10.3)
devise (>= 4.8.0)
devise-i18n (1.11.0)
devise (>= 4.9.0)
devise-token_authenticatable (1.1.0)
devise (>= 4.0.0, < 5.0.0)
diff-lcs (1.5.0)
@@ -283,15 +289,17 @@ GEM
websocket-driver (>= 0.6, < 0.8)
ffaker (2.21.0)
ffi (1.15.5)
flipper (0.20.4)
flipper-active_record (0.20.4)
activerecord (>= 5.0, < 7)
flipper (~> 0.20.4)
flipper-ui (0.20.4)
flipper (0.26.2)
concurrent-ruby (< 2)
flipper-active_record (0.26.2)
activerecord (>= 4.2, < 8)
flipper (~> 0.26.2)
flipper-ui (0.26.2)
erubi (>= 1.0.0, < 2.0.0)
flipper (~> 0.20.4)
flipper (~> 0.26.2)
rack (>= 1.4, < 3)
rack-protection (>= 1.5.3, < 2.2.0)
rack-protection (>= 1.5.3, <= 4.0.0)
sanitize (< 7)
fog-aws (2.0.1)
fog-core (~> 1.38)
fog-json (~> 1.0)
@@ -343,7 +351,7 @@ GEM
activerecord (>= 3.0)
io-console (0.6.0)
ipaddress (0.8.3)
irb (1.6.2)
irb (1.6.3)
reline (>= 0.3.0)
jmespath (1.6.2)
jquery-rails (4.4.0)
@@ -367,14 +375,14 @@ GEM
jsonapi-serializer (2.2.0)
activesupport (>= 4.2)
jwt (2.7.0)
knapsack_pro (3.8.0)
knapsack_pro (3.9.0)
rake
launchy (2.5.0)
addressable (~> 2.7)
letter_opener (1.8.1)
launchy (>= 2.2, < 3)
libdatadog (1.0.1.1.0)
libddwaf (1.5.1.0.0)
libdatadog (2.0.0.1.0)
libddwaf (1.6.2.0.0)
ffi (~> 1.0)
libv8-node (16.10.0.0)
listen (3.8.0)
@@ -402,12 +410,12 @@ GEM
mini_portile2 (2.8.1)
mini_racer (0.6.3)
libv8-node (~> 16.10.0.0)
minitest (5.17.0)
minitest (5.18.0)
monetize (1.12.0)
money (~> 6.12)
money (6.16.0)
i18n (>= 0.6.4, <= 2)
msgpack (1.6.0)
msgpack (1.6.1)
multi_json (1.15.0)
multi_xml (0.6.0)
net-imap (0.3.4)
@@ -459,7 +467,7 @@ GEM
parallel (1.22.1)
paranoia (2.6.1)
activerecord (>= 5.1, < 7.1)
parser (3.2.1.0)
parser (3.2.1.1)
ast (~> 2.4.1)
paypal-sdk-core (0.3.4)
multi_json (~> 1.0)
@@ -474,6 +482,7 @@ GEM
ttfunk
pg (1.2.3)
power_assert (2.0.2)
private_address_check (0.5.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
@@ -482,7 +491,7 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.6.2)
rack (2.2.6.2)
rack (2.2.6.4)
rack-mini-profiler (2.3.4)
rack (>= 1.2.0)
rack-oauth2 (1.21.3)
@@ -491,29 +500,28 @@ GEM
httpclient
json-jwt (>= 1.11.0)
rack (>= 2.1.0)
rack-protection (2.1.0)
rack-protection (3.0.5)
rack
rack-proxy (0.7.6)
rack
rack-rewrite (1.5.1)
rack-test (2.0.2)
rack-test (2.1.0)
rack (>= 1.3)
rack-timeout (0.6.3)
rails (6.1.7.2)
actioncable (= 6.1.7.2)
actionmailbox (= 6.1.7.2)
actionmailer (= 6.1.7.2)
actionpack (= 6.1.7.2)
actiontext (= 6.1.7.2)
actionview (= 6.1.7.2)
activejob (= 6.1.7.2)
activemodel (= 6.1.7.2)
activerecord (= 6.1.7.2)
activestorage (= 6.1.7.2)
activesupport (= 6.1.7.2)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 6.1.7.2)
sprockets-rails (>= 2.0.0)
railties (= 7.0.4.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -532,12 +540,13 @@ GEM
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
rails_safe_tasks (1.0.0)
railties (6.1.7.2)
actionpack (= 6.1.7.2)
activesupport (= 6.1.7.2)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
ransack (2.6.0)
@@ -549,10 +558,10 @@ GEM
ffi (~> 1.0)
redcarpet (3.6.0)
redis (4.8.1)
redis-client (0.13.0)
redis-client (0.14.0)
connection_pool
regexp_parser (2.7.0)
reline (0.3.2)
reline (0.3.3)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
@@ -605,7 +614,7 @@ GEM
rswag-ui (2.8.0)
actionpack (>= 3.1, < 7.1)
railties (>= 3.1, < 7.1)
rubocop (1.47.0)
rubocop (1.48.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
@@ -623,7 +632,7 @@ GEM
rubocop (>= 1.33.0, < 2.0)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.12.0)
ruby-progressbar (1.13.0)
ruby-rc4 (0.1.5)
ruby-vips (2.1.4)
ffi (~> 1.12)
@@ -631,6 +640,9 @@ GEM
rubyzip (2.3.2)
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
sanitize (6.0.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sass (3.4.25)
sass-rails (5.0.8)
railties (>= 5.2.0)
@@ -642,7 +654,7 @@ GEM
semantic_range (3.0.0)
shoulda-matchers (5.3.0)
activesupport (>= 5.2.0)
sidekiq (7.0.6)
sidekiq (7.0.7)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
@@ -706,7 +718,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
uniform_notifier (1.16.0)
valid_email2 (4.0.5)
valid_email2 (4.0.6)
activemodel (>= 3.2)
mail (~> 2.5)
validate_email (0.1.6)
@@ -801,6 +813,7 @@ DEPENDENCIES
digest
dotenv-rails
factory_bot_rails (= 6.2.0)
faraday
ffaker
flipper
flipper-active_record
@@ -843,12 +856,13 @@ DEPENDENCIES
paypal-sdk-merchant (= 1.117.2)
pdf-reader
pg (~> 1.2.3)
private_address_check
pry (~> 0.13.0)
puma
rack-mini-profiler (< 3.0.0)
rack-rewrite
rack-timeout
rails (>= 6.1.4)
rails
rails-controller-testing
rails-erd
rails-i18n

View File

@@ -55,28 +55,12 @@ angular.module("admin.enterprises")
else
alert ("#{manager.email}" + " " + t("is_already_manager"))
$scope.inviteManager = ->
$scope.invite_errors = $scope.invite_success = null
email = $scope.newUser
$http.post("/admin/manager_invitations", {email: email, enterprise_id: $scope.Enterprise.id}).then (response)->
$scope.addManager({id: response.data.user, email: email})
$scope.invite_success = t('user_invited', email: email)
.catch (response) ->
$scope.invite_errors = response.data.errors
$scope.resetModal = ->
$scope.newUser = $scope.invite_errors = $scope.invite_success = null
$scope.removeLogo = ->
$scope.performEnterpriseAction("removeLogo", "immediate_logo_removal_warning", "removed_logo_successfully")
$scope.removePromoImage = ->
$scope.performEnterpriseAction("removePromoImage", "immediate_promo_image_removal_warning", "removed_promo_image_successfully")
$scope.removeTermsAndConditions = ->
$scope.performEnterpriseAction("removeTermsAndConditions", "immediate_terms_and_conditions_removal_warning", "removed_terms_and_conditions_successfully")
$scope.performEnterpriseAction = (enterpriseActionName, warning_message_key, success_message_key) ->
return unless confirm($scope.translation(warning_message_key))

View File

@@ -1,32 +0,0 @@
angular.module("admin.enterprises").directive 'termsAndConditionsWarning', ($rootScope, $compile, $templateCache, DialogDefaults, $timeout) ->
restrict: 'A'
scope: true
link: (scope, element, attr) ->
# This file input click handler will hold the browser file input dialog and show a warning modal
scope.hold_file_input_and_show_warning_modal = (event) ->
event.preventDefault()
scope.template = $compile($templateCache.get('admin/modals/terms_and_conditions_warning.html'))(scope)
if scope.template.dialog
scope.template.dialog(DialogDefaults)
scope.template.dialog('open')
$rootScope.$evalAsync()
element.bind 'click', scope.hold_file_input_and_show_warning_modal
# When the user presses continue in the warning modal, we open the browser file input dialog
scope.continue = ->
scope.template.dialog('close')
$rootScope.$evalAsync()
# unbind warning modal handler and click file input again to open the browser file input dialog
element.unbind('click').trigger('click')
# afterwards, bind warning modal handler again so that the warning is shown the next time
$timeout ->
element.bind 'click', scope.hold_file_input_and_show_warning_modal
return
scope.close = ->
scope.template.dialog('close')
$rootScope.$evalAsync()
return

View File

@@ -17,7 +17,14 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
]
$scope.page = 1
$scope.per_page = $scope.per_page_options[0].id
searchThrough = ["order_distributor_name",
"order_bill_address_phone",
"order_bill_address_firstname",
"order_bill_address_lastname",
"variant_product_supplier_name",
"order_email",
"order_number",
"product_name"].join("_or_") + "_cont"
$scope.confirmRefresh = ->
LineItems.allSaved() || confirm(t("unsaved_changes_warning"))
@@ -26,7 +33,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.distributorFilter = ''
$scope.supplierFilter = ''
$scope.orderCycleFilter = ''
$scope.quickSearch = ''
$scope.query = ''
$scope.startDate = undefined
$scope.endDate = undefined
event = new CustomEvent('flatpickr:clear')
@@ -60,6 +67,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
[formattedStartDate, formattedEndDate] = $scope.formatDates($scope.startDate, $scope.endDate)
RequestMonitor.load LineItems.index(
"q[#{searchThrough}]": $scope.query,
"q[order_state_not_eq]": "canceled",
"q[order_shipment_state_not_eq]": "shipped",
"q[order_completed_at_not_null]": "true",
@@ -150,6 +158,10 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
else
Promise.all(LineItems.delete(item) for item in items).then(-> $scope.refreshData())
, "js.admin.deleting_item_will_cancel_order")
else
ofnDeleteLineItemsAlert(() ->
Promise.all(LineItems.delete(item) for item in lineItemsToDelete).then(-> $scope.refreshData())
, lineItemsToDelete.length)
$scope.allBoxesChecked = ->
checkedCount = $scope.filteredLineItems.reduce (count,lineItem) ->

View File

@@ -14,7 +14,4 @@ angular.module("admin.resources").factory 'EnterpriseResource', ($resource) ->
'removePromoImage':
url: '/api/v0/enterprises/:id/promo_image.json'
method: 'DELETE'
'removeTermsAndConditions':
url: '/api/v0/enterprises/:id/terms_and_conditions.json'
method: 'DELETE'
})

View File

@@ -63,4 +63,3 @@ angular.module("admin.resources").factory 'Enterprises', ($q, $filter, Enterpris
removeLogo: performActionOnEnterpriseResource(EnterpriseResource.removeLogo)
removePromoImage: performActionOnEnterpriseResource(EnterpriseResource.removePromoImage)
removeTermsAndConditions: performActionOnEnterpriseResource(EnterpriseResource.removeTermsAndConditions)

View File

@@ -250,6 +250,18 @@ ofnCancelOrderAlert = function(callback, i18nKey) {
$('#custom-confirm').show();
}
ofnDeleteLineItemsAlert = function(callback, count) {
$('#custom-confirm .message').html(`${t("js.admin.orders.delete_line_items_html", {count: count})}`);
$('#custom-confirm button.confirm').click(() => {
$('#custom-confirm').hide();
callback();
});
$('#custom-confirm button.cancel').click(() => {
$('#custom-confirm').hide();
});
$('#custom-confirm').show();
}
ofnConfirm = function(callback) {
$('#custom-confirm .message').html(
` ${t("are_you_sure")}

View File

@@ -8,7 +8,7 @@ handle_move = (e, data) ->
node = data.rslt.o
new_parent = data.rslt.np
url = new URL(base_url)
url = new URL(Spree.routes.admin_taxonomy_taxons)
url.pathname = url.pathname + '/' + node.attr("id")
data = {
_method: "put",

View File

@@ -1,2 +1,3 @@
angular.module("admin.utils", ["templates", "ngSanitize"]).config ($httpProvider) ->
angular.module("admin.utils", ["templates", "ngSanitize"]).config ($httpProvider, $locationProvider) ->
$locationProvider.hashPrefix('')
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"

View File

@@ -55,6 +55,10 @@ angular.module('Darkswarm').factory "EnterpriseRegistrationService", ($http, Reg
).catch((response) ->
Loading.clear()
alert(t('failed_to_update_enterprise_unknown'))
if response.data.errors.instagram
igErr = document.querySelector("#instagram-error")
igErr.style.display = 'block'
igErr.textContent = response.data.errors.instagram[0]
)
prepare: =>

View File

@@ -1,14 +0,0 @@
%div
.margin-bottom-30.text-center
.text-big
{{ 'js.admin.modals.terms_and_conditions_warning.title' | t }}
.margin-bottom-30
%p
{{ 'js.admin.modals.terms_and_conditions_warning.message_1' | t }}
.margin-bottom-30
%p
{{ 'js.admin.modals.terms_and_conditions_warning.message_2' | t }}
.text-center
%input.button.red{ type: 'button', value: t('js.admin.modals.close'), ng: { click: 'close()' } }
%input.button.red{ type: 'button', value: t('js.admin.modals.continue'), ng: { click: 'continue()' } }

View File

@@ -67,7 +67,7 @@ module Admin
def collection
if json_request? && params[:enterprise_id].present?
CustomersWithBalance.new(managed_enterprise_id).query.
CustomersWithBalance.new(Customer.of(managed_enterprise_id)).query.
includes(
:enterprise,
{ bill_address: [:state, :country] },

View File

@@ -1,47 +0,0 @@
# frozen_string_literal: true
module Admin
class ManagerInvitationsController < Spree::Admin::BaseController
authorize_resource class: false
def create
@email = params[:email]
@enterprise = Enterprise.find(params[:enterprise_id])
authorize! :edit, @enterprise
existing_user = Spree::User.find_by(email: @email)
if existing_user
render json: { errors: t('admin.enterprises.invite_manager.user_already_exists') },
status: :unprocessable_entity
return
end
new_user = create_new_manager
if new_user
render json: { user: new_user.id }, status: :ok
else
render json: { errors: t('admin.enterprises.invite_manager.error') },
status: :internal_server_error
end
end
private
def create_new_manager
password = Devise.friendly_token
new_user = Spree::User.create(email: @email, unconfirmed_email: @email, password: password)
new_user.reset_password_token = Devise.friendly_token
# Same time as used in Devise's lib/devise/models/recoverable.rb.
new_user.reset_password_sent_at = Time.now.utc
new_user.save!
@enterprise.users << new_user
EnterpriseMailer.manager_invitation(@enterprise, new_user).deliver_later
new_user
end
end
end

View File

@@ -100,10 +100,13 @@ module Admin
order_cycle.schedules.each do |schedule|
Subscription.where(schedule_id: schedule.id).each do |subscription|
shop = Enterprise.managed_by(spree_current_user).find_by(id: subscription.shop_id)
fee_calculator = OpenFoodNetwork::EnterpriseFeeCalculator.new(shop, order_cycle)
subscription.subscription_line_items.nil_price_estimate.each do |line_item|
variant = OrderManagement::Subscriptions::
VariantsList.eligible_variants(shop).find_by(id: line_item.variant_id)
fee_calculator = OpenFoodNetwork::EnterpriseFeeCalculator.new(shop, order_cycle)
# If the variant is not available in the shop, the price estimate will be nil
next if variant.nil?
price = variant.price + fee_calculator.indexed_fees_for(variant)
line_item.update_column(:price_estimate, price)
end

View File

@@ -55,11 +55,10 @@ module Admin
def render_report_as(format)
if OpenFoodNetwork::FeatureToggle.enabled?(:background_reports, spree_current_user)
job = ReportJob.new
JobProcessor.perform_forked(
job,
job = ReportJob.perform_later(
report_class, spree_current_user, params, format
)
sleep 1 until job.done?
# This result has been rendered by Rails in safe mode already.
job.result.html_safe # rubocop:disable Rails/OutputSafety

View File

@@ -0,0 +1,36 @@
# frozen_string_literal: true
module Admin
class VouchersController < ResourceController
before_action :load_enterprise
def new
@voucher = Voucher.new
end
def create
voucher_params = permitted_resource_params.merge(enterprise: @enterprise)
@voucher = Voucher.create(voucher_params)
if @voucher.save
redirect_to(
"#{edit_admin_enterprise_path(@enterprise)}#vouchers_panel",
flash: { success: flash_message_for(@voucher, :successfully_created) }
)
else
flash[:error] = @voucher.errors.full_messages.to_sentence
render :new
end
end
private
def load_enterprise
@enterprise = Enterprise.find_by permalink: params[:enterprise_id]
end
def permitted_resource_params
params.require(:voucher).permit(:code)
end
end
end

View File

@@ -106,7 +106,9 @@ module Api
end
def json_api_error(message, **options)
{ errors: [{ detail: message }] }.merge(options)
error_options = options.delete(:error_options) || {}
{ errors: [{ detail: message }.merge(error_options)] }.merge(options)
end
def json_api_invalid(message, errors)

View File

@@ -6,11 +6,17 @@ module Api
module V1
class CustomersController < Api::V1::BaseController
include AddressTransformation
include ExtraFields
skip_authorization_check only: :index
before_action :authorize_action, only: [:show, :update, :destroy]
# Query parameters
before_action only: [:index] do
@extra_customer_fields = extra_fields :customer, [:balance]
end
def index
@pagy, customers = pagy(search_customers, pagy_options)
@@ -51,7 +57,11 @@ module Api
private
def customer
@customer ||= Customer.find(params[:id])
@customer ||= if action_name == "show"
CustomersWithBalance.new(Customer.where(id: params[:id])).query.first!
else
Customer.find(params[:id])
end
end
def authorize_action
@@ -61,6 +71,11 @@ module Api
def search_customers
customers = visible_customers.includes(:bill_address, :ship_address)
customers = customers.where(enterprise_id: params[:enterprise_id]) if params[:enterprise_id]
if @extra_customer_fields.include?(:balance)
customers = CustomersWithBalance.new(customers).query
end
customers.ransack(params[:q]).result.order(:id)
end

View File

@@ -15,9 +15,7 @@ module CheckoutCallbacks
prepend_before_action :require_distributor_chosen
before_action :load_order, :associate_user, :load_saved_addresses, :load_saved_credit_cards
before_action :allowed_shipping_methods, if: -> {
params[:step] == "details"
}
before_action :load_shipping_methods, if: -> { params[:step] == "details" }
before_action :ensure_order_not_completed
before_action :ensure_checkout_allowed
@@ -48,22 +46,8 @@ module CheckoutCallbacks
@selected_card = nil
end
def allowed_shipping_methods
@allowed_shipping_methods ||= sorted_available_shipping_methods.filter(
&method(:supports_all_products_shipping_categories?)
)
end
def sorted_available_shipping_methods
available_shipping_methods.sort { |a, b| a.name.casecmp(b.name) }
end
def supports_all_products_shipping_categories?(shipping_method)
(products_shipping_categories - shipping_method.shipping_categories.pluck(:id)).empty?
end
def products_shipping_categories
@products_shipping_categories ||= @order.products.pluck(:shipping_category_id).uniq
def load_shipping_methods
@shipping_methods = available_shipping_methods.sort { |a, b| a.name.casecmp(b.name) }
end
def redirect_to_shop?

View File

@@ -0,0 +1,32 @@
# frozen_string_literal: true
# To be included in api controllers for handeling query params
module ExtraFields
extend ActiveSupport::Concern
def invalid_query_param(name, status, msg)
render status: status, json: json_api_error(msg, error_options:
{
title: I18n.t("api.query_param.error.title"),
source: { parameter: name },
status: status,
code: Rack::Utils::SYMBOL_TO_STATUS_CODE[status]
})
end
def extra_fields(type, available_fields)
fields = params.dig(:extra_fields, type)&.split(',')&.compact&.map(&:to_sym)
return [] if fields.blank?
unknown_fields = fields - available_fields
if unknown_fields.present?
invalid_query_param(
"extra_fields[#{type}]", :unprocessable_entity,
I18n.t("api.query_param.error.extra_fields", fields: unknown_fields.join(', '))
)
end
fields
end
end

View File

@@ -0,0 +1,19 @@
# frozen_string_literal: true
module ManagerInvitations
extend ActiveSupport::Concern
def create_new_manager(email, enterprise)
password = Devise.friendly_token
new_user = Spree::User.create(email: email, unconfirmed_email: email, password: password)
new_user.reset_password_token = Devise.friendly_token
# Same time as used in Devise's lib/devise/models/recoverable.rb.
new_user.reset_password_sent_at = Time.now.utc
if new_user.save
enterprise.users << new_user
EnterpriseMailer.manager_invitation(enterprise, new_user).deliver_later
end
new_user
end
end

View File

@@ -24,7 +24,7 @@ class SplitCheckoutController < ::BaseController
check_step if params[:step]
recalculate_tax if params[:step] == "summary"
flash_error_when_no_shipping_method_available if allowed_shipping_methods.none?
flash_error_when_no_shipping_method_available if available_shipping_methods.none?
end
def update
@@ -141,6 +141,10 @@ class SplitCheckoutController < ::BaseController
def update_order
return if params[:confirm_order] || @order.errors.any?
# If we have "pick up" shipping method (require_ship_address is set to false), use the
# distributor address as shipping address
use_shipping_address_from_distributor if shipping_method_ship_address_not_required?
@order.select_shipping_method(params[:shipping_method_id])
@order.update(order_params)
@order.updater.update_totals_and_states
@@ -150,6 +154,29 @@ class SplitCheckoutController < ::BaseController
@order.errors.empty?
end
def use_shipping_address_from_distributor
@order.ship_address = @order.address_from_distributor
# Add the missing data
bill_address = params[:order][:bill_address_attributes]
@order.ship_address.firstname = bill_address[:firstname]
@order.ship_address.lastname = bill_address[:lastname]
@order.ship_address.phone = bill_address[:phone]
# Remove shipping address from parameter so we don't override the address we just set
params[:order].delete(:ship_address_attributes)
end
def shipping_method_ship_address_not_required?
selected_shipping_method = available_shipping_methods&.select do |sm|
sm.id.to_s == params[:shipping_method_id]
end
return false if selected_shipping_method.empty?
selected_shipping_method.first.require_ship_address == false
end
def summary_step?
params[:step] == "summary"
end

View File

@@ -13,7 +13,7 @@ module Spree
def collection
params[:q] ||= {}
params[:q][:s] ||= "ascend_by_name"
params[:q][:s] ||= "name asc"
@search = super.ransack(params[:q])
@pagy, @zones = pagy(@search.result, items: Spree::Config[:orders_per_page])
@zones

View File

@@ -0,0 +1,47 @@
# frozen_string_literal: true
class WebhookEndpointsController < ::BaseController
before_action :load_resource, only: :destroy
def create
webhook_endpoint = spree_current_user.webhook_endpoints.new(webhook_endpoint_params)
if webhook_endpoint.save
flash[:success] = t('.success')
else
flash[:error] = t('.error')
end
redirect_to redirect_path
end
def destroy
if @webhook_endpoint.destroy
flash[:success] = t('.success')
else
flash[:error] = t('.error')
end
redirect_to redirect_path
end
def load_resource
@webhook_endpoint = spree_current_user.webhook_endpoints.find(params[:id])
end
def webhook_endpoint_params
params.require(:webhook_endpoint).permit(:url)
end
def redirect_path
if request.referer.blank? || request.referer.include?(spree.account_path)
developer_settings_path
else
request.referer
end
end
def developer_settings_path
"#{spree.account_path}#/developer_settings"
end
end

View File

@@ -14,6 +14,7 @@ module Admin
producers.size == 1 ? producers.first.id : nil
end
# rubocop:disable Metrics/MethodLength
def enterprise_side_menu_items(enterprise)
is_shop = enterprise.sells != "none"
show_properties = !!enterprise.is_primary_producer
@@ -34,6 +35,7 @@ module Admin
{ name: 'shipping_methods', icon_class: "icon-truck", show: show_shipping_methods },
{ name: 'payment_methods', icon_class: "icon-money", show: show_payment_methods },
{ name: 'enterprise_fees', icon_class: "icon-tasks", show: show_enterprise_fees },
{ name: 'vouchers', icon_class: "icon-ticket", show: true },
{ name: 'enterprise_permissions', icon_class: "icon-plug", show: true,
href: admin_enterprise_relationships_path },
{ name: 'inventory_settings', icon_class: "icon-list-ol", show: is_shop },
@@ -42,5 +44,6 @@ module Admin
{ name: 'users', icon_class: "icon-user", show: true }
]
end
# rubocop:enable Metrics/MethodLength
end
end

View File

@@ -0,0 +1,27 @@
# frozen_string_literal: true
# Trigger jobs for any order cycles that recently opened
class OrderCycleOpenedJob < ApplicationJob
def perform
ActiveRecord::Base.transaction do
recently_opened_order_cycles.find_each do |order_cycle|
OrderCycleWebhookService.create_webhook_job(order_cycle, 'order_cycle.opened')
end
mark_as_opened(recently_opened_order_cycles)
end
end
private
def recently_opened_order_cycles
@recently_opened_order_cycles ||= OrderCycle
.where(opened_at: nil)
.where(orders_open_at: 1.hour.ago..Time.zone.now)
.lock.order(:id)
end
def mark_as_opened(order_cycles)
now = Time.zone.now
order_cycles.update_all(opened_at: now, updated_at: now)
end
end

View File

@@ -0,0 +1,50 @@
# frozen_string_literal: true
require "faraday"
require "private_address_check"
require "private_address_check/tcpsocket_ext"
# Deliver a webhook payload
# As a delayed job, it can run asynchronously and handle retries.
class WebhookDeliveryJob < ApplicationJob
# General failed request error that we're going to use to signal
# the job runner to retry our webhook worker.
class FailedWebhookRequestError < StandardError; end
queue_as :default
def perform(url, event, payload)
body = {
id: job_id,
at: Time.zone.now.to_s,
event: event,
data: payload,
}
# Request user-submitted url, preventing any private connections being made
# (SSRF).
# This method may allow the socket to open, but is necessary in order to
# protect from TOC/TOU.
# Note that private_address_check provides some methods for pre-validating,
# but they're not as comprehensive and so unnecessary here. Simply
# momentarily opening sockets probably can't cause DoS or other damage.
PrivateAddressCheck.only_public_connections do
notify_endpoint(url, body)
end
end
def notify_endpoint(url, body)
connection = Faraday.new(
request: { timeout: 30 },
headers: {
'User-Agent' => 'openfoodnetwork_webhook/1.0',
'Content-Type' => 'application/json',
}
)
response = connection.post(url, body.to_json)
# Raise a failed request error and let job runner handle retrying.
# In theory, only 5xx errors should be retried, but who knows.
raise FailedWebhookRequestError, response.status.to_s unless response.success?
end
end

View File

@@ -61,4 +61,9 @@ class CustomerSchema < JsonApiSchema
def self.relationships
[:enterprise]
end
# Optional attributes included with eg: CustomerSchema.schema(extra_fields: :balance)
def self.balance
{ balance: { type: :number, format: :double } }
end
end

View File

@@ -19,84 +19,77 @@ class JsonApiSchema
end
def schema(options = {})
{
type: :object,
properties: {
data: {
type: :object,
properties: data_properties(**options)
},
meta: { type: :object },
links: { type: :object }
},
required: [:data]
}
Structure.schema(data_properties(**options))
end
def collection(options)
{
type: :object,
properties: {
data: {
type: :array,
items: {
type: :object,
properties: data_properties(**options)
}
},
meta: {
type: :object,
properties: {
pagination: {
type: :object,
properties: {
results: { type: :integer, example: 250 },
pages: { type: :integer, example: 5 },
page: { type: :integer, example: 2 },
per_page: { type: :integer, example: 50 },
}
}
},
required: [:pagination]
},
links: {
type: :object,
properties: {
self: { type: :string },
first: { type: :string },
prev: { type: :string, nullable: true },
next: { type: :string, nullable: true },
last: { type: :string }
}
}
},
required: [:data, :meta, :links]
}
Structure.collection(data_properties(**options))
end
private
def data_properties(require_all: false)
def data_properties(require_all: false, extra_fields: nil)
extra_fields_result = get_extra_fields(extra_fields)
attributes = get_attributes(extra_fields_result)
required = get_required(require_all, extra_fields, extra_fields_result)
Structure.data_properties(object_name, attributes, required, relationship_properties)
end
def relationship_properties
relationships.to_h { |name| [name, relationship_schema(name)] }
end
# Example
# MySchema.schema(extra_fields: :my_method)
# => extra_fields_result = MySchema.my_method
# => attributes = attributes.merge(extra_fields_result)
#
# MySchema.schema(extra_fields: {name: :my_method, required: true, opts: {method_opt: true}})
# => extra_fields_result = MySchema.my_method(method_opt: true)
# => attributes = attributes.merge(extra_fields_result)
# => required += extra_fields_result.keys
#
# MySchema.schema(extra_fields: [:my_method, :another_method])
# => extra_fields_result = MySchema.my_method.merge(another_method)
# => attributes = attribtues.merge(extra_fields_result)
#
# To test use eg:
# MySchema.schema(extra_fields: :my_method)
# .dig(:properties, :data, :properties, :attributes)
def get_extra_fields(extra_fields)
case extra_fields
when Symbol
public_send(extra_fields)
when Hash
public_send(extra_fields[:name], **extra_fields[:opts].to_h)
when Array
obj = {}
extra_fields.each do |w|
obj.merge!(get_extra_fields(w))
end
obj
end
end
def get_required(require_all, extra_fields, extra_fields_result)
required = require_all ? all_attributes : required_attributes
{
id: { type: :string, example: "1" },
type: { type: :string, example: object_name },
attributes: {
type: :object,
properties: attributes,
required: required
},
relationships: {
type: :object,
properties: relationships.to_h do |name|
[
name,
relationship_schema(name)
]
end
}
}
if extra_fields.is_a?(Hash) && extra_fields[:required] == true && extra_fields_result.present?
required += extra_fields_result.keys
end
required
end
def get_attributes(extra_fields_result)
if [extra_fields_result, attributes].all?{ |obj| obj.respond_to?(:merge) }
attributes.merge(extra_fields_result)
else
attributes
end
end
def relationship_schema(name)

View File

@@ -0,0 +1,83 @@
# frozen_string_literal: true
# rubocop:disable Metrics/MethodLength
class JsonApiSchema
module Structure
extend self
def schema(data_properties)
{
type: :object,
properties: {
data: {
type: :object,
properties: data_properties
},
meta: { type: :object },
links: { type: :object }
},
required: [:data]
}
end
def collection(data_properties)
{
type: :object,
properties: {
data: {
type: :array,
items: {
type: :object,
properties: data_properties
}
},
meta: {
type: :object,
properties: {
pagination: {
type: :object,
properties: {
results: { type: :integer, example: 250 },
pages: { type: :integer, example: 5 },
page: { type: :integer, example: 2 },
per_page: { type: :integer, example: 50 },
}
}
},
required: [:pagination]
},
links: {
type: :object,
properties: {
self: { type: :string },
first: { type: :string },
prev: { type: :string, nullable: true },
next: { type: :string, nullable: true },
last: { type: :string }
}
}
},
required: [:data, :meta, :links]
}
end
def data_properties(object_name, attributes, required, relationship_properties)
{
id: { type: :string, example: "1" },
type: { type: :string, example: object_name },
attributes: {
type: :object,
properties: attributes,
required: required
},
relationships: {
type: :object,
properties: relationship_properties
}
}
end
end
end
# rubocop:enable Metrics/MethodLength

View File

@@ -17,7 +17,7 @@ class Enterprise < ApplicationRecord
}.freeze
VALID_INSTAGRAM_REGEX = %r{\A[a-zA-Z0-9._]{1,30}([^/-]*)\z}
searchable_attributes :sells, :is_primary_producer
searchable_attributes :sells, :is_primary_producer, :name
searchable_associations :properties
searchable_scopes :is_primary_producer, :is_distributor, :is_hub, :activated, :visible,
:ready_for_checkout, :not_ready_for_checkout
@@ -65,6 +65,7 @@ class Enterprise < ApplicationRecord
has_many :inventory_items
has_many :tag_rules
has_one :stripe_account, dependent: :destroy
has_many :vouchers
delegate :latitude, :longitude, :city, :state_name, to: :address
@@ -450,7 +451,8 @@ class Enterprise < ApplicationRecord
end
def strip_url(url)
url&.sub(%r{(https?://)?}, '')
# Strip protocol and trailing slash
url&.sub(%r{(https?://)?}, '')&.sub(%r{/\z}, '')
end
def correct_whatsapp_url(phone_number)
@@ -458,11 +460,11 @@ class Enterprise < ApplicationRecord
end
def correct_instagram_url(url)
url && strip_url(url.downcase).sub(%r{www.instagram.com/}, '').sub(%r{instagram.com/}, '').delete("@")
url && strip_url(url.downcase).sub(%r{(www\.)?instagram.com/}, '').delete("@")
end
def correct_twitter_url(url)
url && strip_url(url).sub(%r{www.twitter.com/}, '').delete("@")
url && strip_url(url).sub(%r{(www\.)?twitter.com/}, '').delete("@")
end
def set_unused_address_fields

View File

@@ -34,6 +34,7 @@ class OrderCycle < ApplicationRecord
attr_accessor :incoming_exchanges, :outgoing_exchanges
before_update :reset_opened_at, if: :will_save_change_to_orders_open_at?
before_update :reset_processed_at, if: :will_save_change_to_orders_close_at?
after_save :sync_subscriptions, if: :opening?
@@ -333,6 +334,14 @@ class OrderCycle < ApplicationRecord
errors.add(:orders_close_at, :after_orders_open_at)
end
def reset_opened_at
# Reset only if order cycle is opening again at a later date
return unless orders_open_at.present? && orders_open_at_was.present?
return unless orders_open_at > orders_open_at_was
self.opened_at = nil
end
def reset_processed_at
return unless orders_close_at.present? && orders_close_at_was.present?
return unless orders_close_at > orders_close_at_was

View File

@@ -271,10 +271,16 @@ module ProductImport
end
def entry_matches_existing_variant?(entry, existing_variant)
existing_variant.display_name == entry.display_name &&
display_name_are_the_same?(entry, existing_variant) &&
existing_variant.unit_value == entry.unit_value.to_f
end
def display_name_are_the_same?(entry, existing_variant)
return true if entry.display_name.blank? && existing_variant.display_name.blank?
existing_variant.display_name == entry.display_name
end
def category_validation(entry)
category_name = entry.category

View File

@@ -179,6 +179,8 @@ module Spree
can [:admin, :create], :manager_invitation
can [:admin, :index], :oidc_setting
can [:admin, :create], Voucher
end
def add_product_management_abilities(user)

View File

@@ -4,7 +4,7 @@ module Spree
class Address < ApplicationRecord
include AddressDisplay
searchable_attributes :firstname, :lastname
searchable_attributes :firstname, :lastname, :phone
searchable_associations :country, :state
belongs_to :country, class_name: "Spree::Country"

View File

@@ -14,7 +14,7 @@ module Spree
searchable_attributes :number, :state, :shipment_state, :payment_state, :distributor_id,
:order_cycle_id, :email, :total, :customer_id
searchable_associations :shipping_method, :bill_address
searchable_associations :shipping_method, :bill_address, :distributor
searchable_scopes :complete, :incomplete
checkout_flow do

View File

@@ -38,7 +38,10 @@ module Spree
has_many :customers
has_many :credit_cards
has_many :report_rendering_options, class_name: "::ReportRenderingOptions", dependent: :destroy
has_many :webhook_endpoints, dependent: :destroy
accepts_nested_attributes_for :enterprise_roles, allow_destroy: true
accepts_nested_attributes_for :webhook_endpoints
accepts_nested_attributes_for :bill_address
accepts_nested_attributes_for :ship_address
@@ -148,10 +151,6 @@ module Spree
spree_orders.incomplete.where(created_by_id: id).order('created_at DESC').first
end
def flipper_id
"#{self.class.name};#{id}"
end
def disabled
disabled_at.present?
end

View File

@@ -20,7 +20,7 @@ module Spree
belongs_to :product, -> { with_deleted }, touch: true, class_name: 'Spree::Product'
delegate_belongs_to :product, :name, :description, :permalink, :available_on,
:tax_category_id, :shipping_category_id, :meta_description,
:tax_category_id, :shipping_category_id,
:meta_keywords, :tax_category, :shipping_category
has_many :inventory_units, inverse_of: :variant

15
app/models/voucher.rb Normal file
View File

@@ -0,0 +1,15 @@
# frozen_string_literal: false
class Voucher < ApplicationRecord
belongs_to :enterprise
validates :code, presence: true, uniqueness: { scope: :enterprise_id }
def value
10
end
def display_value
Spree::Money.new(value)
end
end

View File

@@ -0,0 +1,6 @@
# frozen_string_literal: true
# Records a webhook url to send notifications to
class WebhookEndpoint < ApplicationRecord
validates :url, presence: true
end

View File

@@ -1,28 +1,22 @@
# frozen_string_literal: true
# Fetches the customers of the specified enterprise including the aggregated balance across the
# customer's orders. That is, we get the total balance for each customer with this enterprise.
# Adds an aggregated 'balance_value' to each customer based on their order history
#
class CustomersWithBalance
def initialize(enterprise)
@enterprise = enterprise
def initialize(customers)
@customers = customers
end
def query
Customer.of(enterprise).
@customers.
joins(left_join_complete_orders).
group("customers.id").
select("customers.*").
select(outstanding_balance_sum)
select("#{outstanding_balance_sum} AS balance_value")
end
private
attr_reader :enterprise
def outstanding_balance_sum
"SUM(#{OutstandingBalance.new.statement}) AS balance_value"
end
# The resulting orders are in states that belong after the checkout. Only these can be considered
# for a customer's balance.
def left_join_complete_orders
@@ -36,4 +30,8 @@ class CustomersWithBalance
states = Spree::Order::FINALIZED_STATES.map { |state| Arel::Nodes.build_quoted(state) }
Arel::Nodes::In.new(Spree::Order.arel_table[:state], states)
end
def outstanding_balance_sum
"SUM(#{OutstandingBalance.new.statement})::float"
end
end

View File

@@ -23,4 +23,8 @@ class ApplicationReflex < StimulusReflex::Reflex
def current_ability
Spree::Ability.new(current_user)
end
def with_locale(&block)
I18n.with_locale(current_user.locale, &block)
end
end

View File

@@ -0,0 +1,35 @@
# frozen_string_literal: true
class BulkActionsInOrdersListReflex < ApplicationReflex
def resend_confirmation_email(order_ids)
orders(order_ids).find_each do |o|
Spree::OrderMailer.confirm_email_for_customer(o.id, true).deliver_later if can? :resend, o
end
success("admin.resend_confirmation_emails_feedback", order_ids.count)
end
def send_invoice(order_ids)
count = 0
orders(order_ids).find_each do |o|
next unless o.distributor.can_invoice? && (o.resumed? || o.complete?)
Spree::OrderMailer.invoice_email(o.id).deliver_later
count += 1
end
success("admin.send_invoice_feedback", count)
end
private
def success(i18n_key, count)
flash[:success] = I18n.t(i18n_key, count: count)
cable_ready.dispatch_event(name: "modal:close")
morph "#flashes", render(partial: "shared/flashes", locals: { flashes: flash })
end
def orders(order_ids)
Spree::Order.where(id: order_ids)
end
end

View File

@@ -0,0 +1,10 @@
# frozen_string_literal: false
class EnterpriseEditReflex < ApplicationReflex
def remove_terms_and_conditions
@enterprise = Enterprise.find(element.dataset['enterprise-id'])
throw :forbidden unless can?(:remove_terms_and_conditions, @enterprise)
@enterprise.terms_and_conditions.purge_later
end
end

View File

@@ -0,0 +1,42 @@
# frozen_string_literal: true
class InviteManagerReflex < ApplicationReflex
include ManagerInvitations
def invite
email = params[:email]
enterprise = Enterprise.find(params[:enterprise_id])
authorize! :edit, enterprise
existing_user = Spree::User.find_by(email: email)
locals = { error: nil, success: nil, email: email, enterprise: enterprise }
if existing_user
locals[:error] = I18n.t('admin.enterprises.invite_manager.user_already_exists')
return_morph(locals)
return
end
new_user = create_new_manager(email, enterprise)
if new_user.errors.empty?
locals[:success] = true
else
locals[:error] = new_user.errors.full_messages.to_sentence
end
return_morph(locals)
end
private
def return_morph(locals)
morph "#add_manager_modal",
with_locale {
render(partial: "admin/enterprises/form/add_new_unregistered_manager", locals: locals)
}
end
end

View File

@@ -1,13 +0,0 @@
# frozen_string_literal: true
class ResendConfirmationEmailReflex < ApplicationReflex
def confirm(order_ids)
Spree::Order.where(id: order_ids).find_each do |o|
Spree::OrderMailer.confirm_email_for_customer(o.id, true).deliver_later if can? :resend, o
end
flash[:success] = I18n.t("admin.resend_confirmation_emails_feedback", count: order_ids.count)
cable_ready.dispatch_event(name: "modal:close")
morph "#flashes", render(partial: "shared/flashes", locals: { flashes: flash })
end
end

View File

@@ -16,6 +16,10 @@ module Api
address(object.shipping_address)
end
attribute :balance, if: proc { |record|
record.respond_to?(:balance_value)
}, &:balance_value
belongs_to :enterprise, links: {
related: ->(object) {
url_helpers.api_v1_enterprise_url(id: object.enterprise_id)

View File

@@ -1,29 +0,0 @@
# frozen_string_literal: true
# Forks into a separate process to contain memory usage and timeout errors.
class JobProcessor
def self.perform_forked(job, *args)
# Reports should abort when puma threads are killed to avoid wasting
# resources. Nobody would be collecting the result. We still need to
# implement a way to email or download reports later.
timeout = ENV.fetch("RACK_TIMEOUT_WAIT_TIMEOUT", "30").to_i
child = fork do
Process.setproctitle("Job worker #{job.job_id}")
Timeout.timeout(timeout) do
job.perform(*args)
end
# Exit is not a good idea within a Rails process but Rubocop doesn't know
# that we are in a forked process.
exit # rubocop:disable Rails/Exit
end
# Wait for the forked child process to exit.
Process.waitpid(child)
ensure
# If this Puma thread is interrupted then we need to detach the child
# process to avoid it becoming a zombie.
Process.detach(child)
end
end

View File

@@ -18,9 +18,7 @@ class OrderAvailablePaymentMethods
applicator = OpenFoodNetwork::TagRuleApplicator.new(distributor,
"FilterPaymentMethods", customer&.tag_list)
applicator.filter!(payment_methods)
payment_methods.uniq
applicator.filter(payment_methods)
end
private
@@ -32,7 +30,7 @@ class OrderAvailablePaymentMethods
distributor.payment_methods.where(
id: available_distributor_payment_methods_ids
)
end.available.select(&:configured?)
end.available.select(&:configured?).uniq
end
def available_distributor_payment_methods_ids

View File

@@ -14,25 +14,32 @@ class OrderAvailableShippingMethods
def to_a
return [] if distributor.blank?
shipping_methods = shipping_methods_before_tag_rules_applied
applicator = OpenFoodNetwork::TagRuleApplicator.new(distributor,
"FilterShippingMethods", customer&.tag_list)
applicator.filter!(shipping_methods)
shipping_methods.uniq
filter_by_category(tag_rules.filter(shipping_methods))
end
private
def shipping_methods_before_tag_rules_applied
def filter_by_category(methods)
return methods unless OpenFoodNetwork::FeatureToggle.enabled?(:match_shipping_categories,
distributor&.owner)
required_category_ids = order.products.pluck(:shipping_category_id).to_set
return methods if required_category_ids.empty?
methods.select do |method|
provided_category_ids = method.shipping_categories.pluck(:id).to_set
required_category_ids.subset?(provided_category_ids)
end
end
def shipping_methods
if order_cycle.nil? || order_cycle.simple?
distributor.shipping_methods
else
distributor.shipping_methods.where(
id: available_distributor_shipping_methods_ids
)
end.frontend.to_a
end.frontend.to_a.uniq
end
def available_distributor_shipping_methods_ids
@@ -40,4 +47,10 @@ class OrderAvailableShippingMethods
.where(distributor_id: distributor.id)
.select(:shipping_method_id)
end
def tag_rules
OpenFoodNetwork::TagRuleApplicator.new(
distributor, "FilterShippingMethods", customer&.tag_list
)
end
end

View File

@@ -0,0 +1,21 @@
# frozen_string_literal: true
# Create a webhook payload for an order cycle event.
# The payload will be delivered asynchronously.
class OrderCycleWebhookService
def self.create_webhook_job(order_cycle, event)
webhook_payload = order_cycle
.slice(:id, :name, :orders_open_at, :orders_close_at, :coordinator_id)
.merge(coordinator_name: order_cycle.coordinator.name)
# Endpoints for coordinator owner
webhook_endpoints = order_cycle.coordinator.owner.webhook_endpoints
# Plus unique endpoints for distributor owners (ignore duplicates)
webhook_endpoints |= order_cycle.distributors.map(&:owner).flat_map(&:webhook_endpoints)
webhook_endpoints.each do |endpoint|
WebhookDeliveryJob.perform_later(endpoint.url, event, webhook_payload)
end
end
end

View File

@@ -8,7 +8,7 @@ module PermittedAttributes
:variant_unit, :variant_unit_scale, :unit_value, :unit_description, :variant_unit_name,
:display_as, :sku, :available_on, :group_buy, :group_buy_unit_size,
:taxon_ids, :primary_taxon_id, :tax_category_id, :shipping_category_id,
:meta_keywords, :meta_description, :notes, :inherits_properties,
:meta_keywords, :notes, :inherits_properties,
{ product_properties_attributes: [:id, :property_name, :value],
variants_attributes: [PermittedAttributes::Variant.attributes],
images_attributes: [:attachment] }

View File

@@ -15,7 +15,10 @@ module PermittedAttributes
private
def permitted_attributes
[:email, :password, :password_confirmation, :disabled]
[
:email, :password, :password_confirmation, :disabled,
{ webhook_endpoints_attributes: [:id, :url] },
]
end
end
end

View File

@@ -29,15 +29,11 @@ module Shop
private
# order_cycles is a ActiveRecord::Relation that is modified with reject in the TagRuleApplicator
# If this relation is reloaded (for example by calling count on it), the modifications are lost
def apply_tag_rules!(order_cycles)
applicator = OpenFoodNetwork::TagRuleApplicator.new(@distributor,
"FilterOrderCycles",
@customer&.tag_list)
applicator.filter!(order_cycles)
order_cycles
applicator.filter(order_cycles)
end
end
end

View File

@@ -9,6 +9,12 @@
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
%legend= t(".#{ item[:name] }.legend")
- when 'vouchers'
- if feature?(:vouchers, spree_current_user)
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
%legend= t(".#{ item[:form_name] || item[:name] }.legend")
= render "admin/enterprises/form/#{ item[:form_name] || item[:name] }", f: f
- else
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
%legend= t(".#{ item[:form_name] || item[:name] }.legend")

View File

@@ -0,0 +1,22 @@
%div#add_manager_modal
%form{ "data-reflex": "submit->InviteManager#invite", "data-reflex-serialize-form": true }
.margin-bottom-30.text-center
.text-big
= t('js.admin.modals.invite_title')
- if success
%p.alert-box.ok= t('user_invited', email: email)
- if error
%p.alert-box.error= error
= text_field_tag :email, nil, class: 'fullwidth margin-bottom-20'
= hidden_field_tag :enterprise_id, @enterprise&.id || enterprise.id
.modal-actions
- if success
%input{ class: "button icon-plus secondary", type: 'button', value: t('js.admin.modals.close'), "data-action": "click->help-modal#close" }
- else
%input{ class: "button icon-plus secondary", type: 'button', value: t('js.admin.modals.cancel'), "data-action": "click->help-modal#close" }
= submit_tag "#{t('js.admin.modals.invite')}"

View File

@@ -31,22 +31,39 @@
= f.label :invoice_text, t('.invoice_text')
.omega.eight.columns
= f.text_area :invoice_text, style: "width: 100%; height: 100px;"
.row
.row{ data: { controller: 'terms-and-conditions', "terms-and-conditions-message-value": t('js.admin.enterprises.form.images.immediate_terms_and_conditions_removal_warning') } }
.alpha.three.columns
= f.label :terms_and_conditions, t('.terms_and_conditions')
%i.text-big.icon-question-sign{ "data-controller": "help-modal-link", "data-action": "click->help-modal-link#open", "data-help-modal-link-target-value": "terms_and_conditions_info_modal" }
.omega.eight.columns
%a{ href: '{{ Enterprise.terms_and_conditions }}', target: '_blank', ng: { if: 'Enterprise.terms_and_conditions' } }
= '{{ Enterprise.terms_and_conditions_file_name }}'
= t('.uploaded_on')
= '{{ Enterprise.terms_and_conditions_updated_at }}'
.omega.eight.columns#terms_and_conditions{data: { 'reflex-root': '#terms_and_conditions' } }
- if @enterprise.terms_and_conditions.attached?
= link_to "#{@enterprise.terms_and_conditions.blob.filename} #{ t('.uploaded_on') } #{@enterprise.terms_and_conditions.blob.created_at}", url_for(@enterprise.terms_and_conditions), target: '_blank'
%div
%a.icon-trash{ href: '#', data: { action: 'click->terms-and-conditions#remove', "terms-and-conditions-message-value": t('js.admin.enterprises.form.images.immediate_terms_and_conditions_removal_warning'), 'enterprise-id': @enterprise.id}}
= t('.remove_terms_and_conditions')
.pad-top
= f.file_field :terms_and_conditions, accept: 'application/pdf', 'terms-and-conditions-warning' => 'true'
.pad-top
%a.button.red{ href: '', ng: {click: 'removeTermsAndConditions()', if: 'Enterprise.terms_and_conditions'} }
= t('.remove_terms_and_conditions')
%div
.button.small{ data: { controller: 'help-modal-link', action: 'click->help-modal-link#open', "help-modal-link-target-value": "terms_and_conditions_warning_modal" } }
= t('.upload')
%span{ data: { "terms-and-conditions-target": "filename" } }
= f.file_field :terms_and_conditions, accept: 'application/pdf', style: 'display: none;', data: { "terms-and-conditions-target": "fileinput" }
= render HelpModalComponent.new(id: "terms_and_conditions_warning_modal", close_button: false ) do
%div
.margin-bottom-30.text-center
.text-big{ style: 'color: red'}
= t('js.admin.modals.terms_and_conditions_warning.title')
.margin-bottom-30
%p
= t('js.admin.modals.terms_and_conditions_warning.message_1')
.margin-bottom-30
%p
= t('js.admin.modals.terms_and_conditions_warning.message_2')
.text-center
%input.button.red{ type: 'button', value: t('js.admin.modals.close'), "data-action": "click->help-modal#close"}
%input.button.red{ type: 'button', value: t('js.admin.modals.continue'), "data-action": "click->help-modal#close click->terms-and-conditions#add" }
= f.fields_for :business_address, @enterprise.business_address || @enterprise.build_business_address do |bf|
@@ -63,13 +80,12 @@
%legend= t('.invoice_item_sorting_legend')
.three.columns.alpha
%label= t('.sort_items_by_supplier?')
%div{'ofn-with-tip' => t('.sort_items_by_supplier_tip')}
%a= t 'admin.whats_this'
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.sort_items_by_supplier_tip')}
.three.columns
= f.radio_button :preferred_invoice_order_by_supplier, true, 'ng-model' => 'Enterprise.preferred_invoice_order_by_supplier', 'ng-value' => 'true'
= f.radio_button :preferred_invoice_order_by_supplier, true
= f.label :preffered_invoice_order_by_supplier, t('.enabled'), value: :true
.five.columns.omega
= f.radio_button :preferred_invoice_order_by_supplier, false, 'ng-model' => 'Enterprise.preferred_invoice_order_by_supplier', 'ng-value' => 'false'
= f.radio_button :preferred_invoice_order_by_supplier, false
= f.label :preferred_invoice_order_by_name, t('.disabled'), value: :false
= render HelpModalComponent.new(id: "terms_and_conditions_info_modal") do

View File

@@ -6,8 +6,7 @@
=f.label :owner_id, t('.owner')
- if full_permissions
%span.required *
%div{'ofn-with-tip' => t('.owner_tip')}
%a= t('admin.whats_this')
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.owner_tip')}
.eight.columns.omega
- if full_permissions
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner', 'ng-model' => 'Enterprise.owner'
@@ -19,8 +18,7 @@
=f.label :user_ids, t('.notifications')
- if full_permissions
%span.required *
%div{'ofn-with-tip' => t('.contact_tip')}
%a= t('admin.whats_this')
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.contact_tip')}
.eight.columns.omega
- if full_permissions
%select.select2.fullwidth{id: 'receives_notifications_dropdown', name: 'receives_notifications', ng: {model: 'receivesNotifications', init: "receivesNotifications = '#{@enterprise.contact.id}'"}}
@@ -34,8 +32,7 @@
=f.label :user_ids, t('.managers')
- if full_permissions
%span.required *
%div{'ofn-with-tip' => t('.managers_tip')}
%a= t('admin.whats_this')
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.managers_tip')}
.eight.columns.omega
- if full_permissions
%table.managers
@@ -66,8 +63,7 @@
.three.columns.alpha
%label
= t('.invite_manager')
%div{'ofn-with-tip' => t('.invite_manager_tip')}
%a= t('admin.whats_this')
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.invite_manager_tip')}
.eight.columns.omega
.row
%a.button{ "data-controller": "help-modal-link", "data-action": "click->help-modal-link#open", "data-help-modal-link-target-value": "invite-manager-modal" }
@@ -76,22 +72,4 @@
-# add to admin footer to avoid nesting invitation form inside enterprise form
- content_for :admin_footer do
= render HelpModalComponent.new(id: "invite-manager-modal", close_button: false) do
%div{ng: {app: 'admin.enterprises', controller: 'enterpriseCtrl'}}
.margin-bottom-30.text-center
.text-big
= t('js.admin.modals.invite_title')
%p.alert-box.ok{ng: {show: 'invite_success'}}
{{invite_success}}
%p.alert-box.error{ng: {show: 'invite_errors'}}
{{invite_errors}}
%input#invite_email.fullwidth.margin-bottom-20{ng: {model: 'newUser'}}
.margin-bottom-20.text-center
%button.text-center.margin-top-10{ng: {show: '!invite_success', click: 'inviteManager()'}}
= t('js.admin.modals.invite')
%button.text-center.margin-top-10{"data-action": "click->help-modal#close", ng: {show: 'invite_success', click: 'resetModal();'}}
= t('js.admin.modals.close')
= render partial: 'admin/enterprises/form/add_new_unregistered_manager', locals: { error: nil, success: nil }

View File

@@ -0,0 +1,33 @@
.text-right
%a.button{ href: "#{new_admin_enterprise_voucher_path(@enterprise)}"}
= t('.add_new')
%br
- if @enterprise.vouchers.present?
%table
%thead
%tr
%th= t('.voucher_code')
%th= t('.rate')
/%th= t('.label')
/%th= t('.purpose')
/%th= t('.expiry')
/%th= t('.use_limit')
/%th= t('.customers')
/%th= t('.net_value')
%tbody
- @enterprise.vouchers.each do |voucher|
%tr
%td= voucher.code
%td= voucher.display_value
/%td
/%td
/%td
/%td
/%td
/%td
- else
%p.text-center
= t('.no_voucher_yet')

View File

@@ -5,7 +5,7 @@
%fieldset.no-border-bottom.print-hidden
%legend{ align: 'center'}= t(:report_filters)
= render partial: "admin/reports/filters/#{@report_type}", locals: { f: f }
- if @report_subtype && lookup_context.exists?(@report_subtype, "admin/reports/filters/", true)
- if @report_subtype && lookup_context.exists?(@report_subtype, "admin/reports/filters", true)
= render partial: "admin/reports/filters/#{@report_subtype}", locals: { f: f }
%fieldset.print-hidden

View File

@@ -1,7 +1,7 @@
.side_menu#side_menu
- if @enterprise
- enterprise_side_menu_items(@enterprise).each do |item|
- next unless item[:show]
- next if !item[:show] || (item[:name] == 'vouchers' && !feature?(:vouchers, spree_current_user))
%a.menu_item{ href: item[:href] || "##{item[:name]}_panel", id: item[:name], data: { action: "tabs-and-panels#changeActivePanel tabs-and-panels#changeActiveTab", "tabs-and-panels-target": "tab" }, class: item[:selected] }
%i{ class: item[:icon_class] }
%span= t(".enterprise.#{item[:name] }")

View File

@@ -0,0 +1,23 @@
= form_with model: @voucher, url: admin_enterprise_vouchers_path(@enterprise), html: { name: "voucher_form" } do |f|
.row
.sixteen.columns.alpha
.four.columns.alpha.text-right
%a.button{ href: "#{edit_admin_enterprise_path(@enterprise)}#!#vouchers_panel"}
= t('.back')
.twelve.columns.omega
.row
.eight.columns.text-center
%legend= t(".legend")
.four.columns.text-right
= f.submit t('.save'), class: 'red'
.row
.alpha.four.columns
= f.label :code, t('.voucher_code')
.omega.eight.columns
= f.text_area :code, rows: 6, class: 'fullwidth'
.row
.alpha.four.columns
= f.label :amount, t('.voucher_amount')
.omega.eight.columns
= Spree::Money.currency_symbol
= f.text_field :amount, value: @voucher.value, disabled: true

View File

@@ -10,7 +10,7 @@
%span{ ng: { class: "{brick: !enterprise.is_primary_producer, turquoise: enterprise.is_primary_producer}" } }
{{ enterprise.name }}
%form{ name: 'about', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "update('images',about)" } }
%form{ name: 'about', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "selectIfValid('images', about)" } }
.row
.small-12.columns
.alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } }

View File

@@ -37,6 +37,7 @@
.field
%label{ for: 'enterprise_instagram' }= t(".instagram")+":"
%input.chunky{ id: 'enterprise_instagram', placeholder: "{{'registration.steps.social.instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } }
%span.error.small-12.columns#instagram-error{ style: "display: none" }
.row.buttons
.small-12.columns

View File

@@ -76,8 +76,8 @@
- display_ship_address = false
- ship_method_description = nil
- selected_shipping_method ||= @allowed_shipping_methods[0].id if @allowed_shipping_methods.length == 1
- @allowed_shipping_methods.each do |shipping_method|
- selected_shipping_method ||= @shipping_methods[0].id if @shipping_methods.length == 1
- @shipping_methods.each do |shipping_method|
- ship_method_is_selected = shipping_method.id == selected_shipping_method.to_i
%div.checkout-input.checkout-input-radio
= fields_for shipping_method do |shipping_method_form|

View File

@@ -34,6 +34,10 @@
= @order.bill_address.zipcode
%div
= @order.bill_address.country
- if @order.special_instructions.present?
%br
%em
= @order.special_instructions
- if @order.shipping_method.description.present?
%div
.summary-subtitle

View File

@@ -29,5 +29,5 @@
- if spree_current_user
.checkout-input
= check_box_tag "order[payments_attributes][][source_attributes][save_requested_by_customer]", 1, false
= label :save_requested_by_customer, t('split_checkout.step2.form.stripe.save_card'), { for: "save_requested_by_customer" }
= label_tag :order_payments_attributes__source_attributes_save_requested_by_customer, t('split_checkout.step2.form.stripe.save_card')

View File

@@ -18,22 +18,28 @@
%input.red{ type: "button", value: "Save Changes", ng: { click: "submit()", disabled: "!bulk_order_form.$dirty" } }
%legend{ align: 'center'}= t(:search)
%div{ :class => "sixteen columns alpha" }
.filter_select{ :class => "four columns" }
.quick_search.three.columns.alpha
%label{ for: 'quick_filter' }
%br
%input.quick-search.fullwidth{ ng: {model: 'query'}, name: "quick_filter", type: 'text', placeholder: t('admin.quick_search'), "ng-keypress" => "$event.keyCode === 13 && fetchResults()" }
.one.columns
&nbsp;
.filter_select{ :class => "three columns" }
%label{ :for => 'supplier_filter' }
= t("admin.producer")
%br
%input#supplier_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'suppliers', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'supplierFilter' } }
.filter_select{ :class => "four columns" }
.filter_select{ :class => "three columns" }
%label{ :for => 'distributor_filter' }
= t("admin.shop")
%br
%input#distributor_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'distributors', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'distributorFilter' } }
.filter_select{ :class => "four columns" }
.filter_select{ :class => "three columns" }
%label{ :for => 'order_cycle_filter' }
= t("admin.order_cycle")
%br
%input#order_cycle_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'orderCycles', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'orderCycleFilter' } }
.date_filter{class: "four columns"}
.date_filter{class: "three columns"}
%label
= t("date_range")
%br
@@ -97,8 +103,6 @@
.clear
%div{ ng: { hide: 'RequestMonitor.loading || line_items.length == 0' }, style: "display: flex; justify-content: flex-start; column-gap: 10px; margin-bottom: 15px" }
%div{ style: "flex-grow: 1" }
%input.fullwidth{ :type => "text", :id => 'quick_search', 'ng-model' => 'quickSearch', :placeholder => 'Quick Search' }
-# This -20px is a hack to make the dropdowns align properly
%div{ style: "margin-right: -20px;" }
= render 'admin/shared/bulk_actions_dropdown'
@@ -162,7 +166,7 @@
= "#{t('admin.price')} (#{Spree::Money.currency_symbol})"
%th.actions
%tr.line_item{ ng: { repeat: "line_item in filteredLineItems = ( line_items | filter:quickSearch | variantFilter:selectedUnitsProduct:selectedUnitsVariant:sharedResource | orderBy:sorting.predicate:sorting.reverse )", 'class-even' => "'even'", 'class-odd' => "'odd'", attr: { id: "li_{{line_item.id}}" } } }
%tr.line_item{ ng: { repeat: "line_item in filteredLineItems = ( line_items | variantFilter:selectedUnitsProduct:selectedUnitsVariant:sharedResource | orderBy:sorting.predicate:sorting.reverse )", 'class-even' => "'even'", 'class-odd' => "'odd'", attr: { id: "li_{{line_item.id}}" } } }
%td.bulk
%input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'line_item.checked', 'ignore-dirty' => true }
%td.order_no{ 'ng-show' => 'columns.order_no.visible' } {{ line_item.order.number }}

View File

@@ -21,24 +21,27 @@
.row.index-controls{'ng-show' => '!RequestMonitor.loading && orders.length > 0'}
%div{style: "display: flex; justify-content: space-between;"}
- if Spree::Config[:enable_invoices?]
.ofn-drop-down-with-prepend
.ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
{{ "spree.admin.orders.index.selected" | t:{count: selected_orders.length} }}
.ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
%span{ :class => 'icon-reorder' }
="#{t('admin.actions')}".html_safe
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
%div.menu{ 'ng-show' => "expanded" }
.ofn-drop-down-with-prepend
.ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
{{ "spree.admin.orders.index.selected" | t:{count: selected_orders.length} }}
.ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
%span{ :class => 'icon-reorder' }
="#{t('admin.actions')}".html_safe
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
%div.menu{ 'ng-show' => "expanded" }
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" }
= t('.resend_confirmation')
- if Spree::Config[:enable_invoices?]
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" }
= t('.resend_confirmation')
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "send_invoice" }
= t('.send_invoice')
%div.menu_item
%span.name.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()' }
= t('.print_invoices')
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "cancel_orders" }
= t('.cancel_orders')
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "cancel_orders" }
= t('.cancel_orders')
= render partial: 'admin/shared/angular_per_page_controls', locals: { position: "right", model: "orders" }
@@ -124,6 +127,11 @@
= render ConfirmModalComponent.new(id: "resend_confirmation", confirm_actions: "click->resend-confirmation-email#confirm", controllers: "resend-confirmation-email") do
.margin-bottom-30
= t('.resend_confirmation_confirm_html')
= render ConfirmModalComponent.new(id: "send_invoice", confirm_actions: "click->send-invoice#confirm", controllers: "send-invoice") do
.margin-bottom-30
= t('.send_invoice_confirm_html')
= render ConfirmModalComponent.new(id: "cancel_orders", confirm_actions: "click->cancel-orders#confirm", controllers: "cancel-orders", message: "spree/admin/orders/messages/cancel_orders") do
.margin-bottom-30
= t("js.admin.orders.cancel_the_order_html")

View File

@@ -45,7 +45,7 @@
= f.field_container :shipping_categories do
= f.label :shipping_category_id, t(:shipping_categories)
= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { :include_blank => t(:none) }, { :class => 'select2' })
= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {}, { :class => 'select2' })
= f.error_message_on :shipping_category
= f.field_container :tax_category do

View File

@@ -5,11 +5,6 @@
%span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.product_search_tip') }
%br/
= f.text_field :meta_keywords, :class => 'fullwidth', :rows => 6
= f.field_container :meta_description do
= f.label :meta_description, t('admin.products.seo.SEO_keywords')
%span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.seo_tip') }
%br/
= f.text_field :meta_description, :class => 'fullwidth', :rows => 6
.alpha.eleven.columns
= f.field_container :notes do
= f.label :notes, t(:notes)

View File

@@ -4,7 +4,7 @@
= tab :orders, :subscriptions, :customer_details, :adjustments, :payments, :return_authorizations, url: admin_orders_path('q[s]' => 'completed_at desc'), icon: 'icon-shopping-cart'
= tab :reports, url: main_app.admin_reports_path, icon: 'icon-file'
= tab :general_settings, :mail_methods, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path
= tab :enterprises, :enterprise_relationships, :oidc_settings, url: main_app.admin_enterprises_path
= tab :enterprises, :enterprise_relationships, :vouchers, :oidc_settings, url: main_app.admin_enterprises_path
= tab :customers, url: main_app.admin_customers_path
= tab :enterprise_groups, url: main_app.admin_enterprise_groups_path, label: 'groups'
- if can? :admin, Spree::User

View File

@@ -66,12 +66,12 @@
.field
= f.label 'weight', t(:weight)+' (kg)'
- value = number_with_precision(@variant.weight, precision: 2)
= f.text_field 'weight', value: value, class: 'fullwidth'
= f.number_field 'weight', value: value, class: 'fullwidth', step: 0.01
- [:height, :width, :depth].each do |field|
.field
= f.label field, t(field)
- value = number_with_precision(@variant.send(field), precision: 2)
= f.text_field field, value: value, class: 'fullwidth'
= f.number_field field, value: value, class: 'fullwidth', step: 0.01
.clear

View File

@@ -1,3 +1,4 @@
%script{ type: "text/ng-template", id: "account/developer_settings.html" }
%h3= t('.title')
= render partial: 'api_keys'
= render partial: 'webhook_endpoints'

View File

@@ -0,0 +1,33 @@
%section{ id: "webhook_endpoints" }
%hr
%h3= t('.title')
%p= t('.description')
%table{width: "100%"}
%thead
%tr
%th= t('.event_type.header')
%th= t('.url.header')
%th.actions
%tbody
-# Existing endpoints
- @user.webhook_endpoints.each do |webhook_endpoint|
%tr
%td= t('.event_types.order_cycle_opened') # For now, we only support one type.
%td= webhook_endpoint.url
%td.actions
- if webhook_endpoint.persisted?
= button_to account_webhook_endpoint_path(webhook_endpoint), method: :delete,
class: "tiny alert no-margin",
data: { confirm: I18n.t(:are_you_sure)} do
= I18n.t(:delete)
-# Create new
- if @user.webhook_endpoints.empty? # Only one allowed for now.
%tr
%td= t('.event_types.order_cycle_opened') # For now, we only support one type.
%td
= form_for(@user.webhook_endpoints.build, url: account_webhook_endpoints_path, id: 'new_webhook_endpoint') do |f|
= f.url_field :url, placeholder: t('.url.create_placeholder'), required: true, size: 64
%td.actions
= button_tag t(:create), class: 'button primary tiny no-margin', form: 'new_webhook_endpoint'

View File

@@ -0,0 +1,20 @@
import ApplicationController from "./application_controller";
export default class extends ApplicationController {
connect() {
super.connect();
}
// abstract
confirm(action) {
this.stimulate(action, this.getOrdersIds());
}
// private
getOrdersIds() {
const checkboxes = document.querySelectorAll(
"#listing_orders input[name='order_ids[]']:checked"
);
return Array.from(checkboxes).map((checkbox) => checkbox.value);
}
}

View File

@@ -1,18 +1,11 @@
import ApplicationController from "./application_controller";
import BulkActionsController from "./bulk_actions_controller";
export default class extends ApplicationController {
export default class extends BulkActionsController {
connect() {
super.connect();
}
confirm() {
const order_ids = [];
document
.querySelectorAll("#listing_orders input[name='order_ids[]']:checked")
.forEach((checkbox) => {
order_ids.push(checkbox.value);
});
this.stimulate("ResendConfirmationEmailReflex#confirm", order_ids);
super.confirm("BulkActionsInOrdersList#resend_confirmation_email");
}
}

View File

@@ -0,0 +1,11 @@
import BulkActionsController from "./bulk_actions_controller";
export default class extends BulkActionsController {
connect() {
super.connect();
}
confirm() {
super.confirm("BulkActionsInOrdersList#send_invoice");
}
}

View File

@@ -12,13 +12,40 @@ export default class extends Controller {
// only display the default panel
this.defaultTarget.style.display = "block";
// Display panel specified in url anchor
const anchors = window.location.toString().split("#");
let anchor = anchors.length > 1 ? anchors.pop() : "";
if (anchor != "") {
// Conveniently AngularJs rewrite "example.com#panel" to "example.com#/panel" :(
// strip the starting / if any
if (anchor[0] == "/") {
anchor = anchor.slice(1);
}
this.updateActivePanel(anchor);
// tab
const tab_id = anchor.split("_panel").shift();
this.updateActiveTab(tab_id);
}
}
changeActivePanel(event) {
this.updateActivePanel(`${event.currentTarget.id}_panel`);
}
updateActivePanel(panel_id) {
const newActivePanel = this.panelTargets.find(
(panel) => panel.id == `${event.currentTarget.id}_panel`
(panel) => panel.id == panel_id
);
if (newActivePanel === undefined) {
// No panel found
return;
}
this.currentActivePanel.style.display = "none";
newActivePanel.style.display = "block";
}
@@ -28,6 +55,18 @@ export default class extends Controller {
event.currentTarget.classList.add(`${this.classNameValue}`);
}
updateActiveTab(tab_id) {
const newActiveTab = this.tabTargets.find((tab) => tab.id == tab_id);
if (newActiveTab === undefined) {
// No tab found
return;
}
this.currentActiveTab.classList.remove(`${this.classNameValue}`);
newActiveTab.classList.add(`${this.classNameValue}`);
}
get currentActiveTab() {
return this.tabTargets.find((tab) => tab.classList.contains("selected"));
}

View File

@@ -0,0 +1,30 @@
import ApplicationController from "./application_controller";
export default class extends ApplicationController {
static targets = ["filename", "fileinput"];
static values = {
message: String,
};
connect() {
super.connect();
this.fileinputTarget.addEventListener("change", (event) => {
this.filenameTarget.innerText = event.target.files[0].name;
});
}
remove(event) {
let confirmation = confirm(this.messageValue);
if (confirmation) {
location.hash = "";
this.stimulate(
"EnterpriseEdit#remove_terms_and_conditions",
event.target
);
}
}
add() {
this.fileinputTarget.click();
}
}

View File

@@ -2,6 +2,7 @@
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
ENV["NODE_OPTIONS"] ||= "--openssl-legacy-provider"
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",

View File

@@ -2,6 +2,7 @@
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
ENV["NODE_OPTIONS"] ||= "--openssl-legacy-provider"
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",

View File

@@ -240,6 +240,7 @@ module Openfoodnetwork
config.generators.template_engine = :haml
Rails.application.routes.default_url_options[:host] = ENV["SITE_URL"]
DfcProvider::Engine.routes.default_url_options[:host] = ENV["SITE_URL"]
Rails.autoloaders.main.ignore(Rails.root.join('app/webpacker'))
@@ -248,7 +249,5 @@ module Openfoodnetwork
config.active_storage.variable_content_types += ["image/svg+xml"]
config.exceptions_app = self.routes
config.autoloader = :zeitwerk
end
end

View File

@@ -0,0 +1,15 @@
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#key-generator-digest-class-changing-to-use-sha256
Rails.application.config.after_initialize do
Rails.application.config.action_dispatch.cookies_rotations.tap do |cookies|
salt = Rails.application.config.action_dispatch.authenticated_encrypted_cookie_salt
secret_key_base = Rails.application.secret_key_base
key_generator = ActiveSupport::KeyGenerator.new(
secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1
)
key_len = ActiveSupport::MessageEncryptor.key_len
secret = key_generator.generate_key(salt, key_len)
cookies.rotate :encrypted, secret
end
end

View File

@@ -1,22 +1,28 @@
require "flipper"
require "flipper/adapters/active_record"
require "flipper/instrumentation/log_subscriber"
require "open_food_network/feature_toggle"
Flipper.configure do |config|
config.default do
adapter = Flipper::Adapters::ActiveRecord.new
instrumented = Flipper::Adapters::Instrumented.new(adapter, instrumenter: ActiveSupport::Notifications)
Flipper.new(instrumented, instrumenter: ActiveSupport::Notifications)
Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }
Flipper::UI.configure do |config|
config.descriptions_source = ->(_keys) do
# return has to be hash of {String key => String description}
OpenFoodNetwork::FeatureToggle::CURRENT_FEATURES
end
end
if Rails.env.production?
Flipper::UI.configure do |config|
config.banner_text = '⚠️ Production environment: be aware that the changes have an impact on the application. Please, read the how-to before: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-toggle-with-Flipper'
# Defaults to false. Set to true to show feature descriptions on the list
# page as well as the view page.
# config.show_feature_description_in_list = true
if Rails.env.production?
config.banner_text = <<~TEXT
Production environment: be aware that the changes have an impact on the
application. Please read the how-to before:
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-toggles
TEXT
config.banner_class = 'danger'
end
end
Rails.configuration.middleware.use Flipper::Middleware::Memoizer, preload_all: true
Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }
# Add known feature toggles. This may fail if the database isn't setup yet.
OpenFoodNetwork::FeatureToggle.setup! rescue ActiveRecord::StatementInvalid

View File

@@ -650,7 +650,6 @@ ar:
seo:
product_search_keywords: "كلمات البحث المنتج"
product_search_tip: "اكتب كلمات للمساعدة في البحث عن منتجاتك في المتاجر. استخدام المسافة لفصل كل كلمة رئيسية."
SEO_keywords: "SEO الكلمات الرئيسية"
seo_tip: "اكتب كلمات للمساعدة في البحث عن منتجاتك على الويب. استخدام المسافة لفصل كل كلمة رئيسية."
search: "بحث"
properties:
@@ -1065,6 +1064,9 @@ ar:
add_unregistered_user: "إضافة مستخدم غير مسجل"
email_confirmed: "تأكيد البريد الإلكتروني"
email_not_confirmed: "البريد الإلكتروني غير مؤكد"
vouchers:
rate: معدل
customers: عميل
actions:
edit_profile: الإعدادات
properties: الخصائص
@@ -1506,6 +1508,11 @@ ar:
schedules:
destroy:
associated_subscriptions_error: لا يمكن حذف هذا الجدول لأنه يحتوي على اشتراكات مقترنة
vouchers:
new:
back: عودة
save: حفظ
voucher_amount: القيمة
controllers:
enterprises:
stripe_connect_cancelled: "تم إلغاء الاتصال بـ Stripe"

View File

@@ -634,7 +634,6 @@ ca:
seo:
product_search_keywords: "Paraules clau de cerca de producte"
product_search_tip: "Escriviu paraules per ajudar-vos a cercar els vostres productes a les botigues. Utilitzeu espai per separar cada paraula clau."
SEO_keywords: "Paraules clau de SEO"
seo_tip: "Escriviu paraules per ajudar-vos a cercar els vostres productes a la web. Utilitzeu espai per separar cada paraula clau."
search: "Cerca"
properties:
@@ -1049,6 +1048,9 @@ ca:
add_unregistered_user: "Afegeix un usuari no registrat"
email_confirmed: "S'ha confirmat el correu electrònic"
email_not_confirmed: "Correu electrònic no confirmat"
vouchers:
rate: Taxa
customers: Consumidora
actions:
edit_profile: Configuració
properties: Propietats
@@ -1464,6 +1466,11 @@ ca:
schedules:
destroy:
associated_subscriptions_error: Aquesta programació no es pot suprimir perquè té subscripcions associades
vouchers:
new:
back: Enrere
save: Desa
voucher_amount: Quantitat
controllers:
enterprises:
stripe_connect_cancelled: "S'ha cancel·lat la connexió a Stripe"

View File

@@ -6,9 +6,13 @@ cy:
spree/shipping_method: Dull Anfon
attributes:
spree/order/ship_address:
address2: "Cyfeiriad danfon llinell 2"
city: "Tref y cyfeiriad danfon"
country: "Gwlad y cyfeiriad danfon"
phone: "Rhif ffôn"
firstname: "Enw cyntaf"
lastname: "Enw olaf"
zipcode: "Cod post y cyfeiriad danfon"
spree/user:
password: "Cyfrinair"
password_confirmation: "Cadarnhau'r cyfrinair"
@@ -637,7 +641,6 @@ cy:
seo:
product_search_keywords: "Allweddeiriau Chwilio Cynnyrch"
product_search_tip: "Teipiwch eiriau i helpu i chwilio am eich cynnyrch yn y siopau. Defnyddiwch fwlch i wahanu pob allweddair."
SEO_keywords: "Allweddeiriau SEO"
seo_tip: "Teipiwch eiriau i helpu chwilio am eich cynnyrch ar y we. Defnyddiwch fwlch i wahanu pob allweddair."
search: "Chwilio"
properties:
@@ -1053,6 +1056,9 @@ cy:
add_unregistered_user: "Ychwanegwch ddefnyddiwr anghofrestredig"
email_confirmed: "Cadarnhawyd yr e-bost "
email_not_confirmed: "E-bost heb ei gadarnhau"
vouchers:
rate: Cyfradd
customers: Cwsmer
actions:
edit_profile: Gosodiadau
properties: Manylion
@@ -1321,6 +1327,7 @@ cy:
addresses: Cyfeiriadau
payment_methods: Adroddiad Dulliau Talu
delivery: Adroddiad Cyflenwi
sales_tax_totals_by_producer: Cyfanswm Trethi Gwerthu fesul Cynhyrchwr
tax_types: Mathau o dreth
tax_rates: Cyfraddau Treth
pack_by_customer: Pecyn fesul Cwsmer
@@ -1493,6 +1500,11 @@ cy:
schedules:
destroy:
associated_subscriptions_error: Nid yw'n bosib dileu'r amserlen hon oherwydd bod tanysgrifiadau cysylltiedig yn berthnasol
vouchers:
new:
back: Yn ôl
save: Cadw
voucher_amount: Nifer
controllers:
enterprises:
stripe_connect_cancelled: "Canslwyd y cysylltiad â Stripe"
@@ -1516,6 +1528,9 @@ cy:
destroy_attachment_does_not_exist: "Nid yw'r ffeil Telerau ac Amodau yn bodoli"
orders:
failed_to_update: "Wedi methu diweddaru'r archeb"
query_param:
error:
title: Invalid query parameter
checkout:
already_ordered:
cart: "basged"
@@ -1810,6 +1825,7 @@ cy:
message_html: "Mae gennych chi archeb ar gyfer y cylch archebu hwn eisoes. Gwiriwch y %{cart} i weld yr eitemau a archebwyd o'r blaen. Gallwch hefyd ganslo eitemau cyn belled â bod y cylch archebu ar agor."
step1:
contact_information:
title: Manylion cyswllt
email:
label: E-bost
phone:
@@ -1863,10 +1879,13 @@ cy:
title: Manylion dosbarthu
edit: Golygu
address: Cyfeiriad dosbarthu
instructions: Cyfarwyddiadau
payment_method:
title: Dull talu
edit: Golygu
instructions: Cyfarwyddiadau
order:
title: Manylion yr archeb
edit: Golygu
terms_and_conditions:
message_html: "Rwy'n cytuno i %{terms_and_conditions_link} y gwerthwr."
@@ -1879,6 +1898,7 @@ cy:
submit: Cwblhau'r archeb
cancel: Nôl at y Dull Talu
errors:
saving_failed: "Wedi methu cadw, llenwch y meysydd a amlygwyd. %{messages}"
terms_not_accepted: Mae angen ichi dderbyn y Telerau ac Amodau
required: Ni chaniateir gadael maes yn wag
invalid_number: "Noder rhif ffôn dilys os gwelwch yn dda"
@@ -2661,6 +2681,8 @@ cy:
report_header_tax_on_delivery: "Treth ar Gyflenwi (%{currency_symbol})"
report_header_tax_on_fees: "Treth ar Ffioedd (%{currency_symbol})"
report_header_tax_category: "Categori Treth"
report_header_tax_rate_name: "Enwr Gyfradd Dreth"
report_header_tax_rate: "Cyfradd Dreth"
report_header_total_tax: "Cyfanswm Treth (%{currency_symbol})"
report_header_total_excl_tax: "Cyfanswm heb dreth (%{currency_symbol})"
report_header_total_incl_tax: "Cyfanswm gan gynnwys treth (%{currency_symbol})"
@@ -2683,6 +2705,7 @@ cy:
report_header_supplier: Cyflenwr
report_header_producer: Cynhyrchydd
report_header_producer_suburb: Maestref y Cynhyrchydd
report_header_producer_tax_status: Statws Treth y Cynhyrchwr
report_header_producer_charges_sales_tax?: Cofrestrwyd ar gyfer GST/TAW
report_header_unit: Uned
report_header_group_buy_unit_quantity: Nifer Unedau Grŵp Prynu
@@ -2699,10 +2722,12 @@ cy:
report_header_distributor_address: Cyfeiriad dosbarthwr
report_header_distributor_city: Dinas ddosbarthu
report_header_distributor_postcode: Cod post dosbarthwr
report_header_distributor_tax_status: Statws Treth y Dosbarthwr
report_header_delivery_address: Cyfeiriad Dosbarthu
report_header_delivery_postcode: Cod Post Cyflenwi
report_header_bulk_unit_size: Maint Uned Swmp
report_header_weight: Pwysau
report_header_final_weight_volume: Terfynol (Pwysau/Cyfaint)
report_header_height: Uchder
report_header_width: Lled
report_header_depth: Dyfnder
@@ -2879,6 +2904,7 @@ cy:
deleting_item_will_cancel_order: "Bydd y weithred hon yn golygu un neu fwy o archebion gwag, fydd yn cael eu canslo. Ydych chi'n siwr eich bod am wneud hyn?"
modals:
got_it: "Yn deall"
confirm: "Cadarnhau"
close: "Cau"
continue: "Parhau"
cancel: "Canslo"
@@ -3412,6 +3438,13 @@ cy:
first: "Yn gyntaf"
previous: "Blaenorol"
last: "Diwethaf"
webhook_endpoints:
create:
success: Webhook endpoint failed to create
error: Webhook endpoint failed to create
destroy:
success: Webhook endpoint successfully deleted
error: Webhook endpoint failed to delete
spree:
add_country: "Ychwanegu gwlad"
add_state: "Ychwanegu sir"
@@ -3452,6 +3485,8 @@ cy:
server_error: "Nam gyda'r gweinydd"
shipping_method_names:
UPS Ground: "UPS dros y tir"
pick_up: "Casglu ar y fferm"
delivery: "Llofnodwyd, cadarnhawyd a chyflenwyd"
start_date: "Dyddiad cychwyn"
successfully_removed: "Llwyddwyd i ddileu"
taxonomy_edit: "Golygu tacsonomi"
@@ -3536,6 +3571,7 @@ cy:
display_currency: "Arddangos arian cyfred"
choose_currency: "Dewis Arian Cyfred"
mail_method_settings: "Gosodiadau Dull Postio"
mail_settings_notice_html: "<b>Bydd unrhyw newid a wneir fan hyn yn un dros dro at ddiben dadfygion unig</b>, a hwyrach y caiff ei droi yn ôl yn y dyfodol. <br>Gellir gwneud newidiadau parhaol trwy ddiweddaru cyfrinachaur achos au cyflenwi trwy ddefnyddio <a href='https://github.com/openfoodfoundation/ofn-install'>ofn-install</a>. Cysylltwch â thîm byd-eang OFN am fanylion pellach."
general: "Cyffredinol"
enable_mail_delivery: "Galluogi Dosbarthu trwy'r Post"
send_mails_as: "Anfon eitemau drwy'r Post fel"
@@ -3769,6 +3805,7 @@ cy:
print_invoices: "Argraffu anfonebau"
cancel_orders: "Canslo Archebion"
resend_confirmation: "Ailanfon Cadarnhad "
resend_confirmation_confirm_html: "Bydd hwn yn ail-anfon yr ebost cadarnhau at y cwsmer. <br />Ydych chin siŵr eich bod am wneud hyn?"
selected:
zero: "Ni ddewiswyd archeb."
one: "Dewiswyd 1 archeb"
@@ -3917,6 +3954,7 @@ cy:
title: "Cynnyrch Newydd"
new_product: "Cynnyrch Newydd"
supplier: "Cyflenwr"
supplier_select_placeholder: "Dewis cyflenwr"
product_name: "Enw Cynnyrch"
units: "Maint yr Uned"
value: "Gwerth"
@@ -4183,6 +4221,16 @@ cy:
api_keys:
regenerate_key: "Allwedd Adfer"
title: Allwedd API
webhook_endpoints:
title: Webhook Endpoints
description: Events in the system may trigger webhooks to external systems.
event_types:
order_cycle_opened: Order Cycle Opened
event_type:
header: Event type
url:
header: Endpoint URL
create_placeholder: Enter the URL of the remote webhook endpoint
developer_settings:
title: Gosodiadau'r Datblygwr
form:
@@ -4340,6 +4388,7 @@ cy:
search_input:
placeholder: Chwilio
selector_with_filter:
selected_items: "Dewiswyd %{count}"
search_placeholder: Chwilio
pagination:
next: Nesaf

View File

@@ -624,7 +624,6 @@ de_CH:
seo:
product_search_keywords: "Stichwörter für die Produktsuche"
product_search_tip: "Geben Sie Stichwörter ein, damit Ihre Produkte in den Läden besser gefunden werden. Trennen Sie mehrere Stichwörter voneinander mit Leerzeichen."
SEO_keywords: "Stichwörter für die Suche im Internet"
seo_tip: "Geben Sie Stichwörter ein, damit Ihre Produkte im Internet besser gefunden werden. Trennen Sie mehrere Stichwörter voneinander mit Leerzeichen."
search: "Suche"
properties:
@@ -1034,6 +1033,9 @@ de_CH:
add_unregistered_user: "Laden Sie einen nicht registrierten Benutzer ein"
email_confirmed: "E-Mail-Adresse bestätigt"
email_not_confirmed: "E-Mail-Adresse nicht bestätigt"
vouchers:
rate: Steuersatz
customers: Kunde
actions:
edit_profile: Einstellungen
properties: Eigenschaften
@@ -1454,6 +1456,11 @@ de_CH:
schedules:
destroy:
associated_subscriptions_error: Dieser Zeitplan kann nicht gelöscht werden, da ihm Abonnements zugeordnet sind.
vouchers:
new:
back: Zurück
save: Speichern
voucher_amount: Betrag
controllers:
enterprises:
stripe_connect_cancelled: "Die Verbindung zu Stripe wurde abgebrochen."

View File

@@ -640,7 +640,6 @@ de_DE:
seo:
product_search_keywords: "Stichwörter für die Produktsuche"
product_search_tip: "Geben Sie Stichwörter ein, damit Ihre Produkte in den Läden besser gefunden werden. Trennen Sie mehrere Stichwörter voneinander mit Leerzeichen."
SEO_keywords: "Stichwörter für die Suche im Internet"
seo_tip: "Geben Sie Stichwörter ein, damit Ihre Produkte im Internet besser gefunden werden. Trennen Sie mehrere Stichwörter voneinander mit Leerzeichen."
search: "Suche"
properties:
@@ -1058,6 +1057,9 @@ de_DE:
add_unregistered_user: "Laden Sie einen nicht registrierten Benutzer ein"
email_confirmed: "E-Mail-Adresse bestätigt"
email_not_confirmed: "E-Mail-Adresse nicht bestätigt"
vouchers:
rate: Steuersatz
customers: Kunde
actions:
edit_profile: Einstellungen
properties: Eigenschaften
@@ -1499,6 +1501,11 @@ de_DE:
schedules:
destroy:
associated_subscriptions_error: Dieser Zeitplan kann nicht gelöscht werden, da ihm Abonnements zugeordnet sind.
vouchers:
new:
back: Zurück
save: Speichern
voucher_amount: Summe
controllers:
enterprises:
stripe_connect_cancelled: "Die Verbindung zu Stripe wurde abgebrochen."

View File

@@ -728,7 +728,6 @@ en:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -936,6 +935,7 @@ en:
legend: "Address"
business_details:
legend: "Business Details"
upload: 'upload'
abn: ABN
abn_placeholder: eg. 99 123 456 789
acn: ACN
@@ -1143,6 +1143,18 @@ en:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
legend: Vouchers
voucher_code: Voucher Code
rate: Rate
label: Label
purpose: Purpose
expiry: Expiry
use_limit: Use/Limit
customers: Customer
net_value: Net Value
add_new: Add New
no_voucher_yet: No Vouchers yet
actions:
edit_profile: Settings
properties: Properties
@@ -1381,6 +1393,7 @@ en:
tag_rules: "Tag Rules"
shop_preferences: "Shop Preferences"
users: "Users"
vouchers: Vouchers
enterprise_group:
primary_details: "Primary Details"
users: "Users"
@@ -1589,6 +1602,13 @@ en:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
legend: New Voucher
back: Back
save: Save
voucher_code: Voucher Code
voucher_amount: Amount
# Admin controllers
controllers:
@@ -1602,6 +1622,9 @@ en:
resend_confirmation_emails_feedback:
one: "Confirmation email sent for 1 order."
other: "Confirmation emails sent for %{count} orders."
send_invoice_feedback:
one: "Invoice email sent for 1 order."
other: "Invoice emails sent for %{count} orders."
# API
#
@@ -1621,6 +1644,11 @@ en:
destroy_attachment_does_not_exist: "Terms and Conditions file does not exist"
orders:
failed_to_update: "Failed to update order"
query_param:
error:
title: Invalid query parameter
extra_fields: "Unsupported fields: %{fields}"
# Frontend views
#
@@ -3253,6 +3281,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using
cancel_the_order_send_cancelation_email: "Send a cancellation email to the customer"
restock_item: "Restock Items: return this item to stock"
restock_items: "Restock Items: return all items to stock"
delete_line_items_html:
one: "This will delete one line item from the order.<br />Are you sure you want to proceed?"
other: "This will delete %{count} line items from the order.<br />Are you sure you want to proceed?"
resend_user_email_confirmation:
resend: "Resend"
sending: "Resend..."
@@ -3562,6 +3593,14 @@ See the %{link} to find out more about %{sitename}'s features and to start using
previous: "Previous"
last: "Last"
webhook_endpoints:
create:
success: Webhook endpoint successfully created
error: Webhook endpoint failed to create
destroy:
success: Webhook endpoint successfully deleted
error: Webhook endpoint failed to delete
spree:
order_updated: "Order Updated"
add_country: "Add country"
@@ -3942,6 +3981,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using
cancel_orders: "Cancel Orders"
resend_confirmation: "Resend Confirmation"
resend_confirmation_confirm_html: "This will resend the confirmation email to the customer.<br />Are you sure you want to proceed?"
send_invoice: "Send Invoices"
send_invoice_confirm_html: "This will email customer invoices for all selected complete orders. <br>Are you sure you want to proceed?"
selected:
zero: "No order selected"
one: "1 order selected"
@@ -4357,6 +4398,16 @@ See the %{link} to find out more about %{sitename}'s features and to start using
api_keys:
regenerate_key: "Regenerate Key"
title: API key
webhook_endpoints:
title: Webhook Endpoints
description: Events in the system may trigger webhooks to external systems.
event_types:
order_cycle_opened: Order Cycle Opened
event_type:
header: Event type
url:
header: Endpoint URL
create_placeholder: Enter the URL of the remote webhook endpoint
developer_settings:
title: Developer Settings
form:

View File

@@ -510,7 +510,6 @@ en_AU:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -897,6 +896,9 @@ en_AU:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
rate: Rate
customers: Customer
actions:
edit_profile: Settings
properties: Properties
@@ -1303,6 +1305,11 @@ en_AU:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
back: Back
save: Save
voucher_amount: Amount
controllers:
enterprises:
stripe_connect_cancelled: "Connection to Stripe has been cancelled"

View File

@@ -477,7 +477,6 @@ en_BE:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -839,6 +838,9 @@ en_BE:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
rate: Rate
customers: Customer
actions:
edit_profile: Settings
properties: Properties
@@ -1220,6 +1222,11 @@ en_BE:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
back: Back
save: Save
voucher_amount: Amount
controllers:
enterprises:
stripe_connect_cancelled: "Connection to Stripe has been cancelled"

View File

@@ -6,12 +6,22 @@ en_CA:
spree/shipping_method: Shipping/Pick-up Method
attributes:
spree/order/ship_address:
address1: "Shipping address (House number + Street)"
address2: "Shipping address line 2"
city: "Shipping address city"
country: "Shipping address country"
phone: "Phone number"
firstname: "First name"
lastname: "Last name"
zipcode: "Shipping address postal code"
spree/order/bill_address:
address1: "Billing address (House number & Street)"
zipcode: "Billing address Postal Code"
city: "Billing address City"
country: "Billing address country"
firstname: "Billing address first name"
lastname: "Billing address last name"
phone: Customer phone
spree/user:
password: "Password"
password_confirmation: "Password confirmation"
@@ -640,7 +650,6 @@ en_CA:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -1056,6 +1065,9 @@ en_CA:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
rate: Rate
customers: Customer
actions:
edit_profile: Settings
properties: Properties
@@ -1313,6 +1325,7 @@ en_CA:
total_by_customer: Total by Customer
total_by_supplier: Total By Supplier
supplier_totals: Order Cycle Supplier Totals
percentage: "%{value} %"
supplier_totals_by_distributor: Order Cycle Supplier Totals by Distributor
totals_by_supplier: Order Cycle Distributor Totals by Supplier
customer_totals: Order Cycle Customer Totals
@@ -1323,6 +1336,8 @@ en_CA:
addresses: Addresses
payment_methods: Payment Methods Report
delivery: Delivery Report
sales_tax_totals_by_producer: Sales Tax Totals by Producer
sales_tax_totals_by_order: Sales Tax Totals by Order
tax_types: Tax Types
tax_rates: Tax Rates
pack_by_customer: Pack By Customer
@@ -1495,6 +1510,11 @@ en_CA:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
back: Back
save: Save
voucher_amount: Amount
controllers:
enterprises:
stripe_connect_cancelled: "Connection to Stripe has been cancelled"
@@ -2671,6 +2691,7 @@ en_CA:
report_header_tax_on_delivery: "Tax on Delivery (%{currency_symbol})"
report_header_tax_on_fees: "Tax on Fees (%{currency_symbol})"
report_header_tax_category: "Tax Category"
report_header_tax_rate_name: "Tax Rate Name"
report_header_tax_rate: "Tax Rate"
report_header_total_tax: "Total Tax (%{currency_symbol})"
report_header_total_excl_tax: "Total excl. tax (%{currency_symbol})"
@@ -2694,6 +2715,7 @@ en_CA:
report_header_supplier: Supplier
report_header_producer: Producer
report_header_producer_suburb: Producer City/Town
report_header_producer_tax_status: Producer Tax Status
report_header_producer_charges_sales_tax?: Tax registered
report_header_unit: Unit
report_header_group_buy_unit_quantity: Group Buy Unit Quantity
@@ -2710,6 +2732,7 @@ en_CA:
report_header_distributor_address: Distributor address
report_header_distributor_city: Distributor city
report_header_distributor_postcode: Distributor postal code
report_header_distributor_tax_status: Distributor Tax Status
report_header_delivery_address: Delivery Address
report_header_delivery_postcode: Delivery Postal Code
report_header_bulk_unit_size: Bulk Unit Size
@@ -3083,6 +3106,9 @@ en_CA:
cancel_the_order_send_cancelation_email: "Send a cancellation email to the customer."
restock_item: "Restock Items: Return this item to stock"
restock_items: "Restock Items: Return all items to stock"
delete_line_items_html:
one: "This will delete one line item from the order. <br />Are you sure you want to proceed?"
other: "This will delete %{count} line items from the order.<br />Are you sure you want to proceed?"
resend_user_email_confirmation:
resend: "Resend"
sending: "Resend..."

View File

@@ -482,7 +482,6 @@ en_DE:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -847,6 +846,9 @@ en_DE:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
rate: Rate
customers: Customer
actions:
edit_profile: Settings
properties: Properties
@@ -1230,6 +1232,11 @@ en_DE:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
back: Back
save: Save
voucher_amount: Amount
controllers:
enterprises:
stripe_connect_cancelled: "Connection to Stripe has been cancelled"

View File

@@ -650,7 +650,6 @@ en_FR:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -1066,6 +1065,9 @@ en_FR:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
rate: Rate
customers: Customer
actions:
edit_profile: Settings
properties: Properties
@@ -1508,6 +1510,11 @@ en_FR:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
back: Back
save: Save
voucher_amount: Amount
controllers:
enterprises:
stripe_connect_cancelled: "Connection to Stripe has been cancelled"

View File

@@ -6,12 +6,22 @@ en_GB:
spree/shipping_method: Shipping Method
attributes:
spree/order/ship_address:
address1: "Shipping address (Street + House number)"
address2: "Shipping address line 2"
city: "Shipping address city"
country: "Shipping address country"
phone: "Phone number"
firstname: "First name"
lastname: "Last name"
zipcode: "Shipping address postcode"
spree/order/bill_address:
address1: "Billing address (Street + House number)"
zipcode: "Billing address postcode"
city: "Billing address city"
country: "Billing address country"
firstname: "Billing address first name"
lastname: "Billing address last name"
phone: Customer phone
spree/user:
password: "Password"
password_confirmation: "Password confirmation"
@@ -640,7 +650,6 @@ en_GB:
seo:
product_search_keywords: "Product Search Keywords"
product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword."
SEO_keywords: "SEO Keywords"
seo_tip: "Type words to help search your products in the web. Use space to separate each keyword."
search: "Search"
properties:
@@ -846,6 +855,7 @@ en_GB:
legend: "Address"
business_details:
legend: "Business Details"
upload: 'upload'
abn: Company Number
abn_placeholder: eg. 99 123 456 789
acn: Charity Number
@@ -1056,6 +1066,9 @@ en_GB:
add_unregistered_user: "Add an unregistered user"
email_confirmed: "Email confirmed"
email_not_confirmed: "Email not confirmed"
vouchers:
rate: Rate
customers: Customer
actions:
edit_profile: Settings
properties: Properties
@@ -1325,6 +1338,7 @@ en_GB:
payment_methods: Payment Methods Report
delivery: Delivery Report
sales_tax_totals_by_producer: Sales Tax Totals By Producer
sales_tax_totals_by_order: Sales Tax Totals By Order
tax_types: Tax Types
tax_rates: Tax Rates
pack_by_customer: Pack By Customer
@@ -1497,6 +1511,11 @@ en_GB:
schedules:
destroy:
associated_subscriptions_error: This schedule cannot be deleted because it has associated subscriptions
vouchers:
new:
back: Back
save: Save
voucher_amount: Amount
controllers:
enterprises:
stripe_connect_cancelled: "Connection to Stripe has been cancelled"
@@ -1520,6 +1539,10 @@ en_GB:
destroy_attachment_does_not_exist: "Terms and Conditions file does not exist"
orders:
failed_to_update: "Failed to update order"
query_param:
error:
title: Invalid query parameter
extra_fields: "Unsupported fields: %{fields}"
checkout:
already_ordered:
cart: "cart"
@@ -3383,6 +3406,13 @@ en_GB:
first: "First"
previous: "Previous"
last: "Last"
webhook_endpoints:
create:
success: Webhook endpoint successfully created
error: Webhook endpoint failed to create
destroy:
success: Webhook endpoint successfully deleted
error: Webhook endpoint failed to delete
spree:
add_country: "Add country"
add_state: "Add county"
@@ -3744,6 +3774,8 @@ en_GB:
cancel_orders: "Cancel Orders"
resend_confirmation: "Resend Confirmation"
resend_confirmation_confirm_html: "This will resend the confirmation email to the customer.<br />Are you sure you want to proceed?"
send_invoice: "Send Invoices"
send_invoice_confirm_html: "This will email customer invoices for all selected complete orders. <br>Are you sure you want to proceed?"
selected:
zero: "No order selected"
one: "1 order selected"
@@ -4159,6 +4191,16 @@ en_GB:
api_keys:
regenerate_key: "Regenerate Key"
title: API key
webhook_endpoints:
title: Webhook Endpoints
description: Events in the system may trigger webhooks to external systems.
event_types:
order_cycle_opened: Order Cycle Opened
event_type:
header: Event type
url:
header: Endpoint URL
create_placeholder: Enter the URL of the remote webhook endpoint
developer_settings:
title: Developer Settings
form:

Some files were not shown because too many files have changed in this diff Show More