Compare commits
350 Commits
7913576f1a
...
1.0.0-rc.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0479ae25f8 | ||
|
|
0a45b0c71f | ||
|
|
1cc6cc879e | ||
|
|
adbba79bd2 | ||
|
|
592402a6c1 | ||
|
|
d1cc62c9b1 | ||
|
|
a76d81c437 | ||
|
|
2e71f17856 | ||
|
|
df78126b12 | ||
|
|
befaa40b48 | ||
|
|
b3fbfc38e7 | ||
|
|
ee60bac538 | ||
|
|
c63bb762ed | ||
|
|
44bfe7d09c | ||
|
|
5db7438c27 | ||
|
|
2227242704 | ||
|
|
7b7295aed1 | ||
|
|
26ca3eb3ca | ||
|
|
139aeb8074 | ||
|
|
cc411cba68 | ||
|
|
fb6da523fa | ||
|
|
64a218afc2 | ||
|
|
722ea43bc2 | ||
|
|
869b148e20 | ||
|
|
15a6621a56 | ||
|
|
601b758179 | ||
|
|
e559c785c2 | ||
|
|
329643ce3b | ||
|
|
7bb38071ef | ||
|
|
ee9979f547 | ||
|
|
c4fda18356 | ||
|
|
8c6e10fb3b | ||
|
|
5a400aaedd | ||
|
|
23fb8a79ac | ||
|
|
67e439f420 | ||
|
|
df377c4f3f | ||
|
|
69264dcf80 | ||
|
|
308b6cb349 | ||
|
|
4c6f9b3b61 | ||
|
|
067532b6fc | ||
|
|
8eb3104b2a | ||
|
|
1bc9bf9fe9 | ||
|
|
53ad10eefa | ||
|
|
9fcc81f4d9 | ||
|
|
75107285e7 | ||
|
|
502b71617a | ||
|
|
ca474ddadb | ||
|
|
fbe9633651 | ||
|
|
1677ec6b03 | ||
|
|
1533c18c54 | ||
|
|
fc5a3186bf | ||
|
|
0bb75125a7 | ||
|
|
af5fc8d0ee | ||
|
|
17e322cd88 | ||
|
|
8ceab7e9f5 | ||
|
|
116f289285 | ||
|
|
560ef61c9f | ||
|
|
4df8628a3e | ||
|
|
5144c1f7fd | ||
|
|
90b0af5b2d | ||
|
|
03027cde01 | ||
|
|
8a463e7b9e | ||
|
|
643c26d549 | ||
|
|
ee64ae0be7 | ||
|
|
e0d8106078 | ||
|
|
df65516b36 | ||
|
|
25b78f3380 | ||
|
|
2a429e4163 | ||
|
|
b5da5fc881 | ||
|
|
ec509df665 | ||
|
|
4bcfc7bc6d | ||
|
|
9949ae95cf | ||
|
|
82b864768e | ||
|
|
34f0b2796f | ||
|
|
731c31a58c | ||
|
|
9b18531c83 | ||
|
|
2ebdc5f16b | ||
|
|
04df068931 | ||
|
|
86b8156e38 | ||
|
|
b86b043604 | ||
|
|
23ac0cedad | ||
|
|
9f90f983ab | ||
|
|
4ce3d528dd | ||
|
|
e42ac75ff7 | ||
|
|
746cf661ce | ||
|
|
a9432bd3c1 | ||
|
|
f3b9db1a6f | ||
|
|
50d5d6944d | ||
|
|
bc7880b242 | ||
|
|
5f215cef81 | ||
|
|
da48f41ec0 | ||
|
|
eda2bbf1db | ||
|
|
5e161745bb | ||
|
|
a29faabbf2 | ||
|
|
470560efb6 | ||
|
|
b1d16a7871 | ||
|
|
496274b4f4 | ||
|
|
7addea00a2 | ||
|
|
f721422abc | ||
|
|
1cba52bb6d | ||
|
|
902604b9cd | ||
|
|
b8c31f6049 | ||
|
|
1675745e2a | ||
|
|
0879b0abf0 | ||
|
|
72a7b270f9 | ||
|
|
3d16580bc8 | ||
|
|
d6ab6c73e2 | ||
|
|
9f9b7173d7 | ||
|
|
c677dbd5fa | ||
|
|
313525a25b | ||
|
|
24e518fffe | ||
|
|
7d1a34a12e | ||
|
|
938d6a9cbd | ||
|
|
0a6b90b434 | ||
|
|
20b3521c72 | ||
|
|
06c68dd223 | ||
|
|
4f9f9b296d | ||
|
|
7454411d27 | ||
|
|
4e69399309 | ||
|
|
3745abc90b | ||
|
|
0828ac3377 | ||
|
|
b3d16a06b0 | ||
|
|
753be00a1e | ||
|
|
a63618a753 | ||
|
|
3287caac54 | ||
|
|
312f1f4e3d | ||
|
|
39e3407ea1 | ||
|
|
03a52d504b | ||
|
|
c1d7f3fe10 | ||
|
|
8e571de523 | ||
|
|
878ec7a8f2 | ||
|
|
06107cb8fc | ||
|
|
10cebd0955 | ||
|
|
0ecc7c73c7 | ||
|
|
f2f4788ce1 | ||
|
|
8313e25f2e | ||
|
|
cafd0a49e7 | ||
|
|
405effe43e | ||
|
|
4914e0c9c9 | ||
|
|
909336bb8b | ||
|
|
60682f2295 | ||
|
|
2fc88c6163 | ||
|
|
6c60d9a148 | ||
|
|
cb488383e0 | ||
|
|
32291dc44a | ||
|
|
0123885e03 | ||
|
|
72d989f692 | ||
|
|
66e0197b50 | ||
|
|
bfd30b668e | ||
|
|
28c200fd9f | ||
|
|
7819a8e11b | ||
|
|
b6821d52a7 | ||
|
|
b4d8bab385 | ||
|
|
d72dfa5b6b | ||
|
|
35fcc992ae | ||
|
|
0feebca7e0 | ||
|
|
5151f393be | ||
|
|
73ed46bc28 | ||
|
|
533b63f8fb | ||
|
|
966e687509 | ||
|
|
ee1511962b | ||
|
|
d62cad1725 | ||
|
|
0cf5569a4c | ||
|
|
73763bb146 | ||
|
|
caee665758 | ||
|
|
7df2421373 | ||
|
|
f89acd9399 | ||
|
|
c22b10dd10 | ||
|
|
5cd48c03f9 | ||
|
|
d423fce4f5 | ||
|
|
573e98a2ce | ||
|
|
06cfb92757 | ||
|
|
bcb3e15f33 | ||
|
|
b392b426d5 | ||
|
|
e435752484 | ||
|
|
c2fd71e3d1 | ||
|
|
e9ab7173f8 | ||
|
|
6b1cc0f045 | ||
|
|
123b951538 | ||
|
|
9710a7017a | ||
|
|
32044118f3 | ||
|
|
b37321daf8 | ||
|
|
e31978b1e3 | ||
|
|
5b74c93b2e | ||
|
|
352b109e87 | ||
|
|
a70e8c39cf | ||
|
|
439a339027 | ||
|
|
2ee339a022 | ||
|
|
84063d2f72 | ||
|
|
61a52ef330 | ||
|
|
c9bf18d87d | ||
|
|
328d791b87 | ||
|
|
e22a541342 | ||
|
|
d8bf91da54 | ||
|
|
5747b93952 | ||
|
|
570374bab7 | ||
|
|
416c724ad1 | ||
|
|
5d68e8787a | ||
|
|
e4672a42d7 | ||
|
|
94234218d6 | ||
|
|
a12dd0c653 | ||
|
|
fe1e14d2c0 | ||
|
|
1dc815bf39 | ||
|
|
2d111605f2 | ||
|
|
68a13b7a58 | ||
|
|
c2ef0c7b35 | ||
|
|
9c2b9cf02e | ||
|
|
6e133246cf | ||
|
|
eff2cb21c7 | ||
|
|
c50bd2aead | ||
|
|
dd0dddb1ff | ||
|
|
34d273e510 | ||
|
|
f1f1a8bc70 | ||
|
|
c1a0d449be | ||
|
|
957d033e2d | ||
|
|
dde59a0c90 | ||
|
|
1dced19068 | ||
|
|
1c5db3c654 | ||
|
|
c8cd3e4fa6 | ||
|
|
e312572bcc | ||
|
|
c4bb4fdd59 | ||
|
|
ff18a0f5bf | ||
|
|
573e4dc6cb | ||
|
|
2a98b24bc1 | ||
|
|
c357ea932a | ||
|
|
c65056531c | ||
|
|
ddc5f2664c | ||
|
|
0eaa11b2a9 | ||
|
|
aa50f908ba | ||
|
|
719f89cc50 | ||
|
|
14931bc5e6 | ||
|
|
30876ba67d | ||
|
|
5794cbb045 | ||
|
|
27893eaa7e | ||
|
|
53d1307837 | ||
|
|
f8c686caa3 | ||
|
|
3c3481b39d | ||
|
|
c75f580ad2 | ||
|
|
ea53cb4c8a | ||
|
|
4b2c431ee9 | ||
|
|
655f502279 | ||
|
|
6556127cc8 | ||
|
|
b3a2ad31b2 | ||
|
|
7d6c7ca36d | ||
|
|
5701985734 | ||
|
|
9e064bcd74 | ||
|
|
f0386269e6 | ||
|
|
90d683f7ed | ||
|
|
7723b475ac | ||
|
|
d8ce8f5259 | ||
|
|
48359525bf | ||
|
|
0399d90ca7 | ||
|
|
32362d74dc | ||
|
|
b90d3ba3f2 | ||
|
|
642fd52d36 | ||
|
|
a6a4b9e59a | ||
|
|
3c00452219 | ||
|
|
2e14e494a1 | ||
|
|
b4856266c8 | ||
|
|
5e5f12ddb2 | ||
|
|
5799eb36fc | ||
|
|
b4057c28d0 | ||
|
|
45c7385046 | ||
|
|
fb047aa036 | ||
|
|
ed1d87a7d1 | ||
|
|
9b6bac5545 | ||
|
|
1fb9319bac | ||
|
|
30666e2931 | ||
|
|
3e26bf368b | ||
|
|
52019357ba | ||
|
|
81b6c87d59 | ||
|
|
fe759565a8 | ||
|
|
94a162deb7 | ||
|
|
f4aecc9130 | ||
|
|
f35650b234 | ||
|
|
6f04a8e7b7 | ||
|
|
2912dc6794 | ||
|
|
6ff65eb927 | ||
|
|
7ae2c4b07c | ||
|
|
cefe956bc4 | ||
|
|
3641bd7d68 | ||
|
|
050fd76122 | ||
|
|
95ca3c6404 | ||
|
|
a3c6fc6ebe | ||
|
|
2be07ce72c | ||
|
|
2f3da7d700 | ||
|
|
b0b1164881 | ||
|
|
6439d2d4ad | ||
|
|
6f0506a71e | ||
|
|
5b84ff74e3 | ||
|
|
323330b1a1 | ||
|
|
63c6671c97 | ||
|
|
c7c8e18cbc | ||
|
|
46b751c361 | ||
|
|
4761656405 | ||
|
|
eb0c9444bc | ||
|
|
e8d503b65d | ||
|
|
900da34b57 | ||
|
|
ae20643879 | ||
|
|
8aaab4345f | ||
|
|
e356b3fcda | ||
|
|
fae7b7897f | ||
|
|
e040837ce6 | ||
|
|
86f6ee9a13 | ||
|
|
c150be2c3e | ||
|
|
a7f661ab10 | ||
|
|
9d21f28d9e | ||
|
|
95997a4a0a | ||
|
|
2195ca122c | ||
|
|
85465f67c6 | ||
|
|
c347b7fe82 | ||
|
|
e98266e556 | ||
|
|
ffb9f81353 | ||
|
|
1dcc3e34a9 | ||
|
|
9cf96b7d4e | ||
|
|
50d445bb3b | ||
|
|
b20c32d722 | ||
|
|
4614ea57cf | ||
|
|
73cfe5a42e | ||
|
|
144532acbf | ||
|
|
8d3ccbf148 | ||
|
|
e407934e2a | ||
|
|
5ddcebc303 | ||
|
|
04685cc7dc | ||
|
|
32c532d49b | ||
|
|
67f490b2fe | ||
|
|
82afe63c60 | ||
|
|
a84955412a | ||
|
|
f32ac13f1e | ||
|
|
8d51ced269 | ||
|
|
967af93f8c | ||
|
|
c3f66af009 | ||
|
|
46316ac974 | ||
|
|
7d1b2f1273 | ||
|
|
5d99f9a09a | ||
|
|
24fffce7a1 | ||
|
|
81fbec892c | ||
|
|
9a0601d473 | ||
|
|
daeece59c9 | ||
|
|
b879f11c99 | ||
|
|
f75632b054 | ||
|
|
b50f50ea62 | ||
|
|
4ce0fa942d | ||
|
|
fd2e87aa07 | ||
|
|
ebea9844dd | ||
|
|
096351ae4e | ||
|
|
f5ca57fdf2 | ||
|
|
f781158e36 | ||
|
|
7a9f20acb9 | ||
|
|
098a46f3a0 |
@@ -55,7 +55,6 @@ RUN chmod +x artisan
|
||||
|
||||
RUN ./artisan vendor:publish --tag=public --force ## creates public/vendor/jsvalidation
|
||||
RUN ./artisan vendor:publish --tag=boilerplate-public --force --ansi ## creates public/vendor/boilerplate
|
||||
RUN ./artisan vendor:publish --tag=datatables-buttons --force --ansi ## creates public/vendor/datatables/buttons
|
||||
|
||||
## XXXvlab: 2025-09-25 these migration files are breaking first
|
||||
## install, but we had to resolve to not install from scratch and use
|
||||
@@ -94,8 +93,7 @@ RUN mkdir -p /out \
|
||||
--exclude=.editorconfig --exclude=phpunit.xml \
|
||||
--exclude=.travis.yml --exclude=composer.lock --exclude=.styleci.yml \
|
||||
--exclude=Makefile --exclude=.gitkeep --exclude=test \
|
||||
--exclude=resources/shop \
|
||||
artisan app config database vendor public resources routes stubs bootstrap storage composer.json \
|
||||
artisan app build config database vendor public resources routes stubs bootstrap storage composer.json \
|
||||
&& xz -T0 -9e /out/app.tar \
|
||||
&& mv /out/app.tar.xz /out/opensem-prod.tar.xz
|
||||
|
||||
|
||||
48
Gruntfile.js
@@ -19,8 +19,8 @@ var jsSite = [
|
||||
jsBootstrap,
|
||||
'node_modules/jquery-serializejson/jquery.serializejson.min.js',
|
||||
'node_modules/currency.js/dist/currency.min.js',
|
||||
'resources/shop/js/plugins/smooth_products/js/smoothproducts.min.js',
|
||||
'resources/shop/js/site.js',
|
||||
'build/js/plugins/smooth_products/js/smoothproducts.min.js',
|
||||
'build/js/site.js',
|
||||
]
|
||||
|
||||
var cssSite = [
|
||||
@@ -28,8 +28,8 @@ var cssSite = [
|
||||
'node_modules/@fortawesome/fontawesome-free/css/all.min.css',
|
||||
'node_modules/animate.css/animate.min.css',
|
||||
'node_modules/icheck-bootstrap/icheck-bootstrap.min.css',
|
||||
'resources/shop/js/plugins/smooth_products/css/smoothproducts.css',
|
||||
'resources/shop/css/site.css',
|
||||
'build/js/plugins/smooth_products/css/smoothproducts.css',
|
||||
'build/css/site.css',
|
||||
]
|
||||
|
||||
var jsAdminLTE = [
|
||||
@@ -41,15 +41,15 @@ var jsAdminLTE = [
|
||||
]
|
||||
|
||||
var jsCoreInclude = [
|
||||
'resources/shop/js/include/core/objectLength.js',
|
||||
'resources/shop/js/include/core/url.js',
|
||||
'resources/shop/js/include/core/user.js',
|
||||
'resources/shop/js/include/form/radio.js',
|
||||
'resources/shop/js/include/form/upload.js',
|
||||
'resources/shop/js/include/form/validator.js',
|
||||
'resources/shop/js/include/layout/animate.js',
|
||||
'resources/shop/js/include/layout/scroll.js',
|
||||
'resources/shop/js/include/layout/tooltip.js',
|
||||
'build/js/include/core/objectLength.js',
|
||||
'build/js/include/core/url.js',
|
||||
'build/js/include/core/user.js',
|
||||
'build/js/include/form/radio.js',
|
||||
'build/js/include/form/upload.js',
|
||||
'build/js/include/form/validator.js',
|
||||
'build/js/include/layout/animate.js',
|
||||
'build/js/include/layout/scroll.js',
|
||||
'build/js/include/layout/tooltip.js',
|
||||
]
|
||||
|
||||
var jsBundle = [
|
||||
@@ -84,7 +84,7 @@ var jsMain = [
|
||||
var cssPrint = [
|
||||
// 'node_modules/bootstrap/dist/css/bootstrap.min.css',
|
||||
'cssIcons',
|
||||
'resources/shop/print.css'
|
||||
'build/print.css'
|
||||
]
|
||||
|
||||
var cssBundle = [
|
||||
@@ -109,7 +109,7 @@ var cssIcons = [
|
||||
var cssMain = [
|
||||
cssBundle,
|
||||
cssIcons,
|
||||
'resources/shop/css/main.css',
|
||||
'build/css/main.css',
|
||||
]
|
||||
|
||||
var jsDataTables = [
|
||||
@@ -251,31 +251,31 @@ module.exports = function(grunt) {
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/fonts',
|
||||
cwd: 'build/fonts',
|
||||
src: ['**'],
|
||||
dest: 'public/fonts/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/img',
|
||||
cwd: 'build/img',
|
||||
src: ['**'],
|
||||
dest: 'public/img/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/lang',
|
||||
cwd: 'build/lang',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/lang/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/plugins',
|
||||
cwd: 'build/plugins',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/assets/tpl',
|
||||
cwd: 'build/assets/tpl',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/tpl/'
|
||||
},
|
||||
@@ -395,7 +395,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/plugins/pdfjs/',
|
||||
cwd: 'build/plugins/pdfjs/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/pdfjs',
|
||||
},
|
||||
@@ -461,7 +461,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/js/include/plugins/datatables_lang/',
|
||||
cwd: 'build/js/include/plugins/datatables_lang/',
|
||||
src: ['*.json'],
|
||||
dest: 'public/assets/plugins/datatables_lang',
|
||||
},
|
||||
@@ -539,7 +539,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/js/include/',
|
||||
cwd: 'build/js/include/',
|
||||
src: ['boilerplate.js'],
|
||||
dest: 'public/assets/plugins',
|
||||
},
|
||||
@@ -548,7 +548,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
watch: {
|
||||
dist: {
|
||||
files: ['resources/shop/js/*', 'resources/shop/css/*'],
|
||||
files: ['build/js/*', 'build/css/*'],
|
||||
// tasks: ['concat', 'copy']
|
||||
tasks: ['concat']
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Shop\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Core\User\ShopCart;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -32,7 +31,6 @@ class LoginController extends Controller
|
||||
]);
|
||||
|
||||
if ($this->guard()->attempt($credentials, $request->get('remember'))) {
|
||||
ShopCart::migrateGuestCartToUser();
|
||||
$request->session()->regenerate();
|
||||
if (back()->getTargetUrl() === route('Shop.Orders.store')) {
|
||||
$route = 'Shop.Orders.order';
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Shop\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Shop\RegisterCustomer;
|
||||
use App\Repositories\Core\User\ShopCart;
|
||||
use App\Repositories\Shop\CustomerSaleChannels;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use App\Repositories\Shop\Customers;
|
||||
@@ -34,7 +33,6 @@ class RegisterController extends Controller
|
||||
$user = $this->create($request->all());
|
||||
|
||||
$this->guard()->login($user);
|
||||
ShopCart::migrateGuestCartToUser();
|
||||
|
||||
return $request->wantsJson()
|
||||
? new JsonResponse([], 201)
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace App\Http\Controllers\Shop;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
@@ -57,89 +56,10 @@ class CustomerController extends Controller
|
||||
return redirect()->route('Shop.Customers.edit');
|
||||
}
|
||||
|
||||
public function storeAddress(Request $request)
|
||||
{
|
||||
if (Customers::isNotConnected()) {
|
||||
return response()->json(['message' => __('Authentification requise.')], 403);
|
||||
}
|
||||
|
||||
$prefix = $request->input('prefix');
|
||||
$types = ['deliveries' => 1, 'invoices' => 2];
|
||||
|
||||
if (! array_key_exists($prefix, $types)) {
|
||||
return response()->json(['message' => __('Type d\'adresse inconnu.')], 422);
|
||||
}
|
||||
|
||||
$addressData = $request->input($prefix, []);
|
||||
|
||||
$validator = Validator::make($addressData, [
|
||||
'name' => ['nullable', 'string', 'max:150'],
|
||||
'address' => ['required', 'string', 'max:255'],
|
||||
'address2' => ['nullable', 'string', 'max:255'],
|
||||
'zipcode' => ['required', 'string', 'max:30'],
|
||||
'city' => ['required', 'string', 'max:255'],
|
||||
], [
|
||||
'address.required' => __('Merci de renseigner l\'adresse.'),
|
||||
'zipcode.required' => __('Merci de renseigner le code postal.'),
|
||||
'city.required' => __('Merci de renseigner la ville.'),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'message' => __('Merci de vérifier les informations saisies.'),
|
||||
'errors' => $validator->errors(),
|
||||
], 422);
|
||||
}
|
||||
|
||||
$data = $validator->validated();
|
||||
$customerId = Customers::getId();
|
||||
$data['customer_id'] = $customerId;
|
||||
$data['type'] = $types[$prefix];
|
||||
|
||||
if (empty($data['name'])) {
|
||||
$data['name'] = Customers::getName($customerId);
|
||||
}
|
||||
|
||||
$address = CustomerAddresses::store($data);
|
||||
CustomerAddresses::setDefault($customerId, $address->id, $types[$prefix]);
|
||||
|
||||
$html = view('Shop.Customers.partials.address_item', [
|
||||
'address' => $address->toArray(),
|
||||
'prefix' => $prefix,
|
||||
'with_name' => true,
|
||||
'selected' => $address->id,
|
||||
])->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'html' => $html,
|
||||
'message' => __('Adresse enregistrée.'),
|
||||
'id' => $address->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function delete_address($id)
|
||||
{
|
||||
$address = CustomerAddresses::get($id);
|
||||
$ret = CustomerAddresses::destroy($id);
|
||||
|
||||
if (! $address || (int) $address->customer_id !== (int) Customers::getId()) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$remaining = CustomerAddresses::getModel()
|
||||
->byCustomer($address->customer_id)
|
||||
->byType($address->type)
|
||||
->count();
|
||||
|
||||
if ($remaining <= 1) {
|
||||
return redirect()->route('Shop.Customers.edit')
|
||||
->with('growl', [__('Vous devez conserver au moins une adresse par type.'), 'warning']);
|
||||
}
|
||||
|
||||
CustomerAddresses::destroy($id);
|
||||
CustomerAddresses::ensureDefault($address->customer_id, $address->type);
|
||||
|
||||
return redirect()->route('Shop.Customers.edit')
|
||||
->with('growl', [__('Adresse supprimée.'), 'success']);
|
||||
return redirect()->route('Shop.Customers.edit');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@ class InvoiceController extends Controller
|
||||
|
||||
public function pdf($uuid)
|
||||
{
|
||||
if (app()->bound('debugbar')) {
|
||||
app('debugbar')->disable();
|
||||
}
|
||||
\Debugbar::disable();
|
||||
|
||||
return InvoicePDF::getByUUID($uuid);
|
||||
}
|
||||
|
||||
@@ -3,19 +3,13 @@
|
||||
namespace App\Http\Controllers\Shop;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Core\User\ShopCart;
|
||||
use App\Repositories\Shop\Paybox as PayboxGateway;
|
||||
use App\Repositories\Shop\Contents;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class PayboxController extends Controller
|
||||
{
|
||||
public function accepted()
|
||||
{
|
||||
ShopCart::clear();
|
||||
|
||||
return view('paybox.paybox', ['content' => Contents::getPayboxConfirmedContent()]);
|
||||
}
|
||||
|
||||
@@ -36,20 +30,8 @@ class PayboxController extends Controller
|
||||
|
||||
public function process(Request $request)
|
||||
{
|
||||
$invoiceId = $request->input('order_number');
|
||||
$data = $request->all();
|
||||
|
||||
if (! $invoiceId) {
|
||||
Log::warning('Paybox callback missing order_number', ['payload' => $request->all()]);
|
||||
|
||||
return response('Missing order_number', 400);
|
||||
}
|
||||
|
||||
$success = PayboxGateway::verifyPayment($invoiceId);
|
||||
|
||||
if (! $success) {
|
||||
return response('KO', 400);
|
||||
}
|
||||
|
||||
return response('OK');
|
||||
return view('paybox.send', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CustomerAddress extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $table = 'shop_customer_addresses';
|
||||
|
||||
@@ -39,7 +39,7 @@ class Invoice extends Model
|
||||
|
||||
public function address(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CustomerAddress::class, 'invoice_address_id')->withTrashed();
|
||||
return $this->belongsTo(CustomerAddress::class, 'invoice_address_id');
|
||||
}
|
||||
|
||||
public function scopeByCustomer($query, $customerId)
|
||||
|
||||
@@ -29,7 +29,7 @@ class Order extends Model
|
||||
|
||||
public function delivery_address(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CustomerAddress::class, 'delivery_address_id')->withTrashed();
|
||||
return $this->belongsTo(CustomerAddress::class, 'delivery_address_id');
|
||||
}
|
||||
|
||||
public function delivery(): BelongsTo
|
||||
|
||||
@@ -94,106 +94,11 @@ class ShopCart
|
||||
return self::get()->getContent();
|
||||
}
|
||||
|
||||
public static function migrateGuestCartToUser($userId = null)
|
||||
public static function get()
|
||||
{
|
||||
$userId = self::resolveUserId($userId);
|
||||
$userId = Auth::guard('customer')->id();
|
||||
$sessionKey = 'cart_'.sha1(static::class . ($userId ?? 'guest'));
|
||||
|
||||
if ($userId === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$guestSessionKey = self::sessionKey();
|
||||
$guestItems = Cart::session($guestSessionKey)->getContent();
|
||||
|
||||
if ($guestItems->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$userSessionKey = self::sessionKey($userId);
|
||||
|
||||
foreach ($guestItems as $item) {
|
||||
$existing = Cart::session($userSessionKey)->get($item->id);
|
||||
|
||||
if ($existing) {
|
||||
Cart::session($userSessionKey)->update($item->id, [
|
||||
'quantity' => [
|
||||
'relative' => false,
|
||||
'value' => $existing->quantity + $item->quantity,
|
||||
],
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$itemData = [
|
||||
'id' => $item->id,
|
||||
'name' => $item->name,
|
||||
'price' => $item->price,
|
||||
'quantity' => $item->quantity,
|
||||
'attributes' => self::extractAttributes($item),
|
||||
];
|
||||
|
||||
if (isset($item->associatedModel)) {
|
||||
$itemData['associatedModel'] = $item->associatedModel;
|
||||
}
|
||||
|
||||
$conditions = self::extractConditions($item);
|
||||
if (! empty($conditions)) {
|
||||
$itemData['conditions'] = $conditions;
|
||||
}
|
||||
|
||||
Cart::session($userSessionKey)->add($itemData);
|
||||
}
|
||||
|
||||
Cart::session($guestSessionKey)->clear();
|
||||
Cart::session($userSessionKey);
|
||||
}
|
||||
|
||||
protected static function extractAttributes($item)
|
||||
{
|
||||
if (! isset($item->attributes)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (is_object($item->attributes) && method_exists($item->attributes, 'toArray')) {
|
||||
return $item->attributes->toArray();
|
||||
}
|
||||
|
||||
return (array) $item->attributes;
|
||||
}
|
||||
|
||||
protected static function extractConditions($item)
|
||||
{
|
||||
if (! isset($item->conditions)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (is_object($item->conditions) && method_exists($item->conditions, 'toArray')) {
|
||||
return $item->conditions->toArray();
|
||||
}
|
||||
|
||||
return (array) $item->conditions;
|
||||
}
|
||||
|
||||
protected static function resolveUserId($userId = null)
|
||||
{
|
||||
return $userId ?? Auth::guard('customer')->id();
|
||||
}
|
||||
|
||||
protected static function sessionKey($userId = null)
|
||||
{
|
||||
$key = $userId ?? 'guest';
|
||||
|
||||
return 'cart_'.sha1(static::class.$key);
|
||||
}
|
||||
|
||||
protected static function session($userId = null)
|
||||
{
|
||||
return Cart::session(self::sessionKey($userId));
|
||||
}
|
||||
|
||||
public static function get($userId = null)
|
||||
{
|
||||
return self::session(self::resolveUserId($userId));
|
||||
return Cart::session($sessionKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,35 +12,17 @@ class CustomerAddresses
|
||||
public static function storeByCustomer($customer, $data)
|
||||
{
|
||||
$deliveries = $data['deliveries'] ?? false;
|
||||
if ($deliveries) {
|
||||
if (! empty($deliveries['address_id'])) {
|
||||
self::setDefault($customer->id, (int) $deliveries['address_id'], 1);
|
||||
}
|
||||
|
||||
if (! empty($deliveries['zipcode']) && ! empty($deliveries['city'])) {
|
||||
$payload = $deliveries;
|
||||
unset($payload['address_id']);
|
||||
$payload['customer_id'] = $customer->id;
|
||||
$payload['type'] = 1;
|
||||
$newAddress = self::store($payload);
|
||||
self::setDefault($customer->id, $newAddress->id, 1);
|
||||
}
|
||||
if ($deliveries && $deliveries['zipcode'] && $deliveries['city']) {
|
||||
$deliveries['customer_id'] = $customer->id;
|
||||
$deliveries['type'] = 1;
|
||||
self::store($deliveries);
|
||||
}
|
||||
|
||||
$invoices = $data['invoices'] ?? false;
|
||||
if ($invoices) {
|
||||
if (! empty($invoices['address_id'])) {
|
||||
self::setDefault($customer->id, (int) $invoices['address_id'], 2);
|
||||
}
|
||||
|
||||
if (! empty($invoices['zipcode']) && ! empty($invoices['city'])) {
|
||||
$payload = $invoices;
|
||||
unset($payload['address_id']);
|
||||
$payload['customer_id'] = $customer->id;
|
||||
$payload['type'] = 2;
|
||||
$newAddress = self::store($payload);
|
||||
self::setDefault($customer->id, $newAddress->id, 2);
|
||||
}
|
||||
if ($invoices && $invoices['zipcode'] && $invoices['city']) {
|
||||
$invoices['customer_id'] = $customer->id;
|
||||
$invoices['type'] = 2;
|
||||
self::store($invoices);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,24 +70,14 @@ class CustomerAddresses
|
||||
|
||||
public static function getInvoiceAddress($customerId)
|
||||
{
|
||||
$address = CustomerAddress::byCustomer($customerId)
|
||||
->byInvoicing()
|
||||
->orderByDesc('priority')
|
||||
->orderBy('id')
|
||||
->first();
|
||||
|
||||
return $address ?? self::getByCustomer($customerId);
|
||||
$addresses = CustomerAddress::byCustomer($customerId)->byInvoicing()->get();
|
||||
return count($addresses) ? $addresses->first() : self::getByCustomer($customerId);
|
||||
}
|
||||
|
||||
public static function getDeliveryAddress($customerId)
|
||||
{
|
||||
$address = CustomerAddress::byCustomer($customerId)
|
||||
->byDelivery()
|
||||
->orderByDesc('priority')
|
||||
->orderBy('id')
|
||||
->first();
|
||||
|
||||
return $address ?? self::getByCustomer($customerId);
|
||||
$addresses = CustomerAddress::byCustomer($customerId)->byDelivery()->get();
|
||||
return count($addresses) ? $addresses->first() : self::getByCustomer($customerId);
|
||||
}
|
||||
|
||||
public static function getByCustomer($customerId = false)
|
||||
@@ -120,40 +92,6 @@ class CustomerAddresses
|
||||
return ((int) $type === 1) ? '<i class="fa fa-fw fa-truck"></i>' : '<i class="fa fa-fw fa-file-invoice"></i>';
|
||||
}
|
||||
|
||||
public static function setDefault($customerId, $addressId, $type)
|
||||
{
|
||||
if (! $addressId) {
|
||||
return;
|
||||
}
|
||||
|
||||
$address = self::get($addressId);
|
||||
|
||||
if (! $address || (int) $address->customer_id !== (int) $customerId || (int) $address->type !== (int) $type) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::getModel()->byCustomer($customerId)->byType($type)->update(['priority' => null]);
|
||||
|
||||
$address->priority = 1;
|
||||
$address->save();
|
||||
}
|
||||
|
||||
public static function ensureDefault($customerId, $type)
|
||||
{
|
||||
$hasDefault = self::getModel()->byCustomer($customerId)->byType($type)->where('priority', 1)->exists();
|
||||
|
||||
if ($hasDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
$address = self::getModel()->byCustomer($customerId)->byType($type)->orderBy('id')->first();
|
||||
|
||||
if ($address) {
|
||||
$address->priority = 1;
|
||||
$address->save();
|
||||
}
|
||||
}
|
||||
|
||||
public static function toggleActive($id, $active)
|
||||
{
|
||||
return self::update(['active' => $active], $id);
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\Datatables\Shop\CustomerInvoicesDataTable;
|
||||
use App\Datatables\Shop\CustomerOrdersDataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
use App\Traits\Model\Basic;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -96,16 +95,6 @@ class Customers
|
||||
$data = $customer->toArray();
|
||||
$data['sale_channels'] = $customer->sale_channels->pluck('id')->toArray();
|
||||
$data['deliveries'] = Deliveries::getBySaleChannels($data['sale_channels'])->toArray();
|
||||
$data['delivery_address_id'] = optional(CustomerAddresses::getDeliveryAddress($id))->id;
|
||||
$data['invoice_address_id'] = optional(CustomerAddresses::getInvoiceAddress($id))->id;
|
||||
|
||||
if (! $data['delivery_address_id'] && ! empty($data['delivery_addresses'])) {
|
||||
$data['delivery_address_id'] = $data['delivery_addresses'][0]['id'] ?? null;
|
||||
}
|
||||
|
||||
if (! $data['invoice_address_id'] && ! empty($data['invoice_addresses'])) {
|
||||
$data['invoice_address_id'] = $data['invoice_addresses'][0]['id'] ?? null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -113,8 +102,8 @@ class Customers
|
||||
public static function storeFull($data)
|
||||
{
|
||||
$data2 = $data;
|
||||
$saleChannels = array_key_exists('sale_channels', $data) ? $data['sale_channels'] : null;
|
||||
if ($saleChannels !== null) {
|
||||
if ($data['sale_channels'] ?? false) {
|
||||
$saleChannels = $data['sale_channels'] ?? false;
|
||||
unset($data['sale_channels']);
|
||||
}
|
||||
if ($data['deliveries'] ?? false) {
|
||||
@@ -124,9 +113,7 @@ class Customers
|
||||
unset($data['invoices']);
|
||||
}
|
||||
$customer = self::store($data);
|
||||
if ($saleChannels !== null) {
|
||||
$customer->sale_channels()->sync($saleChannels);
|
||||
}
|
||||
$customer->sale_channels()->sync($saleChannels);
|
||||
CustomerAddresses::storeByCustomer($customer, $data2);
|
||||
|
||||
return $customer->id;
|
||||
|
||||
@@ -17,15 +17,12 @@ class InvoicePDF
|
||||
public static function get($id)
|
||||
{
|
||||
$invoice = Invoices::getFull($id);
|
||||
$customFields = [];
|
||||
if ($orderRef = optional($invoice->order)->ref) {
|
||||
$customFields['order number'] = $orderRef;
|
||||
}
|
||||
|
||||
$customer = new Party([
|
||||
'name' => optional($invoice->customer)->name ?? __('Client inconnu'),
|
||||
'name' => $invoice->customer->name,
|
||||
'address' => self::makeAddress($invoice->address),
|
||||
'custom_fields' => $customFields,
|
||||
'custom_fields' => [
|
||||
'order number' => $invoice->order->ref,
|
||||
],
|
||||
]);
|
||||
|
||||
$items = self::makeItems($invoice->order->detail);
|
||||
@@ -51,17 +48,7 @@ class InvoicePDF
|
||||
|
||||
public static function makeAddress($address)
|
||||
{
|
||||
if (! $address) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$lines = array_filter([
|
||||
$address->address ?? '',
|
||||
$address->address2 ?? '',
|
||||
trim(($address->zipcode ?? '').' '.($address->city ?? '')),
|
||||
]);
|
||||
|
||||
return implode('<br>', $lines);
|
||||
return $address->address.'<br>'.$address->zipcode.' '.$address->city;
|
||||
}
|
||||
|
||||
public static function makeItems($details)
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Models\Shop\InvoicePayment;
|
||||
use App\Repositories\Core\DateTime;
|
||||
use Bnb\PayboxGateway\Requests\Paybox\AuthorizationWithCapture;
|
||||
use Bnb\PayboxGateway\Requests\PayboxDirect\Capture;
|
||||
use Bnb\PayboxGateway\Responses\Exceptions\InvalidSignature;
|
||||
use Bnb\PayboxGateway\Responses\Paybox\Verify;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Paybox
|
||||
@@ -26,141 +23,17 @@ class Paybox
|
||||
|
||||
public static function verifyPayment($invoiceId)
|
||||
{
|
||||
$invoice = Invoices::get($invoiceId, ['order']);
|
||||
|
||||
if (! $invoice) {
|
||||
Log::warning('Paybox callback received for unknown invoice', [
|
||||
'invoice_id' => $invoiceId,
|
||||
'payload' => request()->all(),
|
||||
]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$invoice = Invoices::get($invoiceId);
|
||||
$payboxVerify = App::make(Verify::class);
|
||||
|
||||
try {
|
||||
$isSuccessful = $payboxVerify->isSuccess($invoice->total_shipped);
|
||||
$success = $payboxVerify->isSuccess($invoice->total_shipped);
|
||||
if ($success) {
|
||||
// process order here after making sure it was real payment
|
||||
}
|
||||
echo 'OK';
|
||||
} catch (InvalidSignature $e) {
|
||||
Log::alert('Invalid payment signature detected', [
|
||||
'invoice_id' => $invoiceId,
|
||||
'payload' => request()->except('signature'),
|
||||
]);
|
||||
|
||||
return false;
|
||||
Log::alert('Invalid payment signature detected');
|
||||
}
|
||||
|
||||
if (! $isSuccessful) {
|
||||
Log::warning('Paybox payment verification failed', [
|
||||
'invoice_id' => $invoiceId,
|
||||
'response_code' => $payboxVerify->getResponseCode(),
|
||||
'payload' => request()->except('signature'),
|
||||
]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::finalizeInvoicePayment($invoice);
|
||||
}
|
||||
|
||||
protected static function finalizeInvoicePayment(Invoice $invoice)
|
||||
{
|
||||
$order = $invoice->order;
|
||||
|
||||
if (! $order) {
|
||||
Log::error('Paybox payment cannot be finalized: missing related order', [
|
||||
'invoice_id' => $invoice->id,
|
||||
]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$request = request();
|
||||
$referenceParts = array_filter([
|
||||
$request->input('call_number'),
|
||||
$request->input('transaction_number'),
|
||||
]);
|
||||
$reference = $referenceParts ? implode('-', $referenceParts) : $request->input('authorization_number');
|
||||
if (! $reference) {
|
||||
$reference = 'paybox-'.$invoice->id;
|
||||
}
|
||||
|
||||
$payload = $request->except('signature');
|
||||
$existingPayment = InvoicePayment::where('invoice_id', $invoice->id)
|
||||
->where('reference', $reference)
|
||||
->first();
|
||||
$shouldNotify = false;
|
||||
$validatedTotal = InvoicePayment::where('invoice_id', $invoice->id)
|
||||
->validated()
|
||||
->sum('amount');
|
||||
|
||||
if (! $existingPayment && (float) $validatedTotal >= (float) $invoice->total_shipped) {
|
||||
Log::info('Paybox payment ignored: invoice already fully settled', [
|
||||
'invoice_id' => $invoice->id,
|
||||
'order_id' => $order->id,
|
||||
'reference' => $reference,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DB::transaction(function () use ($invoice, $order, $reference, $payload, $existingPayment, &$shouldNotify) {
|
||||
$attributes = [
|
||||
'payment_type' => 1,
|
||||
'amount' => $invoice->total_shipped,
|
||||
'date' => DateTime::getDate(),
|
||||
'data' => json_encode($payload, JSON_UNESCAPED_UNICODE),
|
||||
'validated' => 1,
|
||||
];
|
||||
|
||||
if ($existingPayment) {
|
||||
$previousValidationState = (int) ($existingPayment->validated ?? 0);
|
||||
$existingPayment->fill($attributes);
|
||||
|
||||
if ($existingPayment->isDirty()) {
|
||||
$existingPayment->save();
|
||||
}
|
||||
|
||||
if ($previousValidationState !== 1 && (int) $existingPayment->validated === 1) {
|
||||
$shouldNotify = true;
|
||||
}
|
||||
} else {
|
||||
InvoicePayment::create($attributes + [
|
||||
'invoice_id' => $invoice->id,
|
||||
'reference' => $reference,
|
||||
]);
|
||||
$shouldNotify = true;
|
||||
}
|
||||
|
||||
Invoices::checkPayments($invoice->id);
|
||||
|
||||
$paidStatus = Orders::getStatusByName('Préparation');
|
||||
if ($paidStatus !== '' && (int) $order->status !== (int) $paidStatus) {
|
||||
$order->status = $paidStatus;
|
||||
$order->save();
|
||||
}
|
||||
});
|
||||
|
||||
if ($shouldNotify) {
|
||||
try {
|
||||
OrderMails::sendOrderConfirmed($order->id);
|
||||
} catch (\Throwable $exception) {
|
||||
Log::error('Unable to send order confirmation email after Paybox payment', [
|
||||
'order_id' => $order->id,
|
||||
'invoice_id' => $invoice->id,
|
||||
'exception' => $exception->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Log::info('Paybox payment finalized successfully', [
|
||||
'invoice_id' => $invoice->id,
|
||||
'order_id' => $order->id,
|
||||
'reference' => $reference,
|
||||
'notified' => $shouldNotify,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getPreviousAuthorizedRequest($request)
|
||||
|
||||
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
17
build/js/site.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Prevent closing from click inside dropdown
|
||||
$(document).on('click', '.dropdown-menu', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// make it as accordion for smaller screens
|
||||
if ($(window).width() < 992) {
|
||||
$('.dropdown-menu a').click(function(e) {
|
||||
e.preventDefault();
|
||||
if ($(this).next('.submenu').length) {
|
||||
$(this).next('.submenu').toggle();
|
||||
}
|
||||
$('.dropdown').on('hide.bs.dropdown', function () {
|
||||
$(this).find('.submenu').hide();
|
||||
});
|
||||
});
|
||||
}
|
||||