mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Compare commits
258 Commits
dillon/62.3-fixes
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| c70596e6bb | |||
| 924d94796d | |||
| 92a38a96a0 | |||
| c8cdc5ff78 | |||
| 33d922bb23 | |||
| 1b0f864921 | |||
| dfacae1a5d | |||
| caaab55e88 | |||
| 07d353d4bb | |||
| 823958504c | |||
| 4cb30ad7ab | |||
| 7b8eadd5d1 | |||
| 9d130e1531 | |||
| 893d10c7f6 | |||
| 68257952ab | |||
| 07a7901844 | |||
| 91fcb76863 | |||
| cac02b8ebe | |||
| 4370ba2f9c | |||
| 41db8f57f5 | |||
| 18579d5c1d | |||
| 1060401128 | |||
| 3497de9727 | |||
| 5b00b7b45f | |||
| 14a4c37fee | |||
| f27e0aa8c6 | |||
| 5c109d625c | |||
| 965dfb3098 | |||
| d6fad96d4d | |||
| 351447b1fc | |||
| a9910c5a12 | |||
| 4bee415d2d | |||
| 02f7adb1e9 | |||
| 039a6155ca | |||
| c8d806a51d | |||
| 4dbaf6a5dc | |||
| fcc0135843 | |||
| 4a922ac340 | |||
| c4d421db76 | |||
| 2816e80bee | |||
| 466e90a0af | |||
| 5e6ae2a905 | |||
| 3378d37ffb | |||
| fff3d948d0 | |||
| c181882145 | |||
| 2a333f7d19 | |||
| 8f8622aa10 | |||
| f88936c873 | |||
| 20f3004e22 | |||
| fd4bbe5d4f | |||
| a630b49867 | |||
| 75ce5bd752 | |||
| abb7bc2e4c | |||
| 857003b25b | |||
| 551119e313 | |||
| b567f50711 | |||
| 395b15af90 | |||
| 833ffdab8d | |||
| 2f6a30a512 | |||
| 4c433f74f1 | |||
| 852da05e24 | |||
| 1658b65484 | |||
| 8e9ff0cad5 | |||
| acee1a7884 | |||
| 0079d745ba | |||
| 0bd3464184 | |||
| 7ec1bc65a5 | |||
| c401d1e0d5 | |||
| a2983ec9f1 | |||
| 2421640c0a | |||
| 7dae2228f6 | |||
| 75039466ab | |||
| f3df5fbe9f | |||
| 362e47aaa0 | |||
| ba26cda598 | |||
| 8995a567d5 | |||
| 5eeec7806b | |||
| fd46a4fb7f | |||
| 1100267316 | |||
| e133f1fab8 | |||
| 5d5892ce07 | |||
| b26700ea6f | |||
| 589c2e01d9 | |||
| 9cf6058a65 | |||
| ff4d81966c | |||
| a4891aa0de | |||
| 05ba0ba6fd | |||
| 9217970237 | |||
| 828f424cfd | |||
| 057ca8480b | |||
| d07901f31b | |||
| c22638b29e | |||
| c292bfd1e0 | |||
| 85942eff1d | |||
| d69896f807 | |||
| 2c5c97488f | |||
| 99e38b96ce | |||
| 81a00a8195 | |||
| dbab7a9f8c | |||
| 046676d174 | |||
| 2b4f1ad570 | |||
| bcb78f2392 | |||
| 345a62fec6 | |||
| 6257b11a6e | |||
| 4b124ca96d | |||
| 4b25764fb3 | |||
| 422a0af465 | |||
| c73d65343b | |||
| 9e5784b6ec | |||
| 9a863e2143 | |||
| 8024865d5d | |||
| 66abe81e73 | |||
| ca178e1b31 | |||
| e52a27aedb | |||
| 6c2c28fb31 | |||
| 049da351ef | |||
| 0ce8709f70 | |||
| 1e5609bb1b | |||
| 8e7970a925 | |||
| 06b2c5166d | |||
| 6ba3b873a2 | |||
| 623fb1609b | |||
| 24be20a60d | |||
| 3535201481 | |||
| cdefd48d26 | |||
| 45fbcf1447 | |||
| 53805f3608 | |||
| 99e90ad357 | |||
| 5edb9b5cfe | |||
| 86a5a3b2d9 | |||
| a6590e3b81 | |||
| b1bb2b9f33 | |||
| 9318e7471f | |||
| e19ba1c9f3 | |||
| 8cffae079b | |||
| 594b25b71b | |||
| d142a86683 | |||
| 935f3e9bf5 | |||
| dedd6464f4 | |||
| 38aba65178 | |||
| 091119c244 | |||
| 4d095b5459 | |||
| 1c50181132 | |||
| 9e26c470f5 | |||
| 4c0bf164a0 | |||
| 8ab7f72e90 | |||
| 5772e30575 | |||
| 4b2daa62d7 | |||
| 2bd8700a61 | |||
| ad7e77c169 | |||
| e95c41bd3e | |||
| 903269e714 | |||
| 4120a50559 | |||
| 88b31f2d3f | |||
| a2f9bf83ce | |||
| dd2ac4c966 | |||
| c88f6890d6 | |||
| bf4b3fa97f | |||
| 6bcea5a8f1 | |||
| 2704ec1665 | |||
| 0c636d2156 | |||
| 1270ba3f43 | |||
| f2c32c5024 | |||
| ccb3bde260 | |||
| a7eb14c2b7 | |||
| abac96b1e5 | |||
| ecb48c8897 | |||
| 2686229a0f | |||
| 558fa7ae52 | |||
| 88e2136c07 | |||
| 70cdcded9b | |||
| 4022b640f9 | |||
| 0d780074b8 | |||
| 078f675a7f | |||
| 2b48a86f98 | |||
| 19f3aa18fc | |||
| 2b4c932fc8 | |||
| 89f0ca651a | |||
| c9fc5938c6 | |||
| 2ad8235c1b | |||
| dbf8301cb9 | |||
| 7d582c6bca | |||
| 3c4b6afcb2 | |||
| e4bc56d188 | |||
| 9a448d5a3d | |||
| 5c1074b244 | |||
| 49fcdfd89e | |||
| c900759234 | |||
| cd3b47ab1a | |||
| c5f95cdf61 | |||
| cc428a92b8 | |||
| 97bac45612 | |||
| 8048396a88 | |||
| 400ec31235 | |||
| 4d9346c62c | |||
| 94fd2069e8 | |||
| 1f401eb347 | |||
| 80e282bda0 | |||
| 65cd6aae3c | |||
| eba2a30024 | |||
| c103deb2a7 | |||
| dcef782587 | |||
| 10e7da4673 | |||
| faff35f241 | |||
| e2c1562f19 | |||
| df35ceb798 | |||
| cdb81a0bf4 | |||
| f1b1955190 | |||
| 860632b7a3 | |||
| bde7a61fb4 | |||
| b6600c5168 | |||
| 25f38ef7fe | |||
| ddeb44b920 | |||
| 02be710203 | |||
| 2ffbfc9f1c | |||
| 7b34f8116c | |||
| 8a9b6df255 | |||
| c881dd44d6 | |||
| 1cfaeaf8bb | |||
| 914f29184d | |||
| f510d57463 | |||
| 7833c17938 | |||
| 97fdffe6eb | |||
| b1f2900f1c | |||
| ddf015dc71 | |||
| 2a9d4fd212 | |||
| 2cacc23a38 | |||
| a7fd5a038e | |||
| 626b31084f | |||
| 4f3c25d5bd | |||
| 8da942e41e | |||
| b599c8a151 | |||
| d41f796825 | |||
| dd612e2660 | |||
| c503b5e677 | |||
| 0b433cfa18 | |||
| 75aba8c4ac | |||
| 81c65874a3 | |||
| 79d29d9c7b | |||
| 1e558b93af | |||
| 6d3d52639e | |||
| a1d460aa6c | |||
| 5a0bc7aaea | |||
| c7962b4231 | |||
| d14bb39ae8 | |||
| 5cc2f51c02 | |||
| a185f73e8a | |||
| f9a9598210 | |||
| 9976ccec41 | |||
| 8bfb2d749a | |||
| 7bf9a570a1 | |||
| b38df170e8 | |||
| bf38ace70c | |||
| 66c008f97e | |||
| 0298eb946f | |||
| 70fb35e37c | |||
| 1a30877ca9 | |||
| 569a22c0db |
+4
-2
@@ -10,9 +10,9 @@ LOG_LEVEL=debug
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_DATABASE=shpping_portal
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
DB_PASSWORD=root
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
@@ -56,6 +56,8 @@ MIX_EXCHANGE_URL="${EXCHANGE_URL}"
|
||||
|
||||
YD_API_CODE=''
|
||||
|
||||
JWT_SECRET=Btj63iMEleEaww6Bb2IBECkxWn7YHPhhPFluAkg9DfcQik0qDRy6QW75ABGmPT2h
|
||||
|
||||
PERFEXCRM_BASE_URL=""
|
||||
PERFEXCRM_API_KEY=""
|
||||
PERFEXCRM_IS_ENABLED="false"
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:rIar2fvNeRzQdvKOgLUg03detGDMx6ym2SYFRjawrAc=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=shpping_portal
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=P@ssw0rd
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
UNITY_APP_URL="https://unity.izyim.com"
|
||||
EXCHANGE_URL=https://dev.exchange.cief-malaysia.com/
|
||||
MIX_EXCHANGE_URL="${EXCHANGE_URL}"
|
||||
|
||||
YD_API_CODE=''
|
||||
|
||||
JWT_SECRET=Btj63iMEleEaww6Bb2IBECkxWn7YHPhhPFluAkg9DfcQik0qDRy6QW75ABGmPT2h
|
||||
@@ -2,6 +2,8 @@
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/tests/_output
|
||||
/tests/_support
|
||||
/vendor
|
||||
**/.idea/
|
||||
.env
|
||||
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
image: php:7.4
|
||||
stages:
|
||||
- service_build
|
||||
- node
|
||||
- building_assets
|
||||
- database
|
||||
- unit_test
|
||||
- acceptance_test
|
||||
- code_quality
|
||||
|
||||
# Variables
|
||||
variables:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_USER: mysql_password
|
||||
MYSQL_PASSWORD: mysql_password
|
||||
MYSQL_DATABASE: shpping_portal
|
||||
DB_HOST: mysql
|
||||
|
||||
|
||||
before_script:
|
||||
- apt-get update -yqq
|
||||
- apt-get install -yqq
|
||||
- apt-get install -y libonig-dev
|
||||
- apt-get install -y libxml2-dev
|
||||
- apt-get install -y libzip-dev
|
||||
- apt-get install -y libgd-dev
|
||||
- apt-get install -y libgd-dev
|
||||
|
||||
# Install PDO MySQL extension
|
||||
- docker-php-ext-install pdo_mysql
|
||||
|
||||
#install php dependencies
|
||||
- docker-php-ext-install mbstring xml zip gd
|
||||
|
||||
# Install composer package manager
|
||||
- curl --location --output /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
|
||||
- chmod +x /usr/local/bin/composer
|
||||
|
||||
# Install MySQL client
|
||||
- apt-get install -y default-mysql-client
|
||||
|
||||
#install node js
|
||||
- apt-get update && apt-get install -y nodejs npm
|
||||
|
||||
#install gulp Js
|
||||
- npm install -g gulp-cli
|
||||
|
||||
|
||||
#jobs
|
||||
|
||||
#buld the backend
|
||||
composer_php:
|
||||
stage: service_build
|
||||
script:
|
||||
- composer install
|
||||
- cp .env.example .env
|
||||
- php artisan key:generate
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH =~ /.*/'
|
||||
|
||||
#build the UI
|
||||
#node installation
|
||||
npm:
|
||||
stage: node
|
||||
script:
|
||||
- npm install # Install npm dependencies
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH =~ /.*/'
|
||||
|
||||
#building assets
|
||||
building_assets:
|
||||
stage: building_assets
|
||||
# dependencies:
|
||||
# - npm
|
||||
script:
|
||||
- npm install # Install npm dependencies
|
||||
- gulp build # Build assets
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH =~ /.*/'
|
||||
|
||||
#mysql
|
||||
database:
|
||||
stage: database
|
||||
services:
|
||||
- name: mysql:8.0
|
||||
command: [ "--default-authentication-plugin=mysql_native_password" ]
|
||||
#dependencies:
|
||||
# - composer_php
|
||||
script:
|
||||
- composer install
|
||||
- cp .env.example .env
|
||||
- php artisan key:generate
|
||||
- php artisan migrate:fresh
|
||||
- php artisan db:seed
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH =~ /.*/'
|
||||
|
||||
#mysql
|
||||
#unit_test:
|
||||
# stage: unit_test
|
||||
# services:
|
||||
# - name: mysql:8.0
|
||||
# command: [ "--default-authentication-plugin=mysql_native_password" ]
|
||||
#dependencies:
|
||||
# - database
|
||||
# script:
|
||||
# - npm install # Install npm dependencies
|
||||
# - gulp build # Build assets
|
||||
# - composer install
|
||||
# - cp .env.example .env
|
||||
# - php artisan key:generate
|
||||
# - php artisan migrate:fresh
|
||||
# - php artisan db:seed
|
||||
# - php artisan test
|
||||
# rules:
|
||||
# - if: '$CI_COMMIT_BRANCH =~ /.*/'
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,62 +1,39 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
|
||||
## Shipping portal documentation
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
simple documentation on how to install, run, test, commit and deploy application
|
||||
|
||||
## About Laravel
|
||||
## creating and running unit tests
|
||||
|
||||
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:
|
||||
Required Tools
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
- Chromium Driver / selenium
|
||||
- add running and setting selenium on all OS if possible
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
Required Packages :
|
||||
|
||||
## Learning Laravel
|
||||
- laravel/legacy-factories
|
||||
|
||||
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.
|
||||
- codeception/codeception
|
||||
|
||||
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.
|
||||
Or Simply Run
|
||||
|
||||
## Laravel Sponsors
|
||||
``Composer install``
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
To create a unit test
|
||||
|
||||
### Premium Partners
|
||||
``php artisan make test: Test Example --unit``
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
Running the tests :
|
||||
|
||||
## Contributing
|
||||
Running a single Test
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
`` php artisan test --filter Example``
|
||||
|
||||
## Code of Conduct
|
||||
Running Unit tests -
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
`` php artisan test ``
|
||||
|
||||
## Security Vulnerabilities
|
||||
Running Codeception tests -
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
``vendor/bin/codecept run``
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class IdNext implements Filter
|
||||
{
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('id', '>', $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class NextMainQuestion implements Filter
|
||||
{
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('next_main_question', $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class OwnerType implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('owner_type', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class QuestionId implements Filter
|
||||
{
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('question_id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class QuestionNumber implements Filter
|
||||
{
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('question_number', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class QuestionnaireSetId implements Filter
|
||||
{
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('questionnaire_set_id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class UserId implements Filter
|
||||
{
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('user_id', $value);
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,16 @@ use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMInvoice;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMInvoiceStatus;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class UpdatePerfexCRMInvoice implements ShouldQueue
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
namespace App\Classes\Modules\Addresses\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
@@ -17,6 +20,7 @@ use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use App\Transformers\AddressTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -27,7 +31,8 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Address',
|
||||
'message' => 'You have successfully created a new Address'
|
||||
@@ -74,11 +79,11 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
@@ -90,16 +95,22 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
/** @var Address $address */
|
||||
$address = $this->createsAddress->execute($this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]), $object);
|
||||
|
||||
if($request->input('phone')){
|
||||
if ($request->input('phone')) {
|
||||
$contactObject = new ContactObject($request->input('person_in_charge'), $request->input('phone'), '', '');
|
||||
$this->createContactProcessor->execute($contactObject, $address);
|
||||
}
|
||||
|
||||
if($request->input('remark')){
|
||||
if ($request->input('remark')) {
|
||||
$remarkObject = new RemarkObject($request->input('remark'), Auth()->user()->id);
|
||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||
}
|
||||
|
||||
/* return fractal()
|
||||
->item($address, new AddressTransformer())
|
||||
->parseIncludes('remark')
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
namespace App\Classes\Modules\Addresses\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress;
|
||||
@@ -14,6 +17,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Transformers\AddressTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -23,7 +27,8 @@ class CreateBillingAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Billing Address',
|
||||
'message' => 'You have successfully created a new Billing Address'
|
||||
@@ -60,27 +65,35 @@ class CreateBillingAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$companyModule = $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]);
|
||||
|
||||
$address = $this->fetchesAddress->execute(['id' => $request->input('billing_address_id')]);
|
||||
|
||||
if ($address->type !== AddressType::BILLING || $address->id !== $companyModule->addresses->where('type', AddressType::BILLING)->first()->id) {
|
||||
$billingAddressInputed = $this->fetchesAddress->execute(['id' => $request->input('billing_address_id')]);
|
||||
|
||||
if ($billingAddressInputed->type !== AddressType::BILLING || $billingAddressInputed->id !== $companyModule->addresses->where('type', AddressType::BILLING)->first()->id) {
|
||||
// delete all current billing address
|
||||
Address::where('owner_type', CompanyModule::class)->where('owner_id', $request->input('company_module_id'))->where('type', AddressType::BILLING)->delete();
|
||||
|
||||
// create addrress
|
||||
$billingAddress = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, AddressType::BILLING, ApprovalStatus::APPROVED, $address->reference);
|
||||
// create new billing addrress
|
||||
$billingAddress = new AddressObject($billingAddressInputed->street_one, $billingAddressInputed->street_two, $billingAddressInputed->country_id, $billingAddressInputed->state_id, $billingAddressInputed->district_id, $billingAddressInputed->postcode, AddressType::BILLING, ApprovalStatus::APPROVED, $billingAddressInputed->reference);
|
||||
$this->canCreateAddress->passes($billingAddress);
|
||||
$this->createsAddress->execute($companyModule, $billingAddress);
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
//load address with only owner address
|
||||
|
||||
/* return fractal()
|
||||
->item($billingAddressInputed, new AddressTransformer())
|
||||
->parseIncludes('Owner_address')
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new AddressResource($billingAddressInputed));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Classes\Modules\Addresses\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanFetchAddress;
|
||||
@@ -17,7 +19,8 @@ class FetchAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Address',
|
||||
'message' => 'You have successfully retrieved a Address'
|
||||
@@ -45,15 +48,22 @@ class FetchAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$this->canFetchAddress->passes();
|
||||
|
||||
$query = $this->fetchesAddress->execute(['id' => $request->route('id')]);
|
||||
|
||||
|
||||
//load address with no relationships
|
||||
/* return fractal()
|
||||
->item($address, new AddressTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new AddressResource($query));
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
namespace App\Classes\Modules\Addresses\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\ListsAddresses;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanListAddresses;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Transformers\AddressTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,7 +21,8 @@ class ListAddressesLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Addresses',
|
||||
'message' => 'You have successfully retrieved a list of Addresses'
|
||||
@@ -45,17 +50,25 @@ class ListAddressesLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$this->canListAddresses->passes();
|
||||
|
||||
$query = $this->listsAddresses->execute($this->listsAddresses->deserializeFilters($request->input('filters')));
|
||||
|
||||
//a collection of addresses with all incluides
|
||||
/* return fractal()
|
||||
->collection($query, new AddressTransformer)
|
||||
->parseIncludes('Owner_address')
|
||||
->parseIncludes('remark')
|
||||
->parseIncludes('contact')
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->collectionResponse(AddressResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\ListsAddresses;
|
||||
use App\Classes\Modules\Addresses\Services\ListsDistricts;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanListAddresses;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Http\Resources\DistrictResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\ListsAddresses;
|
||||
use App\Classes\Modules\Addresses\Services\ListsStates;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanListAddresses;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Http\Resources\StateResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\ResetsAddressesDefault;
|
||||
use App\Classes\Modules\Addresses\Services\SetsAddressToDefault;
|
||||
use App\Models\Address;
|
||||
use App\Transformers\AddressTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -33,7 +34,7 @@ class SetAddressToDefaultLogic extends AbstractControllerLogic
|
||||
/** @var ResetsAddressesDefault */
|
||||
private $resetsAddressesDefault;
|
||||
|
||||
/** @var SetsAddressToDefault*/
|
||||
/** @var SetsAddressToDefault */
|
||||
private $setsAddressToDefault;
|
||||
|
||||
|
||||
@@ -64,7 +65,15 @@ class SetAddressToDefaultLogic extends AbstractControllerLogic
|
||||
|
||||
$this->resetsAddressesDefault->execute($address->owner, $address->type);
|
||||
|
||||
return $this->resourceResponse(new AddressResource($this->setsAddressToDefault->execute($address)));
|
||||
|
||||
$setAddress = $this->setsAddressToDefault->execute($address);
|
||||
//no relationships needed
|
||||
/* return fractal()
|
||||
->item($setAddress, new AddressTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use App\Transformers\AddressTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -26,7 +27,8 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Updated Address',
|
||||
'message' => 'You have successfully updated the Address'
|
||||
@@ -77,7 +79,7 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
|
||||
@@ -90,18 +92,25 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
/** @var Address $address */
|
||||
$address = $this->updatesAddress->execute($address, $object);
|
||||
|
||||
$address->contacts()->delete(); $address->remarks()->delete();
|
||||
$address->contacts()->delete();
|
||||
$address->remarks()->delete();
|
||||
|
||||
if($request->input('phone')){
|
||||
if ($request->input('phone')) {
|
||||
$contactObject = new ContactObject($request->input('person_in_charge'), $request->input('phone'), '', '');
|
||||
$this->createContactProcessor->execute($contactObject, $address);
|
||||
}
|
||||
|
||||
if($request->input('remark')){
|
||||
if ($request->input('remark')) {
|
||||
$remarkObject = new RemarkObject($request->input('remark'), Auth()->user()->id);
|
||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||
}
|
||||
|
||||
//only remark relationship needed
|
||||
/* return fractal()
|
||||
->item($address, new AddressTransformer())
|
||||
->parseIncludes('remark')
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
|
||||
}
|
||||
|
||||
@@ -131,10 +131,10 @@ class CallbackBillplzLogic
|
||||
|
||||
if(($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
|
||||
if(app()->environment('production')){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\ListsCompanies;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanListCompanies;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use App\Transformers\CompanyTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Fractalistic\ArraySerializer;
|
||||
|
||||
class ListCompaniesLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -45,16 +48,24 @@ class ListCompaniesLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$this->canListCompanies->passes();
|
||||
|
||||
$query = $this->listsCompanies->execute($this->listsCompanies->deserializeFilters($request->input('filters')));
|
||||
return $this->collectionResponse(CompanyResource::collection($query));
|
||||
// return $this->collectionResponse(CompanyResource::collection($query));
|
||||
|
||||
return fractal()
|
||||
->parseIncludes(['owner'])
|
||||
->collection($query, new CompanyTransformer(), "data")
|
||||
->serializeWith(new ArraySerializer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\ListsCompanyModules;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanListCompanies;
|
||||
use App\Http\Resources\CompanyModuleResource;
|
||||
use App\Transformers\CompanyTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,7 +21,8 @@ class ListCompanyModulesLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Company Moduels',
|
||||
'message' => 'You have successfully retrieved a list of Companies'
|
||||
@@ -45,15 +50,26 @@ class ListCompanyModulesLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$this->canListCompanies->passes();
|
||||
|
||||
$query = $this->listsCompanyModules->execute($this->listsCompanyModules->deserializeFilters($request->input('filters')));
|
||||
|
||||
/*include all relationships*/
|
||||
/* return fractal()
|
||||
->collection($query, new CompanyTransformer)
|
||||
->parseIncludes('company')
|
||||
->parseIncludes('contact')
|
||||
->parseIncludes('remarks')
|
||||
->parseIncludes('address')
|
||||
->parseIncludes('billingAddress')
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->collectionResponse(CompanyModuleResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Classes\Modules\Contacts\Services\UpdatesContact;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Services\FetchesContact;
|
||||
use App\Http\Resources\ContactResource;
|
||||
use App\Transformers\ContactTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -63,6 +64,13 @@ class UpdateContactLogic extends AbstractControllerLogic
|
||||
|
||||
$query = $this->updatesContact->execute($query, $object);
|
||||
|
||||
/*uniformity*/
|
||||
/* return fractal()
|
||||
->item($query, new ContactTransformer())
|
||||
->parseIncludes('remark')
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new ContactResource($query));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Classes\Modules\Orders\Services\CancelsOrder;
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Models\Order;
|
||||
use App\Transformers\DeliveryOrderTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -52,6 +53,14 @@ class CancelDeliveryOrderLogic extends AbstractControllerLogic
|
||||
/** @var Order $order */
|
||||
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
|
||||
|
||||
$order = $this->cancelsOrder->execute($order);
|
||||
|
||||
//no relationship needed
|
||||
/* return fractal()
|
||||
->item($order, new DeliveryOrderTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new DeliveryOrderResource($this->cancelsOrder->execute($order)));
|
||||
|
||||
}
|
||||
|
||||
@@ -172,6 +172,12 @@ class CreateDeliveryOrderLogic extends AbstractControllerLogic
|
||||
$packageObject = new PackageObject($request->input('packing_list.type'), $request->input('packing_list.description'), (float) 1, (float) 1, (float) 1, $request->input('packing_list.weight'), (float) $request->input('packing_list.quantity'), ApprovalStatus::APPROVED);
|
||||
$this->createsPackage->execute($packageObject, $packingList);
|
||||
|
||||
//add relationship to order
|
||||
/* return fractal()
|
||||
->item($order, new DeliveryOrderTransformer())
|
||||
->parseIncludes(['sender_address', 'delivery_address', 'sender_address.contacts', 'delivery_address.contacts', 'sender_address.remarks', 'delivery_address.remarks', 'packing_list', 'packing_list.packages'])
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new DeliveryOrderResource($order));
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ class ListOrdersLogic extends AbstractControllerLogic
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::LAST_MILE_DELIVERY]]));
|
||||
|
||||
|
||||
//no relationship needed
|
||||
/* return fractal()
|
||||
->collection($query, new DeliveryOrderTransformer)
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->collectionResponse(DeliveryOrderResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
@@ -3,13 +3,21 @@
|
||||
namespace App\Classes\Modules\Documents\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\Services\ListsDocuments;
|
||||
use App\Classes\Modules\Documents\Standards\Rules\CanListDocuments;
|
||||
use App\Http\Resources\DocumentResource;
|
||||
use App\Models\Document;
|
||||
use App\Transformers\DocumentTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use League\Fractal\Serializer\ArraySerializer;
|
||||
use League\Fractal;
|
||||
|
||||
|
||||
class ListDocumentLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -17,7 +25,8 @@ class ListDocumentLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Document',
|
||||
'message' => 'You have successfully retrieved a list of Document'
|
||||
@@ -45,19 +54,29 @@ class ListDocumentLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$this->canListDocuments->passes();
|
||||
|
||||
$query = $this->listsDocuments->execute(array_merge($this->listsDocuments->deserializeFilters($request->input('filters')), ['with_owner' => true]));
|
||||
|
||||
return $this->collectionResponse(DocumentResource::collection($query));
|
||||
$data = fractal()
|
||||
->parseIncludes(['owner'])
|
||||
->collection($query, new DocumentTransformer, "data")
|
||||
->serializeWith(new ArraySerializer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);
|
||||
|
||||
return $data;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Classes\Modules\Documents\DataTransferObjects;
|
||||
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use App\Classes\Modules\Documents\Services\ConvertsBase64ToFile;
|
||||
|
||||
@@ -68,7 +69,7 @@ class DocumentObject implements DataTransferObject
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function getFiles(): array
|
||||
{
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\Processors;
|
||||
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\QAUserAnswerSelected;
|
||||
|
||||
class UploadDocumentForHelpMenuProcessor
|
||||
{
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFiles;
|
||||
|
||||
/**
|
||||
* UploadDocumentForHelpMenuProcessor constructor.
|
||||
* @param CreatesDocument $createsDocument
|
||||
* @param CreatesFiles $createsFiles
|
||||
*/
|
||||
public function __construct(CreatesDocument $createsDocument, CreatesFiles $createsFiles)
|
||||
{
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFiles = $createsFiles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param QAUserAnswerSelected qaUserAnswerSelected
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Request $request, QAUserAnswerSelected $qaUserAnswerSelected) {
|
||||
$object = new DocumentObject("HELP_MENU", $request->input('files'),
|
||||
'123456', ApprovalStatus::PENDING_VERIFICATION, 'help_menu'); //cief todo: 123456 cannot be hardcoded
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($qaUserAnswerSelected, $object);
|
||||
|
||||
$result = $this->createsFiles->execute($document, $object);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -97,7 +97,8 @@ class ConvertsBase64ToFile
|
||||
* @return string
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
private function generateFile(FileObject $file, string $suffix = '') {
|
||||
private function generateFile(FileObject $file, string $suffix = ''): string
|
||||
{
|
||||
|
||||
$filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace App\Classes\Modules\Exports\Services;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Models\Order;
|
||||
use App\Models\State;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
@@ -32,10 +31,8 @@ class ExportsWarehousePackingList implements FromQuery, WithHeadings, WithHeadin
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$johor_state_id = State::where('name', 'johor')->first()->id;
|
||||
|
||||
return Order::whereHas('addresses', function($address) use ($johor_state_id){
|
||||
$address->where('status', ApprovalStatus::APPROVED)->where('state_id', $johor_state_id);
|
||||
return Order::whereHas('addresses', function($address) {
|
||||
$address->where('status', ApprovalStatus::APPROVED);
|
||||
})->whereHas('packingLists', function($packingLists) {
|
||||
$packingLists->where('type', PackingListType::SHIPPING_PACKING_LIST)->whereDoesntHave('transports');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestionList;
|
||||
use App\Classes\Modules\HelpMenu\Processors\FetchFirstHelpMenuQuestionProcessor;
|
||||
use App\Http\Resources\HelpMenuQuestionResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class FetchHelpMenuQuestionLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Help Menu First Question',
|
||||
'message' => 'You have successfully retrieved a Help Menu First Question'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchHelpMenuQuestionList */
|
||||
private $canFetchHelpMenuQuestionList;
|
||||
|
||||
/** @var FetchFirstHelpMenuQuestionProcessor */
|
||||
private $fetchFirstHelpMenuQuestionProcessor;
|
||||
|
||||
/**
|
||||
* FetchHelpMenuQuestionLogic constructor.
|
||||
* @param CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList
|
||||
* @param FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor
|
||||
*/
|
||||
public function __construct(CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList, FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor)
|
||||
{
|
||||
$this->canFetchHelpMenuQuestionList = $canFetchHelpMenuQuestionList;
|
||||
$this->fetchFirstHelpMenuQuestionProcessor = $fetchFirstHelpMenuQuestionProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$this->canFetchHelpMenuQuestionList->passes();
|
||||
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$query = $this->fetchFirstHelpMenuQuestionProcessor->execute($request);
|
||||
|
||||
return $this->resourceResponse(new HelpMenuQuestionResource($query, $userId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMSupportTicket;
|
||||
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMCustomer;
|
||||
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestionList;
|
||||
use App\Classes\Modules\HelpMenu\Processors\SaveHelpMenuAnswerProcessor;
|
||||
use App\Classes\Modules\HelpMenu\Processors\DeleteHelpMenuAnswerProcessor;
|
||||
use App\Classes\Modules\HelpMenu\Processors\FetchNextHelpMenuQuestionProcessor;
|
||||
use App\Classes\Modules\HelpMenu\Processors\FetchFirstHelpMenuQuestionProcessor;
|
||||
use App\Http\Resources\HelpMenuQuestionResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Classes\ValueObjects\Constants\QAType;
|
||||
|
||||
class UpdateHelpMenuNextQuestionLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Help Menu Next Question',
|
||||
'message' => 'You have successfully retrieved a Help Menu Next Question'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchHelpMenuQuestionList */
|
||||
private $canFetchHelpMenuQuestionList;
|
||||
|
||||
/** @var SaveHelpMenuAnswerProcessor */
|
||||
private $saveHelpMenuAnswerProcessor;
|
||||
|
||||
/** @var DeleteHelpMenuAnswerProcessor */
|
||||
private $deleteHelpMenuAnswerProcessor;
|
||||
|
||||
/** @var FetchNextHelpMenuQuestionProcessor */
|
||||
private $fetchNextHelpMenuQuestionProcessor;
|
||||
|
||||
/** @var FetchFirstHelpMenuQuestionProcessor */
|
||||
private $fetchFirstHelpMenuQuestionProcessor;
|
||||
|
||||
/** @var CreatesPerfexCRMSupportTicket */
|
||||
private $createsPerfexCRMSupportTicket;
|
||||
|
||||
/** @var FetchesPerfexCRMCustomer */
|
||||
private $fetchesPerfexCRMCustomer;
|
||||
|
||||
/**
|
||||
* UpdateHelpMenuNextQuestionLogic constructor.
|
||||
* @param CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList
|
||||
* @param SaveHelpMenuAnswerProcessor $saveHelpMenuAnswerProcessor
|
||||
* @param FetchNextHelpMenuQuestionProcessor $fetchNextHelpMenuQuestionProcessor
|
||||
* @param FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor
|
||||
* @param DeleteHelpMenuAnswerProcessor $deleteHelpMenuAnswerProcessor
|
||||
*/
|
||||
public function __construct(CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList, SaveHelpMenuAnswerProcessor $saveHelpMenuAnswerProcessor, FetchNextHelpMenuQuestionProcessor $fetchNextHelpMenuQuestionProcessor, FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor, CreatesPerfexCRMSupportTicket $createsPerfexCRMSupportTicket, FetchesPerfexCRMCustomer $fetchesPerfexCRMCustomer, DeleteHelpMenuAnswerProcessor $deleteHelpMenuAnswerProcessor)
|
||||
{
|
||||
$this->canFetchHelpMenuQuestionList = $canFetchHelpMenuQuestionList;
|
||||
$this->saveHelpMenuAnswerProcessor = $saveHelpMenuAnswerProcessor;
|
||||
$this->fetchNextHelpMenuQuestionProcessor = $fetchNextHelpMenuQuestionProcessor;
|
||||
$this->fetchFirstHelpMenuQuestionProcessor = $fetchFirstHelpMenuQuestionProcessor;
|
||||
$this->createsPerfexCRMSupportTicket = $createsPerfexCRMSupportTicket;
|
||||
$this->fetchesPerfexCRMCustomer = $fetchesPerfexCRMCustomer;
|
||||
$this->deleteHelpMenuAnswerProcessor = $deleteHelpMenuAnswerProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$questionId = 0;
|
||||
$userId = Auth::user()->id;
|
||||
$currentQuestion = $request->question;
|
||||
$questionId = $currentQuestion['id'];
|
||||
$questionType = $currentQuestion['question_type'];
|
||||
|
||||
$this->canFetchHelpMenuQuestionList->passes();
|
||||
|
||||
//Delete answer
|
||||
$this->deleteHelpMenuAnswerProcessor->execute($userId, $questionId, $request);
|
||||
|
||||
//Save answer given by user
|
||||
if (!$request->has('isPrevious')) {
|
||||
$this->saveHelpMenuAnswerProcessor->execute($userId, $questionId, $request);
|
||||
}
|
||||
|
||||
//Create ticket at crm
|
||||
if (!$request->has('isPrevious')) {
|
||||
if($questionType == QAType::TICKET_CRM){
|
||||
$email = Auth::user()->email;
|
||||
$customer = $this->fetchesPerfexCRMCustomer->execute($email);
|
||||
$subject = "test subject 3";
|
||||
$department = 1;
|
||||
$contactid = 0;
|
||||
$userid = 0;
|
||||
if($customer){
|
||||
$contactid = $customer->id;
|
||||
$userid = $customer->userid;
|
||||
}
|
||||
$this->createsPerfexCRMSupportTicket->execute($subject, $department, $contactid, $userid);
|
||||
}
|
||||
}
|
||||
|
||||
//Get returned question (previous or next)
|
||||
$returnQuestion = $this->fetchNextHelpMenuQuestionProcessor->execute($request);
|
||||
//When a questionnaire ended, return back the first question
|
||||
if(is_null($returnQuestion)){
|
||||
$returnQuestion = $this->fetchFirstHelpMenuQuestionProcessor->execute($request);
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new HelpMenuQuestionResource($returnQuestion, $userId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Processors;
|
||||
|
||||
use App\Models\QAUserAnswerSelected;
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelected;
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelectedList;
|
||||
|
||||
class DeleteHelpMenuAnswerProcessor
|
||||
{
|
||||
/** @var FetchesHelpMenuUserAnswerSelected */
|
||||
private $fetchesHelpMenuUserAnswerSelected;
|
||||
|
||||
/** @var FetchesHelpMenuUserAnswerSelectedList */
|
||||
private $fetchesHelpMenuUserAnswerSelectedList;
|
||||
|
||||
/**
|
||||
* DeleteHelpMenuAnswerProcessor constructor.
|
||||
* @param FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected
|
||||
* @param FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList
|
||||
*/
|
||||
public function __construct(FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected, FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList)
|
||||
{
|
||||
$this->fetchesHelpMenuUserAnswerSelected = $fetchesHelpMenuUserAnswerSelected;
|
||||
$this->fetchesHelpMenuUserAnswerSelectedList = $fetchesHelpMenuUserAnswerSelectedList;
|
||||
}
|
||||
|
||||
public function execute($userId, $questionId, $request){
|
||||
if ($request->has('isPrevious')) {
|
||||
//Get current and previous question's answer
|
||||
try{
|
||||
$selectedAnswer = $this->fetchesHelpMenuUserAnswerSelectedList->execute(['user_id' => $userId, 'question_id' => $questionId, 'order_by' => (object)['column' => 'id','DESC' => true]])[0];
|
||||
} catch (\Exception $exception){
|
||||
$selectedAnswer = null;
|
||||
}
|
||||
|
||||
if($selectedAnswer)
|
||||
{
|
||||
$this->fetchesHelpMenuUserAnswerSelected->execute(['id' => $selectedAnswer['id']])->delete();
|
||||
}
|
||||
}
|
||||
else{
|
||||
//Delete all answer's belongs to the user
|
||||
$currentQuestion = $request->question;
|
||||
$isStart = $currentQuestion['is_start'];
|
||||
if($isStart){
|
||||
QAUserAnswerSelected::where('user_id', $userId)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Processors;
|
||||
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuQuestion;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class FetchFirstHelpMenuQuestionProcessor
|
||||
{
|
||||
/** @var FetchesHelpMenuQuestion */
|
||||
private $fetchesHelpMenuQuestion;
|
||||
|
||||
/**
|
||||
* FetchFirstHelpMenuQuestionProcessor constructor.
|
||||
* @param FetchesHelpMenuQuestion $fetchesHelpMenuQuestion
|
||||
*/
|
||||
public function __construct(FetchesHelpMenuQuestion $fetchesHelpMenuQuestion)
|
||||
{
|
||||
$this->fetchesHelpMenuQuestion = $fetchesHelpMenuQuestion;
|
||||
}
|
||||
|
||||
public function execute(Request $request){
|
||||
try {
|
||||
$query = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1]);
|
||||
return $query;
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Processors;
|
||||
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuQuestion;
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelected;
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelectedList;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Classes\ValueObjects\Constants\QAType;
|
||||
|
||||
class FetchNextHelpMenuQuestionProcessor
|
||||
{
|
||||
/** @var FetchesHelpMenuQuestion */
|
||||
private $fetchesHelpMenuQuestion;
|
||||
|
||||
/** @var FetchesHelpMenuUserAnswerSelected */
|
||||
private $fetchesHelpMenuUserAnswerSelected;
|
||||
|
||||
/** @var FetchesHelpMenuUserAnswerSelectedList */
|
||||
private $fetchesHelpMenuUserAnswerSelectedList;
|
||||
/**
|
||||
* FetchNextHelpMenuQuestionProcessor constructor.
|
||||
* @param FetchesHelpMenuQuestion $fetchesHelpMenuQuestion
|
||||
* @param FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected
|
||||
* @param FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList
|
||||
*/
|
||||
public function __construct(FetchesHelpMenuQuestion $fetchesHelpMenuQuestion, FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected, FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList)
|
||||
{
|
||||
$this->fetchesHelpMenuQuestion = $fetchesHelpMenuQuestion;
|
||||
$this->fetchesHelpMenuUserAnswerSelected = $fetchesHelpMenuUserAnswerSelected;
|
||||
$this->fetchesHelpMenuUserAnswerSelectedList = $fetchesHelpMenuUserAnswerSelectedList;
|
||||
}
|
||||
|
||||
public function execute(Request $request){
|
||||
$isEnd = 0;
|
||||
$questionId = 0;
|
||||
$nextQuestionNumber = 0;
|
||||
$nextNestedQuestion = 0;
|
||||
$nextMainQuestion= 0;
|
||||
$currentQuestion = $request->question;
|
||||
$questionType = QAType::DEFAULT;
|
||||
$returnQuestion = null;
|
||||
|
||||
if ($currentQuestion && array_key_exists('id', $currentQuestion)) {
|
||||
$questionId = $currentQuestion['id'];
|
||||
$isEnd = $currentQuestion['is_end'];
|
||||
$questionType = $currentQuestion['question_type'];
|
||||
$nextNestedQuestion = $currentQuestion['next_nested_question'];
|
||||
$nextMainQuestion = $currentQuestion['next_main_question'];
|
||||
}
|
||||
if ($request->has('answerObj')) {
|
||||
$nextQuestionNumber = $request->answerObj['next_question_number'];
|
||||
}
|
||||
|
||||
if ($request->has('isPrevious')) {
|
||||
$userId = Auth::user()->id;
|
||||
$previousAnswer = $this->fetchesHelpMenuUserAnswerSelectedList->execute(['user_id' => $userId, 'order_by' => (object)['column' => 'id','DESC' => true]])[0];
|
||||
|
||||
//Get previous question
|
||||
$previousQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id' => $previousAnswer['question_id']]);
|
||||
$returnQuestion = $previousQuestion;
|
||||
}
|
||||
else{
|
||||
//Get next question
|
||||
$nextQuestion = null;
|
||||
$question_number = 0;
|
||||
if($nextQuestionNumber != 0){
|
||||
$question_number = $nextQuestionNumber;
|
||||
}
|
||||
else if($nextNestedQuestion != 0){
|
||||
$question_number = $nextNestedQuestion;
|
||||
}
|
||||
else {
|
||||
$question_number = $nextMainQuestion;
|
||||
}
|
||||
|
||||
if($isEnd){
|
||||
$returnQuestion = null;
|
||||
}
|
||||
else if($question_number != 0){
|
||||
$nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'question_number' => $question_number]);
|
||||
$returnQuestion = $nextQuestion;
|
||||
}
|
||||
else if (array_key_exists('id', $request->input('question'))) {
|
||||
$nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id_next' => $questionId, 'next_main_question' => null]);
|
||||
$returnQuestion = $nextQuestion;
|
||||
}
|
||||
}
|
||||
|
||||
return $returnQuestion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Processors;
|
||||
|
||||
use App\Models\QAUserAnswerSelected;
|
||||
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelected;
|
||||
use App\Classes\Modules\Documents\Processors\UploadDocumentForHelpMenuProcessor;
|
||||
|
||||
|
||||
class SaveHelpMenuAnswerProcessor
|
||||
{
|
||||
/** @var FetchesHelpMenuUserAnswerSelected */
|
||||
private $fetchesHelpMenuUserAnswerSelected;
|
||||
|
||||
/** @var UploadDocumentForHelpMenuProcessor */
|
||||
private $uploadDocumentForHelpMenuProcessor;
|
||||
|
||||
/**
|
||||
* SaveHelpMenuAnswerProcessor constructor.
|
||||
* @param FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected
|
||||
* @param UploadDocumentForHelpMenuProcessor $uploadDocumentForHelpMenuProcessor
|
||||
*/
|
||||
public function __construct(FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected, UploadDocumentForHelpMenuProcessor $uploadDocumentForHelpMenuProcessor)
|
||||
{
|
||||
$this->fetchesHelpMenuUserAnswerSelected = $fetchesHelpMenuUserAnswerSelected;
|
||||
$this->uploadDocumentForHelpMenuProcessor = $uploadDocumentForHelpMenuProcessor;
|
||||
}
|
||||
|
||||
public function execute($userId, $questionId, $request){
|
||||
$filesUpload = $request->input('files');
|
||||
$answer = null;
|
||||
try{
|
||||
// $answer = $this->fetchesHelpMenuUserAnswerSelected->execute(['user_id' => $userId, 'question_id' => $questionId, 'order_by' => ['column' => 'id','DESC' => 1]]);
|
||||
$answer = $this->fetchesHelpMenuUserAnswerSelected->execute(['user_id' => $userId, 'question_id' => $questionId]);
|
||||
} catch (\Exception $exception){
|
||||
$answer = null;
|
||||
}
|
||||
|
||||
if(is_null($answer))
|
||||
{
|
||||
$answer = new QAUserAnswerSelected;
|
||||
}
|
||||
$answer->user_id = $userId;
|
||||
$answer->question_id = $questionId;
|
||||
if ($request->has('answerObj')) {
|
||||
$answer->answer_option_id = intval($request->answerObj['id']);
|
||||
}
|
||||
$answer->free_text_answer = $request->answer;
|
||||
$answer->save();
|
||||
|
||||
if($filesUpload){
|
||||
$result = $this->uploadDocumentForHelpMenuProcessor->execute($request, $answer);
|
||||
$newData = array_map(function ($item) {
|
||||
return [
|
||||
'document_id' => $item->document_id,
|
||||
'file_id' => $item->id,
|
||||
];
|
||||
}, $result);
|
||||
$answer->free_text_answer = json_encode($newData);
|
||||
$answer->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\QAQuestions;
|
||||
|
||||
class FetchesHelpMenuQuestion extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var QAQuestions */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesHelpMenuQuestion constructor.
|
||||
* @param QAQuestions $repository
|
||||
*/
|
||||
public function __construct(QAQuestions $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\QAUserAnswerSelected;
|
||||
|
||||
class FetchesHelpMenuUserAnswerSelected extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var QAUserAnswerSelected */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesHelpMenuUserAnswerSelected constructor.
|
||||
* @param QAUserAnswerSelected $repository
|
||||
*/
|
||||
public function __construct(QAUserAnswerSelected $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\QAUserAnswerSelected;
|
||||
|
||||
class FetchesHelpMenuUserAnswerSelectedList extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var QAUserAnswerSelected */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesHelpMenuUserAnswerSelectedList constructor.
|
||||
* @param QAUserAnswerSelected $repository
|
||||
*/
|
||||
public function __construct(QAUserAnswerSelected $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\HelpMenu\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
|
||||
class CanFetchHelpMenuQuestionList extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Processors\ApproveChangeOrderAddressProcessor;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use App\Transformers\AddressTransformer;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -39,6 +40,12 @@ class ApproveChangeOrderAddressLogic extends AbstractControllerLogic
|
||||
{
|
||||
$address = $this->approveChangeOrderAddressProcessor->execute($request);
|
||||
|
||||
|
||||
//load address with no relationships
|
||||
/* return fractal()
|
||||
->item($address, new AddressTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,20 @@ namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\PerfexCRM\Processors\NewLeadTaskToPerfexCRMProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
|
||||
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\WarehouseReferences;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress;
|
||||
use App\Models\Address;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -41,6 +47,12 @@ class CreateOrderLogic extends AbstractControllerLogic
|
||||
/** @var GeneratesOrderNumber */
|
||||
private $generatesOrderNumber;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createsAddress;
|
||||
|
||||
/** @var CanCreateAddress */
|
||||
private $canCreateAddress;
|
||||
|
||||
/** @var NewLeadTaskToPerfexCRMProcessor */
|
||||
private $newLeadTaskToPerfexCRMProcessor;
|
||||
/**
|
||||
@@ -51,14 +63,18 @@ class CreateOrderLogic extends AbstractControllerLogic
|
||||
* @param FetchesCompanyModule $fetchesCompanyModule
|
||||
* @param GeneratesOrderNumber $generatesOrderNumber
|
||||
* @param NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor
|
||||
* @param CreatesAddress $createsAddress
|
||||
* @param CanCreateAddress $canCreateAddress
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CreateOrderProcessor $createOrderProcessor, FetchesCompanyModule $fetchesCompanyModule, GeneratesOrderNumber $generatesOrderNumber, NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor)
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CreateOrderProcessor $createOrderProcessor, FetchesCompanyModule $fetchesCompanyModule, GeneratesOrderNumber $generatesOrderNumber, CreatesAddress $createsAddress, CanCreateAddress $canCreateAddress, NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesAddress = $fetchesAddress;
|
||||
$this->createOrderProcessor = $createOrderProcessor;
|
||||
$this->fetchesCompanyModule = $fetchesCompanyModule;
|
||||
$this->generatesOrderNumber = $generatesOrderNumber;
|
||||
$this->createsAddress = $createsAddress;
|
||||
$this->canCreateAddress = $canCreateAddress;
|
||||
$this->newLeadTaskToPerfexCRMProcessor = $newLeadTaskToPerfexCRMProcessor;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,16 +8,20 @@ use App\Classes\Modules\Orders\Services\ListsOrders;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Http\Resources\OrderV2Resource;
|
||||
use App\Transformers\DocumentTransformer;
|
||||
use App\Transformers\OrderTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use League\Fractal\Serializer\ArraySerializer;
|
||||
|
||||
class ListOrdersV2Logic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Orders',
|
||||
'message' => 'You have successfully retrieved a list of Orders'
|
||||
@@ -41,16 +45,23 @@ class ListOrdersV2Logic extends AbstractControllerLogic
|
||||
$this->listsOrders = $listsOrders;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$this->canListOrders->passes();
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
|
||||
|
||||
return $this->collectionResponse(OrderV2Resource::collection($query));
|
||||
|
||||
// return $this->collectionResponse(OrderV2Resource::collection($query));
|
||||
|
||||
return fractal()
|
||||
->parseIncludes(['remarks', 'warehouse', 'address'])
|
||||
->collection($query, new OrderTransformer(), "data")
|
||||
->serializeWith(new ArraySerializer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -56,6 +57,13 @@ class AssignPackingListContainerLogic extends AbstractControllerLogic
|
||||
$container->packingLists()->attach($packing_list_item);
|
||||
}
|
||||
|
||||
//only return with packing list relationship
|
||||
|
||||
/* return fractal()
|
||||
->item($container, new ContainerTransformer())
|
||||
->parseInclude(['packingLists'])
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
|
||||
+10
-2
@@ -8,6 +8,7 @@ use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -19,7 +20,8 @@ class CompleteContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Updated Container',
|
||||
'message' => 'You have successfully updated the Container'
|
||||
@@ -51,10 +53,16 @@ class CompleteContainerLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
$query = $this->updatesContainerStatus->execute($container, ApprovalStatus::COMPLETED);
|
||||
|
||||
//no relationships needed
|
||||
/* return fractal()
|
||||
->item($container, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -70,6 +71,11 @@ class CreateContainerLogic extends AbstractControllerLogic
|
||||
|
||||
$query = $this->createsContainer->execute($object, $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]));
|
||||
|
||||
//no relationship needed
|
||||
/* return fractal()
|
||||
->item($query, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($query));
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -8,6 +8,7 @@ use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -18,7 +19,8 @@ class CreateContainerRemarkLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Container Remark',
|
||||
'message' => 'You have successfully created a new Container Remark'
|
||||
@@ -50,7 +52,7 @@ class CreateContainerRemarkLogic extends AbstractControllerLogic
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
@@ -59,6 +61,12 @@ class CreateContainerRemarkLogic extends AbstractControllerLogic
|
||||
|
||||
$this->createRemarkProcessor->execute($container, $object);
|
||||
|
||||
//load with remarks only
|
||||
/* return fractal()
|
||||
->item($container, new ContainerTransformer())
|
||||
->parseIncludes(['remarks'])
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
|
||||
}
|
||||
|
||||
+25
-17
@@ -17,6 +17,7 @@ use App\Classes\ValueObjects\Constants\TransportType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -28,7 +29,8 @@ class CreateLoadContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Container',
|
||||
'message' => 'You have successfully created a new Container'
|
||||
@@ -41,7 +43,7 @@ class CreateLoadContainerLogic extends AbstractControllerLogic
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/** @var FetchesCompanyModule */
|
||||
/** @var FetchesCompanyModule */
|
||||
private $fetchesCompanyModule;
|
||||
|
||||
/** @var CreatesPackingList */
|
||||
@@ -54,12 +56,12 @@ class CreateLoadContainerLogic extends AbstractControllerLogic
|
||||
private $createsSchedule;
|
||||
|
||||
public function __construct(
|
||||
CanCreateContainer $canCreateContainer,
|
||||
FetchesPackingList $fetchesPackingList,
|
||||
FetchesCompanyModule $fetchesCompanyModule,
|
||||
CreatesContainer $createsContainer,
|
||||
CreatesTransport $createsTransport,
|
||||
CreatesSchedule $createsSchedule
|
||||
CanCreateContainer $canCreateContainer,
|
||||
FetchesPackingList $fetchesPackingList,
|
||||
FetchesCompanyModule $fetchesCompanyModule,
|
||||
CreatesContainer $createsContainer,
|
||||
CreatesTransport $createsTransport,
|
||||
CreatesSchedule $createsSchedule
|
||||
)
|
||||
{
|
||||
$this->canCreateContainer = $canCreateContainer;
|
||||
@@ -77,11 +79,11 @@ class CreateLoadContainerLogic extends AbstractControllerLogic
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$object = new ContainerObject(
|
||||
$request->input('container_reference'),
|
||||
$request->input('container_number'),
|
||||
$request->input('container_reference'),
|
||||
$request->input('container_number'),
|
||||
$request->input('seal_reference'),
|
||||
$request->input('container_type'),
|
||||
ApprovalStatus::APPROVED
|
||||
@@ -92,21 +94,27 @@ class CreateLoadContainerLogic extends AbstractControllerLogic
|
||||
$container = $this->createsContainer->execute($object, $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]));
|
||||
|
||||
$transportObject = new TransportObject(
|
||||
TransportType::LAND, null,
|
||||
$request->input('tracking'),
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
TransportType::LAND, null,
|
||||
$request->input('tracking'),
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$transport = $this->createsTransport->execute($transportObject, $container);
|
||||
|
||||
$scheduleObject = new ScheduleObject(
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
);
|
||||
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
|
||||
|
||||
//include transport
|
||||
/* return fractal()
|
||||
->item($container, new ContainerTransformer())
|
||||
->parseIncludes(['transport'])
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -7,6 +7,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\Containers\CanFetchContainer;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,7 +18,8 @@ class FetchContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Container',
|
||||
'message' => 'You have successfully retrieved a Container'
|
||||
@@ -48,12 +50,18 @@ class FetchContainerLogic extends AbstractControllerLogic
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$this->canFetchContainer->passes();
|
||||
|
||||
$query = $this->fetchesContainer->execute(['id' => $request->route('id'), 'with_packing_lists' => true]);
|
||||
|
||||
//load with packing lists
|
||||
/* return fractal()
|
||||
->item($query, new ContainerTransformer())
|
||||
->parseIncludes(['packing_lists'])
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($query));
|
||||
|
||||
}
|
||||
|
||||
+9
-2
@@ -9,6 +9,7 @@ use App\Classes\Modules\PackingLists\Standards\Rules\Containers\CanListContainer
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchInboundCustomClearedProcessor;
|
||||
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -19,7 +20,8 @@ class InboundCustomClearedLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Containers',
|
||||
'message' => 'You have successfully retrieved a list of Containers'
|
||||
@@ -52,11 +54,16 @@ class InboundCustomClearedLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$query = $this->fetchInboundCustomCleared->execute();
|
||||
|
||||
//no relations required
|
||||
/* return fractal()
|
||||
->item($query, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->collectionResponse(ContainerResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
+16
-5
@@ -3,10 +3,14 @@
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic\Containers;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\ListsContainers;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\Containers\CanListContainers;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,7 +21,8 @@ class ListContainersLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Containers',
|
||||
'message' => 'You have successfully retrieved a list of Containers'
|
||||
@@ -45,16 +50,22 @@ class ListContainersLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$this->canListContainers->passes();
|
||||
|
||||
$query = $this->listsContainers->execute($this->listsContainers->deserializeFilters($request->input('filters')));
|
||||
|
||||
//load with no filters, a details page to be added to load one with all related data
|
||||
/* return fractal()
|
||||
->collection($query, new ContainerTransformer)
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->collectionResponse(ContainerResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
+13
-6
@@ -10,6 +10,7 @@ use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -20,7 +21,8 @@ class RescheduleContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Reschedule Container',
|
||||
'message' => 'You have successfully Reschedule Container'
|
||||
@@ -54,7 +56,7 @@ class RescheduleContainerLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
@@ -65,15 +67,20 @@ class RescheduleContainerLogic extends AbstractControllerLogic
|
||||
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED);
|
||||
|
||||
$scheduleObject = new ScheduleObject(
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
);
|
||||
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
|
||||
|
||||
//no relationship
|
||||
/* return fractal()
|
||||
->item($container, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
} catch (\Exception $exception) {
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
|
||||
+21
-10
@@ -3,12 +3,16 @@
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic\Containers;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\UpdatesContainer;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\Containers\CanUpdateContainer;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -19,7 +23,8 @@ class UpdateContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Updated Container',
|
||||
'message' => 'You have successfully updated the Container'
|
||||
@@ -52,19 +57,19 @@ class UpdateContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws AccessForbiddenException
|
||||
* @throws MalformedRequestException
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new ContainerObject(
|
||||
$request->input('container_reference'),
|
||||
$container->container_number,
|
||||
$request->input('container_type'),
|
||||
|
||||
$object = new ContainerObject(
|
||||
$request->input('container_reference'),
|
||||
$container->container_number,
|
||||
$request->input('container_type'),
|
||||
$request->input('seal_reference'),
|
||||
$request->input('loading_date'),
|
||||
$container->status,
|
||||
@@ -74,6 +79,12 @@ class UpdateContainerLogic extends AbstractControllerLogic
|
||||
|
||||
$query = $this->updatesContainer->execute($container, $object);
|
||||
|
||||
//no relationships
|
||||
/*
|
||||
return fractal()
|
||||
->item($query, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($query));
|
||||
|
||||
}
|
||||
|
||||
+11
-2
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transports\Services\UpdatesDispatchDateTransport;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,7 +18,8 @@ class UpdateDispatchDateContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Updated Dispatch Date Container',
|
||||
'message' => 'You have successfully updated the Dispatch Date Container'
|
||||
@@ -49,11 +51,18 @@ class UpdateDispatchDateContainerLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
$transport = $container->transports()->first();
|
||||
$query = $this->updatesDispatchDateTransport->execute($transport, Carbon::parse($request->input('dispatch_date')));
|
||||
|
||||
|
||||
//no relationships queried
|
||||
/* return fractal()
|
||||
->item($query, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transports\Services\UpdatesDropDateTransport;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use App\Transformers\ContainerTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,7 +18,8 @@ class UpdateDropDateContainerLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Updated Drop Date Container',
|
||||
'message' => 'You have successfully updated the Drop Date Container'
|
||||
@@ -49,11 +51,17 @@ class UpdateDropDateContainerLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
$transport = $container->transports()->first();
|
||||
$query = $this->updatesDropDateTransport->execute($transport, Carbon::parse($request->input('drop_date')));
|
||||
|
||||
//no relationship needed
|
||||
/* return fractal()
|
||||
->item($query, new ContainerTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
}
|
||||
|
||||
|
||||
+13
-5
@@ -14,6 +14,7 @@ use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
|
||||
use App\Http\Resources\DeliverPackingListResource;
|
||||
use App\Transformers\DeliverPackingListTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -24,7 +25,8 @@ class CreateDeliverPackingListLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Deliver PackingList',
|
||||
'message' => 'You have successfully created a new Deliver PackingList'
|
||||
@@ -60,7 +62,7 @@ class CreateDeliverPackingListLogic extends AbstractControllerLogic
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$company_module = $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]);
|
||||
$packing_list_id = $request->input('packing_list_id');
|
||||
@@ -68,9 +70,9 @@ class CreateDeliverPackingListLogic extends AbstractControllerLogic
|
||||
$reference_number = $this->generatesPackingListReferenceNumber->execute();
|
||||
|
||||
$packingListObject = new PackingListObject(
|
||||
$reference_number,
|
||||
null,
|
||||
PackingListType::DELIVERY_PACKING_LIST,
|
||||
$reference_number,
|
||||
null,
|
||||
PackingListType::DELIVERY_PACKING_LIST,
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
@@ -82,6 +84,12 @@ class CreateDeliverPackingListLogic extends AbstractControllerLogic
|
||||
|
||||
$deliverPackingList->packing_list_owner()->sync($packing_list_id);
|
||||
|
||||
//no relationships required
|
||||
/* return fractal()
|
||||
->item($deliverPackingList, new DeliverPackingListTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
|
||||
return $this->resourceResponse(new DeliverPackingListResource($deliverPackingList));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,11 @@ use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists;
|
||||
use App\Http\Resources\PackingListNullOrderResource;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use App\Transformers\PackageListTransformer;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Fractalistic\ArraySerializer;
|
||||
|
||||
class ListPackingListsLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -18,7 +20,8 @@ class ListPackingListsLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved PackingLists',
|
||||
'message' => 'You have successfully retrieved a list of PackingLists'
|
||||
@@ -48,13 +51,22 @@ class ListPackingListsLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$this->canListPackingLists->passes();
|
||||
|
||||
$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(PackingListResource::collection($query));
|
||||
return fractal()
|
||||
->parseIncludes(['transport', 'packages'])
|
||||
->collection($query, new PackageListTransformer(), "data")
|
||||
->serializeWith(new ArraySerializer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);
|
||||
|
||||
|
||||
//return $this->collectionResponse(PackingListResource::collection($query));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PerfexCRM\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreatesPerfexCRMSupportTicket
|
||||
{
|
||||
/**
|
||||
* @param string $subject
|
||||
* @param string $department
|
||||
* @param int $contactid
|
||||
* @param int $userid
|
||||
* @return null|object
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(string $subject, string $department, int $contactid, int $userid) {
|
||||
try{
|
||||
$data = [
|
||||
'subject' => $subject,
|
||||
'department' => $department,
|
||||
'contactid' => $contactid,
|
||||
'userid' => $userid,
|
||||
];
|
||||
|
||||
$response = Http::asForm()->withHeaders([
|
||||
'authtoken' => config('perfexcrm.api_key')])
|
||||
->post(config('perfexcrm.base_url').'/api/tickets',$data);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
return (object) $data;
|
||||
}else{
|
||||
Log::error($response);
|
||||
return null;
|
||||
}
|
||||
}catch(\Exception $exception){
|
||||
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Notifications\InvoiceIssuedEmail;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\Document;
|
||||
|
||||
class CreateCombinedInvoicesLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Shipping Invoice Status',
|
||||
'message' => 'You have successfully updated multiple shipping invoices status'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFiles;
|
||||
|
||||
/**
|
||||
* ApprovePaymentVerificationLogic constructor.
|
||||
* @param FetchesPackingList $fetchesPackingList
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreatesDocument $createsDocument
|
||||
* @param CreatesFiles $createsFiles
|
||||
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesTransactionStatus $updatesTransactionStatus, CreatesDocument $createsDocument, CreatesFiles $createsFiles)
|
||||
{
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFiles = $createsFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$items = $request->input('ids');
|
||||
$invoice_transactions=array();
|
||||
foreach($items as $item){
|
||||
|
||||
$packing_list = $this->fetchesPackingList->execute(['id' => $item['id']]);
|
||||
|
||||
$invoice_transaction = $packing_list->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::PENDING_SUBMISSION])->first();
|
||||
array_push($invoice_transactions, $invoice_transaction);
|
||||
|
||||
// $this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoices_combined', ['invoice_transactions' => $invoice_transactions]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'shipping_invoice'
|
||||
);
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
|
||||
|
||||
$this->createsFiles->execute($document, $document_object);
|
||||
$user = $packing_list->owner->companyModule->employees()->first();
|
||||
if(app()->environment(['production'])) {
|
||||
$user->notify(new InvoiceIssuedEmail($user, $packing_list));
|
||||
}
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\ListsGroups;
|
||||
use App\Http\Resources\GroupResource;
|
||||
use App\Transformers\GroupTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -22,7 +23,8 @@ class ListGroupsLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Retrieved Groups',
|
||||
'message' => 'You have successfully retrieved a list of groups'
|
||||
@@ -32,10 +34,15 @@ class ListGroupsLogic extends AbstractControllerLogic
|
||||
/** @var ListsGroups */
|
||||
private $listsGroups;
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$query = $this->listsGroups->execute($this->listsGroups->deserializeFilters($request->input('filters')));
|
||||
|
||||
//no relationship needed
|
||||
/* return fractal()
|
||||
->collection($query, new GroupTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->collectionResponse(GroupResource::collection($query));
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class UpdateGroupLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Update Group Transaction',
|
||||
'message' => 'You have successfully updated this Group Transaction'
|
||||
@@ -86,7 +87,7 @@ class UpdateGroupLogic extends AbstractControllerLogic
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$group = $this->fetchesGroup->execute(['id' => $request->route('id')]);
|
||||
|
||||
@@ -100,7 +101,7 @@ class UpdateGroupLogic extends AbstractControllerLogic
|
||||
// $group->transactions()->update(['amount' => DB::raw('(original_amount * (1 / currency_rate)) + service_charge + tax')]);
|
||||
|
||||
|
||||
foreach($transactions as $transaction) {
|
||||
foreach ($transactions as $transaction) {
|
||||
|
||||
$constant = SegmentConstant::where('reference', SegmentConstants::SERVICE_CHARGE)->where('detail->id', $supplier->id)->first();
|
||||
$serviceCharge = $this->calculatesTransactionServiceCharge->execute($transaction->original_amount, $rate, $constant);
|
||||
@@ -169,7 +170,7 @@ class UpdateGroupLogic extends AbstractControllerLogic
|
||||
|
||||
$object = new DocumentObject(
|
||||
DocumentType::CURRENCY_VENDOR_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($pdf->output()))],
|
||||
[chunk_split('data:application/pdf;base64,' . base64_encode($pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'currency_vendor_order'
|
||||
@@ -179,6 +180,11 @@ class UpdateGroupLogic extends AbstractControllerLogic
|
||||
$document = $this->createsDocument->execute($group, $object);
|
||||
$this->createsFile->execute($document, $object);
|
||||
|
||||
//no relationship needed
|
||||
/* return fractal()
|
||||
->item($group, new GroupTransformer())
|
||||
->respond(200, [], JSON_PRETTY_PRINT);*/
|
||||
|
||||
return $this->resourceResponse(new GroupResource($group));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class QAType {
|
||||
|
||||
public const DEFAULT = 0;
|
||||
|
||||
public const MULTIPLE_CHOICES = 1;
|
||||
|
||||
public const FREE_TEXT = 2;
|
||||
|
||||
public const DOCUMENT_UPLOAD = 3;
|
||||
|
||||
public const ANSWER = 4;
|
||||
|
||||
public const TICKET_CRM = 5;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class RouteType {
|
||||
|
||||
public const WEB = 1;
|
||||
|
||||
public const API = 2;
|
||||
|
||||
}
|
||||
+17
-12
@@ -28,26 +28,31 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
|
||||
$schedule->command('command:curlVTCommand')
|
||||
->cron('0 8 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/curlvt.log');
|
||||
// $schedule->command('command:curlVTCommand')
|
||||
// ->cron('0 8 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/curlvt.log');
|
||||
|
||||
$schedule->command('command:curlYdOrderListCommand')
|
||||
->cron('30 9-18/3 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/curlyd.log');
|
||||
// $schedule->command('command:curlYdOrderListCommand')
|
||||
// ->cron('30 9-18/3 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/curlyd.log');
|
||||
|
||||
$schedule->command('command:curlYdOrderListCommand')
|
||||
->cron('0 9 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/departure_email.log');
|
||||
// $schedule->command('command:curlYdOrderListCommand')
|
||||
// ->cron('0 9 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/departure_email.log');
|
||||
|
||||
$schedule->command('invoice:generate')
|
||||
->hourly()
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
|
||||
|
||||
$schedule->command('approve:invoice')
|
||||
->hourly()
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/approve_invoice.log');
|
||||
|
||||
$schedule->command('billplz-failed-callback:fix')
|
||||
->dailyAt('00:00')
|
||||
->withoutOverlapping()
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\HelpMenu;
|
||||
|
||||
use App\Classes\Modules\HelpMenu\ControllersLogic\FetchHelpMenuQuestionLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchHelpMenuQuestionController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchHelpMenuQuestionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchHelpMenuQuestionLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\HelpMenu;
|
||||
|
||||
use App\Classes\Modules\HelpMenu\ControllersLogic\UpdateHelpMenuNextQuestionLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateHelpMenuNextQuestionController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchQAQuestionListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, UpdateHelpMenuNextQuestionLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -19,43 +19,87 @@ use Illuminate\Http\Request;
|
||||
|
||||
class MonthlyReportController
|
||||
{
|
||||
public function salesReport(Request $request): JsonResponse {
|
||||
$from = $request->route('from') ? Carbon::parse($request->route('from')) : Carbon::now()->startOfMonth();
|
||||
$to = $request->route('to') ? Carbon::parse($request->route('to')) : Carbon::now()->endOfMonth();
|
||||
|
||||
$receivedCbm = Package::warehouseReceiveList()->whereHas('deliveryTransports', function ($transport) use ($from, $to) {
|
||||
return $transport->whereBetween('drop_date', [$from, $to]);
|
||||
})->get()->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
});
|
||||
/**
|
||||
* Get Containers
|
||||
* @param $from
|
||||
* @param $to
|
||||
* @return mixed
|
||||
*/
|
||||
private function getContainersByLoadingDate($from, $to)
|
||||
{
|
||||
return Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
|
||||
$containers = Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
}
|
||||
|
||||
$customers = $containers->flatMap(function ($container) {
|
||||
return $container->companyModules;
|
||||
})->unique();
|
||||
private function getPackages($from, $to)
|
||||
{
|
||||
|
||||
$orders = $containers->flatMap(function ($container) {
|
||||
return $container->orders;
|
||||
})->unique();
|
||||
$containers = $this->getContainersByLoadingDate($from, $to);
|
||||
|
||||
$packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
});
|
||||
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
return $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});
|
||||
|
||||
$totalCbm = $packages->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
}
|
||||
|
||||
public function salesReport(Request $request): JsonResponse
|
||||
{
|
||||
$from = $request->route('from') ? Carbon::parse($request->route('from')) : Carbon::now()->startOfMonth();
|
||||
$to = $request->route('to') ? Carbon::parse($request->route('to')) : Carbon::now()->endOfMonth();
|
||||
|
||||
/* $receivedCbm = Package::warehouseReceiveList()->whereHas('deliveryTransports', function ($transport) use ($from, $to) {
|
||||
return $transport->whereBetween('drop_date', [$from, $to]);
|
||||
})->get()->sum(function($package){
|
||||
});*/
|
||||
|
||||
|
||||
$receivedCbm = Package::with('deliveryTransports')
|
||||
->warehouseReceiveList()
|
||||
->whereHas('deliveryTransports', function ($transport) use ($from, $to) {
|
||||
return $transport->whereBetween('drop_date', [$from, $to]);
|
||||
})
|
||||
->get()
|
||||
->sum(function ($package) {
|
||||
return (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
$containers = Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
|
||||
$customers = $containers->flatMap(function ($container) {
|
||||
return $container->companyModules;
|
||||
})->unique()->count();
|
||||
|
||||
$orders = $containers->flatMap(function ($container) {
|
||||
return $container->orders;
|
||||
})->unique()->count();
|
||||
|
||||
$packages = $this->getPackages($from, $to);
|
||||
|
||||
/* $packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
});
|
||||
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});*/
|
||||
|
||||
$totalCbm = $packages->sum(function ($package) {
|
||||
return (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
$newCustomers = CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->count();
|
||||
$newConvertedCustomers = CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->whereHas('orders', function($order){
|
||||
$newConvertedCustomers = CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->whereHas('orders', function ($order) {
|
||||
return $order->whereHas('packingLists');
|
||||
})->count();
|
||||
|
||||
@@ -70,8 +114,8 @@ class MonthlyReportController
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
'containers' => count($containers),
|
||||
'activated_orders' => count($orders),
|
||||
'active_customers' => count($customers),
|
||||
'activated_orders' => $orders,
|
||||
'active_customers' => $customers,
|
||||
'new_customers' => $newCustomers,
|
||||
'new_converted_customers' => $newConvertedCustomers,
|
||||
'total_customers' => CompanyModule::where('type', BusinessType::IMPORTER)->count(),
|
||||
@@ -83,46 +127,46 @@ class MonthlyReportController
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function profitModelReport(Request $request): JsonResponse {
|
||||
public function profitModelReport(Request $request): JsonResponse
|
||||
{
|
||||
$from = $request->route('from') ? Carbon::parse($request->route('from')) : Carbon::now()->startOfMonth();
|
||||
$to = $request->route('to') ? Carbon::parse($request->route('to')) : Carbon::now()->endOfMonth();
|
||||
$model = (int) $request->route('model');
|
||||
$value = (float) $request->route('value');
|
||||
$model = (int)$request->route('model');
|
||||
$value = (float)$request->route('value');
|
||||
|
||||
$packages = $this->getPackages($from, $to);
|
||||
|
||||
$containers = Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
/* $packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
});
|
||||
|
||||
$packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});*/
|
||||
|
||||
$totalCbm = $packages->sum(function ($package) {
|
||||
return (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});
|
||||
$projectedCbm = $packages->sum(function ($package) use ($value, $model) {
|
||||
|
||||
$totalCbm = $packages->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
$projectedCbm = $packages->sum(function($package) use ($value, $model) {
|
||||
|
||||
if($model === 2){
|
||||
return (( (float) ($package->width + ($package->width * ($value/100))) / 100) * ( (float) ($package->length + ($package->length * ($value/100))) / 100) * ( (float) ($package->height + ($package->height * ($value/100))) / 100)) * $package->quantity;
|
||||
if ($model === 2) {
|
||||
return (((float)($package->width + ($package->width * ($value / 100))) / 100) * ((float)($package->length + ($package->length * ($value / 100))) / 100) * ((float)($package->height + ($package->height * ($value / 100))) / 100)) * $package->quantity;
|
||||
}
|
||||
|
||||
if($model === 3){
|
||||
return ((( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) + $value) * $package->quantity;
|
||||
if ($model === 3) {
|
||||
return ((((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) + $value) * $package->quantity;
|
||||
}
|
||||
|
||||
if($model === 4){
|
||||
$packageCbm = (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100));
|
||||
return ( $packageCbm + ($packageCbm * ($value/100))) * $package->quantity;
|
||||
if ($model === 4) {
|
||||
$packageCbm = (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100));
|
||||
return ($packageCbm + ($packageCbm * ($value / 100))) * $package->quantity;
|
||||
}
|
||||
|
||||
return (( (float) ($package->width + $value) / 100) * ( (float) ($package->length + $value) / 100) * ( (float) ($package->height + $value) / 100)) * $package->quantity;
|
||||
return (((float)($package->width + $value) / 100) * ((float)($package->length + $value) / 100) * ((float)($package->height + $value) / 100)) * $package->quantity;
|
||||
|
||||
});
|
||||
|
||||
@@ -134,7 +178,8 @@ class MonthlyReportController
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function customerReport(Request $request): JsonResponse {
|
||||
public function customerReport(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$connection = CompanyConnection::where('invitee_reference', $request->route('marking'))->firstOrFail();
|
||||
$id = $connection->invitee->id;
|
||||
@@ -142,20 +187,22 @@ class MonthlyReportController
|
||||
$from = $request->route('from') ? Carbon::parse($request->route('from')) : Carbon::parse('01-01-2018');
|
||||
$to = $request->route('to') ? Carbon::parse($request->route('to')) : Carbon::now();
|
||||
|
||||
$containers = Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
/* $containers = $this->getContainersByLoadingDate($from, $to);
|
||||
|
||||
$packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
});
|
||||
$packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
});
|
||||
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});*/
|
||||
|
||||
$packages = $packages->filter(function($package) use ($id) {
|
||||
$packages = $this->getPackages($from, $to);
|
||||
|
||||
$packages = $packages->filter(function ($package) use ($id) {
|
||||
return $package->companyModule->id === $id;
|
||||
});
|
||||
|
||||
@@ -163,8 +210,8 @@ class MonthlyReportController
|
||||
return $package->order;
|
||||
});
|
||||
|
||||
$totalCbm = $packages->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
$totalCbm = $packages->sum(function ($package) {
|
||||
return (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
return (new ApiResponseObject('fetch monthly report Successful',
|
||||
@@ -176,32 +223,72 @@ class MonthlyReportController
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function serviceReport(Request $request): JsonResponse {
|
||||
public function serviceReport(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
return (new ApiResponseObject('fetch service report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
'received' => (float) Package::warehouseReceiveList()->sum('quantity'),
|
||||
'pending_shipment' => (float) Package::shippingList()->whereDoesntHave('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'in_transit' => (float) Package::shippingList()->Shipping()->whereHas('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->whereDoesntHave('container', function($container){
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->sum('quantity'),
|
||||
'pending_delivery' => (float) Package::shippingList()->whereHas('container', function($container){
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->whereDoesntHave('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'delivered' => (float) Package::shippingList()->whereHas('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'received' => (float)Package::warehouseReceiveList()->sum('quantity'),
|
||||
|
||||
/* 'pending_shipment' => (float)Package::shippingList()->whereDoesntHave('shippingSchedules', function ($schedule) {
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
|
||||
'in_transit' => (float) Package::shippingList()->Shipping()->whereHas('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->whereDoesntHave('container', function($container){
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->sum('quantity'),
|
||||
'pending_delivery' => (float) Package::shippingList()->whereHas('container', function($container){
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->whereDoesntHave('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),
|
||||
'delivered' => (float) Package::shippingList()->whereHas('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->sum('quantity'),*/
|
||||
|
||||
'pending_shipment' => (float)Package::shippingList()
|
||||
->whereDoesntHave('shippingSchedules', function ($schedule) {
|
||||
$statuses = [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED];
|
||||
$schedule->dispatched()->whereIn('schedules.status', $statuses);
|
||||
})
|
||||
->sum('quantity'),
|
||||
|
||||
'in_transit' => (float)Package::shippingList()
|
||||
->whereHas('shippingSchedules', function ($schedule) {
|
||||
$statuses = [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED];
|
||||
$schedule->dispatched()->whereIn('schedules.status', $statuses);
|
||||
})
|
||||
->whereDoesntHave('container', function ($container) {
|
||||
$container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})
|
||||
->sum('quantity'),
|
||||
|
||||
'pending_delivery' => (float)Package::shippingList()
|
||||
->whereHas('container', function ($container) {
|
||||
$container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})
|
||||
->whereDoesntHave('deliverySchedules', function ($schedule) {
|
||||
$statuses = [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED];
|
||||
$schedule->dispatched()->whereIn('schedules.status', $statuses);
|
||||
})
|
||||
->sum('quantity'),
|
||||
|
||||
'delivered' => (float)Package::shippingList()
|
||||
->whereHas('deliverySchedules', function ($schedule) {
|
||||
$statuses = [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED];
|
||||
$schedule->dispatched()->whereIn('schedules.status', $statuses);
|
||||
})
|
||||
->sum('quantity')
|
||||
|
||||
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function customerActivityReport(Request $request): JsonResponse {
|
||||
public function customerActivityReport(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
$active_start = $request->input('active_start');
|
||||
$active_end = $request->input('active_end');
|
||||
@@ -210,44 +297,97 @@ class MonthlyReportController
|
||||
$minCbm = $request->input('cbm');
|
||||
$minOrders = $request->input('minOrders');
|
||||
|
||||
$activeCompanies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($inactive_start, $inactive_end) {
|
||||
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('drop_date', '>=', \Carbon\Carbon::parse($inactive_start))->where('drop_date', '<=', \Carbon\Carbon::parse($inactive_end)->addDay());
|
||||
});
|
||||
})->pluck('id');
|
||||
/* $activeCompanies = CompanyModule::where('type', BusinessType::IMPORTER)->whereHas('orderPackingLists', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('packing_lists.type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('drop_date', '>=', Carbon::parse($inactive_start))->where('drop_date', '<=', Carbon::parse($inactive_end)->addDay());
|
||||
});
|
||||
})->pluck('id');
|
||||
|
||||
$companies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($active_start, $active_end) {
|
||||
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
|
||||
return $query->whereDate('drop_date', '>=', \Carbon\Carbon::parse($active_start))->whereDate('drop_date', '<=', \Carbon\Carbon::parse($active_end)->addDay());
|
||||
});
|
||||
})->whereNotIn('id', $activeCompanies)->get();
|
||||
$companies = CompanyModule::where('type', BusinessType::IMPORTER)->whereHas('orderPackingLists', function ($query) use ($active_start, $active_end) {
|
||||
return $query->where('packing_lists.type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
|
||||
return $query->whereDate('drop_date', '>=', Carbon::parse($active_start))->whereDate('drop_date', '<=', Carbon::parse($active_end)->addDay());
|
||||
});
|
||||
})->whereNotIn('id', $activeCompanies)->get();
|
||||
|
||||
$companies = getActiveCompanies($inactive_start, $inactive_end, $active_start, $active_end);
|
||||
|
||||
$customerActivityData = [];
|
||||
$counter = 1;
|
||||
|
||||
foreach ($companies as $key => $company){
|
||||
foreach ($companies as $key => $company) {
|
||||
$connection = $company->inviters()->withPivot('invitee_reference')->first();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference:'';
|
||||
$packingList = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference : '';
|
||||
$packingList = $company->orderPackingLists()->where('packing_lists.type', PackingListType::SHIPPING_PACKING_LIST)->get();
|
||||
$totalCbm = $packingList->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
})->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
})->sum(function ($package) {
|
||||
return (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
if ($minCbm != 'null' && $totalCbm < $minCbm) { continue; }
|
||||
if ($minCbm != 'null' && $totalCbm < $minCbm) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($minOrders != 'null' && $packingList->count() < $minOrders) { continue; }
|
||||
if ($minOrders != 'null' && $packingList->count() < $minOrders) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($customerActivityData, array(
|
||||
'key' => $counter,
|
||||
'key' => $counter,
|
||||
'marking' => $marking,
|
||||
'packingListCount'=> $packingList->count(),
|
||||
'totalCbm'=> $totalCbm,
|
||||
'packingListCount' => $packingList->count(),
|
||||
'totalCbm' => $totalCbm,
|
||||
));
|
||||
$counter ++;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
$companies = getActiveCompanies($inactive_start, $inactive_end, $active_start, $active_end);
|
||||
|
||||
$customerActivityData = [];
|
||||
|
||||
$packingListType = PackingListType::SHIPPING_PACKING_LIST;
|
||||
|
||||
$companies->load([
|
||||
'inviters' => function ($query) {
|
||||
$query->withPivot('invitee_reference')->first();
|
||||
},
|
||||
'orderPackingLists' => function ($query) use ($packingListType) {
|
||||
$query->where('packing_lists.type', $packingListType)->with('packages');
|
||||
},
|
||||
]);
|
||||
|
||||
$counter = 1;
|
||||
|
||||
foreach ($companies as $company) {
|
||||
$connection = $company->inviters->first();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference : '';
|
||||
$packingList = $company->orderPackingLists;
|
||||
|
||||
$totalCbm = $packingList->flatMap->packages->sum(function ($package) {
|
||||
return (((float)$package->width / 100) * ((float)$package->length / 100) * ((float)$package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
if ($minCbm !== null && $totalCbm < $minCbm) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($minOrders !== null && $packingList->count() < $minOrders) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$customerActivityData[] = [
|
||||
'key' => $counter,
|
||||
'marking' => $marking,
|
||||
'packingListCount' => $packingList->count(),
|
||||
'totalCbm' => $totalCbm,
|
||||
];
|
||||
|
||||
$counter++;
|
||||
}
|
||||
|
||||
|
||||
return (new ApiResponseObject('fetch service report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\CreateCombinedInvoicesLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateCombinedInvoicesController
|
||||
{
|
||||
|
||||
public function combine(Request $request, CreateCombinedInvoicesLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -38,11 +38,13 @@ class Kernel extends HttpKernel
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
// \App\Http\Middleware\WebRouteLogs::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:300,1',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
// \App\Http\Middleware\ApiRouteLogs::class,
|
||||
],
|
||||
|
||||
'apipub' => [
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\RouteLog;
|
||||
use App\Classes\ValueObjects\Constants\RouteType;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ApiRouteLogs
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$ip_address = getenv('REMOTE_ADDR') == '::1' ? '127.0.0.1' : getenv('REMOTE_ADDR');
|
||||
$url = urldecode($request->fullUrl());
|
||||
$request_method = $request->method();
|
||||
$platform = $request->header('sec-ch-ua-platform');
|
||||
$browser = Str::after($request->header('sec-ch-ua'), 'Not?A_Brand";v="8", "Chromium";v="108", "');
|
||||
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$ip_address"));
|
||||
$longitude = $geo["geoplugin_longitude"];
|
||||
$latitude = $geo["geoplugin_latitude"];
|
||||
$last_page = url()->previous();
|
||||
$countryName = $geo["geoplugin_countryName"];
|
||||
|
||||
$user_id = Auth::user() ? Auth::user()->id : 0;
|
||||
|
||||
// if ($user_id != 0) {
|
||||
// // $ip_address
|
||||
// $webRouteLogWithSameIp = RouteLog::where('ip_address', $ip_address)->where('user_id', 0)->get();
|
||||
// dd($webRouteLogWithSameIp);
|
||||
// foreach($webRouteLogWithSameIp as $result){
|
||||
// $result
|
||||
// }
|
||||
// }
|
||||
|
||||
$route_log = [
|
||||
'user_id' => $user_id,
|
||||
// 'ip_address' => $request->ip(),
|
||||
'ip_address' => $ip_address,
|
||||
'url' => $url,
|
||||
'request_method' => $request_method,
|
||||
'browser' => $browser,
|
||||
'platform' => $platform,
|
||||
'longitude' => $longitude,
|
||||
'latitude' => $latitude,
|
||||
'last_page' => $last_page,
|
||||
'countryname' => $countryName,
|
||||
'route_type' => RouteType::API,
|
||||
];
|
||||
|
||||
RouteLog::create($route_log);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\RouteLog;
|
||||
use App\Classes\ValueObjects\Constants\RouteType;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class WebRouteLogs
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$ip_address = getenv('REMOTE_ADDR') == '::1' ? '127.0.0.1' : getenv('REMOTE_ADDR');
|
||||
$url = $request->fullUrl();
|
||||
$request_method = $request->method();
|
||||
$platform = $request->header('sec-ch-ua-platform');
|
||||
$browser = Str::after($request->header('sec-ch-ua'), 'Not?A_Brand";v="8", "Chromium";v="108", "');
|
||||
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$ip_address"));
|
||||
$longitude = $geo["geoplugin_longitude"];
|
||||
$latitude = $geo["geoplugin_latitude"];
|
||||
$last_page = url()->previous();
|
||||
$countryName = $geo["geoplugin_countryName"];
|
||||
|
||||
$route_log = [
|
||||
'user_id' => Auth::user() ? Auth::user()->id : 0,
|
||||
// 'ip_address' => $request->ip(),
|
||||
'ip_address' => $ip_address,
|
||||
'url' => $url,
|
||||
'request_method' => $request_method,
|
||||
'browser' => $browser,
|
||||
'platform' => $platform,
|
||||
'longitude' => $longitude,
|
||||
'latitude' => $latitude,
|
||||
'last_page' => $last_page,
|
||||
'countryname' => $countryName,
|
||||
'route_type' => RouteType::WEB,
|
||||
];
|
||||
|
||||
// dd($route_log);
|
||||
|
||||
RouteLog::create($route_log);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AirShipmentItemPriceResource extends JsonResource
|
||||
@@ -9,10 +10,10 @@ class AirShipmentItemPriceResource extends JsonResource
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
public function toArray($request): array
|
||||
{
|
||||
$object = $this->resource;
|
||||
$detailsArray = (array)json_decode($object['details']);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Carbon\Carbon;
|
||||
|
||||
@@ -10,10 +11,10 @@ class AnnouncementResource extends JsonResource
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BankResource extends JsonResource
|
||||
@@ -9,10 +10,10 @@ class BankResource extends JsonResource
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/*todo delete this*/
|
||||
class BookingResource extends JsonResource
|
||||
{
|
||||
|
||||
|
||||
@@ -28,4 +28,16 @@ class DocumentResource extends JsonResource
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* include only when should include file, to be loaded if needed in the UI
|
||||
* @param bool $includeFile
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldIncludeFiles(bool $includeFile): bool
|
||||
{
|
||||
return $includeFile;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class HelpMenuAnswerOptionsResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'display_text' => $this->display_text,
|
||||
'value' => $this->value,
|
||||
'order' => $this->order,
|
||||
'question_number' => $this->question_number,
|
||||
'next_question_number' => $this->next_question_number,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Models\QAQuestions;
|
||||
use App\Models\QAAnswerOptions;
|
||||
use App\Models\QAUserAnswerSelected;
|
||||
|
||||
class HelpMenuQuestionResource extends JsonResource
|
||||
{
|
||||
/** @var integer */
|
||||
private $userId;
|
||||
|
||||
/** @var QAQuestions*/
|
||||
private $question;
|
||||
|
||||
public function __construct($question, $userId) {
|
||||
$this->question = $question;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
if($this->question){
|
||||
$q = (object)$this->question;
|
||||
return [
|
||||
'id' => $q->id,
|
||||
'question_number' => $q->question_number,
|
||||
'question_text' => $q->question_text,
|
||||
'question_type' => $q->question_type,
|
||||
'question_answers' => HelpMenuAnswerOptionsResource::collection(QAAnswerOptions::where('question_number', $q->question_number)->get()),
|
||||
'questionnaire_set_id' => $q->questionnaire_set_id,
|
||||
'next_nested_question' => $q->next_nested_question,
|
||||
'next_main_question' => $q->next_main_question,
|
||||
'is_start' => $q->is_start,
|
||||
'is_end' => $q->is_end,
|
||||
'end_text' => $q->end_text,
|
||||
'order' => $q->order,
|
||||
'answer' => QAUserAnswerSelected::where('question_id', $q->id)->where('user_id', $this->userId)->first(),
|
||||
'questionnaire_answers' => $q->is_end ? HelpMenuQuestionnaireAnswersResource::collection(QAUserAnswerSelected::where('user_id', $this->userId)->get()) : null,
|
||||
];
|
||||
}
|
||||
else{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Models\QAQuestions;
|
||||
|
||||
class HelpMenuQuestionnaireAnswersResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$question = QAQuestions::where('id', $this->question_id)->first();
|
||||
return [
|
||||
'question_text' => $question ? $question->question_text : null,
|
||||
'free_text_answer' => $this->free_text_answer
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
use Spatie\Fractalistic\ArraySerializer;
|
||||
|
||||
class DefaultFractalSerializer extends ArraySerializer
|
||||
{
|
||||
/**
|
||||
* @param $resourceKey
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function collection($resourceKey, array $data):array
|
||||
{
|
||||
if ($resourceKey) {
|
||||
return $resourceKey == 'include' ? $data : [$resourceKey => $data];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $resourceKey
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function item($resourceKey, array $data):array
|
||||
{
|
||||
if ($resourceKey) {
|
||||
return $resourceKey == 'include' ? $data : [$resourceKey => $data];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
//global helpers functions here
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyModule;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Get Active companies
|
||||
* TODO add extract BusinessType::IMPORTER to a $businessType parameter
|
||||
* @param $inactive_start
|
||||
* @param $inactive_end
|
||||
* @param $active_start
|
||||
* @param $active_end
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
if (!function_exists('getActiveCompanies')) {
|
||||
function getActiveCompanies($inactive_start, $inactive_end, $active_start, $active_end)
|
||||
{
|
||||
$activeCompanies = CompanyModule::where('type', BusinessType::IMPORTER)->whereHas('orderPackingLists', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('packing_lists.type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('drop_date', '>=', Carbon::parse($inactive_start))->where('drop_date', '<=', Carbon::parse($inactive_end)->addDay());
|
||||
});
|
||||
})->pluck('id');
|
||||
|
||||
return CompanyModule::where('type', BusinessType::IMPORTER)->whereHas('orderPackingLists', function ($query) use ($active_start, $active_end) {
|
||||
return $query->where('packing_lists.type', PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
|
||||
return $query->whereDate('drop_date', '>=', Carbon::parse($active_start))->whereDate('drop_date', '<=', Carbon::parse($active_end)->addDay());
|
||||
});
|
||||
})->whereNotIn('id', $activeCompanies)->get();
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Get Packing List
|
||||
* TODO change all packing related query to this
|
||||
* @param Company $company
|
||||
* @return mixed
|
||||
*/
|
||||
if (!function_exists('getPackingList')) {
|
||||
function getPackingList(Company $company)
|
||||
{
|
||||
return $company->orderPackingLists()->where('packing_lists.type', PackingListType::SHIPPING_PACKING_LIST)->get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Get Packing List
|
||||
* TODO change all packing related query to this
|
||||
* @param Company $company
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
if (!function_exists('format_number')) {
|
||||
function format_number($number): string
|
||||
{
|
||||
if ($number == 0) {
|
||||
return $number;
|
||||
} elseif (is_float($number)) {
|
||||
return number_format($number, 2);
|
||||
} else {
|
||||
return number_format($number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a customer have confirmed orders
|
||||
* @param Company $company
|
||||
* @return bool
|
||||
*/
|
||||
if (!function_exists('checkIfHasConfirmedOrders'))
|
||||
{
|
||||
function checkIfHasConfirmedOrders(Company $company): bool
|
||||
{
|
||||
return $company->hasConfirmedOrder();
|
||||
}
|
||||
}
|
||||
|
||||
+55
-2
@@ -4,16 +4,22 @@ namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use Barryvdh\LaravelIdeHelper\Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* Class Address
|
||||
* @package App\Models
|
||||
*
|
||||
* @package App\Models
|
||||
* @property int country_id
|
||||
* @property int company_id
|
||||
* @property int state_id
|
||||
@@ -22,6 +28,53 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
* @property string street_one
|
||||
* @property string street_two
|
||||
* @property integer billing_type
|
||||
* @property int $id
|
||||
* @property string $owner_type
|
||||
* @property int $owner_id
|
||||
* @property string|null $reference
|
||||
* @property int $type
|
||||
* @property int $default
|
||||
* @property int $status
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|Eloquent $causer
|
||||
* @property-read Collection|Contact[] $contacts
|
||||
* @property-read int|null $contacts_count
|
||||
* @property-read Country|null $country
|
||||
* @property-read District|null $district
|
||||
* @property-read Model|Eloquent $owner
|
||||
* @property-read Collection|Remark[] $remarks
|
||||
* @property-read int|null $remarks_count
|
||||
* @property-read State|null $state
|
||||
* @property-read Model|Eloquent $subject
|
||||
* @property-read Model|Eloquent $target
|
||||
* @method static Builder|Address defaultAddress()
|
||||
* @method static Builder|Address newModelQuery()
|
||||
* @method static Builder|Address newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Address onlyTrashed()
|
||||
* @method static Builder|Address query()
|
||||
* @method static Builder|Address whereCountryId($value)
|
||||
* @method static Builder|Address whereCreatedAt($value)
|
||||
* @method static Builder|Address whereDefault($value)
|
||||
* @method static Builder|Address whereDeletedAt($value)
|
||||
* @method static Builder|Address whereDistrictId($value)
|
||||
* @method static Builder|Address whereId($value)
|
||||
* @method static Builder|Address whereOwnerId($value)
|
||||
* @method static Builder|Address whereOwnerType($value)
|
||||
* @method static Builder|Address wherePostcode($value)
|
||||
* @method static Builder|Address whereReference($value)
|
||||
* @method static Builder|Address whereStateId($value)
|
||||
* @method static Builder|Address whereStatus($value)
|
||||
* @method static Builder|Address whereStreetOne($value)
|
||||
* @method static Builder|Address whereStreetTwo($value)
|
||||
* @method static Builder|Address whereType($value)
|
||||
* @method static Builder|Address whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Address withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Address withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Address extends AbstractModel implements Contactable, Remarkable
|
||||
{
|
||||
@@ -58,7 +111,7 @@ class Address extends AbstractModel implements Contactable, Remarkable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
|
||||
@@ -2,13 +2,56 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* Class Announcement
|
||||
* @package App\Models
|
||||
*
|
||||
* @package App\Models
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property string $description
|
||||
* @property string|null $starting_on
|
||||
* @property string|null $ending_on
|
||||
* @property int $is_all_day
|
||||
* @property int $duration
|
||||
* @property int $is_recurring
|
||||
* @property string|null $recurrence_pattern
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Collection|Segment[] $segments
|
||||
* @property-read int|null $segments_count
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @method static Builder|Announcement newModelQuery()
|
||||
* @method static Builder|Announcement newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Announcement onlyTrashed()
|
||||
* @method static Builder|Announcement query()
|
||||
* @method static Builder|Announcement whereCreatedAt($value)
|
||||
* @method static Builder|Announcement whereDeletedAt($value)
|
||||
* @method static Builder|Announcement whereDescription($value)
|
||||
* @method static Builder|Announcement whereDuration($value)
|
||||
* @method static Builder|Announcement whereEndingOn($value)
|
||||
* @method static Builder|Announcement whereId($value)
|
||||
* @method static Builder|Announcement whereIsAllDay($value)
|
||||
* @method static Builder|Announcement whereIsRecurring($value)
|
||||
* @method static Builder|Announcement whereRecurrencePattern($value)
|
||||
* @method static Builder|Announcement whereStartingOn($value)
|
||||
* @method static Builder|Announcement whereTitle($value)
|
||||
* @method static Builder|Announcement whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Announcement withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Announcement withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Announcement extends AbstractModel
|
||||
{
|
||||
@@ -17,7 +60,7 @@ class Announcement extends AbstractModel
|
||||
protected $table = 'announcements';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
**/
|
||||
public function segments(): BelongsToMany
|
||||
{
|
||||
|
||||
@@ -3,13 +3,64 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* App\Models\BankAccount
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $owner_type
|
||||
* @property int $owner_id
|
||||
* @property int $country_id
|
||||
* @property string $bank_name
|
||||
* @property string|null $bank_branch
|
||||
* @property string $account_name
|
||||
* @property string $account_number
|
||||
* @property int $type
|
||||
* @property int $default
|
||||
* @property int $status
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Country|null $country
|
||||
* @property-read Model|\Eloquent $owner
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @method static Builder|BankAccount newModelQuery()
|
||||
* @method static Builder|BankAccount newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|BankAccount onlyTrashed()
|
||||
* @method static Builder|BankAccount query()
|
||||
* @method static Builder|BankAccount whereAccountName($value)
|
||||
* @method static Builder|BankAccount whereAccountNumber($value)
|
||||
* @method static Builder|BankAccount whereBankBranch($value)
|
||||
* @method static Builder|BankAccount whereBankName($value)
|
||||
* @method static Builder|BankAccount whereCountryId($value)
|
||||
* @method static Builder|BankAccount whereCreatedAt($value)
|
||||
* @method static Builder|BankAccount whereDefault($value)
|
||||
* @method static Builder|BankAccount whereDeletedAt($value)
|
||||
* @method static Builder|BankAccount whereId($value)
|
||||
* @method static Builder|BankAccount whereOwnerId($value)
|
||||
* @method static Builder|BankAccount whereOwnerType($value)
|
||||
* @method static Builder|BankAccount whereStatus($value)
|
||||
* @method static Builder|BankAccount whereType($value)
|
||||
* @method static Builder|BankAccount whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|BankAccount withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|BankAccount withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BankAccount extends AbstractModel implements DataTransferObject
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
+74
-6
@@ -5,24 +5,72 @@ namespace App\Models;
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
/**
|
||||
* Class Company
|
||||
* @package App\Models
|
||||
*
|
||||
* @property \App\Models\Country country_id
|
||||
* @property \App\Models\State state_id
|
||||
* @property \App\Models\District district_id
|
||||
* @package App\Models
|
||||
* @property Country country_id
|
||||
* @property State state_id
|
||||
* @property District district_id
|
||||
* @property string postcode
|
||||
* @property string street_one
|
||||
* @property string street_two
|
||||
* @property integer billing_type
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $reference
|
||||
* @property string|null $debtor
|
||||
* @property int $type
|
||||
* @property int $status
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Collection|Address[] $addresses
|
||||
* @property-read int|null $addresses_count
|
||||
* @property-read Collection|BankAccount[] $banks
|
||||
* @property-read int|null $banks_count
|
||||
* @property-read Model|Eloquent $causer
|
||||
* @property-read Collection|CompanyModule[] $companyModules
|
||||
* @property-read int|null $company_modules_count
|
||||
* @property-read Collection|Contact[] $contacts
|
||||
* @property-read int|null $contacts_count
|
||||
* @property-read Collection|Document[] $documents
|
||||
* @property-read int|null $documents_count
|
||||
* @property-read Collection|User[] $employees
|
||||
* @property-read int|null $employees_count
|
||||
* @property-read Model|Eloquent $subject
|
||||
* @property-read Model|Eloquent $target
|
||||
* @method static Builder|Company newModelQuery()
|
||||
* @method static Builder|Company newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Company onlyTrashed()
|
||||
* @method static Builder|Company query()
|
||||
* @method static Builder|Company whereCreatedAt($value)
|
||||
* @method static Builder|Company whereDebtor($value)
|
||||
* @method static Builder|Company whereDeletedAt($value)
|
||||
* @method static Builder|Company whereId($value)
|
||||
* @method static Builder|Company whereName($value)
|
||||
* @method static Builder|Company whereReference($value)
|
||||
* @method static Builder|Company whereStatus($value)
|
||||
* @method static Builder|Company whereType($value)
|
||||
* @method static Builder|Company whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Company withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Company withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Company extends AbstractModel implements Documentable, Contactable
|
||||
{
|
||||
@@ -63,12 +111,32 @@ class Company extends AbstractModel implements Documentable, Contactable
|
||||
$orders = [];
|
||||
|
||||
$this->CompanyModules->each(function ($companyModule) {
|
||||
$orders[] = $companyModule->orders->sortByDesc('id');
|
||||
});
|
||||
$orders[] = $companyModule->orders->sortByDesc('id');
|
||||
});
|
||||
|
||||
return collect($orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Has Confirmed orders
|
||||
* @return bool
|
||||
*/
|
||||
public function hasConfirmedOrder(): bool
|
||||
{
|
||||
$importerModule = $this->companyModules()->where('type', BusinessType::IMPORTER)->first();
|
||||
|
||||
if (!$importerModule) {
|
||||
return false; // Return false if no relation found
|
||||
}
|
||||
|
||||
$hasConfirmedOrder = $importerModule->orders()
|
||||
->where('status', '!=', 0)
|
||||
->exists();
|
||||
|
||||
return (bool)$hasConfirmedOrder;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
|
||||
@@ -10,7 +10,9 @@ use App\Classes\General\Interfaces\Packable;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -20,18 +22,83 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use PhpParser\Node\Expr\AssignOp\Mod;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
|
||||
/**
|
||||
* Class CompanyModule
|
||||
* @package App\Models
|
||||
*
|
||||
* @property \App\Models\Company company_id
|
||||
* @package App\Models
|
||||
* @property Company company_id
|
||||
* @property integer type
|
||||
* @property integer status
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $reference
|
||||
* @property string $unity_hash_id
|
||||
* @property string $unity_signature
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Collection|Address[] $addresses
|
||||
* @property-read int|null $addresses_count
|
||||
* @property-read Collection|BankAccount[] $banks
|
||||
* @property-read int|null $banks_count
|
||||
* @property-read Model|Eloquent $causer
|
||||
* @property-read Company $company
|
||||
* @property-read Collection|CompanyConnection[] $connections
|
||||
* @property-read int|null $connections_count
|
||||
* @property-read Collection|Contact[] $contacts
|
||||
* @property-read int|null $contacts_count
|
||||
* @property-read Collection|Container[] $containers
|
||||
* @property-read int|null $containers_count
|
||||
* @property-read Collection|Document[] $documents
|
||||
* @property-read int|null $documents_count
|
||||
* @property-read Collection|User[] $employees
|
||||
* @property-read int|null $employees_count
|
||||
* @property-read Collection|CompanyModule[] $inviters
|
||||
* @property-read int|null $inviters_count
|
||||
* @property-read Collection|CompanyModule[] $invites
|
||||
* @property-read int|null $invites_count
|
||||
* @property-read Collection|Order[] $orders
|
||||
* @property-read int|null $orders_count
|
||||
* @property-read Collection|PackingList[] $packingLists
|
||||
* @property-read int|null $packing_lists_count
|
||||
* @property-read Collection|Remark[] $remarks
|
||||
* @property-read int|null $remarks_count
|
||||
* @property-read Collection|Segment[] $segments
|
||||
* @property-read int|null $segments_count
|
||||
* @property-read Model|Eloquent $subject
|
||||
* @property-read Model|Eloquent $target
|
||||
* @property-read Collection|Wallet[] $wallets
|
||||
* @property-read int|null $wallets_count
|
||||
* @method static Builder|CompanyModule freightForwarders()
|
||||
* @method static Builder|CompanyModule importers()
|
||||
* @method static Builder|CompanyModule newModelQuery()
|
||||
* @method static Builder|CompanyModule newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|CompanyModule onlyTrashed()
|
||||
* @method static Builder|CompanyModule query()
|
||||
* @method static Builder|CompanyModule warehouses()
|
||||
* @method static Builder|CompanyModule whereCompanyId($value)
|
||||
* @method static Builder|CompanyModule whereCreatedAt($value)
|
||||
* @method static Builder|CompanyModule whereDeletedAt($value)
|
||||
* @method static Builder|CompanyModule whereId($value)
|
||||
* @method static Builder|CompanyModule whereName($value)
|
||||
* @method static Builder|CompanyModule whereReference($value)
|
||||
* @method static Builder|CompanyModule whereStatus($value)
|
||||
* @method static Builder|CompanyModule whereType($value)
|
||||
* @method static Builder|CompanyModule whereUnityHashId($value)
|
||||
* @method static Builder|CompanyModule whereUnitySignature($value)
|
||||
* @method static Builder|CompanyModule whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|CompanyModule withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|CompanyModule withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner, Packable, Remarkable
|
||||
{
|
||||
|
||||
+34
-1
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* Class Contact
|
||||
* @package App\Models
|
||||
*
|
||||
* @package App\Models
|
||||
* @property int owner_id
|
||||
* @property string owner_type
|
||||
* @property string reference
|
||||
@@ -16,6 +21,34 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
* @property string email
|
||||
* @property string wechat_id
|
||||
* @property int default
|
||||
* @property int $id
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Model|\Eloquent $owner
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @method static Builder|Contact newModelQuery()
|
||||
* @method static Builder|Contact newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Contact onlyTrashed()
|
||||
* @method static Builder|Contact query()
|
||||
* @method static Builder|Contact whereCreatedAt($value)
|
||||
* @method static Builder|Contact whereDefault($value)
|
||||
* @method static Builder|Contact whereDeletedAt($value)
|
||||
* @method static Builder|Contact whereEmail($value)
|
||||
* @method static Builder|Contact whereId($value)
|
||||
* @method static Builder|Contact whereOwnerId($value)
|
||||
* @method static Builder|Contact whereOwnerType($value)
|
||||
* @method static Builder|Contact wherePhone($value)
|
||||
* @method static Builder|Contact whereReference($value)
|
||||
* @method static Builder|Contact whereUpdatedAt($value)
|
||||
* @method static Builder|Contact whereWechatId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Contact withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Contact withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Contact extends AbstractModel
|
||||
{
|
||||
|
||||
@@ -5,12 +5,63 @@ namespace App\Models;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\General\Interfaces\Transportable;
|
||||
use App\Classes\General\Traits\LogData;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
/**
|
||||
* App\Models\Container
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $owner_type
|
||||
* @property int $owner_id
|
||||
* @property string $reference
|
||||
* @property string|null $container_number
|
||||
* @property int $container_type
|
||||
* @property string|null $seal_reference
|
||||
* @property Carbon|null $loading_date
|
||||
* @property int $status
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Collection|PackingList[] $packingLists
|
||||
* @property-read int|null $packing_lists_count
|
||||
* @property-read Collection|Remark[] $remarks
|
||||
* @property-read int|null $remarks_count
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @property-read Collection|\App\Models\Transport[] $transports
|
||||
* @property-read int|null $transports_count
|
||||
* @method static Builder|Container newModelQuery()
|
||||
* @method static Builder|Container newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Container onlyTrashed()
|
||||
* @method static Builder|Container query()
|
||||
* @method static Builder|Container whereContainerNumber($value)
|
||||
* @method static Builder|Container whereContainerType($value)
|
||||
* @method static Builder|Container whereCreatedAt($value)
|
||||
* @method static Builder|Container whereDeletedAt($value)
|
||||
* @method static Builder|Container whereId($value)
|
||||
* @method static Builder|Container whereLoadingDate($value)
|
||||
* @method static Builder|Container whereOwnerId($value)
|
||||
* @method static Builder|Container whereOwnerType($value)
|
||||
* @method static Builder|Container whereReference($value)
|
||||
* @method static Builder|Container whereSealReference($value)
|
||||
* @method static Builder|Container whereStatus($value)
|
||||
* @method static Builder|Container whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Container withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Container withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Container extends AbstractModel implements Transportable, Remarkable
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
+34
-2
@@ -2,20 +2,52 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\hasMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* Class Currency
|
||||
* @package App\Models
|
||||
*
|
||||
* @property \App\Models\Country country_id
|
||||
* @package App\Models
|
||||
* @property Country country_id
|
||||
* @property string name
|
||||
* @property string short_code
|
||||
* @property string symbol
|
||||
* @property int $id
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Country|null $country
|
||||
* @property-read Collection|CurrencyRate[] $rates
|
||||
* @property-read int|null $rates_count
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @method static Builder|Currency newModelQuery()
|
||||
* @method static Builder|Currency newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Currency onlyTrashed()
|
||||
* @method static Builder|Currency query()
|
||||
* @method static Builder|Currency whereCountryId($value)
|
||||
* @method static Builder|Currency whereCreatedAt($value)
|
||||
* @method static Builder|Currency whereDeletedAt($value)
|
||||
* @method static Builder|Currency whereId($value)
|
||||
* @method static Builder|Currency whereName($value)
|
||||
* @method static Builder|Currency whereShortCode($value)
|
||||
* @method static Builder|Currency whereSymbol($value)
|
||||
* @method static Builder|Currency whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Currency withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Currency withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
|
||||
class Currency extends AbstractModel
|
||||
|
||||
+41
-4
@@ -3,26 +3,63 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Traits\Timestamp;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\hasMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* Class Document
|
||||
* @package App\Models
|
||||
* @version August 4, 2020, 4:36 am
|
||||
*
|
||||
* @property int owner_id
|
||||
* @property int owner_type
|
||||
* @property int document_type
|
||||
* @property string reference
|
||||
* @property int status
|
||||
* @property \App\Models\User approver
|
||||
* @property User approver
|
||||
* @property timestamp issued_date
|
||||
* @property timestamp expired_date
|
||||
* @property timestamp approved_date
|
||||
* @property int $id
|
||||
* @property string|null $approval_date
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Collection|File[] $files
|
||||
* @property-read int|null $files_count
|
||||
* @property-read Model|\Eloquent $owner
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @method static Builder|Document newModelQuery()
|
||||
* @method static Builder|Document newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|Document onlyTrashed()
|
||||
* @method static Builder|Document query()
|
||||
* @method static Builder|Document whereApprovalDate($value)
|
||||
* @method static Builder|Document whereApprover($value)
|
||||
* @method static Builder|Document whereCreatedAt($value)
|
||||
* @method static Builder|Document whereDeletedAt($value)
|
||||
* @method static Builder|Document whereDocumentType($value)
|
||||
* @method static Builder|Document whereExpiredDate($value)
|
||||
* @method static Builder|Document whereId($value)
|
||||
* @method static Builder|Document whereIssuedDate($value)
|
||||
* @method static Builder|Document whereOwnerId($value)
|
||||
* @method static Builder|Document whereOwnerType($value)
|
||||
* @method static Builder|Document whereReference($value)
|
||||
* @method static Builder|Document whereStatus($value)
|
||||
* @method static Builder|Document whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|Document withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Document withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Document extends AbstractModel
|
||||
{
|
||||
@@ -33,7 +70,7 @@ class Document extends AbstractModel
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
@@ -43,7 +80,7 @@ class Document extends AbstractModel
|
||||
/**
|
||||
* @return hasMany
|
||||
*/
|
||||
public function files(): hasMany
|
||||
public function files(): hasMany
|
||||
{
|
||||
return $this->hasMany(File::class, 'document_id');
|
||||
}
|
||||
|
||||
+30
-2
@@ -2,17 +2,45 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
/**
|
||||
* Class File
|
||||
*
|
||||
* @package App\Models
|
||||
* @version August 4, 2020, 4:36 am
|
||||
*
|
||||
* @property \App\Models\Document document_id
|
||||
* @property Document document_id
|
||||
* @property text file
|
||||
* @property int file_type_id
|
||||
* @property int $id
|
||||
* @property string $file_type
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|\Eloquent $causer
|
||||
* @property-read Model|\Eloquent $subject
|
||||
* @property-read Model|\Eloquent $target
|
||||
* @method static Builder|File newModelQuery()
|
||||
* @method static Builder|File newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|File onlyTrashed()
|
||||
* @method static Builder|File query()
|
||||
* @method static Builder|File whereCreatedAt($value)
|
||||
* @method static Builder|File whereDeletedAt($value)
|
||||
* @method static Builder|File whereDocumentId($value)
|
||||
* @method static Builder|File whereFile($value)
|
||||
* @method static Builder|File whereFileType($value)
|
||||
* @method static Builder|File whereId($value)
|
||||
* @method static Builder|File whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|File withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|File withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class File extends AbstractModel
|
||||
{
|
||||
|
||||
+23
-1
@@ -3,6 +3,9 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Traits\LogData;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -10,16 +13,35 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use App\Classes\General\Interfaces\Transactionable;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
/**
|
||||
* App\Models\Group
|
||||
*
|
||||
* @property-read Currency|null $currency
|
||||
* @property-read Collection|Document[] $documents
|
||||
* @property-read int|null $documents_count
|
||||
* @property-read CompanyModule|null $issuerCompany
|
||||
* @property-read Currency|null $original_currency
|
||||
* @property-read CompanyModule|null $receiverCompany
|
||||
* @property-read Collection|Transaction[] $transactions
|
||||
* @property-read int|null $transactions_count
|
||||
* @method static Builder|Group newModelQuery()
|
||||
* @method static Builder|Group newQuery()
|
||||
* @method static Builder|Group query()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Group extends Model implements Documentable, Transactionable
|
||||
{
|
||||
use HasRelationships;
|
||||
use HasTableAlias;
|
||||
|
||||
use \Staudenmeir\EloquentHasManyDeep\HasTableAlias;
|
||||
use SoftDeletes;
|
||||
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
|
||||
@@ -11,14 +11,70 @@ use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Scopes\CustomerOrdersScope;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
/**
|
||||
* App\Models\Order
|
||||
*
|
||||
* @method static whereBetween(string $string, array $array)
|
||||
* @property int $id
|
||||
* @property int $company_module_id
|
||||
* @property string $reference
|
||||
* @property string|null $reference_contract
|
||||
* @property int $type Order packages can be shipped in shared or dedicated container
|
||||
* @property int $status Status of this order, e.g. processing, shipping etc.
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|OrderRole[] $OrderRoles
|
||||
* @property-read int|null $order_roles_count
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Collection|Addon[] $addons
|
||||
* @property-read int|null $addons_count
|
||||
* @property-read Collection|Address[] $addresses
|
||||
* @property-read int|null $addresses_count
|
||||
* @property-read Model|Eloquent $causer
|
||||
* @property-read CompanyModule|null $companyModule
|
||||
* @property-read Collection|Step[] $orderSteps
|
||||
* @property-read int|null $order_steps_count
|
||||
* @property-read Collection|PackingList[] $packingLists
|
||||
* @property-read int|null $packing_lists_count
|
||||
* @property-read Collection|Package[] $parcels
|
||||
* @property-read int|null $parcels_count
|
||||
* @property-read Collection|Remark[] $remarks
|
||||
* @property-read int|null $remarks_count
|
||||
* @property-read Model|Eloquent $subject
|
||||
* @property-read Model|Eloquent $target
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order newQuery()
|
||||
* @method static Builder|Order onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereCompanyModuleId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereReference($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereReferenceContract($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Order whereUpdatedAt($value)
|
||||
* @method static Builder|Order withTrashed()
|
||||
* @method static Builder|Order withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Order extends AbstractModel implements Addressable, Packable, Remarkable, Notifiable
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
@@ -7,15 +7,71 @@ use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Scopes\CustomerOrdersScope;
|
||||
use App\Scopes\CustomerPackagesScope;
|
||||
use Barryvdh\LaravelIdeHelper\Eloquent;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasOneDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
/**
|
||||
* App\Models\Package
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $packing_list_id
|
||||
* @property int $type
|
||||
* @property string|null $reference
|
||||
* @property string|null $description
|
||||
* @property string $width
|
||||
* @property string $height
|
||||
* @property string $length
|
||||
* @property string $weight
|
||||
* @property int $quantity
|
||||
* @property int $status
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Model|Eloquent $causer
|
||||
* @property-read Collection|Transport[] $deliveryTransports
|
||||
* @property-read int|null $delivery_transports_count
|
||||
* @property-read PackingList|null $packingList
|
||||
* @property-read Model|Eloquent $subject
|
||||
* @property-read Model|Eloquent $target
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package newQuery()
|
||||
* @method static Builder|Package onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package shipped()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package shipping()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package shippingList()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package warehouseReceiveList()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereHeight($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereLength($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package wherePackingListId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereQuantity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereReference($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereWeight($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Package whereWidth($value)
|
||||
* @method static Builder|Package withTrashed()
|
||||
* @method static Builder|Package withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Package extends AbstractModel
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
@@ -10,15 +10,78 @@ use App\Classes\General\Interfaces\Transactionable;
|
||||
use App\Classes\General\Traits\LogData;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;
|
||||
|
||||
/**
|
||||
* App\Models\PackingList
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $owner_type
|
||||
* @property int $owner_id
|
||||
* @property int|null $claimant_id
|
||||
* @property string|null $reference_contract
|
||||
* @property string $reference
|
||||
* @property int $type
|
||||
* @property int $status
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read Collection|Activity[] $activities
|
||||
* @property-read int|null $activities_count
|
||||
* @property-read Collection|Addon[] $addons
|
||||
* @property-read int|null $addons_count
|
||||
* @property-read Model|Eloquent $causer
|
||||
* @property-read Collection|Container[] $containers
|
||||
* @property-read int|null $containers_count
|
||||
* @property-read Model|Eloquent $owner
|
||||
* @property-read Collection|Package[] $packages
|
||||
* @property-read int|null $packages_count
|
||||
* @property-read Collection|PackingList[] $packingLists
|
||||
* @property-read int|null $packing_lists_count
|
||||
* @property-read Collection|PackingList[] $packing_list_owner
|
||||
* @property-read int|null $packing_list_owner_count
|
||||
* @property-read Collection|Remark[] $remarks
|
||||
* @property-read int|null $remarks_count
|
||||
* @property-read Collection|Step[] $steps
|
||||
* @property-read int|null $steps_count
|
||||
* @property-read Model|Eloquent $subject
|
||||
* @property-read Model|Eloquent $target
|
||||
* @property-read Collection|Transaction[] $transactions
|
||||
* @property-read int|null $transactions_count
|
||||
* @property-read Collection|Transport[] $transports
|
||||
* @property-read int|null $transports_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList newQuery()
|
||||
* @method static Builder|PackingList onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList shipping()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereClaimantId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereOwnerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereOwnerType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereReference($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereReferenceContract($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PackingList whereUpdatedAt($value)
|
||||
* @method static Builder|PackingList withTrashed()
|
||||
* @method static Builder|PackingList withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class PackingList extends AbstractModel implements Transportable, Steppable, Packable, Transactionable
|
||||
{
|
||||
use HasTableAlias;
|
||||
@@ -31,7 +94,7 @@ class PackingList extends AbstractModel implements Transportable, Steppable, Pac
|
||||
protected $fillable = ['status'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
class QAAnswerOptions extends AbstractModel
|
||||
{
|
||||
protected $table = 'qa_answer_options';
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class QAQuestionnaireSet extends AbstractModel
|
||||
{
|
||||
protected $table = 'qa_questionnaire_sets';
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user