Skip to content

Commit

Permalink
Merged in ECM-462 (pull request bagisto#129)
Browse files Browse the repository at this point in the history
[ECM-462] Move abandoned cart and order creating in sales

Approved-by: Zoran Bogoevski
  • Loading branch information
Jovica Dimishkovski authored and KalimeroMK committed Jul 21, 2021
2 parents 4a07847 + 767a035 commit 675cabe
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 81 deletions.
29 changes: 7 additions & 22 deletions packages/Bookmark/API/src/Config/system.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
<?php

return [
[
'key' => 'abandon-cart',
'name' => 'admin::app.admin.system.abandon-cart',
'sort' => 3,
], [
'key' => 'abandon-cart.settings',
'name' => 'admin::app.admin.system.abandon-cart-settings',
'sort' => 3,
[
'key' => 'sales.orderSettings.abandonCart',
'name' => 'Abandoned Cart',
'sort' => 4,
'fields' => [
[
'name' => 'abandon_cart_enabled',
'title' => 'admin::app.admin.system.abandon-cart-settings',
'type' => 'boolean',
'title' => 'Enabled',
'type' => 'boolean'
],
],
], [
'key' => 'abandon-cart.settings.general',
'name' => 'admin::app.admin.system.abandon-cart-settings-general',
'sort' => 3,
'fields' => [
[
'name' => 'abandon_cart_enabled',
'title' => 'admin::app.admin.system.abandon-cart-settings-status',
'type' => 'boolean',
],
],
],
]
];
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AbandonedCartRequest extends FormRequest
*/
public function authorize(): bool
{
return (bool) core()->getConfigData('abandon-cart.settings.general.abandon_cart_enabled');
return (bool) core()->getConfigData('sales.orderSettings.abandonCart.abandon_cart_enabled');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/Bookmark/API/src/Http/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ function cookie(): string
*/
function abandoned_cart_enabled(): bool
{
return (bool) core()->getConfigData('abandon-cart.settings.general.abandon_cart_enabled');
return (bool) core()->getConfigData('sales.orderSettings.abandonCart.abandon_cart_enabled');
}
}
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/ar/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/de/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/es/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/fa/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/fr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/it/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/nl/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/pl/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/pt_BR/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
4 changes: 2 additions & 2 deletions packages/Bookmark/API/src/Language/tr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],

'abandon-cart' => [
'title' => 'Abandon Cart',
'title' => 'Abandoned Cart',
'cart-and-account' => 'Cart And Account',
'cart-info' => 'Cart Information',
'products-info' => 'Products Information',
Expand Down Expand Up @@ -91,7 +91,7 @@
'system' => [
'customer-attributes' => 'Customer Attributes',
'customer-attributes-enabled' => 'Customer Attributes Enabled',
'abandon-cart' => 'Abandon Cart',
'abandon-cart' => 'Abandoned Cart',
'abandon-cart-settings' => 'Settings',
'abandon-cart-settings-general' => 'General',
'abandon-cart-settings-status' => 'Status',
Expand Down
40 changes: 12 additions & 28 deletions packages/Bookmark/OrderCreation/src/Config/system.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
<?php

return [
[
'key' => 'ordercreate',
'name' => 'ordercreation::app.module-name',
'sort' => 1,
],
[
'key' => 'ordercreate.general',
'name' => 'ordercreation::app.general',
'sort' => 1,
],

[
'key' => 'ordercreate.general.general',
'name' => 'ordercreation::app.general',
'sort' => 1,
'fields' => [
[
'name' => 'module_enable',
'title' => 'ordercreation::app.module-enable',
'type' => 'boolean',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
],

return [
[
'key' => 'sales.orderSettings.orderCreation',
'name' => 'Manual order creating',
'sort' => 5,
'fields' => [
[
'name' => 'module_enable',
'title' => 'Enabled',
'type' => 'boolean'
],
],

];
]
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ class OrderCreationConfiguration extends Seeder
public function run()
{
CoreConfig::create([
'code' => 'ordercreate.general.general.module_enable',
'code' => 'sales.orderSettings.orderCreation.module_enable',
'value' => '1',
'company_id' => 1,
'channel_code' => 'default',
'locale_code' => 'en',
]);
CoreConfig::create([
'code' => 'ordercreate.general.general.module_enable',
'code' => 'sales.orderSettings.orderCreation.module_enable',
'value' => '1',
'company_id' => 1,
'channel_code' => 'default',
'locale_code' => 'fr',
]);
CoreConfig::create([
'code' => 'ordercreate.general.general.module_enable',
'code' => 'sales.orderSettings.orderCreation.module_enable',
'value' => '1',
'company_id' => 1,
'channel_code' => 'default',
'locale_code' => 'nl',
]);
CoreConfig::create([
'code' => 'ordercreate.general.general.module_enable',
'code' => 'sales.orderSettings.orderCreation.module_enable',
'value' => '1',
'company_id' => 1,
'channel_code' => 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public function __construct(
ProductRepository $productRepository,
ProductInventoryRepository $productInventoryRepository
) {
abort_unless(core()->getConfigData('sales.orderSettings.orderCreation.module_enable'), 404);

$this->middleware('admin');

$this->_config = request('_config');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
{{ __('admin::app.export.export') }}
</span>
</div>

@if(core()->getConfigData('ordercreate.general.general.module_enable'))
@if(core()->getConfigData('sales.orderSettings.orderCreation.module_enable'))

@if($permissionType != 'all' && in_array('sales.orders.product', $allowedPermissions))
<a href="{{ route('admin.ordercreate.customer') }}" class="btn btn-lg btn-primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class AbandonedCartController extends Controller
public function __construct(
AbandonedCartRepository $abandonedCartRepository
) {
abort_unless(core()->getConfigData('sales.orderSettings.abandonCart.abandon_cart_enabled'), 404);

$this->abandonedCartRepository = $abandonedCartRepository;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ __('admin::app.export.export') }}
</span>
</div>
@if(core()->getConfigData('ordercreate.general.general.module_enable'))
@if(core()->getConfigData('sales.orderSettings.orderCreation.module_enable'))
<a href="{{ route('admin.ordercreate.customer') }}" class="btn btn-lg btn-primary">
{{ __('ordercreation::app.datagrid.create-order-customer') }}
</a>
Expand Down

0 comments on commit 675cabe

Please sign in to comment.