Compare commits
394 Commits
ccb0399d91
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef1964d472 | ||
|
|
abb32e32b9 | ||
|
|
8c29459489 | ||
|
|
accb052f5c | ||
|
|
d5f095b5e5 | ||
|
|
fd628f3f95 | ||
|
|
a10f0b35d9 | ||
|
|
858421a9eb | ||
|
|
158bc4fd57 | ||
|
|
b7e3eefed6 | ||
|
|
67e4346c68 | ||
|
|
9ce62e82e5 | ||
|
|
7e93219774 | ||
|
|
29f46b7287 | ||
|
|
1f02c932a0 | ||
|
|
7d8bd8c372 | ||
|
|
f4bd4ddf24 | ||
|
|
1f7098d55b | ||
|
|
1867e75177 | ||
|
|
d502882052 | ||
|
|
a5b2196b32 | ||
|
|
cc8dfa29b4 | ||
|
|
62bce92d6d | ||
|
|
8d130b9741 | ||
|
|
2d7436a12b | ||
|
|
f25a62ed26 | ||
|
|
36764f2647 | ||
|
|
e37cad6699 | ||
|
|
ae7f8ed2c9 | ||
|
|
a3a86f4b2f | ||
|
|
9c081574c8 | ||
|
|
11edccad02 | ||
|
|
7c796802be | ||
|
|
5cc43bc889 | ||
|
|
f094411f10 | ||
|
|
ccc477f291 | ||
|
|
7217d945a3 | ||
|
|
9185269874 | ||
|
|
e42e3b4c0d | ||
|
|
a7ae946797 | ||
|
|
7a189abf0b | ||
|
|
34fc1c33bf | ||
|
|
61e34b4f4e | ||
|
|
7fe2770d45 | ||
|
|
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 |
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
||||
.git
|
||||
.gitlab
|
||||
Dockerfile
|
||||
node_modules
|
||||
storage/logs
|
||||
storage/framework/cache/data
|
||||
.dockerignore
|
||||
build.sh
|
||||
opensem-*.tar.xz
|
||||
1
.gitlab/merge_request_templates/mytemplate.md
Normal file
1
.gitlab/merge_request_templates/mytemplate.md
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
74
AGENTS.md
Normal file
74
AGENTS.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# Repository Guidelines
|
||||
|
||||
## Project Structure & Module Organization
|
||||
|
||||
OpenSem builds on Laravel 9.
|
||||
|
||||
Core application code lives in `app/`, while HTTP routes reside in
|
||||
`routes/` and Blade views in `resources/views/`. Reusable front-end
|
||||
assets (JS, SCSS, images) sit under `resources/` and are compiled into
|
||||
`public/` via Laravel Mix.
|
||||
|
||||
Database blueprints are versioned in `database/migrations/` with seeds
|
||||
in `database/seeders/`.
|
||||
|
||||
Tests are organised in `tests/Unit/` and `tests/Feature/`; keep large
|
||||
fixtures in `tests/Fixtures/` to avoid polluting source directories.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
- `composer install` — install PHP dependencies defined in
|
||||
`composer.json`.
|
||||
|
||||
- `php artisan serve` — start a local HTTP server on port 8000.
|
||||
|
||||
- `npm install && npm run dev` — install Node tooling and build UI
|
||||
assets for development.
|
||||
|
||||
- `npm run prod` — generate minified production assets in `public/`.
|
||||
|
||||
- `php artisan migrate --seed` — apply database schema and load
|
||||
default data for demo instances.
|
||||
|
||||
- `./build.sh` — builds a `.tar.xz` that contains the production and
|
||||
deployement ready source to be deployed.
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
|
||||
Follow PSR-12 with four-space indentation and `snake_case` database
|
||||
columns. Controllers, models, and Livewire components use StudlyCase
|
||||
class names; private methods remain `camelCase`. Run `composer run
|
||||
inspect` before opening a PR to execute `phpcs` and `phpstan`. For
|
||||
front-end changes, keep Blade sections in lowercase kebab IDs (for
|
||||
example, `@section('order-summary')`).
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
Use PHPUnit via `php artisan test`; target deterministic tests with
|
||||
clear Arrange/Act/Assert blocks. Feature tests should mirror top-level
|
||||
route names (e.g., `OrdersTest.php`). Unit tests belong in
|
||||
`tests/Unit/` and should stub external services. When adding
|
||||
migrations or service integrations, include coverage that exercises
|
||||
failure paths. For granular checks, `./vendor/bin/phpunit --filter
|
||||
FooTest` is acceptable, but always run the full suite before pushing.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
Commits in this repo mix Conventional Commit prefixes (`new:`, `fix:`,
|
||||
`chg:`); `fix: prevent null totals`. Keep messages in the imperative
|
||||
mood and reference ticket IDs when available.
|
||||
|
||||
Pull requests must describe scope, list schema or configuration
|
||||
changes, and note any manual follow-up (cron, storage links,
|
||||
queues).
|
||||
|
||||
Attach screenshots or terminal logs when touching UI or console
|
||||
output, and ensure CI scripts (when available) pass.
|
||||
|
||||
## Environment & Security Notes
|
||||
|
||||
Copy `.env.example` to `.env` and run `php artisan key:generate`
|
||||
before local work. Never commit `.env`, `storage/`, or database dumps
|
||||
containing sensitive data. Use the Docker resources in `docker/` only
|
||||
for reproducible environments; keep secrets in your host overrides,
|
||||
not in version control.
|
||||
102
Dockerfile
Normal file
102
Dockerfile
Normal file
@@ -0,0 +1,102 @@
|
||||
FROM php:8.3.25-cli-alpine3.21 AS phpdeps
|
||||
|
||||
|
||||
## Install composer
|
||||
|
||||
RUN apk add wget gnupg ca-certificates
|
||||
|
||||
ARG COMPOSER_VERSION=2.8.11
|
||||
ENV COMPOSER_ALLOW_SUPERUSER=0
|
||||
|
||||
RUN cd tmp && \
|
||||
wget "https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar" && \
|
||||
wget "https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar.sha256sum" && \
|
||||
sha256sum -c composer.phar.sha256sum && \
|
||||
install -m0755 /tmp/composer.phar /usr/local/bin/composer && \
|
||||
composer --version
|
||||
|
||||
|
||||
## Install PHP extensions
|
||||
|
||||
RUN apk add autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c libxml2-dev
|
||||
RUN docker-php-ext-install dom
|
||||
|
||||
RUN docker-php-ext-install bcmath
|
||||
|
||||
RUN apk add libpng-dev libjpeg-turbo-dev libwebp-dev libxpm-dev
|
||||
RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-xpm && \
|
||||
docker-php-ext-install gd
|
||||
|
||||
RUN apk add libzip-dev
|
||||
RUN docker-php-ext-install zip
|
||||
|
||||
RUN apk add libexif-dev
|
||||
RUN docker-php-ext-install exif
|
||||
|
||||
|
||||
## Composer dependencies
|
||||
|
||||
RUN apk add git ## required by composer install
|
||||
|
||||
COPY . /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir -p /app/bootstrap/cache \
|
||||
/app/storage/media-library/temp \
|
||||
/app/storage/framework/cache \
|
||||
/app/storage/framework/views \
|
||||
/app/storage/framework/sessions \
|
||||
/app/storage/app/public \
|
||||
/app/storage/logs
|
||||
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
|
||||
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
|
||||
## the existing database, so commenting out for now
|
||||
#RUN rm -f vendor/sebastienheyd/boilerplate/src/database/migrations/2017_03_24_093351_laratrust_setup_tables.php
|
||||
#RUN rm -f vendor/sebastienheyd/boilerplate/src/database/migrations/2017_03_24_093352_users_table_update.php
|
||||
#RUN rm -f vendor/sebastienheyd/boilerplate/src/database/migrations/2020_01_14_090810_permissions_categories.php
|
||||
|
||||
|
||||
## Node.js, npm, yarn and frontend dependencies
|
||||
|
||||
RUN apk add nodejs npm yarn
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn production
|
||||
RUN yarn grunt ## this step requires both node_modules and vendor to be present
|
||||
|
||||
|
||||
## Separate out the build stages
|
||||
|
||||
FROM alpine:3.21 AS pack
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache xz
|
||||
|
||||
# bring PHP app with vendor
|
||||
COPY --from=phpdeps /app /app
|
||||
|
||||
# create artifact (use tar + xz so we don't depend on GNU tar -J)
|
||||
RUN mkdir -p /out \
|
||||
&& tar -C /app -cf /out/app.tar \
|
||||
--exclude=.git --exclude=.github --exclude=.env --exclude='*.md' \
|
||||
--exclude=tests --exclude=.gitignore \
|
||||
--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 \
|
||||
&& xz -T0 -9e /out/app.tar \
|
||||
&& mv /out/app.tar.xz /out/opensem-prod.tar.xz
|
||||
|
||||
FROM scratch AS export
|
||||
COPY --from=pack /out/opensem-prod.tar.xz /
|
||||
575
Gruntfile.js
575
Gruntfile.js
@@ -1,121 +1,132 @@
|
||||
var jsBase = [
|
||||
'node_modules/jquery/dist/jquery.min.js',
|
||||
'node_modules/jquery-migrate/jquery-migrate.min.js',
|
||||
'node_modules/jquery-migrate/dist/jquery-migrate.min.js',
|
||||
'node_modules/jquery-ui-dist/jquery-ui.min.js'
|
||||
]
|
||||
|
||||
var jsBootstrap = [
|
||||
'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js',
|
||||
'node_modules/bootbox/dist/bootbox.all.min.js',
|
||||
]
|
||||
|
||||
var cssBase = [
|
||||
'node_modules/bootstrap/dist/css/bootstrap.min.css',
|
||||
]
|
||||
|
||||
var cssIcons = [
|
||||
'node_modules/font-awesome/css/font-awesome.css',
|
||||
]
|
||||
|
||||
var jsCompatibilty = [
|
||||
var jsCompat = [
|
||||
'node_modules/promise-polyfill/dist/polyfill.min.js',
|
||||
'node_modules/es6-promise/dist/es6-promise.min.js'
|
||||
]
|
||||
|
||||
var jsCoreInclude = [
|
||||
'build/js/include/core/appender.js',
|
||||
// 'build/js/include/core/cache.js',
|
||||
// 'build/js/include/core/handlebars.js',
|
||||
// 'build/js/include/core/lang.js',
|
||||
'build/js/include/core/objectLength.js',
|
||||
// 'build/js/include/core/session.js',
|
||||
'build/js/include/core/url.js',
|
||||
// 'build/js/include/core/user.js',
|
||||
// 'build/js/include/form/check_fields.js',
|
||||
// 'build/js/include/form/checkbox.js',
|
||||
// 'build/js/include/form/datetime.js',
|
||||
// 'build/js/include/form/multi-select.js',
|
||||
// 'build/js/include/form/radio.js',
|
||||
// 'build/js/include/form/select.js',
|
||||
'build/js/include/form/upload.js',
|
||||
// 'build/js/include/form/validator.js',
|
||||
'build/js/include/layout/animate.js',
|
||||
// 'build/js/include/layout/message.js',
|
||||
// 'build/js/include/layout/modal.js',
|
||||
'build/js/include/layout/scroll.js',
|
||||
// 'build/js/include/layout/tooltip.js',
|
||||
// 'build/js/include/datatable.js',
|
||||
'build/js/include/file.js',
|
||||
'build/js/include/uploader.js',
|
||||
]
|
||||
|
||||
var jsMain = [
|
||||
// 'node_modules/sweetalert2/dist/sweetalert2.all.min.js',
|
||||
// 'node_modules/inputmask/dist/min/jquery.inputmask.bundle.min.js',
|
||||
/* 'node_modules/summernote/dist/summernote.min.js',
|
||||
'node_modules/summernote/dist/lang/summernote-fr-FR.min.js',
|
||||
*/
|
||||
// 'node_modules/@activix/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js',
|
||||
// 'node_modules/@activix/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.fr.js',
|
||||
'node_modules/bootstrap-fileinput/js/plugins/piexif.min.js',
|
||||
'node_modules/bootstrap-fileinput/js/plugins/sortable.min.js',
|
||||
// 'node_modules/bootstrap-slider/dist/bootstrap-slider.min.js',
|
||||
// 'node_modules/bootstrap-validate/dist/bootstrap-validate.js',
|
||||
// 'node_modules/jQuery-QueryBuilder/dist/js/jquery-builder.standalone.min.js',
|
||||
/* 'node_modules/jQuery-QueryBuilder/dist/i18n/query-builder.fr.js', */
|
||||
/* 'node_modules/isotope-layout/dist/isotope.pkgd.min.js', */
|
||||
'node_modules/jquery-serializejson/jquery.serializejson.min.js',
|
||||
'node_modules/bootstrap4-toggle/js/bootstrap4-toggle.min.js',
|
||||
'node_modules/wew.js/dist/wew.min.js',
|
||||
'node_modules/jquery.are-you-sure/jquery.are-you-sure.js',
|
||||
/* 'node_modules/letteringjs/jquery.lettering.js', */
|
||||
/* 'node_modules/textillate/jquery.textillate.js', */
|
||||
'node_modules/jqtree/tree.jquery.js',
|
||||
'node_modules/numeral/min/numeral.min.js',
|
||||
'node_modules/numeral/min/locales/fr.min.js',
|
||||
'build/js/include/plugins/jquery.hcaptions.js',
|
||||
jsCoreInclude
|
||||
// 'build/js/include/confirm.js',
|
||||
]
|
||||
|
||||
var cssMain = [
|
||||
// 'node_modules/sweetalert2/dist/sweetalert2.min.css',
|
||||
// 'node_modules/inputmask/css/inputmask.css',
|
||||
// 'node_modules/summernote/dist/summernote.css',
|
||||
// 'node_modules/@activix/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css',
|
||||
// 'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css',
|
||||
// 'node_modules/jQuery-QueryBuilder/dist/css/query-builder.default.min.css',
|
||||
'node_modules/animate.css/animate.min.css',
|
||||
'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css',
|
||||
'node_modules/jqtree/jqtree.css',
|
||||
// 'build/css/modal-option.css',
|
||||
'build/css/shadow.css',
|
||||
// 'build/css/utility.css',
|
||||
'build/css/main.css'
|
||||
'node_modules/es6-promise/dist/es6-promise.min.js',
|
||||
]
|
||||
|
||||
var jsSite = [
|
||||
jsBase
|
||||
jsBase,
|
||||
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',
|
||||
]
|
||||
|
||||
var cssSite = [
|
||||
cssBase,
|
||||
cssIcons,
|
||||
'node_modules/bootstrap/dist/css/bootstrap.min.css',
|
||||
'node_modules/@fortawesome/fontawesome-free/css/all.min.css',
|
||||
'node_modules/animate.css/animate.min.css',
|
||||
'build/css/shadow.css',
|
||||
'build/css/site.css'
|
||||
'node_modules/icheck-bootstrap/icheck-bootstrap.min.css',
|
||||
'resources/shop/js/plugins/smooth_products/css/smoothproducts.css',
|
||||
'resources/shop/css/site.css',
|
||||
]
|
||||
|
||||
var jsAdminLTE = [
|
||||
jsBase,
|
||||
jsBootstrap,
|
||||
'node_modules/sizzle/dist/sizzle.min.js',
|
||||
'node_modules/admin-lte/dist/js/adminlte.min.js',
|
||||
'node_modules/toastr/build/toastr.min.js',
|
||||
]
|
||||
|
||||
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',
|
||||
]
|
||||
|
||||
var jsBundle = [
|
||||
'node_modules/jquery-ui-sortable/jquery-ui.min.js',
|
||||
'node_modules/jquery-serializejson/jquery.serializejson.min.js',
|
||||
'node_modules/jquery-placeholder/jquery.placeholder.js',
|
||||
'node_modules/@claviska/jquery-minicolors/jquery.minicolors.js',
|
||||
'node_modules/bootstrap-validate/dist/bootstrap-validate.js',
|
||||
'node_modules/bootstrap-validator/dist/validator.min.js',
|
||||
'node_modules/jquery-validation/dist/jquery.validate.min.js',
|
||||
'node_modules/jquery-confirm/dist/jquery-confirm.min.js',
|
||||
'node_modules/jquery.cookie/jquery.cookie.js',
|
||||
'node_modules/jquery.filer/js/jquery.filer.min.js',
|
||||
'node_modules/jquery-file-download/src/Scripts/jquery.fileDownload.js',
|
||||
'node_modules/jquery-jeditable/dist/jquery.jeditable.min.js',
|
||||
'node_modules/jquery.quicksearch/dist/jquery.quicksearch.min.js',
|
||||
'node_modules/jquery.nicescroll/dist/jquery.nicescroll.js',
|
||||
'node_modules/jquery-slimscroll/jquery.slimscroll.min.js',
|
||||
'node_modules/handlebars/dist/handlebars.min.js',
|
||||
'node_modules/swag/lib/swag.min.js',
|
||||
'node_modules/multiselect/js/jquery.multi-select.js',
|
||||
'node_modules/screenfull/dist/screenfull.js',
|
||||
'node_modules/underscore/underscore-min.js',
|
||||
]
|
||||
|
||||
var jsMain = [
|
||||
jsCompat,
|
||||
jsCoreInclude,
|
||||
jsBundle,
|
||||
]
|
||||
|
||||
var cssPrint = [
|
||||
// 'node_modules/bootstrap/dist/css/bootstrap.min.css',
|
||||
'cssIcons',
|
||||
'resources/shop/print.css'
|
||||
]
|
||||
|
||||
var cssBundle = [
|
||||
'node_modules/bootstrap/dist/css/bootstrap.min.css',
|
||||
'node_modules/animate.css/animate.min.css',
|
||||
'node_modules/dropzone/dist/min/dropzone.min.css',
|
||||
'node_modules/daterangepicker/daterangepicker.css',
|
||||
'node_modules/jquery-confirm/dist/jquery-confirm.min.css',
|
||||
'node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css',
|
||||
'node_modules/bootstrap-sweetalert/dist/sweetalert.css',
|
||||
'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css',
|
||||
'node_modules/@claviska/jquery-minicolors/jquery.minicolors.css',
|
||||
'node_modules/jquery.filer/css/jquery.filer.css',
|
||||
'node_modules/jquery.filer/css/themes/jquery.filer-dragdropbox-theme.css',
|
||||
'node_modules/jquery.filer/assets/fonts/jquery.filer-icons/jquery-filer.css',
|
||||
]
|
||||
|
||||
var cssIcons = [
|
||||
'node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css',
|
||||
]
|
||||
|
||||
var cssMain = [
|
||||
cssBundle,
|
||||
cssIcons,
|
||||
'resources/shop/css/main.css',
|
||||
]
|
||||
|
||||
var jsDataTables = [
|
||||
'node_modules/jszip/dist/jszip.min.js',
|
||||
'node_modules/pdfmake/build/pdfmake.min.js',
|
||||
'node_modules/pdfmake/build/vfs_fonts.js',
|
||||
'node_modules/datatables/media/js/jquery.dataTables.min.js',
|
||||
'node_modules/datatables.net/js/jquery.dataTables.min.js',
|
||||
'node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-autofill/js/autoFill.min.js',
|
||||
'node_modules/datatables.net-autofill/js/autoFill.bootstrap.min.js',
|
||||
'node_modules/datatables.net-autofill/js/dataTables.autoFill.min.js',
|
||||
'node_modules/datatables.net-autofill-bs4/js/autoFill.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-buttons/js/dataTables.buttons.min.js',
|
||||
'node_modules/datatables.net-buttons-bs4/js/buttons.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-buttons/js/buttons.html5.min.js',
|
||||
'node_modules/datatables.net-buttons/js/buttons.print.min.js',
|
||||
'node_modules/datatables.net-buttons/js/buttons.colVis.min.js',
|
||||
'node_modules/datatables.net-colreorder/js/dataTables.colReorder.min.js',
|
||||
'node_modules/datatables.net-colreorder-bs4/js/dataTables.colReorder-bs4.min.js',
|
||||
'node_modules/datatables.net-colreorder-bs4/js/colReorder.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js',
|
||||
'node_modules/datatables.net-fixedheader-bs4/js/fixedHeader.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-fixedcolumns/js/dataTables.fixedColumns.min.js',
|
||||
@@ -124,21 +135,18 @@ var jsDataTables = [
|
||||
'node_modules/datatables.net-keytable-bs4/js/keyTable.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-responsive/js/dataTables.responsive.min.js',
|
||||
'node_modules/datatables.net-rowreorder/js/dataTables.rowReorder.min.js',
|
||||
'node_modules/datatables.net-rowreorder-bs4/js/dataTables.rowReorder.botstrap4.min.js',
|
||||
'node_modules/datatables.net-rowreorder-bs4/js/rowReorder.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-scroller/js/dataTables.scroller.min.js',
|
||||
'node_modules/datatables.net-scroller-bs4/js/scroller.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-select/js/dataTables.select.min.js',
|
||||
'node_modules/datatables.net-select-bs4/js/select.bootstrap4.min.js',
|
||||
'node_modules/yadcf/jquery.dataTables.yadcf.js',
|
||||
'build/js/modal.js',
|
||||
'build/js/datatables.js',
|
||||
/* 'node_modules/yadcf/jquery.dataTables.yadcf.js', */
|
||||
];
|
||||
|
||||
var cssDataTables = [
|
||||
// 'node_modules/datatables/media/css/jquery.dataTables.min.css',
|
||||
'node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-autofill-bs4/css/autoFill.bootstrap4.min.css',
|
||||
'node_modules/dataTables.net-buttons-bs4/css/buttons.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-autofill/css/autoFill.bootstrap.min.css',
|
||||
'node_modules/datatables.net-colreorder-bs4/css/colReorder.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-fixedheader-bs4/css/fixedHeader.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-fixedcolumns-bs4/css/fixedColumns.bootstrap4.min.css',
|
||||
@@ -146,18 +154,9 @@ var cssDataTables = [
|
||||
'node_modules/datatables.net-rowreorder-bs4/css/rowReorder.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-scroller-bs4/css/scroller.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-select-bs4/css/select.bootstrap4.min.css',
|
||||
'node_modules/yadcf/jquery.dataTables.yadcf.css',
|
||||
'build/dataTables.bootstrap.min.css',
|
||||
/* 'node_modules/yadcf/jquery.dataTables.yadcf.css', */
|
||||
];
|
||||
|
||||
var jsCalendar = [
|
||||
'node_modules/fullcalendar/dist/fullcalendar.min.js',
|
||||
'node_modules/fullcalendar/dist/locale/fr.js'
|
||||
]
|
||||
|
||||
var cssCalendar = [
|
||||
'node_modules/fullcalendar/dist/fullcalendar.min.css',
|
||||
]
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
@@ -171,65 +170,56 @@ module.exports = function(grunt) {
|
||||
build: {
|
||||
files: [
|
||||
{
|
||||
'public/js/main.min.js': jsMain,
|
||||
'public/js/site.js': jsSite,
|
||||
'public/js/datatables.min.js': jsDataTables,
|
||||
'public/js/calendar.min.js': jsCalendar
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'build/js/modules',
|
||||
src: '**/*.js',
|
||||
dest: 'public/js',
|
||||
rename: function (dest, src) {
|
||||
return dest + '/' + src.replace('.js', '.min.js');
|
||||
}
|
||||
'public/assets/js/main.min.js': jsMain,
|
||||
'public/assets/plugins/datatables.min.js': jsDataTables,
|
||||
'public/assets/plugins/adminlte/adminlte.min.js': jsAdminLTE,
|
||||
'public/js/site.min.js': jsSite,
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
eslint: {
|
||||
target: ['build/js/*']
|
||||
target: ['public/assets/js/*']
|
||||
},
|
||||
webstandards: {
|
||||
'src': ['build/js/*']
|
||||
'src': ['public/assets/js/*']
|
||||
},
|
||||
concat: {
|
||||
options: {
|
||||
separator: '\n'
|
||||
},
|
||||
mainjs: {
|
||||
src: jsMain,
|
||||
dest: 'public/js/main.min.js'
|
||||
},
|
||||
maincss: {
|
||||
src: cssMain,
|
||||
dest: 'public/css/main.min.css'
|
||||
},
|
||||
sitejs: {
|
||||
src: jsSite,
|
||||
dest: 'public/js/site.min.js'
|
||||
},
|
||||
sitecss: {
|
||||
src: cssSite,
|
||||
dest: 'public/css/site.min.css'
|
||||
},
|
||||
siteJs: {
|
||||
src: jsSite,
|
||||
dest: 'public/js/site.min.js'
|
||||
},
|
||||
mainjs: {
|
||||
src: jsMain,
|
||||
dest: 'public/assets/js/main.min.js'
|
||||
},
|
||||
maincss: {
|
||||
src: cssMain,
|
||||
dest: 'public/assets/css/main.min.css'
|
||||
},
|
||||
printcss: {
|
||||
src: cssPrint,
|
||||
dest: 'public/assets/css/print.min.css'
|
||||
},
|
||||
adminltejs: {
|
||||
src: jsAdminLTE,
|
||||
dest: 'public/assets/plugins/adminlte/adminlte.min.js'
|
||||
},
|
||||
datatablesjs: {
|
||||
src: jsDataTables,
|
||||
dest: 'public/js/datatables.min.js'
|
||||
dest: 'public/assets/plugins/datatables.min.js'
|
||||
},
|
||||
datatablescss: {
|
||||
src: cssDataTables,
|
||||
dest: 'public/css/datatables.min.css'
|
||||
dest: 'public/assets/plugins/datatables.min.css'
|
||||
},
|
||||
calendarjs: {
|
||||
src: jsCalendar,
|
||||
dest: 'public/js/calendar.min.js'
|
||||
},
|
||||
calendarcss: {
|
||||
src: cssCalendar,
|
||||
dest: 'public/css/calendar.min.css'
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
options: {
|
||||
@@ -239,7 +229,13 @@ module.exports = function(grunt) {
|
||||
target: {
|
||||
files: [
|
||||
{
|
||||
'public/css/main.min.css': cssMain
|
||||
'public/assets/css/main.min.css': cssMain
|
||||
},
|
||||
{
|
||||
'public/assets/css/print.min.css': cssPrint
|
||||
},
|
||||
{
|
||||
'public/css/site.min.css': cssSite
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -249,33 +245,57 @@ module.exports = function(grunt) {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap/dist/fonts/',
|
||||
cwd: 'node_modules/@fortawesome/fontawesome-free/webfonts/',
|
||||
src: ['**'],
|
||||
dest: 'public/webfonts/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/fonts',
|
||||
src: ['**'],
|
||||
dest: 'public/fonts/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/font-awesome/fonts/',
|
||||
cwd: 'resources/shop/img',
|
||||
src: ['**'],
|
||||
dest: 'public/fonts/'
|
||||
dest: 'public/img/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/summernote/dist/font/',
|
||||
cwd: 'resources/shop/lang',
|
||||
src: ['**'],
|
||||
dest: 'public/css/font/'
|
||||
dest: 'public/assets/lang/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/datatables/media/images/',
|
||||
cwd: 'resources/shop/plugins',
|
||||
src: ['**'],
|
||||
dest: 'public/images/'
|
||||
dest: 'public/assets/plugins/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap4-toggle/',
|
||||
cwd: 'resources/shop/assets/tpl',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/bootstrap4-toggle',
|
||||
dest: 'public/assets/tpl/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/owp.glyphicons/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/fonts/glyphicons'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/@claviska/jquery-minicolors/',
|
||||
src: ['jquery.minicolors.png'],
|
||||
dest: 'public/assets/css/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/@claviska/jquery-minicolors/',
|
||||
src: ['jquery.minicolors.*'],
|
||||
dest: 'public/assets/plugins/jquery-minicolors',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
@@ -285,19 +305,252 @@ module.exports = function(grunt) {
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'build/img/',
|
||||
cwd: 'node_modules/jquery.quicksearch/dist/',
|
||||
src: ['jquery.quicksearch.min.js.map'],
|
||||
dest: 'public/assets/js/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jquery.quicksearch/dist/',
|
||||
src: ['**/*.map'],
|
||||
dest: 'public/js'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/pdfmake/build/',
|
||||
src: ['pdfmake.min.js.map'],
|
||||
dest: 'public/assets/plugins/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/daterangepicker/',
|
||||
src: ['daterangepicker.css'],
|
||||
dest: 'public/assets/plugins/daterangepicker',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/daterangepicker/',
|
||||
src: ['daterangepicker.js'],
|
||||
dest: 'public/assets/plugins/daterangepicker',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/chart.js/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/img/'
|
||||
dest: 'public/assets/plugins/chartjs'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/highcharts/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/highcharts'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/@highcharts/map-collection/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/highcharts/map',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/nestable2/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/nestable2'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap-autocomplete/dist/latest/',
|
||||
src: ['bootstrap-autocomplete.min.js'],
|
||||
dest: 'public/assets/plugins/autocomplete'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/slick-carousel/slick/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/slick',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jquery-slimscroll/',
|
||||
src: ['jquery.slimscroll.min.js'],
|
||||
dest: 'public/assets/plugins',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jquery.nicescroll/dist/',
|
||||
src: ['jquery.nicescroll.min.js'],
|
||||
dest: 'public/assets/plugins',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap4-toggle/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/bootstrap4-toggle',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/pdfobject/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/pdfobject',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/plugins/pdfjs/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/pdfjs',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap4-duallistbox/dist/',
|
||||
src: ['*.min.*'],
|
||||
dest: 'public/assets/plugins/bootstrap4-duallistbox',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/select2/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/select2',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/tempusdominus-bootstrap-4/build/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/datepicker',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/moment/min/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/moment',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/currency.js/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/currency',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap-fileinput/css/',
|
||||
src: ['**/*.min.css'],
|
||||
dest: 'public/assets/plugins/bootstrap-fileinput/css',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap-fileinput/js/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/bootstrap-fileinput/js',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap-fileinput/img/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/bootstrap-fileinput/img',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap-fileinput/themes/fa/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/bootstrap-fileinput/themes/fa',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap-fileinput/themes/fas/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/bootstrap-fileinput/themes/fas',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/js/include/plugins/datatables_lang/',
|
||||
src: ['*.json'],
|
||||
dest: 'public/assets/plugins/datatables_lang',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/tinymce/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/tinymce',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'vendor/sebastienheyd/boilerplate/src/public/plugins/tinymce/plugins/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/tinymce/plugins',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'vendor/sebastienheyd/boilerplate/src/resources/assets/js/vendor/tinymce/plugins/stickytoolbar/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/tinymce/plugins/stickytoolbar',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'vendor/sebastienheyd/boilerplate/src/resources/assets/js/vendor/tinymce/langs/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/tinymce/langs',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'vendor/sebastienheyd/boilerplate/src/resources/assets/js/vendor/tinymce/skins/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/tinymce/skins/ui',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'vendor/sebastienheyd/boilerplate/src/public/plugins/tinymce/skins/ui/boilerplate/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/tinymce/skins/ui/boilerplate',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/icheck-bootstrap/',
|
||||
src: ['icheck-bootstrap.min.css'],
|
||||
dest: 'public/assets/plugins/icheck/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jstree/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/jstree/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jquery.fancytree/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/fancytree'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jqtree/',
|
||||
src: ['tree.jquery.js'],
|
||||
dest: 'public/assets/plugins/jqtree'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/jqtree/',
|
||||
src: ['jqtree.css'],
|
||||
dest: 'public/assets/plugins/jqtree'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/sidr/dist/',
|
||||
src: ['**'],
|
||||
dest: 'public/assets/plugins/sidr'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'resources/shop/js/include/',
|
||||
src: ['boilerplate.js'],
|
||||
dest: 'public/assets/plugins',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dist: {
|
||||
files: [
|
||||
'build/*',
|
||||
],
|
||||
tasks: ['concat', 'copy']
|
||||
files: ['resources/shop/js/*', 'resources/shop/css/*'],
|
||||
// tasks: ['concat', 'copy']
|
||||
tasks: ['concat']
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
30
README.md
30
README.md
@@ -1,10 +1,19 @@
|
||||
## A propos de OpenSem
|
||||
|
||||
OpenSem est une solution de commerce électronique et un ERP développé pour les besoins exprimés.
|
||||
OpenSem est une solution de commerce électronique et un ERP développé
|
||||
pour les besoins exprimés.
|
||||
|
||||
Développée par Ludovic Candellier en étroite relation avec
|
||||
Jardin'Envie.
|
||||
|
||||
L'application est écrite en PHP et est basée sur Laravel.
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
Laravel is a web application framework with expressive, elegant
|
||||
syntax. We believe development must be an enjoyable and creative
|
||||
experience to be truly fulfilling. Laravel takes the pain out of
|
||||
development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
@@ -14,12 +23,21 @@ Laravel is a web application framework with expressive, elegant syntax. We belie
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
Laravel is accessible, powerful, and provides tools required for
|
||||
large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
Laravel has the most extensive and thorough
|
||||
[documentation](https://laravel.com/docs) and video tutorial library
|
||||
of all modern web application frameworks, making it a breeze to get
|
||||
started with the framework.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can
|
||||
help. Laracasts contains over 1500 video tutorials on a range of
|
||||
topics including Laravel, modern PHP, unit testing, and
|
||||
JavaScript. Boost your skills by digging into our comprehensive video
|
||||
library.
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
The Laravel framework is open-sourced software licensed under the [MIT
|
||||
license](https://opensource.org/licenses/MIT).
|
||||
|
||||
22
app/Charts/Shop/Order.php
Normal file
22
app/Charts/Shop/Order.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Charts\Shop;
|
||||
|
||||
use Akaunting\Apexcharts\Chart;
|
||||
use App\Repositories\Shop\OrderMetrics;
|
||||
|
||||
class Order
|
||||
{
|
||||
public static function getMonthly()
|
||||
{
|
||||
$data = OrderMetrics::getTotalMonthly();
|
||||
|
||||
return (new Chart)->setType('bar')
|
||||
->setWidth('100%')
|
||||
->setHeight(300)
|
||||
->setLabels(array_keys($data))
|
||||
->setDataset('CA', 'bar', array_values($data))
|
||||
->setColor('#334F17')
|
||||
->setStrokeColors(['#527C39']);
|
||||
}
|
||||
}
|
||||
24
app/Console/Commands/FixSlug.php
Normal file
24
app/Console/Commands/FixSlug.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Shop\Article;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class FixSlug extends Command
|
||||
{
|
||||
protected $signature = 'FixSlug';
|
||||
|
||||
protected $description = 'Slugify articles';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$articles = Article::all();
|
||||
foreach ($articles as $article) {
|
||||
$article->slug = null;
|
||||
$article->update(['name' => $article->name]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
27
app/Console/Commands/addTagGroup.php
Normal file
27
app/Console/Commands/addTagGroup.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Shop\Tag;
|
||||
use App\Repositories\Shop\TagGroups;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class AddTagGroup extends Command
|
||||
{
|
||||
protected $signature = 'addTagGroup';
|
||||
|
||||
protected $description = 'Migrations of tags';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$tags = Tag::withTrashed()->get();
|
||||
foreach ($tags as $tag) {
|
||||
$tag->update(['group' => TagGroups::getName($tag->tag_group_id)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
app/Console/Commands/untranslateShelves.php
Normal file
30
app/Console/Commands/untranslateShelves.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Shop\Category;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class UntranslateShelves extends Command
|
||||
{
|
||||
protected $signature = 'untranslateShelves';
|
||||
|
||||
protected $description = 'Migrations of shelves';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$categories = Category::all();
|
||||
foreach ($categories as $category) {
|
||||
$trans = json_decode($category->name, true);
|
||||
$name = $trans['fr'];
|
||||
$trans = $category->description ? json_decode($category->description, true) : false;
|
||||
$description = $trans ? $trans['fr'] : '';
|
||||
$category->update(['name' => $name, 'description' => $description]);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
app/Console/Commands/untranslateTags.php
Normal file
28
app/Console/Commands/untranslateTags.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Shop\Tag;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class UntranslateTags extends Command
|
||||
{
|
||||
protected $signature = 'untranslateTags';
|
||||
|
||||
protected $description = 'Migrations of tags';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$tags = Tag::withTrashed()->get();
|
||||
foreach ($tags as $tag) {
|
||||
$trans = json_decode($tag->name, true);
|
||||
$name = $trans['fr'];
|
||||
$tag->update(['name' => $name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,36 +7,18 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
$schedule->command(\Spatie\Health\Commands\RunHealthChecksCommand::class)->everyMinute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
include base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
|
||||
13
app/Contracts/Commentator.php
Normal file
13
app/Contracts/Commentator.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace BeyondCode\Comments\Contracts;
|
||||
|
||||
interface Commentator
|
||||
{
|
||||
/**
|
||||
* Check if a comment for a specific model needs to be approved.
|
||||
*
|
||||
* @param mixed $model
|
||||
*/
|
||||
public function needsCommentApproval($model): bool;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Family;
|
||||
|
||||
class FamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'families';
|
||||
|
||||
public function query(Family $model)
|
||||
{
|
||||
$model = $model::withCount(['genres','species','varieties']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('genres_count')->title('Nb genres')->searchable(false)->addClass('text-right'),
|
||||
Column::make('species_count')->title('Nb espèces')->searchable(false)->addClass('text-right'),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Specie;
|
||||
|
||||
class SpeciesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'species';
|
||||
|
||||
public function query(Specie $model)
|
||||
{
|
||||
$model = $model::withCount('varieties')->with('genre');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('genre_name', function(Specie $specie) {
|
||||
return $specie->genre ? $specie->genre->name : '';
|
||||
})
|
||||
->rawColumns(['genre_name', 'action'])
|
||||
;
|
||||
return Parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
||||
Column::make('latin'),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Variety;
|
||||
|
||||
class VarietiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'varieties';
|
||||
|
||||
public function query(Variety $model)
|
||||
{
|
||||
// $model = $model::with('specie')->withCount('Articles')->select('botanic_varieties.*');
|
||||
$model = $model::joinRelations('Specie')->select('botanic_varieties.*','botanic_species.name as specie_name')->with('Specie')->withCount('Articles');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('Specie.name')->data('specie_name')->title('Espèce'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->class('text-right')->searchable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables;
|
||||
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
use Yajra\DataTables\Html\Editor\Fields;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class ParentDataTable extends DataTable
|
||||
{
|
||||
public $rowReorder = true;
|
||||
public $rowReorderSelector; // ['selector' => 'tr']
|
||||
public $colReorder = false;
|
||||
public $fixedColumns = false;
|
||||
public $scrollX = false;
|
||||
public $scrollCollapse = true;
|
||||
public $sortedColumn = 0;
|
||||
public $sortedOrder = 'asc';
|
||||
public $stateSave = false;
|
||||
|
||||
/**
|
||||
* Build DataTable class.
|
||||
*
|
||||
* @param mixed $query Results from query() method.
|
||||
* @return \Yajra\DataTables\DataTableAbstract
|
||||
*/
|
||||
public function dataTable($query)
|
||||
{
|
||||
return $this->modifier(datatables()->eloquent($query));
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
return $this->addButtons($datatables->setRowId('{{$id}}'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add buttons DataTable class.
|
||||
*
|
||||
* @param mixed $query Results from query() method.
|
||||
* @return \Yajra\DataTables\DataTableAbstract
|
||||
*/
|
||||
public function addButtons($datatables)
|
||||
{
|
||||
return $datatables->addColumn('action', $this->getHtmlButtons());
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '';
|
||||
|
||||
// $buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||
// $buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-leaf-alt"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-pencil-alt"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
||||
return $buttons;
|
||||
// return view('components.datatables.buttons.row_action');
|
||||
}
|
||||
|
||||
public function makeColumnButtons()
|
||||
{
|
||||
return Column::computed('action')
|
||||
->title('')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->searchable(false)
|
||||
->width("74")
|
||||
->addClass('text-center text-nowrap');
|
||||
}
|
||||
|
||||
public static function isFilteredByField($field)
|
||||
{
|
||||
return (request()->has('filters.' . $field)) ? request()->input('filters.'. $field) : (request()->has($field) ? request()->input($field) : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query source of dataTable.
|
||||
*
|
||||
* @param \App\Family $model
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function buildQuery($model)
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function html()
|
||||
{
|
||||
return $this->buildHtml(strtolower($this->model_name) . '-table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function buildHtml($table_id = false, $selector = false)
|
||||
{
|
||||
$table_id = $table_id ? $table_id : strtolower($this->model_name) . '-table';
|
||||
$selector = $selector ? $selector : '#' . $this->model_name . '-filters';
|
||||
return $this->builder()
|
||||
->setTableId($table_id)
|
||||
->parameters($this->getParameters())
|
||||
->columns($this->getColumns())
|
||||
->ajax([
|
||||
'data' => 'function(d) { d.filters = $("' . $selector . '").serializeJSON(); }',
|
||||
'url' => isset($this->url) ? $this->url : ''
|
||||
])
|
||||
->dom($this->getDom())
|
||||
->orderBy($this->sortedColumn,$this->sortedOrder)
|
||||
->buttons($this->getButtons());
|
||||
}
|
||||
|
||||
public function getButtons() {
|
||||
return [
|
||||
Button::make('export'),
|
||||
Button::make('print'),
|
||||
Button::make('colvis'),
|
||||
Button::make('columnsToggle')
|
||||
];
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
{
|
||||
$data = [
|
||||
'pageLength' => 5,
|
||||
'scrollX' => $this->scrollX,
|
||||
'scrollCollapse' => $this->scrollCollapse,
|
||||
'searchDelay' => 500,
|
||||
'colReorder' => $this->colReorder,
|
||||
'fixedColumns' => $this->fixedColumns,
|
||||
// 'autoWidth' => false,
|
||||
'stateSave' => $this->stateSave
|
||||
];
|
||||
if ($this->rowReorder) {
|
||||
$data['rowReorder'] = ['selector' => $this->rowReorderSelector];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDom()
|
||||
{
|
||||
$dom = '';
|
||||
// $dom .= $this->getDatatablesHeaderDefault();
|
||||
$dom .= "rt";
|
||||
$dom .= $this->getDatatablesFooterDefault();
|
||||
return $dom;
|
||||
}
|
||||
|
||||
public function getDatatablesHeader() {
|
||||
return view('components.datatables.header');
|
||||
}
|
||||
|
||||
public function getDatatablesHeaderDefault() {
|
||||
// return "<div class'row'><div class='col'></div></div>";
|
||||
/*
|
||||
|
||||
$dom = 't<"row datatable-pager light"<"col-md-12"'
|
||||
. '<"datatable-more-export-buttons filter-buttons pull-left">'
|
||||
. '<"datatable-more-export-favorites-buttons filter-buttons pull-left">'
|
||||
. '<"datatable-more-export-basket-buttons filter-buttons pull-left">'
|
||||
. '<"datatable-download-buttons filter-buttons pull-left">'
|
||||
. '>>'
|
||||
. '<"dt-toolbar-footer"<"col"i><"col pull-right datatable-pager light nopadding-right"p>>';
|
||||
|
||||
*/
|
||||
|
||||
$dom = "<'row dt-toolbar-header'<'col-lg-4'l><'col-lg-4'B><'col-lg-4 text-right add'f>>";
|
||||
return $dom;
|
||||
// return 't<"row datatable-pager light"<"col-md-12"<"datatable-more-export-buttons filter-buttons pull-left"><"datatable-more-export-favorites-buttons filter-buttons pull-left"><"datatable-more-export-basket-buttons filter-buttons pull-left"><"datatable-download-buttons filter-buttons pull-left">>><"dt-toolbar-footer"<"col-md-6"i><"col-md-6 pull-right datatable-pager light nopadding-right"p>>';
|
||||
|
||||
}
|
||||
|
||||
public function getDatatablesFooterDefault() {
|
||||
return "<'row pt-3 dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function filename()
|
||||
{
|
||||
return self::buildFilename($this->model_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildFilename($name)
|
||||
{
|
||||
return $name . '_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleFamily;
|
||||
|
||||
class ArticleFamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'article_families';
|
||||
|
||||
public function query(ArticleFamily $model)
|
||||
{
|
||||
$model = $model::withCount('Articles');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'articles';
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
// $model = $model::with('Family')->select('shop_articles.*','family.name as family_name')->join('shop_article_families as family', 'family.id', '=', 'shop_articles.article_family_id')->groupBy('shop_articles.id');
|
||||
$model = $model::with('article_family')->select('shop_articles.*');
|
||||
// $model = $model::joinRelations('Family')->select('shop_articles.*','shop_article_families.name as family_name');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('article_family.name')->title('Famille')->orderable(false),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'categories';
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
$model = $model::withCount('articles');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb Articles')->class('text-right')->searchable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
|
||||
class CustomersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customers';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('address')->title('Adresse'),
|
||||
Column::make('zipcode')->title('Code postal'),
|
||||
Column::make('city')->title('Ville'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Invoices';
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status.name'),
|
||||
Column::make('customer.name'),
|
||||
Column::make('total'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Package;
|
||||
|
||||
class PackagesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'packages';
|
||||
|
||||
public function query(Package $model)
|
||||
{
|
||||
$model = $model::with(['article_family'])->select('shop_packages.*');
|
||||
$model = self::filterByFamily($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByFamily($model, $family_id = false)
|
||||
{
|
||||
$family_id = $family_id ? $family_id : self::isFilteredByField('family_id');
|
||||
return $family_id ? $model->byArticleFamily($family_id) : $model;
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('article_family.name')->title('Famille d\'articles'),
|
||||
Column::make('value')->title('Valeur'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceGenericCategory;
|
||||
|
||||
class PriceGenericCategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_generic_categories';
|
||||
|
||||
public function query(PriceGenericCategory $model)
|
||||
{
|
||||
$model = $model->withCount('price_generics');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('price_generics_count')->title('Nb Tarifs')->class('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceGeneric;
|
||||
|
||||
class PriceGenericsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_generics';
|
||||
|
||||
public function query(PriceGeneric $model)
|
||||
{
|
||||
$model = $model::with(['category','priceByUnit'])->withCount('prices');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('category.name')->title('Catégorie'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('price_by_unit.price')->title('Prix HT')->class('text-right'),
|
||||
Column::make('price_by_unit.price_taxed')->title('Prix TTC')->class('text-right'),
|
||||
Column::make('prices_count')->title('Nb tarifs')->class('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TagGroup;
|
||||
|
||||
class TagGroupsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tag_groups';
|
||||
|
||||
public function query(TagGroup $model)
|
||||
{
|
||||
$model = $model::withCount('tags');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('tags_count')->title('Nb de tags')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tag;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tags';
|
||||
public $rowReorder = ['selector' => 'tr'];
|
||||
|
||||
public function query(Tag $model)
|
||||
{
|
||||
$model = $model::with('group')->select(['tags.*']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('group.name')->title('Groupe'),
|
||||
Column::make('sort_order')->title('Ordre'),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Unity;
|
||||
|
||||
class UnitiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'unities';
|
||||
|
||||
public function query(Unity $model)
|
||||
{
|
||||
$model = $model::with(['package.article_family'])->select('shop_unities.*');
|
||||
$model = self::filterByFamily($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByFamily($model, $family_id = false)
|
||||
{
|
||||
$family_id = $family_id ? $family_id : self::isFilteredByField('family_id');
|
||||
return $family_id ? $model->byArticleFamily($family_id) : $model;
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('package.article_family.name')->title('Famille'),
|
||||
Column::make('package.value')->title('Package'),
|
||||
Column::make('value')->title('Valeur'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
34
app/Datatables/Admin/Core/CommentsDataTable.php
Normal file
34
app/Datatables/Admin/Core/CommentsDataTable.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Core;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Core\Comment;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CommentsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'comments';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Core.Comments.index');
|
||||
}
|
||||
|
||||
public function query(Comment $model)
|
||||
{
|
||||
$model = $model::with(['commentator'])->select('*');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('updated_at')->title(__('date'))->width('80')->class('text-center')->searchable(false),
|
||||
Column::make('commentator.name')->title(__('name'))->searchable(false),
|
||||
Column::make('comment')->title(__('comments'))->searchable(false),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Datatables/Admin/Core/Mail/MailTemplatesDataTable.php
Normal file
33
app/Datatables/Admin/Core/Mail/MailTemplatesDataTable.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Core\Mail;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Core\Mail\MailTemplate;
|
||||
use App\Repositories\Core\Auth\Users;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class MailTemplatesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'mail_templates';
|
||||
|
||||
public $sortedColumn = 0;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(MailTemplate $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('subject')->title(__('Core.subject')),
|
||||
Column::make('mailable')->title(__('Mailable')),
|
||||
$this->makeColumnButtons()->width('60'),
|
||||
];
|
||||
}
|
||||
}
|
||||
50
app/Datatables/Admin/Shop/ArticleNaturesDataTable.php
Normal file
50
app/Datatables/Admin/Shop/ArticleNaturesDataTable.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleNature;
|
||||
use App\Repositories\Core\Medias;
|
||||
use App\Repositories\Shop\ArticleNatures;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ArticleNaturesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'article_natures';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public function query(ArticleNature $model)
|
||||
{
|
||||
$model = $model::withCount('Articles');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('icon', function (ArticleNature $nature) {
|
||||
$logo = Medias::getImage($nature, 'normal', 'icon');
|
||||
|
||||
return $logo ? "<img src='{$logo}'>" : '';
|
||||
})
|
||||
->editColumn('product_type', function (ArticleNature $nature) {
|
||||
return ArticleNatures::getProductTypeName($nature->product_type);
|
||||
})
|
||||
->rawColumns(['icon', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('icon')->title('Icone')->width(40)->orderable(false),
|
||||
Column::make('product_type')->title('Famille de produit')->width(140),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb Art.')->addClass('text-right')->searchable(false)->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
116
app/Datatables/Admin/Shop/ArticlesDataTable.php
Normal file
116
app/Datatables/Admin/Shop/ArticlesDataTable.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Article;
|
||||
use App\Repositories\Shop\ArticleImages;
|
||||
use App\Repositories\Shop\Articles;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'articles';
|
||||
|
||||
public $sortedColumn = 3;
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
$model = $model::with(['article_nature', 'image'])->withCount(['categories', 'images', 'offers', 'tags']);
|
||||
$model = self::filterByArticleNature($model);
|
||||
$model = self::filterByCategory($model);
|
||||
$model = self::filterByTag($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByArticleNature($model, $article_nature_id = false)
|
||||
{
|
||||
$article_nature_id = $article_nature_id ? $article_nature_id : self::isFilteredByField('article_nature_id');
|
||||
|
||||
return $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||
}
|
||||
|
||||
public static function filterByCategory($model, $category_id = false)
|
||||
{
|
||||
$category_id = $category_id ? $category_id : self::isFilteredByField('category_id');
|
||||
|
||||
return $category_id ? $model->byCategory($category_id) : $model;
|
||||
}
|
||||
|
||||
public static function filterByTag($model, $tag_id = false)
|
||||
{
|
||||
$tag_id = $tag_id ? $tag_id : self::isFilteredByField('tag_id');
|
||||
|
||||
return $tag_id ? $model->byTag($tag_id) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('visible', function (Article $article) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'visible',
|
||||
'value' => $article->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$article->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->editColumn('homepage', function (Article $article) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'homepage',
|
||||
'value' => $article->homepage,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$article->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'homepage',
|
||||
]);
|
||||
})
|
||||
->editColumn('thumb', function (Article $article) {
|
||||
$image = ArticleImages::getFullImageByArticle($article);
|
||||
|
||||
return Articles::getThumb($image, false);
|
||||
})
|
||||
->editColumn('article_nature.name', function (Article $article) {
|
||||
return $article->article_nature ? $article->article_nature->name : '';
|
||||
})
|
||||
->editColumn('tags2', function (Article $article) {
|
||||
$html = '';
|
||||
foreach ($article->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->editColumn('images_count2', function (Article $article) {
|
||||
return ArticleImages::countFullImagesByArticle($article);
|
||||
})
|
||||
->rawColumns(['tags2', 'thumb', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('visible')->title('Visible')->searchable(false)->width(50),
|
||||
Column::make('homepage')->title('Accueil')->searchable(false)->width(50),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('article_nature.name')->title('Nature'),
|
||||
Column::make('thumb')->title('')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||
Column::make('name')->title('Nom'),
|
||||
// Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||
// Column::make('tags_count')->title('#Tag')->class('text-right')->searchable(false)->width(40),
|
||||
Column::make('categories_count')->title('#Ray')->class('text-right')->searchable(false)->width(40),
|
||||
Column::make('offers_count')->title('#Ofr')->class('text-right')->searchable(false)->width(40),
|
||||
// Column::make('images_count')->title('#Pho')->class('text-right')->searchable(false)->width(40),
|
||||
// Column::make('images_count2')->title('#PhoH')->class('text-right')->searchable(false)->orderable(false)->width(40),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
74
app/Datatables/Admin/Shop/CategoriesDataTable.php
Normal file
74
app/Datatables/Admin/Shop/CategoriesDataTable.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'categories';
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
$model = $model::notRoot()->with(['tags.articles'])->withCount(['articles', 'tags']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('name', function (Category $category) {
|
||||
return $category->name;
|
||||
})
|
||||
->editColumn('visible', function (Category $category) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'visible',
|
||||
'value' => $category->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$category->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->editColumn('homepage', function (Category $category) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'homepage',
|
||||
'value' => $category->homepage,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$category->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'homepage',
|
||||
]);
|
||||
})
|
||||
->editColumn('articles_tagged_count', function (Category $category) {
|
||||
$count = 0;
|
||||
foreach ($category->tags as $tag) {
|
||||
$nb = collect($tag->articles)->count();
|
||||
$count += $nb;
|
||||
}
|
||||
|
||||
return $count;
|
||||
})
|
||||
->rawColumns(['visible', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('visible')->title('visible')->width(60),
|
||||
Column::make('homepage')->title('homepage')->width(60),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->orderable(false)->searchable(false)->width(60),
|
||||
Column::make('tags_count')->title('#Tags')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('articles_tagged_count')->title('#ArtTag')->class('text-right')->searchable(false)->orderable(false)->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Datatables/Admin/Shop/ContentsDataTable.php
Normal file
33
app/Datatables/Admin/Shop/ContentsDataTable.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Content;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ContentsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'contents';
|
||||
|
||||
public function query(Content $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables->rawColumns(['text', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('id')->title('id'),
|
||||
Column::make('text')->title('Texte'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Datatables/Admin/Shop/CustomerAddressesDataTable.php
Normal file
53
app/Datatables/Admin/Shop/CustomerAddressesDataTable.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\CustomerAddress;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerAddressesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customer_addresses';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.CustomerAddresses.index');
|
||||
}
|
||||
|
||||
public function query(CustomerAddress $model)
|
||||
{
|
||||
$model = self::filterByCustomer($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByCustomer($model, $customerId = false)
|
||||
{
|
||||
$customerId = $customerId ? $customerId : self::isFilteredByField('customer_id');
|
||||
|
||||
return $customerId ? $model->byCustomer($customerId) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables->editColumn('type', function (CustomerAddress $address) {
|
||||
return CustomerAddresses::getIconByType($address->type);
|
||||
})->rawColumns(['type', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('type')->title('')->width(30),
|
||||
Column::make('address')->title('Adresse'),
|
||||
Column::make('zipcode')->title('Code postal'),
|
||||
Column::make('city')->title('Ville'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
80
app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php
Normal file
80
app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerInvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customer_invoices';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Shop.Invoices.index');
|
||||
}
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$customerId = Customers::getId();
|
||||
$model = $model->byCustomer($customerId)->with(['address']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = view('components.form.button', [
|
||||
'dataId' => '{{$uuid}}',
|
||||
'class' => 'btn-sm btn-secondary btn-invoice mr-2',
|
||||
'icon' => 'fa-file-pdf',
|
||||
'title' => 'Télécharger la facture',
|
||||
'url' => route('Shop.Invoices.pdf').'/{{$uuid}}',
|
||||
]);
|
||||
|
||||
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Invoice $invoice) {
|
||||
return Invoices::getStatus($invoice->status);
|
||||
})
|
||||
->editColumn('created_at', function (Invoice $invoice) {
|
||||
return $invoice->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||
})
|
||||
->editColumn('payment_type', function (Invoice $invoice) {
|
||||
return InvoicePayments::getPaymentType($invoice->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('payment_type')->title('Règlement'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
69
app/Datatables/Admin/Shop/CustomerOrdersDataTable.php
Normal file
69
app/Datatables/Admin/Shop/CustomerOrdersDataTable.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use App\Repositories\Shop\Orders;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerOrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Shop.Orders.index');
|
||||
}
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$customerId = Customers::getId();
|
||||
$model = $model->byCustomer($customerId);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '';
|
||||
|
||||
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Order $order) {
|
||||
return Orders::getStatus($order->status);
|
||||
})
|
||||
->editColumn('created_at', function (Order $order) {
|
||||
return $order->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Datatables/Admin/Shop/CustomersDataTable.php
Normal file
42
app/Datatables/Admin/Shop/CustomersDataTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customers';
|
||||
|
||||
public function query(Customer $model)
|
||||
{
|
||||
$model = $model->with('addresses');
|
||||
$model = self::filterBySaleChannel($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterBySaleChannel($model, $sale_channel_id = false)
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id');
|
||||
|
||||
return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model;
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('company')->title('Société'),
|
||||
Column::make('last_name')->title('Nom'),
|
||||
Column::make('first_name')->title('Prénom'),
|
||||
Column::make('address')->title('Adresse'),
|
||||
Column::make('zipcode')->title('Code postal'),
|
||||
Column::make('city')->title('Ville'),
|
||||
Column::make('phone')->title('Téléphone'),
|
||||
Column::make('email')->title('Email'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
66
app/Datatables/Admin/Shop/DeliveriesDataTable.php
Normal file
66
app/Datatables/Admin/Shop/DeliveriesDataTable.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Delivery;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'deliveries';
|
||||
|
||||
public function query(Delivery $model)
|
||||
{
|
||||
$model = $model->with('sale_channel');
|
||||
$model = self::filterBySaleChannel($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterBySaleChannel($model, $sale_channel_id = false)
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id');
|
||||
|
||||
return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('active', function (Delivery $delivery) {
|
||||
return view('components.form.toggle', [
|
||||
'value' => $delivery->active,
|
||||
'on' => __('active'),
|
||||
'off' => __('inactive'),
|
||||
'meta' => 'data-id='.$delivery->id,
|
||||
'size' => 'xs',
|
||||
]);
|
||||
})
|
||||
->editColumn('is_public', function (Delivery $delivery) {
|
||||
return $delivery->is_public ? "<i class='fa fa-check secondary'></i>" : '';
|
||||
})
|
||||
->editColumn('at_house', function (Delivery $delivery) {
|
||||
return $delivery->at_house ? "<i class='fa fa-check secondary'></i>" : '';
|
||||
})
|
||||
->editColumn('address', function (Delivery $delivery) {
|
||||
return $delivery->address.' '.$delivery->zipcode.' '.$delivery->city;
|
||||
})
|
||||
->rawColumns(['active', 'is_public', 'at_house', 'address', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('active')->title(__('active'))->width(60)->class('text-center'),
|
||||
Column::make('is_public')->title(__('Public'))->width(60)->class('text-center'),
|
||||
Column::make('at_house')->title(__('Défaut'))->width(60)->class('text-center'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('sale_channel.name')->title(__('shop.sale_channels.name')),
|
||||
Column::make('address')->title('Adresse')->searchable(false),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
27
app/Datatables/Admin/Shop/DeliveryPackagesDataTable.php
Normal file
27
app/Datatables/Admin/Shop/DeliveryPackagesDataTable.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\DeliveryPackage;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveryPackagesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'delivery_packages';
|
||||
|
||||
public function query(DeliveryPackage $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('weight')->title('Poids')->addClass('text-right'),
|
||||
Column::make('weight_flyer')->title('Flyer')->addClass('text-right'),
|
||||
Column::make('weight_packaging')->title('Packaging')->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\DeliveryTypeCalculation;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveryTypeCalculationsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'delivery_type_calculations';
|
||||
|
||||
public function query(DeliveryTypeCalculation $model)
|
||||
{
|
||||
$model = $model->with('delivery_type');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('delivery_type.name')->title('Nom'),
|
||||
Column::make('weight')->title('Poids en g')->addClass('text-right'),
|
||||
Column::make('price')->title('Prix')->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Datatables/Admin/Shop/DeliveryTypesDataTable.php
Normal file
25
app/Datatables/Admin/Shop/DeliveryTypesDataTable.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\DeliveryType;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveryTypesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'delivery_types';
|
||||
|
||||
public function query(DeliveryType $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
48
app/Datatables/Admin/Shop/InvoicePaymentsDataTable.php
Normal file
48
app/Datatables/Admin/Shop/InvoicePaymentsDataTable.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\InvoicePayment;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class InvoicePaymentsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'invoice_payments';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.InvoicePayments.index');
|
||||
}
|
||||
|
||||
public function query(InvoicePayment $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('payment_type', function (InvoicePayment $payment) {
|
||||
return InvoicePayments::getPaymentType($payment->payment_type);
|
||||
})
|
||||
->editColumn('date', function (InvoicePayment $payment) {
|
||||
return $payment->date;
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('payment_type')->title('Type')->width(80),
|
||||
Column::make('date')->width(60),
|
||||
Column::make('amount')->title('Montant')->width(100),
|
||||
Column::make('reference')->title('Référence'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Datatables/Admin/Shop/InvoicesDataTable.php
Normal file
49
app/Datatables/Admin/Shop/InvoicesDataTable.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'invoices';
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$model = $model->with('customer');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Invoice $invoice) {
|
||||
return Invoices::getStatus($invoice->status);
|
||||
})
|
||||
->editColumn('created_at', function (Invoice $invoice) {
|
||||
return $invoice->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Invoice $invoice) {
|
||||
return ($invoice->customer ?? false) ? $invoice->customer->name : '';
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('ref')->title('Ref')->width(80),
|
||||
Column::make('status')->width(60),
|
||||
Column::make('created_at')->title('Date')->width(100),
|
||||
Column::make('customer.last_name')->title('Client')->default(''),
|
||||
Column::make('total')->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
54
app/Datatables/Admin/Shop/MerchandisesDataTable.php
Normal file
54
app/Datatables/Admin/Shop/MerchandisesDataTable.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Merchandise;
|
||||
use App\Repositories\Shop\Merchandises;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class MerchandisesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'merchandises';
|
||||
|
||||
public function query(Merchandise $model)
|
||||
{
|
||||
$model = $model::with(['image', 'tags', 'producer'])->withCount(['Articles', 'tags', 'images']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('thumb', function (Merchandise $merchandise) {
|
||||
return Merchandises::getThumb($merchandise->image, false);
|
||||
})
|
||||
->editColumn('tags2', function (Merchandise $merchandise) {
|
||||
$html = '';
|
||||
foreach ($merchandise->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['thumb', 'tags2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('thumb')->title('')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('producer.name')->title('Producteur'),
|
||||
Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->searchable(false),
|
||||
Column::make('tags_count')->title('#Tag')->class('text-right')->searchable(false),
|
||||
Column::make('images_count')->title('#Pho')->class('text-right')->searchable(false),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
79
app/Datatables/Admin/Shop/OffersDataTable.php
Normal file
79
app/Datatables/Admin/Shop/OffersDataTable.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Offer;
|
||||
use App\Repositories\Shop\Offers;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class OffersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'offers';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public function query(Offer $model)
|
||||
{
|
||||
$model = $model->with(['article.article_nature', 'variation', 'tariff'])->select($model->getTable().'.*');
|
||||
$model = self::filterByArticleNature($model);
|
||||
$model = self::filterByPackage($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByArticleNature($model, $articleNatureId = false)
|
||||
{
|
||||
$articleNatureId = $articleNatureId ? $articleNatureId : self::isFilteredByField('article_nature_id');
|
||||
|
||||
return $articleNatureId ? $model->byArticleNature($articleNatureId) : $model;
|
||||
}
|
||||
|
||||
public static function filterByPackage($model, $packageId = false)
|
||||
{
|
||||
$packageId = $packageId ? $packageId : self::isFilteredByField('package_id');
|
||||
|
||||
return $packageId ? $model->byPackage($packageId) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('thumb', function (Offer $offer) {
|
||||
return '<img src="'.Offers::getThumbSrc($offer).'">';
|
||||
})
|
||||
->editColumn('status_id', function (Offer $offer) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'status_id',
|
||||
'value' => $offer->status_id,
|
||||
'on' => __('active'),
|
||||
'off' => __('inactive'),
|
||||
'meta' => 'data-id='.$offer->id,
|
||||
'size' => 'xs',
|
||||
]);
|
||||
})
|
||||
->editColumn('stock_delayed', function (Offer $offer) {
|
||||
return $offer->stock_delayed.' - '.$offer->delay_type;
|
||||
})
|
||||
->rawColumns(['active', 'thumb', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status_id')->title('')->width(40)->searchable(false),
|
||||
Column::make('article.article_nature.name')->title('Nature')->defaultContent('')->searchable(false),
|
||||
Column::make('thumb')->title('')->width(30)->searchable(false)->addClass('text-center'),
|
||||
Column::make('article.name')->title('Article')->defaultContent(''),
|
||||
Column::make('variation.name')->title('Déclinaison')->defaultContent('')->searchable(false),
|
||||
Column::make('weight')->title('Poids')->searchable(false)->addClass('text-right'),
|
||||
Column::make('tariff.name')->title('Tarif')->defaultContent('')->searchable(false),
|
||||
Column::make('stock_current')->title('Appro im')->searchable(false)->addClass('text-right'),
|
||||
Column::make('stock_delayed')->title('Appro délai')->searchable(false)->addClass('text-right'),
|
||||
Column::make('stock_ondemand')->title('Dmde')->searchable(false)->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
61
app/Datatables/Admin/Shop/OrdersDataTable.php
Normal file
61
app/Datatables/Admin/Shop/OrdersDataTable.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Orders;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public $sortedColumn = 0;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$model = $model->with(['customer', 'delivery']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Order $order) {
|
||||
return Orders::getStatus($order->status);
|
||||
})
|
||||
->editColumn('created_at', function (Order $order) {
|
||||
return $order->created_at->format('d/m/Y H:i:s');
|
||||
})
|
||||
->editColumn('customer.last_name', function (Order $order) {
|
||||
return $order->customer->last_name.' '.$order->customer->first_name;
|
||||
})
|
||||
->editColumn('payment_type', function (Order $order) {
|
||||
return InvoicePayments::getPaymentType($order->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('status')->title('Statut'),
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('customer.last_name')->title('Client'),
|
||||
Column::make('delivery.name')->title('Point de distribution'),
|
||||
Column::make('payment_type')->title('Règlement'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Datatables/Admin/Shop/PackagesDataTable.php
Normal file
29
app/Datatables/Admin/Shop/PackagesDataTable.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Package;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PackagesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'packages';
|
||||
|
||||
public function query(Package $model)
|
||||
{
|
||||
$model = $model->withCount(['variations', 'offers']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Valeur'),
|
||||
Column::make('variations_count')->title('nb variations')->searchable(false)->class('text-right'),
|
||||
Column::make('offers_count')->title('nb offres')->searchable(false)->class('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
36
app/Datatables/Admin/Shop/PriceListValuesDataTable.php
Normal file
36
app/Datatables/Admin/Shop/PriceListValuesDataTable.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceListValue;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PriceListValuesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_list_values';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.PriceListValues.index');
|
||||
}
|
||||
|
||||
public function query(PriceListValue $model)
|
||||
{
|
||||
$model = $model->with(['price_list']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('price_list.name')->data('price_list')->title('etat'),
|
||||
Column::make('code')->title('Code'),
|
||||
Column::make('quantity')->title('Quantité'),
|
||||
Column::make('price')->title('Prix HT'),
|
||||
Column::make('price_taxed')->title('Prix TTC'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
58
app/Datatables/Admin/Shop/PriceListsDataTable.php
Normal file
58
app/Datatables/Admin/Shop/PriceListsDataTable.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceList;
|
||||
use App\Repositories\Shop\PriceLists;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PriceListsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_lists';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.PriceLists.index');
|
||||
}
|
||||
|
||||
public function query(PriceList $model)
|
||||
{
|
||||
$model = $model->with(['sale_channel', 'price_list_values']);
|
||||
$model = self::filterByTariff($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByTariff($model, $tariff_id = false)
|
||||
{
|
||||
$tariff_id = $tariff_id ? $tariff_id : self::isFilteredByField('tariff_id');
|
||||
|
||||
return $tariff_id ? $model->byTariff($tariff_id) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (PriceList $price_list) {
|
||||
return PriceLists::getStatus($price_list['status_id']);
|
||||
})
|
||||
->editColumn('tariff_id', function (PriceList $price_list) {
|
||||
return view('Admin.Shop.PriceLists.partials.table-prices', ['prices' => $price_list['price_list_values']]);
|
||||
})
|
||||
->rawColumns(['tariff_id', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status_id')->data('status')->title('etat'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('sale_channel.name')->title('Canal de vente'),
|
||||
Column::make('tariff_id')->title('Liste de prix'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Datatables/Admin/Shop/ProducersDataTable.php
Normal file
53
app/Datatables/Admin/Shop/ProducersDataTable.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Producer;
|
||||
use App\Repositories\Shop\Producers;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ProducersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'producers';
|
||||
|
||||
public function query(Producer $model)
|
||||
{
|
||||
$model = $model::with(['image', 'tags'])->withCount(['Merchandises', 'tags', 'images']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('thumb', function (Producer $producer) {
|
||||
return Producers::getThumb($producer->image, false);
|
||||
})
|
||||
->editColumn('tags2', function (Producer $producer) {
|
||||
$html = '';
|
||||
foreach ($producer->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['thumb', 'tags2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('thumb')->title('')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||
Column::make('merchandises_count')->title('#Marchandises')->class('text-right')->searchable(false),
|
||||
// Column::make('tags_count')->title('#Tag')->class('text-right')->searchable(false),
|
||||
// Column::make('images_count')->title('#Pho')->class('text-right')->searchable(false),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Datatables/Admin/Shop/SaleChannelsDataTable.php
Normal file
31
app/Datatables/Admin/Shop/SaleChannelsDataTable.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\SaleChannel;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class SaleChannelsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'sale_channels';
|
||||
|
||||
public function query(SaleChannel $model)
|
||||
{
|
||||
$model = $model->withCount(['customers', 'deliveries', 'tariffs']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('code')->title('Code abrégé')->width(100),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('customers_count')->title('#Clients')->searchable(false)->class('text-right'),
|
||||
Column::make('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'),
|
||||
Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
51
app/Datatables/Admin/Shop/TagGroupsDataTable.php
Normal file
51
app/Datatables/Admin/Shop/TagGroupsDataTable.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TagGroup;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TagGroupsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tag_groups';
|
||||
|
||||
public $sortedColumn = 2;
|
||||
|
||||
public function query(TagGroup $model)
|
||||
{
|
||||
$model = $model::with('article_family')->withCount('tags');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('visible', function (TagGroup $tag_group) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'visible',
|
||||
'value' => $tag_group->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$tag_group->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->rawColumns(['visible', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('visible')->title('Visible')->width(60)->searchable(false),
|
||||
Column::make('code')->title('Code')->width(100),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('tags_count')->title('#Tags')->searchable(false)->addClass('text-right')->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
45
app/Datatables/Admin/Shop/TagsDataTable.php
Normal file
45
app/Datatables/Admin/Shop/TagsDataTable.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tag;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tags';
|
||||
|
||||
public $rowReorder = ['selector' => 'tr'];
|
||||
|
||||
public function query(Tag $model)
|
||||
{
|
||||
$model = $model::with('tag_group')->withCount(['articles', 'shelves', 'species', 'varieties']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('name', function (Tag $tag) {
|
||||
return $tag->name;
|
||||
})
|
||||
->rawColumns(['active', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('tag_group.name')->title('Groupe')->width(200),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('species_count')->title('#Esp')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('varieties_count')->title('#Var')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('shelves_count')->title('#Ray')->class('text-right')->searchable(false)->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Datatables/Admin/Shop/TariffUnitiesDataTable.php
Normal file
25
app/Datatables/Admin/Shop/TariffUnitiesDataTable.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TariffUnity;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TariffUnitiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tariff_unities';
|
||||
|
||||
public function query(TariffUnity $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Valeur'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Datatables/Admin/Shop/TariffsDataTable.php
Normal file
53
app/Datatables/Admin/Shop/TariffsDataTable.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tariff;
|
||||
use App\Repositories\Shop\Tariffs;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TariffsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tariffs';
|
||||
|
||||
public function query(Tariff $model)
|
||||
{
|
||||
$model = $model->with(['sale_channels'])->withCount(['price_lists', 'offers']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Tariff $tariff) {
|
||||
return Tariffs::getStatus($tariff['status_id']);
|
||||
})
|
||||
->editColumn('sale_channels2', function (Tariff $tariff) {
|
||||
$html = '';
|
||||
foreach ($tariff->sale_channels as $sale_channel) {
|
||||
$html .= $sale_channel->code.', ';
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['sale_channels2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status_id')->data('status')->title('status')->searchable(false)->orderable(false),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('sale_channels2')->title('Canaux de vente')->searchable(false)->orderable(false),
|
||||
Column::make('code')->title('Code'),
|
||||
Column::make('ref')->title('Référence'),
|
||||
Column::make('price_lists_count')->title('#Lst prix')->searchable(false)->orderable(false)->class('text-right'),
|
||||
Column::make('offers_count')->title('#Offres')->searchable(false)->orderable(false)->class('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Datatables/Admin/Shop/UnitiesDataTable.php
Normal file
25
app/Datatables/Admin/Shop/UnitiesDataTable.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Unity;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class UnitiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'unities';
|
||||
|
||||
public function query(Unity $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Valeur'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Datatables/Admin/Shop/VariationsDataTable.php
Normal file
42
app/Datatables/Admin/Shop/VariationsDataTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Variation;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class VariationsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'variations';
|
||||
|
||||
public function query(Variation $model)
|
||||
{
|
||||
$model = $model->with(['package', 'unity'])->withCount('offers');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('unity_value', function (Variation $variation) {
|
||||
return $variation->unity ? $variation->unity->value : '';
|
||||
})
|
||||
->rawColumns(['description', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('package.value')->title('Package'),
|
||||
Column::make('quantity')->title('Quantité')->class('text-right')->with(80),
|
||||
Column::make('unity_value')->title('Unité')->searchable(false)->with(80),
|
||||
Column::make('description')->title('Description'),
|
||||
Column::make('offers_count')->title('#Ofr')->searchable(false)->class('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Datatables/Botanic/FamiliesDataTable.php
Normal file
32
app/Datatables/Botanic/FamiliesDataTable.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Family;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class FamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'families';
|
||||
|
||||
public function query(Family $model)
|
||||
{
|
||||
$model = $model::withCount(['genres', 'species', 'varieties']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('genres_count')->title('Nb genres')->searchable(false)->addClass('text-right'),
|
||||
Column::make('species_count')->title('Nb espèces')->searchable(false)->addClass('text-right'),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Genre;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class GenresDataTable extends DataTable
|
||||
{
|
||||
@@ -13,18 +13,19 @@ class GenresDataTable extends DataTable
|
||||
public function query(Genre $model)
|
||||
{
|
||||
$model = $model::with('family')->withCount('species')->withCount('varieties');
|
||||
return self::buildQuery($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('family_name', function(Genre $genre) {
|
||||
return $genre->family ? $genre->family->name : '';
|
||||
->editColumn('family_name', function (Genre $genre) {
|
||||
return $genre->family ? $genre->family->name : '';
|
||||
})
|
||||
->rawColumns(['genre_name', 'action'])
|
||||
;
|
||||
return Parent::modifier($datatables);
|
||||
->rawColumns(['genre_name', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
@@ -36,8 +37,7 @@ class GenresDataTable extends DataTable
|
||||
Column::make('family.name')->data('family_name')->title('Famille'),
|
||||
Column::make('species_count')->title('Nb Espèces')->searchable(false)->addClass('text-right'),
|
||||
Column::make('varieties_count')->title('Nb Variétés')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
59
app/Datatables/Botanic/SpeciesDataTable.php
Normal file
59
app/Datatables/Botanic/SpeciesDataTable.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Specie;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class SpeciesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'species';
|
||||
|
||||
public function query(Specie $model)
|
||||
{
|
||||
$model = $model::withCount(['images', 'varieties', 'tags'])->with(['genre', 'image', 'tags']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('thumb', function (Specie $specie) {
|
||||
return Species::getThumb($specie->image, false);
|
||||
})
|
||||
->editColumn('genre_name', function (Specie $specie) {
|
||||
return $specie->genre ? $specie->genre->name : '';
|
||||
})
|
||||
->editColumn('tags2', function (Specie $specie) {
|
||||
$html = '';
|
||||
foreach ($specie->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['thumb', 'tags2', 'genre_name', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('thumb')->title('')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||
Column::make('alias'),
|
||||
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
||||
Column::make('latin'),
|
||||
Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||
Column::make('varieties_count')->title('#Var')->searchable(false)->addClass('text-right'),
|
||||
Column::make('tags_count')->title('#Tag')->searchable(false)->addClass('text-right'),
|
||||
Column::make('images_count')->title('#Pho')->searchable(false)->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
54
app/Datatables/Botanic/VarietiesDataTable.php
Normal file
54
app/Datatables/Botanic/VarietiesDataTable.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Variety;
|
||||
use App\Repositories\Botanic\Varieties;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class VarietiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'varieties';
|
||||
|
||||
public function query(Variety $model)
|
||||
{
|
||||
$model = $model::joinRelationship('Specie')->select('botanic_varieties.*', 'botanic_species.name as specie_name')->with(['image', 'Specie', 'tags'])->withCount(['Articles', 'tags', 'images']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('thumb', function (Variety $variety) {
|
||||
return Varieties::getThumb($variety->image, false);
|
||||
})
|
||||
->editColumn('tags2', function (Variety $variety) {
|
||||
$html = '';
|
||||
foreach ($variety->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['thumb', 'tags2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('Specie.name')->data('specie_name')->title('Espèce'),
|
||||
Column::make('thumb')->title('')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->searchable(false),
|
||||
Column::make('tags_count')->title('#Tag')->class('text-right')->searchable(false),
|
||||
Column::make('images_count')->title('#Pho')->class('text-right')->searchable(false),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
193
app/Datatables/ParentDataTable.php
Normal file
193
app/Datatables/ParentDataTable.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables;
|
||||
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class ParentDataTable extends DataTable
|
||||
{
|
||||
public $autoWidth = false;
|
||||
|
||||
public $colReorder = false;
|
||||
|
||||
public $fixedColumns = false;
|
||||
|
||||
public $fixedHeader = false;
|
||||
|
||||
public $rowReorder = false;
|
||||
|
||||
public $rowReorderSelector; // ['selector' => 'tr']
|
||||
|
||||
public $scrollCollapse = false;
|
||||
|
||||
public $scrollX = false;
|
||||
|
||||
public $sortedColumn = 0;
|
||||
|
||||
public $sortedOrder = 'asc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function dataTable($query)
|
||||
{
|
||||
return $this->modifier(datatables()->eloquent($query));
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
return $this->addButtons($datatables->setRowId('{{$id}}'));
|
||||
}
|
||||
|
||||
public function addButtons($datatables)
|
||||
{
|
||||
return $datatables->addColumn('action', $this->getHtmlButtons());
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
return self::getButtonEdit().self::getButtonDel();
|
||||
}
|
||||
|
||||
public function getButtonEdit($field = 'id', $title = 'Modifier')
|
||||
{
|
||||
return view('components.form.buttons.edit', [
|
||||
'dataId' => '{{$'.$field.'}}',
|
||||
'class' => 'btn-sm mr-2',
|
||||
'title' => $title,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getButtonShow($field = 'id', $title = 'Voir')
|
||||
{
|
||||
return view('components.form.buttons.show', [
|
||||
'dataId' => '{{$'.$field.'}}',
|
||||
'class' => 'btn-sm mr-2',
|
||||
'title' => $title,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getButtonDel($field = 'id', $title = 'Effacer')
|
||||
{
|
||||
return view('components.form.buttons.delete', [
|
||||
'dataId' => '{{$'.$field.'}}',
|
||||
'class' => 'btn-sm mr-2',
|
||||
'title' => $title,
|
||||
]);
|
||||
}
|
||||
|
||||
public function makeColumnButtons()
|
||||
{
|
||||
return Column::computed('action')
|
||||
->title('')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->searchable(false)
|
||||
->width(74)
|
||||
->addClass('text-center text-nowrap');
|
||||
}
|
||||
|
||||
public static function isFilteredByField($field)
|
||||
{
|
||||
if (request()->has('filters.'.$field)) {
|
||||
return request()->input('filters.'.$field);
|
||||
}
|
||||
|
||||
return request()->has($field) ? request()->input($field) : false;
|
||||
}
|
||||
|
||||
public function buildQuery($model)
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
public function html()
|
||||
{
|
||||
return $this->buildHtml(strtolower($this->model_name).'-table');
|
||||
}
|
||||
|
||||
public function buildHtml($table_id = false, $selector = false)
|
||||
{
|
||||
$table_id = $table_id ? $table_id : strtolower($this->model_name).'-table';
|
||||
$selector = $selector ? $selector : '#'.$this->model_name.'-filters';
|
||||
|
||||
return $this->builder()
|
||||
->setTableId($table_id)
|
||||
->parameters($this->getParameters())
|
||||
->columns($this->getColumns())
|
||||
->ajax([
|
||||
'data' => 'function(d) { d.filters = $("'.$selector.'").serializeJSON(); }',
|
||||
'url' => $this->url ?? '',
|
||||
])
|
||||
->dom($this->getDom())
|
||||
->orderBy($this->sortedColumn, $this->sortedOrder)
|
||||
->buttons($this->getButtons());
|
||||
}
|
||||
|
||||
public function getButtons()
|
||||
{
|
||||
return [
|
||||
Button::make('print'),
|
||||
Button::make('colvis'),
|
||||
Button::make('columnsToggle'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
{
|
||||
$data = [
|
||||
'autoWidth' => $this->autoWidth,
|
||||
'colReorder' => $this->colReorder,
|
||||
'fixedColumns' => $this->fixedColumns,
|
||||
'fixedHeader' => $this->fixedHeader,
|
||||
'pageLength' => 10,
|
||||
'searchDelay' => 500,
|
||||
'scrollX' => $this->scrollX,
|
||||
'scrollCollapse' => $this->scrollCollapse,
|
||||
'stateSave' => $this->stateSave,
|
||||
];
|
||||
if ($this->rowReorder) {
|
||||
$data['rowReorder'] = ['selector' => $this->rowReorderSelector];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDom()
|
||||
{
|
||||
return 'rt'.$this->getDatatablesFooterDefault();
|
||||
}
|
||||
|
||||
public function getDatatablesHeader()
|
||||
{
|
||||
return view('components.datatables.header');
|
||||
}
|
||||
|
||||
public function getDatatablesHeaderDefault()
|
||||
{
|
||||
return "<'row dt-toolbar-header'<'col-lg-4'l><'col-lg-4'B><'col-lg-4 text-right add'f>>";
|
||||
}
|
||||
|
||||
public function getDatatablesFooterDefault()
|
||||
{
|
||||
return "<'row pt-3 dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function filename(): string
|
||||
{
|
||||
return self::buildFilename($this->model_name);
|
||||
}
|
||||
|
||||
protected function buildFilename($name)
|
||||
{
|
||||
return $name.'_'.date('YmdHis');
|
||||
}
|
||||
}
|
||||
28
app/Datatables/Shop/CustomerDeliveriesDataTable.php
Normal file
28
app/Datatables/Shop/CustomerDeliveriesDataTable.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerDeliveriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customer_deliveries';
|
||||
|
||||
public function query(Customer $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('address')->title('Adresse'),
|
||||
Column::make('zipcode')->title('Code postal'),
|
||||
Column::make('city')->title('Ville'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
81
app/Datatables/Shop/CustomerInvoicesDataTable.php
Normal file
81
app/Datatables/Shop/CustomerInvoicesDataTable.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerInvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'invoices';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Shop.Invoices.index');
|
||||
}
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$customerId = Customers::getId();
|
||||
$model = $model->byCustomer($customerId)->with(['address']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = view('components.form.button', [
|
||||
'dataId' => '{{$uuid}}',
|
||||
'class' => 'btn-sm btn-secondary btn-invoice mr-2',
|
||||
'icon' => 'fa-file-pdf',
|
||||
'title' => 'Télécharger la facture',
|
||||
'url' => route('Shop.Invoices.pdf').'/{{$uuid}}',
|
||||
]);
|
||||
|
||||
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Invoice $invoice) {
|
||||
return Invoices::getStatus($invoice->status);
|
||||
})
|
||||
->editColumn('created_at', function (Invoice $invoice) {
|
||||
return $invoice->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||
})
|
||||
->editColumn('payment_type', function (Invoice $invoice) {
|
||||
return InvoicePayments::getPaymentType($invoice->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('payment_type')->title('Règlement'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
70
app/Datatables/Shop/CustomerOrdersDataTable.php
Normal file
70
app/Datatables/Shop/CustomerOrdersDataTable.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use App\Repositories\Shop\Orders;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerOrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Shop.Orders.index');
|
||||
}
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$customerId = Customers::getId();
|
||||
$model = $model->byCustomer($customerId);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '';
|
||||
|
||||
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Order $order) {
|
||||
return Orders::getStatus($order->status);
|
||||
})
|
||||
->editColumn('created_at', function (Order $order) {
|
||||
return $order->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
51
app/Datatables/Shop/InvoicesDataTable.php
Normal file
51
app/Datatables/Shop/InvoicesDataTable.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Invoices';
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$model = $model->with('customer');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Invoice $invoice) {
|
||||
return Invoices::getStatus($invoice->status);
|
||||
})
|
||||
->editColumn('created_at', function (Invoice $invoice) {
|
||||
return $invoice->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Invoice $invoice) {
|
||||
$customer = $invoice->customer ?? false;
|
||||
|
||||
return $customer ? $customer->last_name.' '.$customer->first_name : '';
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('ref')->title('Ref')->width(80),
|
||||
Column::make('status')->width(60),
|
||||
Column::make('created_at')->title('Date')->width(100),
|
||||
Column::make('customer.last_name')->title('Client')->default(''),
|
||||
Column::make('total')->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
66
app/Datatables/Shop/OrdersDataTable.php
Normal file
66
app/Datatables/Shop/OrdersDataTable.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Orders;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$model = $model->with(['customer', 'delivery']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Order $order) {
|
||||
return Orders::getStatus($order->status);
|
||||
})
|
||||
->editColumn('created_at', function (Order $order) {
|
||||
return $order->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Order $order) {
|
||||
return $order->customer->last_name.' '.$order->customer->first_name;
|
||||
})
|
||||
->editColumn('payment_type', function (Order $order) {
|
||||
return InvoicePayments::getPaymentType($order->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
return '<button type="button" data-id="{{$uuid}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('customer.last_name')->title('Client'),
|
||||
Column::make('delivery.name')->title('Point de distribution'),
|
||||
Column::make('payment_type')->title('Règlement'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,53 +2,25 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
app/Http/Controllers/Admin/Botanic/Controller.php
Normal file
13
app/Http/Controllers/Admin/Botanic/Controller.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Botanic;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
40
app/Http/Controllers/Admin/Botanic/FamilyController.php
Normal file
40
app/Http/Controllers/Admin/Botanic/FamilyController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Botanic;
|
||||
|
||||
use App\Datatables\Botanic\FamiliesDataTable;
|
||||
use App\Repositories\Botanic\Families;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FamilyController extends Controller
|
||||
{
|
||||
public function index(FamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Botanic.Families.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.Botanic.Families.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$ret = Families::store($data);
|
||||
|
||||
return redirect()->route('Admin.Botanic.Families.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['family'] = Families::get($id)->toArray();
|
||||
|
||||
return view('Admin.Botanic.Families.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Families::destroy($id);
|
||||
}
|
||||
}
|
||||
44
app/Http/Controllers/Admin/Botanic/GenreController.php
Normal file
44
app/Http/Controllers/Admin/Botanic/GenreController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Botanic;
|
||||
|
||||
use App\Datatables\Botanic\GenresDataTable;
|
||||
use App\Repositories\Botanic\Families;
|
||||
use App\Repositories\Botanic\Genres;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GenreController extends Controller
|
||||
{
|
||||
public function index(GenresDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Botanic.Genres.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Genres::init();
|
||||
|
||||
return view('Admin.Botanic.Genres.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$ret = Genres::store($data);
|
||||
|
||||
return redirect()->route('Admin.Botanic.Genres.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Genres::init();
|
||||
$data['genre'] = Genres::get($id);
|
||||
|
||||
return view('Admin.Botanic.Genres.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Genres::destroy($id);
|
||||
}
|
||||
}
|
||||
67
app/Http/Controllers/Admin/Botanic/SpecieController.php
Normal file
67
app/Http/Controllers/Admin/Botanic/SpecieController.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Botanic;
|
||||
|
||||
use App\Datatables\Botanic\SpeciesDataTable;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SpecieController extends Controller
|
||||
{
|
||||
public function index(SpeciesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Botanic.Species.list');
|
||||
}
|
||||
|
||||
public function getOptions()
|
||||
{
|
||||
return response()->json(['0' => ''] + Species::getOptions());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Species::init();
|
||||
|
||||
return view('Admin.Botanic.Species.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$ret = Species::storeFull($data);
|
||||
|
||||
return redirect()->route('Admin.Botanic.Species.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Species::init();
|
||||
$data['specie'] = Species::getFull($id);
|
||||
|
||||
return view('Admin.Botanic.Species.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Species::destroy($id);
|
||||
}
|
||||
|
||||
public function getImages(Request $request, $id = false, $can_edit = true)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data = [
|
||||
'images' => Species::getImages($id),
|
||||
'can_edit' => $can_edit,
|
||||
];
|
||||
|
||||
return view('components.uploader.mini-gallery-items', $data);
|
||||
}
|
||||
|
||||
public function deleteImage(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$index = $request->input('index');
|
||||
|
||||
return Species::deleteImage($id, $index);
|
||||
}
|
||||
}
|
||||
69
app/Http/Controllers/Admin/Botanic/VarietyController.php
Normal file
69
app/Http/Controllers/Admin/Botanic/VarietyController.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Botanic;
|
||||
|
||||
use App\Datatables\Botanic\VarietiesDataTable;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\Repositories\Botanic\Varieties;
|
||||
use App\Repositories\Shop\TagGroups;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VarietyController extends Controller
|
||||
{
|
||||
public function index(VarietiesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Botanic.Varieties.list');
|
||||
}
|
||||
|
||||
public function getOptionsWithSpecie()
|
||||
{
|
||||
return response()->json(['0' => ''] + Varieties::getOptionsWithSpecie());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Varieties::init();
|
||||
|
||||
return view('Admin.Botanic.Varieties.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
Varieties::storeFull($data);
|
||||
|
||||
return redirect()->route('Admin.Botanic.Varieties.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Varieties::init();
|
||||
$data['variety'] = Varieties::getFull($id);
|
||||
|
||||
return view('Admin.Botanic.Varieties.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Varieties::destroy($id);
|
||||
}
|
||||
|
||||
public function getImages(Request $request, $id = false, $can_edit = true)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data = [
|
||||
'images' => Varieties::getImages($id),
|
||||
'can_edit' => $can_edit,
|
||||
];
|
||||
|
||||
return view('components.uploader.mini-gallery-items', $data);
|
||||
}
|
||||
|
||||
public function deleteImage(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$index = $request->input('index');
|
||||
|
||||
return Varieties::deleteImage($id, $index);
|
||||
}
|
||||
}
|
||||
9
app/Http/Controllers/Admin/Controller.php
Normal file
9
app/Http/Controllers/Admin/Controller.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller as ParentController;
|
||||
|
||||
class Controller extends ParentController
|
||||
{
|
||||
}
|
||||
57
app/Http/Controllers/Admin/Core/CommentController.php
Normal file
57
app/Http/Controllers/Admin/Core/CommentController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core;
|
||||
|
||||
use App\Datatables\Admin\Core\CommentsDataTable;
|
||||
use App\Repositories\Core\Comments;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CommentController extends Controller
|
||||
{
|
||||
public function index($model, $model_id)
|
||||
{
|
||||
$data['comments'] = Comments::getCommentsByModel($model, $model_id);
|
||||
|
||||
return view('Admin.Core.Comments.partials.list-comments', $data);
|
||||
}
|
||||
|
||||
public function list(CommentsDataTable $dataTable, $model, $model_id)
|
||||
{
|
||||
$data['model'] = $model;
|
||||
$data['model_id'] = $model_id;
|
||||
|
||||
return $dataTable->render('Admin.Core.Comment.index', $data);
|
||||
}
|
||||
|
||||
public function create($model, $model_id)
|
||||
{
|
||||
$data['comment']['commentable_type'] = $model;
|
||||
$data['comment']['commentable_id'] = $model_id;
|
||||
|
||||
return view('Admin.Core.Comments.partials.modal', $data);
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data = Comments::get($id);
|
||||
|
||||
return view('Admin.Core.Comments.partials.modal', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
Comments::store($data);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
Comments::destroy($id);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
9
app/Http/Controllers/Admin/Core/Controller.php
Normal file
9
app/Http/Controllers/Admin/Core/Controller.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core;
|
||||
|
||||
use App\Http\Controllers\Controller as ParentController;
|
||||
|
||||
class Controller extends ParentController
|
||||
{
|
||||
}
|
||||
9
app/Http/Controllers/Admin/Core/Mail/Controller.php
Normal file
9
app/Http/Controllers/Admin/Core/Mail/Controller.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core\Mail;
|
||||
|
||||
use App\Http\Controllers\Controller as ParentController;
|
||||
|
||||
class Controller extends ParentController
|
||||
{
|
||||
}
|
||||
26
app/Http/Controllers/Admin/Core/Mail/MailLogController.php
Normal file
26
app/Http/Controllers/Admin/Core/Mail/MailLogController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core\Mail;
|
||||
|
||||
use App\Datatables\Admin\Core\Mail\MailLogsDataTable;
|
||||
use App\Repositories\Core\Mail\MailLogs;
|
||||
|
||||
class MailLogController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('ability:admin');
|
||||
}
|
||||
|
||||
public function index(MailLogsDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('admin.Core.Mail.MailLog.index', $data ?? []);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['message'] = MailLogs::getParsed($id);
|
||||
|
||||
return view('admin.Core.Mail.MailLog.modal', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core\Mail;
|
||||
|
||||
use App\Datatables\Admin\Core\Mail\MailTemplatesDataTable;
|
||||
use App\Repositories\Core\Mail\MailTemplates;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MailTemplateController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('ability:admin');
|
||||
}
|
||||
|
||||
public function index(MailTemplatesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Core.Mail.MailTemplate.index', $data ?? []);
|
||||
}
|
||||
|
||||
public function modalCreate()
|
||||
{
|
||||
$data = MailTemplates::init();
|
||||
|
||||
return view('Admin.Core.Mail.MailTemplate.modal', $data ?? []);
|
||||
}
|
||||
|
||||
public function modalEdit($id = false)
|
||||
{
|
||||
$data = MailTemplates::init();
|
||||
$data['mail_template'] = MailTemplates::edit($id);
|
||||
|
||||
return view('Admin.Core.Mail.MailTemplate.modal', $data);
|
||||
}
|
||||
|
||||
public function storeAjax(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
unset($data['proengsoft_jsvalidation']);
|
||||
$ret = MailTemplates::store($data);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ?? $request->input('id');
|
||||
MailTemplates::destroy($id);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
|
||||
public function getVarsByMailable($mailable)
|
||||
{
|
||||
$data['vars'] = MailTemplates::getVarsByMailable($mailable);
|
||||
|
||||
return view('Admin.Core.Mail.MailTemplate.partials.vars', $data);
|
||||
}
|
||||
|
||||
public function preview($template_id, $model_id)
|
||||
{
|
||||
return MailTemplates::preview($template_id, $model_id);
|
||||
}
|
||||
|
||||
public function modalPreview($template_id)
|
||||
{
|
||||
$data = MailTemplates::getDataFormodalPreview($template_id);
|
||||
|
||||
return view('Admin.Core.Mail.MailTemplate.partials.modalPreview', $data);
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,29 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Charts\Shop\Order;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Shop\Dashboards;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request, $period = false)
|
||||
{
|
||||
// return redirect('dashboard');
|
||||
$start = $request->input('start') ?? Carbon::now()->subMonths(12)->startOfMonth();
|
||||
$end = $request->input('end') ?? Carbon::now();
|
||||
|
||||
$data = Dashboards::getStats($start, $end);
|
||||
$data['chart'] = Order::getMonthly();
|
||||
|
||||
// dump($data);
|
||||
// exit;
|
||||
return view('Admin.Shop.Dashboard.index', $data);
|
||||
}
|
||||
}
|
||||
|
||||
132
app/Http/Controllers/Admin/Shop/ArticleController.php
Normal file
132
app/Http/Controllers/Admin/Shop/ArticleController.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\ArticlesDataTable;
|
||||
use App\Http\Requests\Admin\Shop\StoreArticlePost;
|
||||
use App\Repositories\Shop\ArticleInherited;
|
||||
use App\Repositories\Shop\ArticleNatures;
|
||||
use App\Repositories\Shop\Articles;
|
||||
use App\Repositories\Shop\Categories;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
public function autocomplete(Request $request, $str = false)
|
||||
{
|
||||
$str = $str ? $str : $request->input('q');
|
||||
|
||||
return response()->json(Articles::autocomplete($str));
|
||||
}
|
||||
|
||||
public function index(ArticlesDataTable $dataTable)
|
||||
{
|
||||
$data = [
|
||||
'article_natures' => ArticleNatures::getOptions(),
|
||||
'categories' => Categories::getOptions(),
|
||||
'tags' => Tags::getOptionsFullName(),
|
||||
];
|
||||
|
||||
return $dataTable->render('Admin.Shop.Articles.list', $data);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Articles::getMeta();
|
||||
|
||||
return view('Admin.Shop.Articles.create', $data);
|
||||
}
|
||||
|
||||
public function store(StoreArticlePost $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$data['visible'] = $data['visible'] ?? false;
|
||||
$data['homepage'] = $data['homepage'] ?? false;
|
||||
|
||||
Articles::storeFull($data);
|
||||
|
||||
return redirect()->route('Admin.Shop.Articles.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['article'] = Articles::get($id);
|
||||
|
||||
return view('Admin.Shop.Articles.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Articles::getFull($id);
|
||||
|
||||
return view('Admin.Shop.Articles.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Articles::destroy($id);
|
||||
}
|
||||
|
||||
public function getProductDescription($productId, $model)
|
||||
{
|
||||
$data = [
|
||||
'article' => [
|
||||
'inherited' => ArticleInherited::getInheritedByProduct($productId, base64_decode($model)),
|
||||
],
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Articles.partials.product.description', $data);
|
||||
}
|
||||
|
||||
public function getProductTags($productId, $model)
|
||||
{
|
||||
$data = ArticleInherited::getInheritedByProduct($productId, base64_decode($model));
|
||||
|
||||
return view('Admin.Shop.Articles.partials.product.tags', $data);
|
||||
}
|
||||
|
||||
public function getProductImages($productId)
|
||||
{
|
||||
$data = [
|
||||
'article' => [
|
||||
'product_id' => $productId,
|
||||
],
|
||||
'no_popup' => false,
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Articles.partials.product.images', $data);
|
||||
}
|
||||
|
||||
public function getImages(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data = [
|
||||
'images' => Articles::getImages($id),
|
||||
];
|
||||
|
||||
return view('components.uploader.mini-gallery-items', $data);
|
||||
}
|
||||
|
||||
public function deleteImage(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$index = $request->input('index');
|
||||
|
||||
return Articles::deleteImage($id, $index);
|
||||
}
|
||||
|
||||
public function toggleVisible(Request $request)
|
||||
{
|
||||
$data = Articles::toggleVisible($request->input('id'), $request->input('visible') === 'true' ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
|
||||
public function toggleHomepage(Request $request)
|
||||
{
|
||||
$data = Articles::toggleHomepage($request->input('id'), $request->input('homepage') === 'true' ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
65
app/Http/Controllers/Admin/Shop/ArticleNatureController.php
Normal file
65
app/Http/Controllers/Admin/Shop/ArticleNatureController.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\ArticleNaturesDataTable;
|
||||
use App\Repositories\Shop\ArticleNatures;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ArticleNatureController extends Controller
|
||||
{
|
||||
public function index(ArticleNaturesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.ArticleNatures.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.Shop.ArticleNatures.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$data['slug'] = Str::slug($data['name'], '-');
|
||||
$articleNature = ArticleNatures::store($request->all());
|
||||
ArticleNatures::storeIcon($articleNature, $request->file('icon'), 'icon');
|
||||
ArticleNatures::storeIcon($articleNature, $request->file('icon_selection'), 'icon_selection');
|
||||
|
||||
return redirect()->route('Admin.Shop.ArticleNatures.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = [
|
||||
'article_nature' => ArticleNatures::get($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.ArticleNatures.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'article_nature' => ArticleNatures::get($id),
|
||||
'product_types' => ArticleNatures::getProductTypes(),
|
||||
];
|
||||
$data['article_nature']['icon'] = ArticleNatures::getIcon($id, 'normal', 'icon');
|
||||
$data['article_nature']['icon_selection'] = ArticleNatures::getIcon($id, 'normal', 'icon_selection');
|
||||
|
||||
return view('Admin.Shop.ArticleNatures.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return ArticleNatures::destroy($id);
|
||||
}
|
||||
|
||||
public static function getOptions(Request $request)
|
||||
{
|
||||
$data = ArticleNatures::getOptionsByProductTypeModel($request->input('product_type'));
|
||||
|
||||
return response()->json(['0' => ''] + $data);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\CategoriesDataTable;
|
||||
use App\Repositories\Shop\Categories;
|
||||
use App\DataTables\Shop\CategoriesDataTable;
|
||||
use App\Repositories\Shop\TagGroups;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
public function index(CategoriesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Categories.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Categories::getTables($request->all());
|
||||
return $dataTable->render('Admin.Shop.Categories.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data['category_id'] = 0;
|
||||
$data['categories'] = Categories::getOptions();
|
||||
return view('Shop.Admin.Categories.create', $data);
|
||||
$data = [
|
||||
'category_id' => 0,
|
||||
'categories' => Categories::getOptions(),
|
||||
'tags_list' => TagGroups::getTreeTags(),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Categories.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Categories::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Categories.index');
|
||||
$ret = Categories::storeFull($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.Categories.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.view', $data);
|
||||
|
||||
return view('Admin.Shop.Categories.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Categories::get($id)->toArray();
|
||||
$data['category'] = Categories::getFull($id);
|
||||
$data['categories'] = Categories::getOptions();
|
||||
return view('Shop.Admin.Categories.edit', $data);
|
||||
}
|
||||
$data['tags_list'] = TagGroups::getTreeTags();
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
return view('Admin.Shop.Categories.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -62,6 +57,7 @@ class CategoryController extends Controller
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data['images'] = Categories::getImages($id);
|
||||
|
||||
return view('components.uploader.mini-gallery-items', $data);
|
||||
}
|
||||
|
||||
@@ -69,6 +65,7 @@ class CategoryController extends Controller
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$index = $request->input('index');
|
||||
|
||||
return Categories::deleteImage($id, $index);
|
||||
}
|
||||
|
||||
@@ -77,7 +74,21 @@ class CategoryController extends Controller
|
||||
$node_id = $request->input('node_id');
|
||||
$target_id = $request->input('target_id');
|
||||
$type = $request->input('type');
|
||||
|
||||
return Categories::moveTree($node_id, $target_id, $type);
|
||||
}
|
||||
|
||||
public function toggleVisible(Request $request)
|
||||
{
|
||||
$data = Categories::toggleVisible($request->input('id'), $request->input('visible') === 'true' ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
|
||||
public function toggleHomepage(Request $request)
|
||||
{
|
||||
$data = Categories::toggleHomepage($request->input('id'), $request->input('homepage') === 'true' ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
41
app/Http/Controllers/Admin/Shop/ContentController.php
Normal file
41
app/Http/Controllers/Admin/Shop/ContentController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\ContentsDataTable;
|
||||
use App\Repositories\Shop\Contents;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ContentController extends Controller
|
||||
{
|
||||
public function index(ContentsDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.Contents.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.Shop.Contents.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Contents::store($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.Contents.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'content' => Contents::get($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Contents.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Contents::destroy($id);
|
||||
}
|
||||
}
|
||||
13
app/Http/Controllers/Admin/Shop/Controller.php
Normal file
13
app/Http/Controllers/Admin/Shop/Controller.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\CustomerAddressesDataTable;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomerAddressController extends Controller
|
||||
{
|
||||
public function index(CustomerAddressesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.CustomerAddresses.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'with_country' => false,
|
||||
];
|
||||
|
||||
return view('Admin.Shop.CustomerAddresses.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = CustomerAddresses::store($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.CustomerAddresses.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = [
|
||||
'customer' => CustomerAddresses::get($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.CustomerAddresses.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'customer' => CustomerAddresses::edit($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.CustomerAddresses.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return CustomerAddresses::destroy($id);
|
||||
}
|
||||
}
|
||||
60
app/Http/Controllers/Admin/Shop/CustomerController.php
Normal file
60
app/Http/Controllers/Admin/Shop/CustomerController.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\CustomerAddressesDataTable;
|
||||
use App\Datatables\Admin\Shop\CustomerInvoicesDataTable;
|
||||
use App\Datatables\Admin\Shop\CustomerOrdersDataTable;
|
||||
use App\Datatables\Admin\Shop\CustomersDataTable;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
public function index(CustomersDataTable $dataTable)
|
||||
{
|
||||
$data = Customers::init();
|
||||
|
||||
return $dataTable->render('Admin.Shop.Customers.list', $data);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Customers::init();
|
||||
|
||||
return view('Admin.Shop.Customers.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Customers::storeFull($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.Customers.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = [
|
||||
'customer' => Customers::get($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Customers.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Customers::init() + [
|
||||
'customer' => Customers::edit($id),
|
||||
'customer_addresses' => (new CustomerAddressesDataTable())->html(),
|
||||
'customer_invoices' => (new CustomerInvoicesDataTable())->html(),
|
||||
'customer_orders' => (new CustomerOrdersDataTable())->html(),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Customers.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Customers::destroy($id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\CustomerInvoicesDataTable;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
|
||||
class CustomerInvoiceController extends Controller
|
||||
{
|
||||
public function index(CustomerInvoicesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.CustomerInvoices.list');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Invoices::destroy($id);
|
||||
}
|
||||
}
|
||||
28
app/Http/Controllers/Admin/Shop/CustomerOrderController.php
Normal file
28
app/Http/Controllers/Admin/Shop/CustomerOrderController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\CustomerOrdersDataTable;
|
||||
use App\Repositories\Shop\Orders;
|
||||
|
||||
class CustomerOrderController extends Controller
|
||||
{
|
||||
public function index(CustomerOrdersDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.CustomerOrders.list');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = [
|
||||
'order' => Orders::get($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.CustomerOrders.view', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Orders::destroy($id);
|
||||
}
|
||||
}
|
||||
24
app/Http/Controllers/Admin/Shop/DashboardController.php
Normal file
24
app/Http/Controllers/Admin/Shop/DashboardController.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Shop\Dashboards;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$data = Dashboards::getStats($data);
|
||||
dump($data);
|
||||
|
||||
return view('Admin.Shop.Dashboard.index', $data);
|
||||
}
|
||||
}
|
||||
60
app/Http/Controllers/Admin/Shop/DeliveryController.php
Normal file
60
app/Http/Controllers/Admin/Shop/DeliveryController.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\DeliveriesDataTable;
|
||||
use App\Repositories\Shop\Deliveries;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeliveryController extends Controller
|
||||
{
|
||||
public function index(DeliveriesDataTable $dataTable)
|
||||
{
|
||||
$data = Deliveries::init();
|
||||
|
||||
return $dataTable->render('Admin.Shop.Deliveries.list', $data);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Deliveries::init();
|
||||
|
||||
return view('Admin.Shop.Deliveries.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Deliveries::store($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.Deliveries.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = [
|
||||
'delivery' => Deliveries::getArray($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.Deliveries.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Deliveries::init();
|
||||
$data['delivery'] = Deliveries::getArray($id);
|
||||
|
||||
return view('Admin.Shop.Deliveries.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Deliveries::destroy($id);
|
||||
}
|
||||
|
||||
public function toggleActive(Request $request)
|
||||
{
|
||||
$data = Deliveries::toggleActive($request->input('id'), $request->input('active') === 'true' ? 1 : 0);
|
||||
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\DeliveryPackagesDataTable;
|
||||
use App\Repositories\Shop\DeliveryPackages;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeliveryPackageController extends Controller
|
||||
{
|
||||
public function index(DeliveryPackagesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.DeliveryPackages.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.Shop.DeliveryPackages.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = DeliveryPackages::store($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.DeliveryPackages.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['package'] = DeliveryPackages::get($id)->toArray();
|
||||
|
||||
return view('Admin.Shop.DeliveryPackages.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return DeliveryPackages::destroy($id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\DeliveryTypeCalculationsDataTable;
|
||||
use App\Repositories\Shop\DeliveryTypeCalculations;
|
||||
use App\Repositories\Shop\DeliveryTypes;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeliveryTypeCalculationController extends Controller
|
||||
{
|
||||
public function index(DeliveryTypeCalculationsDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.DeliveryTypeCalculations.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'delivery_types' => DeliveryTypes::getOptions(),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.DeliveryTypeCalculations.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = DeliveryTypeCalculations::store($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.DeliveryTypeCalculations.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'calcul' => DeliveryTypeCalculations::get($id)->toArray(),
|
||||
'delivery_types' => DeliveryTypes::getOptions(),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.DeliveryTypeCalculations.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return DeliveryTypeCalculations::destroy($id);
|
||||
}
|
||||
}
|
||||
40
app/Http/Controllers/Admin/Shop/DeliveryTypeController.php
Normal file
40
app/Http/Controllers/Admin/Shop/DeliveryTypeController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Datatables\Admin\Shop\DeliveryTypesDataTable;
|
||||
use App\Repositories\Shop\DeliveryTypes;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeliveryTypeController extends Controller
|
||||
{
|
||||
public function index(DeliveryTypesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.DeliveryTypes.list');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.Shop.DeliveryTypes.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = DeliveryTypes::store($request->all());
|
||||
|
||||
return redirect()->route('Admin.Shop.DeliveryTypes.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [];
|
||||
$data['delivery'] = DeliveryTypes::get($id)->toArray();
|
||||
|
||||
return view('Admin.Shop.DeliveryTypes.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return DeliveryTypes::destroy($id);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user