Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cart information providing in BO order creation page - part 1 #15814

Merged
merged 24 commits into from Oct 9, 2019
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1766226
Implements empty cart creation and summary after customer select
zuk3975 Oct 1, 2019
13dd8fc
Add loading cart locale info of empty cart
zuk3975 Oct 2, 2019
52e8d92
Separate Carts and Orders summary endpoints
zuk3975 Oct 2, 2019
e5bea56
Separate endpoints for carts/orders summary. WIP omplement cart infor…
zuk3975 Oct 3, 2019
18512a8
Get cart straight from db instead of context
zuk3975 Oct 3, 2019
40809f9
Removes unusable cartContextInitializer
zuk3975 Oct 3, 2019
8293961
Adds TODO check cart context importance
zuk3975 Oct 3, 2019
ec503e8
Separate cart creation and info provider. Some js refactoring, add Us…
zuk3975 Oct 3, 2019
e67b247
updates licences
zuk3975 Oct 4, 2019
73f1d02
Moves addresses renderer to separate class. Removes unused props in c…
zuk3975 Oct 4, 2019
7a070cf
Adds some docblocks in js
zuk3975 Oct 4, 2019
c61e08a
Adds cart duplication action and some todo`s
zuk3975 Oct 4, 2019
fc02e3e
Adds vouchers list providing and rendering
zuk3975 Oct 4, 2019
afb1478
rename method typo
zuk3975 Oct 4, 2019
249ba67
Introduce js routing FOSJsRoutingBundle
zuk3975 Oct 4, 2019
c037c20
Configure js router with dynamic base url and security token
zuk3975 Oct 7, 2019
97e1175
Require npm dependency of fos-routing
zuk3975 Oct 7, 2019
ea71366
Refactor routes after introducing js router
zuk3975 Oct 7, 2019
a4f8b15
Implements CartProduct DTO
zuk3975 Oct 8, 2019
88f4ba2
Removes unusable symlink
zuk3975 Oct 8, 2019
4183d6c
Router wrapper code optimization
zuk3975 Oct 8, 2019
1da0e2e
adds new end of file line
zuk3975 Oct 8, 2019
5085888
Removes fos-js-routing bundle symlink
zuk3975 Oct 8, 2019
3910b24
Move js router metadata from legacy controller to twig function
zuk3975 Oct 9, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -0,0 +1,53 @@
/**
* 2007-2019 PrestaShop SA and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

/**
* Class responsible for checking password's validity.
* Can validate entered password's length against min/max values.
* If password confirmation input is provided, can validate if entered password is matching confirmation.
*/

import Routing from '../../../../../vendor/friendsofsymfony/jsrouting-bundle/Resources/public/js/router.min';

This comment has been minimized.

Copy link
@PierreRambaud

PierreRambaud Oct 5, 2019

Contributor

Please use: https://www.npmjs.com/package/fos-routing instead. Separate php dependecies from npm dependencies


Routing.setRoutingData(require('../fos_js_routes.json'));

/**
* Wraps FOSJsRoutingbundle with exposed routes.
* To expose route add option `expose: true` in .yml routing config
*
* e.g.
*
* `my_route
* path: /my-path
* options:
* expose: true
* `
* And run `bin/console fos:js-routing:dump --format=json --target=admin-dev/themes/new-theme/js/fos_js_routes.json`
*/
export default class Router {
constructor() {
return Routing;
}
}
@@ -0,0 +1 @@
{"base_url":"","routes":{"admin_carts_info":{"tokens":[["text","\/sell\/orders\/carts\/info"]],"defaults":[],"requirements":{"cartId":"\\d+"},"hosttokens":[],"methods":["GET"],"schemes":[]},"admin_carts_create_empty":{"tokens":[["text","\/sell\/orders\/carts\/create-empty"]],"defaults":[],"requirements":{"customerId":"\\d+"},"hosttokens":[],"methods":["POST"],"schemes":[]},"admin_carts_duplicate":{"tokens":[["text","\/sell\/orders\/carts\/duplicate"]],"defaults":[],"requirements":{"orderId":"\\d+"},"hosttokens":[],"methods":["POST"],"schemes":[]},"admin_carts_edit_address":{"tokens":[["text","\/sell\/orders\/carts\/edit-address"]],"defaults":[],"requirements":{"cartId":"\\d+"},"hosttokens":[],"methods":["POST"],"schemes":[]}},"prefix":"","host":"localhost","port":"","scheme":"http","locale":[]}
@@ -31,7 +31,8 @@ import CustomerInfoProvider from './customer-info-provider';
import CartsRenderer from './carts-renderer';
import OrdersRenderer from './orders-renderer';
import AddressesRenderer from './addresses-renderer';
import VouchersRenderer from "./vouchers-renderer";
import VouchersRenderer from './vouchers-renderer';
import Router from '../../../components/router';

const $ = window.$;

@@ -51,6 +52,7 @@ export default class CreateOrderPage {
this.ordersRenderer = new OrdersRenderer();
this.addressesRenderer = new AddressesRenderer();
this.vouchersRenderer = new VouchersRenderer();
this.router = new Router();

return {
listenForCustomerSearch: () => this._handleCustomerSearch(),
@@ -78,6 +80,9 @@ export default class CreateOrderPage {
* @private
*/
_handleCustomerChooseForOrderCreation() {
//@todo: rename routes and remove console log as its for testing only.
console.log(this.router.generate('admin_carts_create_empty'));

this.$container.on('click', createOrderPageMap.chooseCustomerBtn, (event) => {
const customerId = this.customerSearcher.onCustomerChooseForOrderCreation(event);
this.data.customer_id = customerId;
@@ -57,6 +57,7 @@ public function registerBundles()
// REST API consumer
new Csa\Bundle\GuzzleBundle\CsaGuzzleBundle(),
new League\Tactician\Bundle\TacticianBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
@@ -21,6 +21,7 @@
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "~2.5.3",
"ezyang/htmlpurifier": "^4.10",
"friendsofsymfony/jsrouting-bundle": "^2.4",
"geoip2/geoip2": "~2.4.2",
"greenlion/php-sql-parser": "^4.1",
"guzzlehttp/guzzle": "~5.0",

Some generated files are not rendered by default. Learn more.

@@ -22,6 +22,8 @@ admin_carts_info:
_legacy_controller: AdminCarts
requirements:
cartId: \d+
options:
expose: true

admin_carts_create_empty:
path: /create-empty
@@ -31,6 +33,8 @@ admin_carts_create_empty:
_legacy_controller: AdminCarts
requirements:
customerId: \d+
options:
expose: true

admin_carts_duplicate:
path: /duplicate
@@ -40,12 +44,16 @@ admin_carts_duplicate:
_legacy_controller: AdminCarts
requirements:
orderId: \d+
options:
expose: true

admin_carts_edit_address:
path: /edit-address
methods: [POST]
defaults:
_controller: PrestaShopBundle:Admin/Sell/Order/Cart:editAddress
_legacy_controller: AdminCarts
requirements:
cartId: \d+
requirements:
cartId: \d+
options:
expose: true
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.