moved core modules to separate repositories
This commit is contained in:
parent
5f58a4dfd5
commit
dba0f9972a
37
.github/workflows/translations_modules.yml
vendored
37
.github/workflows/translations_modules.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: Translations of Modules
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
name: Sync
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Sync with Crowdin
|
||||
uses: crowdin/github-action@master
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_translations: true
|
||||
download_translations: true
|
||||
skip_untranslated_files: true
|
||||
|
||||
localization_branch_name: 'translations-modules'
|
||||
commit_message: 'new crowdin translations of modules'
|
||||
pull_request_title: 'New Crowdin translations of modules'
|
||||
pull_request_body: 'https://crowdin.com/project/akaunting-apps'
|
||||
pull_request_labels: 'Translation'
|
||||
|
||||
config: 'crowdin_modules.yml'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_APPS_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -93,7 +93,4 @@ _ide_helper_models.php
|
||||
/storage/debugbar/*
|
||||
.phpunit.result.cache
|
||||
modules/*
|
||||
!modules/OfflinePayments
|
||||
!modules/PaypalStandard
|
||||
!modules/BC21
|
||||
.laravelstatsrc
|
||||
|
@ -18,6 +18,9 @@
|
||||
"akaunting/language": "1.0.*",
|
||||
"akaunting/menu": "1.0.*",
|
||||
"akaunting/module": "2.0.*",
|
||||
"akaunting/module-bc21": "^2.0",
|
||||
"akaunting/module-offline-payments": "^2.0",
|
||||
"akaunting/module-paypal-standard": "^2.0",
|
||||
"akaunting/money": "1.2.*",
|
||||
"akaunting/setting": "1.2.*",
|
||||
"akaunting/version": "1.0.*",
|
||||
@ -47,6 +50,7 @@
|
||||
"lorisleiva/laravel-search-string": "1.1.*",
|
||||
"maatwebsite/excel": "3.1.*",
|
||||
"monooso/unobserve": "^3.0",
|
||||
"mnsami/composer-custom-directory-installer": "2.0.*",
|
||||
"plank/laravel-mediable": "4.4.*",
|
||||
"riverskies/laravel-mobile-detect": "^1.3",
|
||||
"santigarcor/laratrust": "6.3.*",
|
||||
@ -67,6 +71,11 @@
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
},
|
||||
"installer-paths": {
|
||||
"modules/BC21": ["akaunting/module-bc21"],
|
||||
"modules/OfflinePayments": ["akaunting/module-offline-payments"],
|
||||
"modules/PaypalStandard": ["akaunting/module-paypal-standard"]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
207
composer.lock
generated
207
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "79c12898250f9e11176ed2a82226d3fa",
|
||||
"content-hash": "7957d8f2405488fbcac455b6ed3f5856",
|
||||
"packages": [
|
||||
{
|
||||
"name": "akaunting/firewall",
|
||||
@ -209,16 +209,16 @@
|
||||
},
|
||||
{
|
||||
"name": "akaunting/module",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/akaunting/module.git",
|
||||
"reference": "d4b82b8f25d8ef1d220b68f23e0b20946037822a"
|
||||
"reference": "e8d5a883a8c0e66baaaaa59b6726d7738c406933"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/akaunting/module/zipball/d4b82b8f25d8ef1d220b68f23e0b20946037822a",
|
||||
"reference": "d4b82b8f25d8ef1d220b68f23e0b20946037822a",
|
||||
"url": "https://api.github.com/repos/akaunting/module/zipball/e8d5a883a8c0e66baaaaa59b6726d7738c406933",
|
||||
"reference": "e8d5a883a8c0e66baaaaa59b6726d7738c406933",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -273,9 +273,76 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/akaunting/module/issues",
|
||||
"source": "https://github.com/akaunting/module/tree/2.0.5"
|
||||
"source": "https://github.com/akaunting/module/tree/2.0.6"
|
||||
},
|
||||
"time": "2021-02-25T11:15:01+00:00"
|
||||
"time": "2021-03-04T08:17:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "akaunting/module-offline-payments",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/akaunting/module-offline-payments.git",
|
||||
"reference": "09bd63c03bd81c524d97bc112ca29f0d82c14e46"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/akaunting/module-offline-payments/zipball/09bd63c03bd81c524d97bc112ca29f0d82c14e46",
|
||||
"reference": "09bd63c03bd81c524d97bc112ca29f0d82c14e46",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-3.0+"
|
||||
],
|
||||
"description": "Offline Payments app for Akaunting",
|
||||
"homepage": "https://akaunting.com",
|
||||
"keywords": [
|
||||
"Accounting",
|
||||
"akaunting",
|
||||
"invoice",
|
||||
"laravel",
|
||||
"offline-payments"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/akaunting/module-offline-payments/issues",
|
||||
"source": "https://github.com/akaunting/module-offline-payments/tree/2.0.0"
|
||||
},
|
||||
"time": "2021-03-04T09:00:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "akaunting/module-paypal-standard",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/akaunting/module-paypal-standard.git",
|
||||
"reference": "0dd391492c6ae47f2d91abe27165907029bf7960"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/akaunting/module-paypal-standard/zipball/0dd391492c6ae47f2d91abe27165907029bf7960",
|
||||
"reference": "0dd391492c6ae47f2d91abe27165907029bf7960",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-3.0+"
|
||||
],
|
||||
"description": "Paypal Standard app for Akaunting",
|
||||
"homepage": "https://akaunting.com",
|
||||
"keywords": [
|
||||
"Accounting",
|
||||
"invoice",
|
||||
"laravel",
|
||||
"paypal"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/akaunting/module-paypal-standard/issues",
|
||||
"source": "https://github.com/akaunting/module-paypal-standard/tree/2.0.0"
|
||||
},
|
||||
"time": "2021-03-04T08:53:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "akaunting/money",
|
||||
@ -4148,16 +4215,16 @@
|
||||
},
|
||||
{
|
||||
"name": "jaybizzle/crawler-detect",
|
||||
"version": "v1.2.104",
|
||||
"version": "v1.2.105",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
|
||||
"reference": "a581e89a9212c4e9d18049666dc735718c29de9c"
|
||||
"reference": "719c1ed49224857800c3dc40838b6b761d046105"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/a581e89a9212c4e9d18049666dc735718c29de9c",
|
||||
"reference": "a581e89a9212c4e9d18049666dc735718c29de9c",
|
||||
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/719c1ed49224857800c3dc40838b6b761d046105",
|
||||
"reference": "719c1ed49224857800c3dc40838b6b761d046105",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4194,9 +4261,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/JayBizzle/Crawler-Detect/issues",
|
||||
"source": "https://github.com/JayBizzle/Crawler-Detect/tree/v1.2.104"
|
||||
"source": "https://github.com/JayBizzle/Crawler-Detect/tree/v1.2.105"
|
||||
},
|
||||
"time": "2021-01-13T15:25:20+00:00"
|
||||
"time": "2021-03-03T20:55:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jenssegers/agent",
|
||||
@ -4522,16 +4589,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v8.29.0",
|
||||
"version": "v8.30.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "d2eba352b3b3a3c515b18c5726b373fe5026733e"
|
||||
"reference": "ab7e1c19ee0403e15fc59983b7ccb86d85db45e6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/d2eba352b3b3a3c515b18c5726b373fe5026733e",
|
||||
"reference": "d2eba352b3b3a3c515b18c5726b373fe5026733e",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/ab7e1c19ee0403e15fc59983b7ccb86d85db45e6",
|
||||
"reference": "ab7e1c19ee0403e15fc59983b7ccb86d85db45e6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4686,20 +4753,20 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2021-02-23T14:27:41+00:00"
|
||||
"time": "2021-03-03T14:59:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/tinker",
|
||||
"version": "v2.6.0",
|
||||
"version": "v2.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/tinker.git",
|
||||
"reference": "daae1c43f1300fe88c05d83db6f3d8f76677ad88"
|
||||
"reference": "04ad32c1a3328081097a181875733fa51f402083"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/tinker/zipball/daae1c43f1300fe88c05d83db6f3d8f76677ad88",
|
||||
"reference": "daae1c43f1300fe88c05d83db6f3d8f76677ad88",
|
||||
"url": "https://api.github.com/repos/laravel/tinker/zipball/04ad32c1a3328081097a181875733fa51f402083",
|
||||
"reference": "04ad32c1a3328081097a181875733fa51f402083",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4752,9 +4819,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/tinker/issues",
|
||||
"source": "https://github.com/laravel/tinker/tree/v2.6.0"
|
||||
"source": "https://github.com/laravel/tinker/tree/v2.6.1"
|
||||
},
|
||||
"time": "2021-01-26T20:35:18+00:00"
|
||||
"time": "2021-03-02T16:53:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/ui",
|
||||
@ -5850,6 +5917,62 @@
|
||||
},
|
||||
"time": "2020-12-07T11:07:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mnsami/composer-custom-directory-installer",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mnsami/composer-custom-directory-installer.git",
|
||||
"reference": "85f66323978d0b1cb0e6acc7f69b3e7b912f82d9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mnsami/composer-custom-directory-installer/zipball/85f66323978d0b1cb0e6acc7f69b3e7b912f82d9",
|
||||
"reference": "85f66323978d0b1cb0e6acc7f69b3e7b912f82d9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0 || ^2.0",
|
||||
"php": ">=5.3"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": [
|
||||
"Composer\\CustomDirectoryInstaller\\LibraryPlugin",
|
||||
"Composer\\CustomDirectoryInstaller\\PearPlugin",
|
||||
"Composer\\CustomDirectoryInstaller\\PluginPlugin"
|
||||
],
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Composer\\CustomDirectoryInstaller": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mina Nabil Sami",
|
||||
"email": "mina.nsami@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A composer plugin, to help install packages of different types in custom paths.",
|
||||
"keywords": [
|
||||
"composer",
|
||||
"composer-installer",
|
||||
"composer-plugin"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mnsami/composer-custom-directory-installer/issues",
|
||||
"source": "https://github.com/mnsami/composer-custom-directory-installer/tree/2.0.0"
|
||||
},
|
||||
"time": "2020-08-18T11:00:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mobiledetect/mobiledetectlib",
|
||||
"version": "2.8.37",
|
||||
@ -7186,16 +7309,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpspreadsheet",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
|
||||
"reference": "76d4323b85129d0c368149c831a07a3e258b2b50"
|
||||
"reference": "c55269cb06911575a126dc225a05c0e4626e5fb4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/76d4323b85129d0c368149c831a07a3e258b2b50",
|
||||
"reference": "76d4323b85129d0c368149c831a07a3e258b2b50",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c55269cb06911575a126dc225a05c0e4626e5fb4",
|
||||
"reference": "c55269cb06911575a126dc225a05c0e4626e5fb4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -7223,7 +7346,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"dompdf/dompdf": "^0.8.5",
|
||||
"friendsofphp/php-cs-fixer": "^2.16",
|
||||
"friendsofphp/php-cs-fixer": "^2.18",
|
||||
"jpgraph/jpgraph": "^4.0",
|
||||
"mpdf/mpdf": "^8.0",
|
||||
"phpcompatibility/php-compatibility": "^9.3",
|
||||
@ -7281,9 +7404,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
|
||||
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.16.0"
|
||||
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.17.1"
|
||||
},
|
||||
"time": "2020-12-31T18:03:49+00:00"
|
||||
"time": "2021-03-02T17:54:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
@ -8312,16 +8435,16 @@
|
||||
},
|
||||
{
|
||||
"name": "santigarcor/laratrust",
|
||||
"version": "6.3.1",
|
||||
"version": "6.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/santigarcor/laratrust.git",
|
||||
"reference": "dcb43416ecfeacb67e056423780e288c325e9c82"
|
||||
"reference": "9ab3bfdc06afe18b17f69b77cb77291c36dae9f6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/santigarcor/laratrust/zipball/dcb43416ecfeacb67e056423780e288c325e9c82",
|
||||
"reference": "dcb43416ecfeacb67e056423780e288c325e9c82",
|
||||
"url": "https://api.github.com/repos/santigarcor/laratrust/zipball/9ab3bfdc06afe18b17f69b77cb77291c36dae9f6",
|
||||
"reference": "9ab3bfdc06afe18b17f69b77cb77291c36dae9f6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8375,7 +8498,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/santigarcor/laratrust/issues",
|
||||
"source": "https://github.com/santigarcor/laratrust/tree/6.3.1"
|
||||
"source": "https://github.com/santigarcor/laratrust/tree/6.3.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8383,7 +8506,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-12-09T14:25:23+00:00"
|
||||
"time": "2021-03-03T13:34:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "seld/jsonlint",
|
||||
@ -11580,16 +11703,16 @@
|
||||
},
|
||||
{
|
||||
"name": "facade/ignition",
|
||||
"version": "2.5.13",
|
||||
"version": "2.5.14",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facade/ignition.git",
|
||||
"reference": "5e9ef386aaad9985cee2ac23281a27568d083b7e"
|
||||
"reference": "17097f7a83e200d90d1cf9f4d1b35c1001513a47"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/facade/ignition/zipball/5e9ef386aaad9985cee2ac23281a27568d083b7e",
|
||||
"reference": "5e9ef386aaad9985cee2ac23281a27568d083b7e",
|
||||
"url": "https://api.github.com/repos/facade/ignition/zipball/17097f7a83e200d90d1cf9f4d1b35c1001513a47",
|
||||
"reference": "17097f7a83e200d90d1cf9f4d1b35c1001513a47",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -11653,7 +11776,7 @@
|
||||
"issues": "https://github.com/facade/ignition/issues",
|
||||
"source": "https://github.com/facade/ignition"
|
||||
},
|
||||
"time": "2021-02-16T12:46:19+00:00"
|
||||
"time": "2021-03-04T08:48:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "facade/ignition-contracts",
|
||||
|
@ -1,22 +0,0 @@
|
||||
"project_id_env": CROWDIN_PROJECT_ID
|
||||
"api_token_env": CROWDIN_PERSONAL_TOKEN
|
||||
"preserve_hierarchy": true
|
||||
|
||||
"files": [
|
||||
{
|
||||
"source": "modules/OfflinePayments/Resources/lang/en-GB/general.php",
|
||||
"dest": "offline-payments/general.php",
|
||||
"translation": "modules/OfflinePayments/Resources/lang/%locale%/offline-payments/general.php",
|
||||
"translation_replace": {
|
||||
"offline-payments/": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "modules/PaypalStandard/Resources/lang/en-GB/general.php",
|
||||
"dest": "paypal-standard/general.php",
|
||||
"translation": "modules/PaypalStandard/Resources/lang/%locale%/paypal-standard/general.php",
|
||||
"translation_replace": {
|
||||
"paypal-standard/": ""
|
||||
}
|
||||
}
|
||||
]
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Abstracts;
|
||||
|
||||
use App\Models\Document\Document;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document
|
||||
*/
|
||||
abstract class DocumentModel extends Document
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentCancelled;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentCancelled
|
||||
*/
|
||||
class BillCancelled extends DocumentCancelled
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentCreated;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document
|
||||
*/
|
||||
class BillCreated extends DocumentCreated
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentCreating;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentCreating
|
||||
*/
|
||||
class BillCreating extends DocumentCreating
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentReceived;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentReceived
|
||||
*/
|
||||
class BillReceived extends DocumentReceived
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentRecurring;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentRecurring
|
||||
*/
|
||||
class BillRecurring extends DocumentRecurring
|
||||
{
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentReminded;
|
||||
use App\Models\Document\Document;
|
||||
use App\Notifications\Purchase\Bill as Notification;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentReminded
|
||||
*/
|
||||
class BillReminded extends DocumentReminded
|
||||
{
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
parent::__construct($document, Notification::class);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentUpdated;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentUpdated
|
||||
*/
|
||||
class BillUpdated extends DocumentUpdated
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Purchase;
|
||||
|
||||
use App\Events\Document\DocumentUpdating;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentUpdating
|
||||
*/
|
||||
class BillUpdating extends DocumentUpdating
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentCancelled;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentCancelled
|
||||
*/
|
||||
class InvoiceCancelled extends DocumentCancelled
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentCreated;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentCreated
|
||||
*/
|
||||
class InvoiceCreated extends DocumentCreated
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentCreating;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentCreating
|
||||
*/
|
||||
class InvoiceCreating extends DocumentCreating
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentPrinting;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentPrinting
|
||||
*/
|
||||
class InvoicePrinting extends DocumentPrinting
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentRecurring;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentRecurring
|
||||
*/
|
||||
class InvoiceRecurring extends DocumentRecurring
|
||||
{
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentReminded;
|
||||
use App\Models\Document\Document;
|
||||
use App\Notifications\Sale\Invoice as Notification;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentReminded
|
||||
*/
|
||||
class InvoiceReminded extends DocumentReminded
|
||||
{
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
parent::__construct($document, Notification::class);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentSent;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentSent
|
||||
*/
|
||||
class InvoiceSent extends DocumentSent
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentUpdated;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentUpdated
|
||||
*/
|
||||
class InvoiceUpdated extends DocumentUpdated
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentUpdating;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentUpdating
|
||||
*/
|
||||
class InvoiceUpdating extends DocumentUpdating
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
use App\Events\Document\DocumentViewed;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentViewed
|
||||
*/
|
||||
class InvoiceViewed extends DocumentViewed
|
||||
{
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Sale;
|
||||
|
||||
class PaymentReceived extends \App\Events\Document\PaymentReceived
|
||||
{
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Purchases;
|
||||
|
||||
use App\Abstracts\Http\ApiController;
|
||||
use App\Http\Requests\Document\Document as Request;
|
||||
use App\Jobs\Document\CreateDocument;
|
||||
use App\Jobs\Document\DeleteDocument;
|
||||
use App\Jobs\Document\UpdateDocument;
|
||||
use App\Models\Document\Document;
|
||||
use App\Transformers\Purchase\Bill as Transformer;
|
||||
|
||||
class Bills extends ApiController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$bills = Document::bill()->with('contact', 'histories', 'items', 'transactions')->collect(['issued_at'=> 'desc']);
|
||||
|
||||
return $this->response->paginator($bills, new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param Document $bill
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function show(Document $bill)
|
||||
{
|
||||
return $this->response->item($bill, new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param $request
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$bill = $this->dispatch(new CreateDocument($request));
|
||||
|
||||
return $this->response->created(route('api.bills.show', $bill->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param $bill
|
||||
* @param $request
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function update(Document $bill, Request $request)
|
||||
{
|
||||
$bill = $this->dispatch(new UpdateDocument($bill, $request));
|
||||
|
||||
return $this->item($bill->fresh(), new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Document $bill
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function destroy(Document $bill)
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new DeleteDocument($bill));
|
||||
|
||||
return $this->response->noContent();
|
||||
} catch(\Exception $e) {
|
||||
$this->response->errorUnauthorized($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Sales;
|
||||
|
||||
use App\Abstracts\Http\ApiController;
|
||||
use App\Http\Requests\Banking\Transaction as Request;
|
||||
use App\Jobs\Banking\CreateBankingDocumentTransaction;
|
||||
use App\Jobs\Banking\DeleteTransaction;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Models\Document\Document;
|
||||
use App\Transformers\Banking\Transaction as Transformer;
|
||||
|
||||
class InvoiceTransactions extends ApiController
|
||||
{
|
||||
/**
|
||||
* Instantiate a new controller instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Add CRUD permission check
|
||||
$this->middleware('permission:create-banking-transactions')->only('create', 'store', 'duplicate', 'import');
|
||||
$this->middleware('permission:read-banking-transactions')->only('index', 'show', 'edit', 'export');
|
||||
$this->middleware('permission:update-banking-transactions')->only('update', 'enable', 'disable');
|
||||
$this->middleware('permission:delete-banking-transactions')->only('destroy');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param $invoice_id
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function index($invoice_id)
|
||||
{
|
||||
$transactions = Transaction::documentId($invoice_id)->get();
|
||||
|
||||
return $this->response->collection($transactions, new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param $invoice_id
|
||||
* @param $id
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function show($invoice_id, $id)
|
||||
{
|
||||
$transaction = Transaction::documentId($invoice_id)->find($id);
|
||||
|
||||
return $this->response->item($transaction, new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param $invoice_id
|
||||
* @param $request
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function store($invoice_id, Request $request)
|
||||
{
|
||||
$invoice = Document::find($invoice_id);
|
||||
|
||||
$transaction = $this->dispatch(new CreateBankingDocumentTransaction($invoice, $request));
|
||||
|
||||
return $this->response->created(url('api/invoices/' . $invoice_id . '/transactions/' . $transaction->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param $invoice_id
|
||||
* @param $id
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function destroy($invoice_id, $id)
|
||||
{
|
||||
$transaction = Transaction::documentId($invoice_id)->find($id);
|
||||
|
||||
$this->dispatch(new DeleteTransaction($transaction));
|
||||
|
||||
return $this->response->noContent();
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Sales;
|
||||
|
||||
use App\Abstracts\Http\ApiController;
|
||||
use App\Http\Requests\Document\Document as Request;
|
||||
use App\Jobs\Document\CreateDocument;
|
||||
use App\Jobs\Document\DeleteDocument;
|
||||
use App\Jobs\Document\UpdateDocument;
|
||||
use App\Models\Document\Document;
|
||||
use App\Transformers\Sale\Invoice as Transformer;
|
||||
|
||||
class Invoices extends ApiController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$invoices = Document::invoice()->with('contact', 'histories', 'items', 'transactions')->collect(['issued_at'=> 'desc']);
|
||||
|
||||
return $this->response->paginator($invoices, new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param $id
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
// Check if we're querying by id or number
|
||||
if (is_numeric($id)) {
|
||||
$invoice = Document::find($id);
|
||||
} else {
|
||||
$invoice = Document::where('document_number', $id)->first();
|
||||
}
|
||||
|
||||
return $this->response->item($invoice, new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param $request
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$invoice = $this->dispatch(new CreateDocument($request));
|
||||
|
||||
return $this->response->created(route('api.invoices.show', $invoice->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param $invoice
|
||||
* @param $request
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function update(Document $invoice, Request $request)
|
||||
{
|
||||
$invoice = $this->dispatch(new UpdateDocument($invoice, $request));
|
||||
|
||||
return $this->response->item($invoice->fresh(), new Transformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Document $invoice
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function destroy(Document $invoice)
|
||||
{
|
||||
try {
|
||||
$this->dispatch(new DeleteDocument($invoice));
|
||||
|
||||
return $this->response->noContent();
|
||||
} catch(\Exception $e) {
|
||||
$this->response->errorUnauthorized($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Purchase;
|
||||
|
||||
use App\Http\Requests\Document\Document;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document
|
||||
*/
|
||||
class Bill extends Document
|
||||
{
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document::rules()
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['bill_number'] = $rules['document_number'];
|
||||
$rules['billed_at'] = $rules['issued_at'];
|
||||
|
||||
unset($rules['document_number'], $rules['issued_at']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document::withValidator()
|
||||
*/
|
||||
public function withValidator($validator)
|
||||
{
|
||||
parent::withValidator($validator);
|
||||
|
||||
if ($validator->errors()->count()) {
|
||||
$this->request->set('billed_at', $this->request->get('issued_at'));
|
||||
$this->request->remove('issued_at');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Purchase;
|
||||
|
||||
use App\Http\Requests\Document\DocumentAddItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentAddItem
|
||||
*/
|
||||
class BillAddItem extends DocumentAddItem
|
||||
{
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Purchase;
|
||||
|
||||
use App\Http\Requests\Document\DocumentHistory;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentHistory
|
||||
*/
|
||||
class BillHistory extends DocumentHistory
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['bill_id'] = $rules['document_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Purchase;
|
||||
|
||||
use App\Http\Requests\Document\DocumentItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItem
|
||||
*/
|
||||
class BillItem extends DocumentItem
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['bill_id'] = $rules['document_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Purchase;
|
||||
|
||||
use App\Http\Requests\Document\DocumentItemTax;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItemTax
|
||||
*/
|
||||
class BillItemTax extends DocumentItemTax
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['bill_id'] = $rules['document_id'];
|
||||
$rules['bill_item_id'] = $rules['document_item_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['document_item_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Purchase;
|
||||
|
||||
use App\Http\Requests\Document\DocumentTotal;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentTotal
|
||||
*/
|
||||
class BillTotal extends DocumentTotal
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['bill_id'] = $rules['document_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Sale;
|
||||
|
||||
use App\Http\Requests\Document\Document;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document
|
||||
*/
|
||||
class Invoice extends Document
|
||||
{
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document::rules()
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['invoice_number'] = $rules['document_number'];
|
||||
$rules['invoiced_at'] = $rules['issued_at'];
|
||||
|
||||
unset($rules['document_number'], $rules['issued_at']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document::withValidator()
|
||||
*/
|
||||
public function withValidator($validator)
|
||||
{
|
||||
parent::withValidator($validator);
|
||||
|
||||
if ($validator->errors()->count()) {
|
||||
$this->request->set('invoiced_at', $this->request->get('issued_at'));
|
||||
$this->request->remove('issued_at');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Sale;
|
||||
|
||||
use App\Http\Requests\Document\DocumentAddItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentAddItem
|
||||
*/
|
||||
class InvoiceAddItem extends DocumentAddItem
|
||||
{
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Sale;
|
||||
|
||||
use App\Http\Requests\Document\DocumentHistory;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentHistory
|
||||
*/
|
||||
class InvoiceHistory extends DocumentHistory
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['invoice_id'] = $rules['document_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Sale;
|
||||
|
||||
use App\Http\Requests\Document\DocumentItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItem
|
||||
*/
|
||||
class InvoiceItem extends DocumentItem
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['invoice_id'] = $rules['document_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Sale;
|
||||
|
||||
use App\Http\Requests\Document\DocumentItemTax;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItemTax
|
||||
*/
|
||||
class InvoiceItemTax extends DocumentItemTax
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['invoice_id'] = $rules['document_id'];
|
||||
$rules['invoice_item_id'] = $rules['document_item_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['document_item_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Sale;
|
||||
|
||||
use App\Http\Requests\Document\DocumentTotal;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentTotal
|
||||
*/
|
||||
class InvoiceTotal extends DocumentTotal
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
$rules['invoice_id'] = $rules['document_id'];
|
||||
|
||||
unset($rules['document_id'], $rules['type']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Banking;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateBankingDocumentTransaction
|
||||
*/
|
||||
class CreateDocumentTransaction extends CreateBankingDocumentTransaction
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\CancelDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CancelDocument
|
||||
*/
|
||||
class CancelBill extends CancelDocument
|
||||
{
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Abstracts\Http\FormRequest;
|
||||
use App\Jobs\Document\CreateDocument;
|
||||
use App\Models\Document\Document;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocument
|
||||
*/
|
||||
class CreateBill extends CreateDocument
|
||||
{
|
||||
protected $bill;
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param FormRequest|array $request
|
||||
*/
|
||||
public function __construct($request)
|
||||
{
|
||||
parent::__construct($request);
|
||||
|
||||
$this->request->merge(
|
||||
[
|
||||
'type' => Document::BILL_TYPE,
|
||||
'document_number' => $this->request->get('bill_number'),
|
||||
'issued_at' => $this->request->get('billed_at'),
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\CreateDocumentHistory;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocumentHistory
|
||||
*/
|
||||
class CreateBillHistory extends CreateDocumentHistory
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\CreateDocumentItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocumentItem
|
||||
*/
|
||||
class CreateBillItem extends CreateDocumentItem
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\CreateDocumentItemsAndTotals;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocumentItemsAndTotals
|
||||
*/
|
||||
class CreateBillItemsAndTotals extends CreateDocumentItemsAndTotals
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\DeleteDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DeleteDocument
|
||||
*/
|
||||
class DeleteBill extends DeleteDocument
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\DuplicateDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DuplicateDocument
|
||||
*/
|
||||
class DuplicateBill extends DuplicateDocument
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Jobs\Document\UpdateDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see UpdateDocument
|
||||
*/
|
||||
class UpdateBill extends UpdateDocument
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\CancelDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CancelDocument
|
||||
*/
|
||||
class CancelInvoice extends CancelDocument
|
||||
{
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Abstracts\Http\FormRequest;
|
||||
use App\Jobs\Document\CreateDocument;
|
||||
use App\Models\Document\Document;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocument
|
||||
*/
|
||||
class CreateInvoice extends CreateDocument
|
||||
{
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param FormRequest|array $request
|
||||
*/
|
||||
public function __construct($request)
|
||||
{
|
||||
parent::__construct($request);
|
||||
|
||||
$this->request->merge(
|
||||
[
|
||||
'type' => Document::INVOICE_TYPE,
|
||||
'document_number' => $this->request->get('invoice_number'),
|
||||
'issued_at' => $this->request->get('invoiced_at'),
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\CreateDocumentHistory;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocumentHistory
|
||||
*/
|
||||
class CreateInvoiceHistory extends CreateDocumentHistory
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\CreateDocumentItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocumentItem
|
||||
*/
|
||||
class CreateInvoiceItem extends CreateDocumentItem
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\CreateDocumentItemsAndTotals;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see CreateDocumentItemsAndTotals
|
||||
*/
|
||||
class CreateInvoiceItemsAndTotals extends CreateDocumentItemsAndTotals
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\DeleteDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DeleteDocument
|
||||
*/
|
||||
class DeleteInvoice extends DeleteDocument
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\DuplicateDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DuplicateDocument
|
||||
*/
|
||||
class DuplicateInvoice extends DuplicateDocument
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Jobs\Document\UpdateDocument;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see UpdateDocument
|
||||
*/
|
||||
class UpdateInvoice extends UpdateDocument
|
||||
{
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Purchase;
|
||||
|
||||
use App\Models\Document\Document;
|
||||
use App\Scopes\ReplaceDeprecatedColumns;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document
|
||||
*/
|
||||
class Bill extends Document
|
||||
{
|
||||
protected static function booted()
|
||||
{
|
||||
static::addGlobalScope(new ReplaceDeprecatedColumns);
|
||||
}
|
||||
|
||||
public function getBillNumberAttribute($value)
|
||||
{
|
||||
return $this->document_number;
|
||||
}
|
||||
|
||||
public function setBillNumberAttribute($value)
|
||||
{
|
||||
$this->attributes['document_number'] = $value;
|
||||
}
|
||||
|
||||
public function getBilledAtAttribute($value)
|
||||
{
|
||||
return $this->issued_at;
|
||||
}
|
||||
|
||||
public function setBilledAtAttribute($value)
|
||||
{
|
||||
$this->attributes['issued_at'] = $value;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentHistory;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentHistory
|
||||
*/
|
||||
class BillHistory extends DocumentHistory
|
||||
{
|
||||
public function getBillIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setBillIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItem
|
||||
*/
|
||||
class BillItem extends DocumentItem
|
||||
{
|
||||
public function getBillIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setBillIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentItemTax;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItemTax
|
||||
*/
|
||||
class BillItemTax extends DocumentItemTax
|
||||
{
|
||||
public function getBillIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setBillIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
|
||||
public function getBillItemIdAttribute($value)
|
||||
{
|
||||
return $this->document_item_id;
|
||||
}
|
||||
|
||||
public function setBillItemIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_item_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentTotal;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentTotal
|
||||
*/
|
||||
class BillTotal extends DocumentTotal
|
||||
{
|
||||
public function getBillIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setBillIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Sale;
|
||||
|
||||
use App\Models\Document\Document;
|
||||
use App\Scopes\ReplaceDeprecatedColumns;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Document
|
||||
*/
|
||||
class Invoice extends Document
|
||||
{
|
||||
protected static function booted()
|
||||
{
|
||||
static::addGlobalScope(new ReplaceDeprecatedColumns);
|
||||
}
|
||||
|
||||
public function setInvoiceNumberAttribute($value)
|
||||
{
|
||||
$this->attributes['document_number'] = $value;
|
||||
}
|
||||
|
||||
public function getInvoiceNumberAttribute($value)
|
||||
{
|
||||
return $this->document_number;
|
||||
}
|
||||
|
||||
public function setInvoicedAtAttribute($value)
|
||||
{
|
||||
$this->attributes['issued_at'] = $value;
|
||||
}
|
||||
|
||||
public function getInvoicedAtAttribute($value)
|
||||
{
|
||||
return $this->issued_at;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Sale;
|
||||
|
||||
use App\Models\Document\DocumentHistory;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentHistory
|
||||
*/
|
||||
class InvoiceHistory extends DocumentHistory
|
||||
{
|
||||
public function getInvoiceIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setInvoiceIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Sale;
|
||||
|
||||
use App\Models\Document\DocumentItem;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItem
|
||||
*/
|
||||
class InvoiceItem extends DocumentItem
|
||||
{
|
||||
public function getInvoiceIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setInvoiceIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Sale;
|
||||
|
||||
use App\Models\Document\DocumentItemTax;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentItemTax
|
||||
*/
|
||||
class InvoiceItemTax extends DocumentItemTax
|
||||
{
|
||||
public function getInvoiceIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setInvoiceIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
|
||||
public function getInvoiceItemIdAttribute($value)
|
||||
{
|
||||
return $this->document_item_id;
|
||||
}
|
||||
|
||||
public function setInvoiceItemIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_item_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Sale;
|
||||
|
||||
use App\Models\Document\DocumentTotal;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see DocumentTotal
|
||||
*/
|
||||
class InvoiceTotal extends DocumentTotal
|
||||
{
|
||||
public function getInvoiceIdAttribute($value)
|
||||
{
|
||||
return $this->document_id;
|
||||
}
|
||||
|
||||
public function setInvoiceIdAttribute($value)
|
||||
{
|
||||
$this->attributes['document_id'] = $value;
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\BC21\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as Provider;
|
||||
|
||||
class Main extends Provider
|
||||
{
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->loadRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadRoutes()
|
||||
{
|
||||
if (app()->routesAreCached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$routes = ['api.php'];
|
||||
|
||||
foreach ($routes as $route) {
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/' . $route);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/**
|
||||
* 'api' prefix applied to all routes
|
||||
*
|
||||
* @see \App\Providers\Route::mapApiRoutes
|
||||
*/
|
||||
|
||||
$api = app('Dingo\Api\Routing\Router');
|
||||
|
||||
$api->version('v2', ['middleware' => ['api']], function($api) {
|
||||
$api->group(['namespace' => 'App\Http\Controllers\Api'], function($api) {
|
||||
// Companies
|
||||
$api->get('companies/{company}/owner', 'Common\Companies@owner')->name('companies.owner');
|
||||
$api->get('companies/{company}/enable', 'Common\Companies@enable')->name('companies.enable');
|
||||
$api->get('companies/{company}/disable', 'Common\Companies@disable')->name('companies.disable');
|
||||
$api->resource('companies', 'Common\Companies');
|
||||
|
||||
// Items
|
||||
$api->get('items/{item}/enable', 'Common\Items@enable')->name('items.enable');
|
||||
$api->get('items/{item}/disable', 'Common\Items@disable')->name('items.disable');
|
||||
$api->resource('items', 'Common\Items');
|
||||
|
||||
// Contacts
|
||||
$api->get('contacts/{contact}/enable', 'Common\Contacts@enable')->name('contacts.enable');
|
||||
$api->get('contacts/{contact}/disable', 'Common\Contacts@disable')->name('contacts.disable');
|
||||
$api->resource('contacts', 'Common\Contacts');
|
||||
|
||||
// Sales
|
||||
$api->resource('invoices', 'Sales\Invoices');
|
||||
$api->resource('invoices.transactions', 'Sales\InvoiceTransactions');
|
||||
|
||||
// Purchases
|
||||
$api->get('bills/{bill}/received', 'Purchases\Bills@received')->name('bills.received');
|
||||
$api->resource('bills', 'Purchases\Bills');
|
||||
|
||||
// Banking
|
||||
$api->get('accounts/{account}/enable', 'Banking\Accounts@enable')->name('accounts.enable');
|
||||
$api->get('accounts/{account}/disable', 'Banking\Accounts@disable')->name('accounts.disable');
|
||||
$api->resource('accounts', 'Banking\Accounts');
|
||||
$api->resource('reconciliations', 'Banking\Reconciliations');
|
||||
$api->resource('transactions', 'Banking\Transactions');
|
||||
$api->resource('transfers', 'Banking\Transfers');
|
||||
|
||||
// Reports
|
||||
$api->resource('reports', 'Common\Reports');
|
||||
|
||||
// Settings
|
||||
$api->get('categories/{category}/enable', 'Settings\Categories@enable')->name('categories.enable');
|
||||
$api->get('categories/{category}/disable', 'Settings\Categories@disable')->name('categories.disable');
|
||||
$api->resource('categories', 'Settings\Categories');
|
||||
$api->get('currencies/{currency}/enable', 'Settings\Currencies@enable')->name('currencies.enable');
|
||||
$api->get('currencies/{currency}/disable', 'Settings\Currencies@disable')->name('currencies.disable');
|
||||
$api->resource('currencies', 'Settings\Currencies');
|
||||
$api->resource('settings', 'Settings\Settings');
|
||||
$api->get('taxes/{tax}/enable', 'Settings\Taxes@enable')->name('taxes.enable');
|
||||
$api->get('taxes/{tax}/disable', 'Settings\Taxes@disable')->name('taxes.disable');
|
||||
$api->resource('taxes', 'Settings\Taxes');
|
||||
|
||||
// Common
|
||||
$api->resource('ping', 'Common\Ping');
|
||||
|
||||
// Auth
|
||||
$api->resource('permissions', 'Auth\Permissions');
|
||||
$api->resource('roles', 'Auth\Roles');
|
||||
$api->get('users/{user}/enable', 'Auth\Users@enable')->name('users.enable');
|
||||
$api->get('users/{user}/disable', 'Auth\Users@disable')->name('users.disable');
|
||||
$api->resource('users', 'Auth\Users');
|
||||
});
|
||||
});
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Scopes;
|
||||
|
||||
|
||||
use App\Models\Purchase\Bill;
|
||||
use App\Models\Sale\Invoice;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Scope;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ReplaceDeprecatedColumns implements Scope
|
||||
{
|
||||
/**
|
||||
* Apply the scope to a given Eloquent query builder.
|
||||
*
|
||||
* @param Builder $builder
|
||||
* @param Model $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function apply(Builder $builder, Model $model)
|
||||
{
|
||||
switch (get_class($model)) {
|
||||
case Invoice::class:
|
||||
$replacements = [
|
||||
'invoiced_at' => 'issued_at',
|
||||
'invoice_number' => 'document_number',
|
||||
];
|
||||
break;
|
||||
case Bill::class:
|
||||
$replacements = [
|
||||
'billed_at' => 'issued_at',
|
||||
'bill_number' => 'document_number',
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
if (false === isset($replacements)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$query = $builder->getQuery();
|
||||
|
||||
foreach ($replacements as $column => $replace) {
|
||||
if ($query->orders !== null) {
|
||||
$query->orders = $this->replaceColumn($query->orders, $column, $replace);
|
||||
}
|
||||
|
||||
if ($query->wheres !== null) {
|
||||
$query->wheres = $this->replaceColumn($query->wheres, $column, $replace);
|
||||
}
|
||||
|
||||
if ($query->havings !== null) {
|
||||
$query->havings = $this->replaceColumn($query->havings, $column, $replace);
|
||||
}
|
||||
|
||||
if ($query->unionOrders !== null) {
|
||||
$query->unionOrders = $this->replaceColumn($query->unionOrders, $column, $replace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function replaceColumn(array $columns, string $column, string $replace): array
|
||||
{
|
||||
return Collection::make($columns)
|
||||
->transform(
|
||||
function ($item) use ($column, $replace) {
|
||||
if (isset($item['column']) && $item['column'] === $column) {
|
||||
$item['column'] = $replace;
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
)->values()->all();
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\Document\Document;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Documents
|
||||
*/
|
||||
trait Purchases
|
||||
{
|
||||
use Documents;
|
||||
/**
|
||||
* Generate next bill number
|
||||
*
|
||||
* @deprecated
|
||||
* @see Documents::getNextDocumentNumber()
|
||||
*/
|
||||
public function getNextBillNumber(): string
|
||||
{
|
||||
return $this->getNextDocumentNumber(Document::BILL_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase the next bill number
|
||||
*
|
||||
* @deprecated`1
|
||||
* @see Documents::increaseNextDocumentNumber()
|
||||
*/
|
||||
public function increaseNextBillNumber(): void
|
||||
{
|
||||
$this->increaseNextDocumentNumber(Document::BILL_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a collection bill statuses
|
||||
*
|
||||
* @deprecated
|
||||
* @see Documents::getBillStatuses()
|
||||
*/
|
||||
public function getBillStatuses(): Collection
|
||||
{
|
||||
return $this->getDocumentStatuses(Document::BILL_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Documents::getDocumentFileName()
|
||||
*/
|
||||
public function getBillFileName(Document $bill, string $separator = '-', string $extension = 'pdf'): string
|
||||
{
|
||||
return $this->getDocumentFileName($bill, $separator, $extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Documents::getSafeDocumentNumber()
|
||||
*/
|
||||
public function getSafeBillNumber(Document $bill, string $separator = '-'): string
|
||||
{
|
||||
return $this->getSafeDocumentNumber($bill, $separator);
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\Document\Document;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Documents
|
||||
*/
|
||||
trait Sales
|
||||
{
|
||||
use Documents;
|
||||
/**
|
||||
* Generate next invoice number
|
||||
*
|
||||
* @deprecated
|
||||
* @see Documents::getNextDocumentNumber()
|
||||
*/
|
||||
public function getNextInvoiceNumber(): string
|
||||
{
|
||||
return $this->getNextDocumentNumber(Document::INVOICE_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase the next invoice number
|
||||
*
|
||||
* @deprecated
|
||||
* @see Documents::increaseNextDocumentNumber()
|
||||
*/
|
||||
public function increaseNextInvoiceNumber(): void
|
||||
{
|
||||
$this->increaseNextDocumentNumber(Document::INVOICE_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a collection invoice statuses
|
||||
*
|
||||
* @deprecated
|
||||
* @see Documents::getInvoiceStatuses()
|
||||
*/
|
||||
public function getInvoiceStatuses(): Collection
|
||||
{
|
||||
return $this->getDocumentStatuses(Document::INVOICE_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Documents::getDocumentFileName()
|
||||
*/
|
||||
public function getInvoiceFileName(Document $invoice, string $separator = '-', string $extension = 'pdf'): string
|
||||
{
|
||||
return $this->getDocumentFileName($invoice, $separator, $extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Documents::getSafeDocumentNumber()
|
||||
*/
|
||||
public function getSafeInvoiceNumber(Document $invoice, string $separator = '-'): string
|
||||
{
|
||||
return $this->getSafeDocumentNumber($invoice, $separator);
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Purchase;
|
||||
|
||||
use App\Transformers\Banking\Transaction;
|
||||
use App\Transformers\Common\Contact;
|
||||
use App\Transformers\Setting\Currency;
|
||||
use App\Models\Document\Document as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class Bill extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $defaultIncludes = ['contact', 'currency', 'histories', 'items', 'transactions'];
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'bill_number' => $model->document_number,
|
||||
'order_number' => $model->order_number,
|
||||
'status' => $model->status,
|
||||
'billed_at' => $model->issued_at ? $model->issued_at->toIso8601String() : '',
|
||||
'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '',
|
||||
'amount' => $model->amount,
|
||||
'currency_code' => $model->currency_code,
|
||||
'currency_rate' => $model->currency_rate,
|
||||
'contact_id' => $model->contact_id,
|
||||
'contact_name' => $model->contact_name,
|
||||
'contact_email' => $model->contact_email,
|
||||
'contact_tax_number' => $model->contact_tax_number,
|
||||
'contact_phone' => $model->contact_phone,
|
||||
'contact_address' => $model->contact_address,
|
||||
'notes' => $model->notes,
|
||||
'attachment' => $model->attachment,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Item
|
||||
*/
|
||||
public function includeContact(Model $model)
|
||||
{
|
||||
return $this->item($model->contact, new Contact());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Item
|
||||
*/
|
||||
public function includeCurrency(Model $model)
|
||||
{
|
||||
return $this->item($model->currency, new Currency());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
*/
|
||||
public function includeHistories(Model $model)
|
||||
{
|
||||
return $this->collection($model->histories, new BillHistories());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
*/
|
||||
public function includeItems(Model $model)
|
||||
{
|
||||
return $this->collection($model->items, new BillItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
*/
|
||||
public function includeTransactions(Model $model)
|
||||
{
|
||||
return $this->collection($model->transactions, new Transaction());
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentHistory as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class BillHistories extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'bill_id' => $model->bill_id,
|
||||
'status' => $model->status,
|
||||
'notify' => $model->notify,
|
||||
'description' => $model->description,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentItem as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class BillItems extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'bill_id' => $model->bill_id,
|
||||
'item_id' => $model->item_id,
|
||||
'name' => $model->name,
|
||||
'price' => $model->price,
|
||||
'total' => $model->total,
|
||||
'tax' => $model->tax,
|
||||
'tax_id' => $model->tax_id,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Purchase;
|
||||
|
||||
use App\Models\Document\DocumentTotal as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class BillTotals extends TransformerAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'bill_id' => $model->bill_id,
|
||||
'code' => $model->code,
|
||||
'name' => $model->name,
|
||||
'amount' => $model->amount,
|
||||
'sort_order' => $model->sort_order,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Sale;
|
||||
|
||||
use App\Transformers\Banking\Transaction;
|
||||
use App\Transformers\Common\Contact;
|
||||
use App\Transformers\Setting\Currency;
|
||||
use App\Models\Document\Document as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class Invoice extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $defaultIncludes = ['contact', 'currency', 'histories', 'items', 'transactions'];
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'invoice_number' => $model->document_number,
|
||||
'order_number' => $model->order_number,
|
||||
'status' => $model->status,
|
||||
'invoiced_at' => $model->issued_at ? $model->issued_at->toIso8601String() : '',
|
||||
'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '',
|
||||
'amount' => $model->amount,
|
||||
'currency_code' => $model->currency_code,
|
||||
'currency_rate' => $model->currency_rate,
|
||||
'contact_id' => $model->contact_id,
|
||||
'contact_name' => $model->contact_name,
|
||||
'contact_email' => $model->contact_email,
|
||||
'contact_tax_number' => $model->contact_tax_number,
|
||||
'contact_phone' => $model->contact_phone,
|
||||
'contact_address' => $model->contact_address,
|
||||
'notes' => $model->notes,
|
||||
'attachment' => $model->attachment,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Item
|
||||
*/
|
||||
public function includeContact(Model $model)
|
||||
{
|
||||
return $this->item($model->contact, new Contact());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Item
|
||||
*/
|
||||
public function includeCurrency(Model $model)
|
||||
{
|
||||
return $this->item($model->currency, new Currency());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
*/
|
||||
public function includeHistories(Model $model)
|
||||
{
|
||||
return $this->collection($model->histories, new InvoiceHistories());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
*/
|
||||
public function includeItems(Model $model)
|
||||
{
|
||||
return $this->collection($model->items, new InvoiceItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
*/
|
||||
public function includeTransactions(Model $model)
|
||||
{
|
||||
return $this->collection($model->transactions, new Transaction());
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Sale;
|
||||
|
||||
use App\Models\Document\DocumentHistory as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class InvoiceHistories extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'invoice_id' => $model->invoice_id,
|
||||
'status' => $model->status,
|
||||
'notify' => $model->notify,
|
||||
'description' => $model->description,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Sale;
|
||||
|
||||
use App\Models\Document\DocumentItem as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class InvoiceItems extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'invoice_id' => $model->invoice_id,
|
||||
'item_id' => $model->item_id,
|
||||
'name' => $model->name,
|
||||
'price' => $model->price,
|
||||
'total' => $model->total,
|
||||
'tax' => $model->tax,
|
||||
'tax_id' => $model->tax_id,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Sale;
|
||||
|
||||
use App\Models\Document\DocumentTotal as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class InvoiceTotals extends TransformerAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'invoice_id' => $model->invoice_id,
|
||||
'code' => $model->code,
|
||||
'name' => $model->name,
|
||||
'amount' => $model->amount,
|
||||
'sort_order' => $model->sort_order,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"alias": "bc21",
|
||||
"icon": "fa fa-cog",
|
||||
"version": "1.0.0",
|
||||
"active": 1,
|
||||
"providers": [
|
||||
"Modules\\BC21\\Providers\\Main"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": [],
|
||||
"reports": [],
|
||||
"widgets": [],
|
||||
"settings": [],
|
||||
"extra-modules": {}
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Http\Controllers;
|
||||
|
||||
use App\Abstracts\Http\PaymentController;
|
||||
use \App\Events\Document\PaymentReceived;
|
||||
use App\Http\Requests\Portal\InvoicePayment as PaymentRequest;
|
||||
use App\Models\Document\Document;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class Payment extends PaymentController
|
||||
{
|
||||
public $alias = 'offline-payments';
|
||||
|
||||
public $type = 'redirect';
|
||||
|
||||
public function show(Document $invoice, PaymentRequest $request)
|
||||
{
|
||||
$setting = [];
|
||||
|
||||
$payment_methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
foreach ($payment_methods as $payment_method) {
|
||||
if ($payment_method['code'] == $request['payment_method']) {
|
||||
$setting = $payment_method;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$html = view('offline-payments::show', compact('setting', 'invoice'))->render();
|
||||
|
||||
return response()->json([
|
||||
'code' => $setting['code'],
|
||||
'name' => $setting['name'],
|
||||
'description' => $setting['description'],
|
||||
'redirect' => false,
|
||||
'html' => $html,
|
||||
]);
|
||||
}
|
||||
|
||||
public function signed(Document $invoice, PaymentRequest $request)
|
||||
{
|
||||
$setting = [];
|
||||
|
||||
$payment_methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
foreach ($payment_methods as $payment_method) {
|
||||
if ($payment_method['code'] == $request['payment_method']) {
|
||||
$setting = $payment_method;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$confirm_url = URL::signedRoute('signed.invoices.offline-payments.confirm', [$invoice->id, 'company_id' => session('company_id')]);
|
||||
|
||||
$html = view('offline-payments::signed', compact('setting', 'invoice', 'confirm_url'))->render();
|
||||
|
||||
return response()->json([
|
||||
'code' => $setting['code'],
|
||||
'name' => $setting['name'],
|
||||
'description' => $setting['description'],
|
||||
'redirect' => false,
|
||||
'html' => $html,
|
||||
]);
|
||||
}
|
||||
|
||||
public function confirm(Document $invoice, Request $request)
|
||||
{
|
||||
try {
|
||||
event(new PaymentReceived($invoice, $request));
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
||||
|
||||
$response = [
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => false,
|
||||
];
|
||||
} catch(\Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
|
||||
$response = [
|
||||
'success' => false,
|
||||
'error' => true,
|
||||
'message' => $message,
|
||||
'data' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Http\Controllers;
|
||||
|
||||
use App\Abstracts\Http\Controller;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\OfflinePayments\Http\Requests\Setting as Request;
|
||||
use Modules\OfflinePayments\Http\Requests\SettingGet as GRequest;
|
||||
use Modules\OfflinePayments\Http\Requests\SettingDelete as DRequest;
|
||||
use Modules\OfflinePayments\Jobs\CreatePaymentMethod;
|
||||
use Modules\OfflinePayments\Jobs\DeletePaymentMethod;
|
||||
use Modules\OfflinePayments\Jobs\UpdatePaymentMethod;
|
||||
|
||||
class Settings extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$methods = json_decode(setting('offline-payments.methods'));
|
||||
|
||||
return view('offline-payments::edit', compact('methods'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
$code_exists = true;
|
||||
$methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
if (array_search($request->update_code, array_column($methods, 'code')) == false) {
|
||||
$code_exists = false;
|
||||
}
|
||||
|
||||
if (!empty($request->get('update_code')) && $code_exists == true) {
|
||||
$payment_method = $this->dispatch(new UpdatePaymentMethod($request));
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => $payment_method['name']]);
|
||||
} else {
|
||||
$payment_method = $this->dispatch(new CreatePaymentMethod($request));
|
||||
|
||||
$message = trans('messages.success.added', ['type' => $payment_method['name']]);
|
||||
}
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'redirect' => route('offline-payments.settings.edit'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param GRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(GRequest $request)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$code = $request->get('code');
|
||||
|
||||
$methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
foreach ($methods as $key => $method) {
|
||||
if ($method['code'] != $code) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$method['title'] = trans('offline-payments::offline-payments.edit', ['method' => $method['name']]);
|
||||
$method['update_code'] = $code;
|
||||
|
||||
$code = explode('.', $method['code']);
|
||||
|
||||
$method['code'] = $code[1];
|
||||
|
||||
$data = $method;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'errors' => false,
|
||||
'success' => true,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param DRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(DRequest $request)
|
||||
{
|
||||
$response = $this->ajaxDispatch(new DeletePaymentMethod($request));
|
||||
|
||||
if ($response['success']) {
|
||||
//$response['redirect'] = route('offline-payments.settings.edit');
|
||||
|
||||
$response['message'] = trans('messages.success.deleted', ['type' => $response['data']['name']]);
|
||||
|
||||
//flash($message)->success();
|
||||
} else {
|
||||
//$response['redirect'] = route('offline-payments.settings.edit');
|
||||
|
||||
$message = $response['message'];
|
||||
|
||||
//flash($message)->error()->important();
|
||||
}
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Http\Requests;
|
||||
|
||||
use App\Abstracts\Http\FormRequest as Request;
|
||||
|
||||
class Setting extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'code' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Http\Requests;
|
||||
|
||||
use App\Abstracts\Http\FormRequest as Request;
|
||||
|
||||
class SettingDelete extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'code' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Http\Requests;
|
||||
|
||||
use App\Abstracts\Http\FormRequest as Request;
|
||||
|
||||
class SettingGet extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'code' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Http\Requests;
|
||||
|
||||
use App\Abstracts\Http\FormRequest as Request;
|
||||
|
||||
class Show extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'payment_method' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Jobs;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Utilities\Modules;
|
||||
|
||||
class CreatePaymentMethod extends Job
|
||||
{
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $request
|
||||
*/
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $this->getRequestInstance($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
$payment_method = [
|
||||
'code' => 'offline-payments.' . $this->request->get('code') . '.' . (count($methods) + 1),
|
||||
'name' => $this->request->get('name'),
|
||||
'customer' => $this->request->get('customer'),
|
||||
'order' => $this->request->get('order'),
|
||||
'description' => $this->request->get('description'),
|
||||
];
|
||||
|
||||
$methods[] = $payment_method;
|
||||
|
||||
setting()->set('offline-payments.methods', json_encode($methods));
|
||||
|
||||
setting()->save();
|
||||
|
||||
Modules::clearPaymentMethodsCache();
|
||||
|
||||
return $payment_method;
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Jobs;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Utilities\Modules;
|
||||
use App\Models\Banking\Transaction;
|
||||
|
||||
class DeletePaymentMethod extends Job
|
||||
{
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $request
|
||||
*/
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $this->getRequestInstance($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->authorize();
|
||||
|
||||
$methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
$payment_method = [];
|
||||
|
||||
$code = $this->request->get('code');
|
||||
|
||||
foreach ($methods as $key => $method) {
|
||||
if ($method['code'] != $code) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$payment_method = $methods[$key];
|
||||
|
||||
unset($methods[$key]);
|
||||
}
|
||||
|
||||
setting()->set('offline-payments.methods', json_encode($methods));
|
||||
|
||||
setting()->save();
|
||||
|
||||
Modules::clearPaymentMethodsCache();
|
||||
|
||||
return $payment_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this action is applicable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if ($relationships = $this->getRelationships()) {
|
||||
$message = trans('messages.warning.deleted', ['name' => $this->request->get('code'), 'text' => implode(', ', $relationships)]);
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function getRelationships()
|
||||
{
|
||||
$counter = [];
|
||||
|
||||
if (!$c = Transaction::where('payment_method', $this->request->get('code'))->get()->count()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$counter[] = $c . ' ' . strtolower(trans_choice('general.transactions', ($c > 1) ? 2 : 1));
|
||||
|
||||
return $counter;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Jobs;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Utilities\Modules;
|
||||
|
||||
class UpdatePaymentMethod extends Job
|
||||
{
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $request
|
||||
*/
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $this->getRequestInstance($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
$payment_method = [];
|
||||
|
||||
$code = $this->request->get('update_code');
|
||||
|
||||
foreach ($methods as $key => $method) {
|
||||
if ($method['code'] != $code) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$method = explode('.', $code);
|
||||
|
||||
$payment_method = [
|
||||
'code' => 'offline-payments.' . $this->request->get('code') . '.' . $method[2],
|
||||
'name' => $this->request->get('name'),
|
||||
'customer' => $this->request->get('customer'),
|
||||
'order' => $this->request->get('order'),
|
||||
'description' => $this->request->get('description'),
|
||||
];
|
||||
|
||||
$methods[$key] = $payment_method;
|
||||
}
|
||||
|
||||
setting()->set('offline-payments.methods', json_encode($methods));
|
||||
|
||||
setting()->save();
|
||||
|
||||
Modules::clearPaymentMethodsCache();
|
||||
|
||||
return $payment_method;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Listeners;
|
||||
|
||||
use App\Events\Auth\LandingPageShowing as Event;
|
||||
|
||||
class AddLandingPage
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Event $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$event->user->landing_pages['offline-payments.settings.edit'] = trans('offline-payments::general.name');
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Listeners;
|
||||
|
||||
use App\Events\Module\Installed as Event;
|
||||
use App\Traits\Permissions;
|
||||
|
||||
class FinishInstallation
|
||||
{
|
||||
use Permissions;
|
||||
|
||||
public $alias = 'offline-payments';
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Event $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
if ($event->alias != $this->alias) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->updatePermissions();
|
||||
}
|
||||
|
||||
protected function updatePermissions()
|
||||
{
|
||||
// c=create, r=read, u=update, d=delete
|
||||
$this->attachPermissionsToAdminRoles([
|
||||
$this->alias . '-settings' => 'r,u,d',
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Listeners;
|
||||
|
||||
use App\Events\Module\PaymentMethodShowing as Event;
|
||||
|
||||
class ShowAsPaymentMethod
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Event $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$methods = json_decode(setting('offline-payments.methods'), true);
|
||||
|
||||
if (empty($methods)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($methods as $method) {
|
||||
$event->modules->payment_methods[] = $method;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Listeners;
|
||||
|
||||
use App\Events\Module\SettingShowing as Event;
|
||||
|
||||
class ShowInSettingsPage
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Event $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$event->modules->settings['offline-payments'] = [
|
||||
'name' => trans('offline-payments::general.name'),
|
||||
'description' => trans('offline-payments::general.description'),
|
||||
'url' => route('offline-payments.settings.edit'),
|
||||
'icon' => 'fas fa-credit-card',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as Provider;
|
||||
|
||||
class Event extends Provider
|
||||
{
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the listener directories that should be used to discover events.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function discoverEventsWithin()
|
||||
{
|
||||
return [
|
||||
__DIR__ . '/../Listeners',
|
||||
];
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as Provider;
|
||||
|
||||
class Main extends Provider
|
||||
{
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->loadTranslations();
|
||||
$this->loadViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->loadRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadViews()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'offline-payments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadTranslations()
|
||||
{
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'offline-payments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadRoutes()
|
||||
{
|
||||
if (app()->routesAreCached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$routes = [
|
||||
'admin.php',
|
||||
'portal.php',
|
||||
'signed.php',
|
||||
];
|
||||
|
||||
foreach ($routes as $route) {
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/' . $route);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
/**
|
||||
* First we will load all of this project's JavaScript dependencies which
|
||||
* includes Vue and other libraries. It is a great starting point when
|
||||
* building robust, powerful web applications using Vue and Laravel.
|
||||
*/
|
||||
|
||||
require('./../../../../../resources/assets/js/bootstrap');
|
||||
|
||||
import Vue from 'vue';
|
||||
|
||||
import Global from './../../../../../resources/assets/js/mixins/global';
|
||||
import Form from './../../../../../resources/assets/js/plugins/form';
|
||||
import DashboardPlugin from './../../../../../resources/assets/js/plugins/dashboard-plugin';
|
||||
|
||||
// plugin setup
|
||||
Vue.use(DashboardPlugin);
|
||||
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
|
||||
mixins: [
|
||||
Global
|
||||
],
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: new Form('offline-payment'),
|
||||
update_code: null,
|
||||
form_loading: '',
|
||||
}
|
||||
},
|
||||
|
||||
methods:{
|
||||
onEdit(event) {
|
||||
var code = event.target.dataset.code;
|
||||
|
||||
this.form_loading = '<span class="form-loading-bar"><span class="form-loading-spin"><i class="fa fa-spinner fa-spin"></i></span></span>';
|
||||
|
||||
this.form.loading = true;
|
||||
|
||||
axios.post('offline-payments/settings/get', {
|
||||
code: code
|
||||
})
|
||||
.then(response => {
|
||||
this.form.name = response.data.data.name;
|
||||
this.form.code = response.data.data.code;
|
||||
this.form.customer = response.data.data.customer;
|
||||
this.form.order = response.data.data.order;
|
||||
this.form.description = response.data.data.description;
|
||||
this.form.update_code = response.data.data.update_code;
|
||||
this.update_code = response.data.data.update_code;
|
||||
this.form.loading = false;
|
||||
this.form_loading = '';
|
||||
})
|
||||
.catch(error => {
|
||||
this.form.loading = false;
|
||||
this.form_loading = '';
|
||||
});
|
||||
},
|
||||
|
||||
// Actions > Delete
|
||||
confirmDelete(code, title, message, button_cancel, button_delete) {
|
||||
let confirm = {
|
||||
code: code,
|
||||
url: url,
|
||||
title: title,
|
||||
message: message,
|
||||
button_cancel: button_cancel,
|
||||
button_delete: button_delete,
|
||||
show: true
|
||||
};
|
||||
|
||||
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
||||
resolve({
|
||||
template : '<div id="dynamic-delete-component"><akaunting-modal v-if="confirm.show" :show="confirm.show" :title="confirm.title" :message="confirm.message" :button_cancel="confirm.button_cancel" :button_delete="confirm.button_delete" @confirm="onDelete" @cancel="cancelDelete"></akaunting-modal></div>',
|
||||
|
||||
mixins: [
|
||||
Global
|
||||
],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
confirm: confirm,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// Delete action post
|
||||
async onDelete() {
|
||||
let promise = Promise.resolve(axios({
|
||||
method: 'DELETE',
|
||||
url: 'offline-payments/settings/delete',
|
||||
data: {
|
||||
code: this.confirm.code
|
||||
}
|
||||
}));
|
||||
|
||||
promise.then(response => {
|
||||
var type = (response.data.success) ? 'success' : 'warning';
|
||||
|
||||
if (response.data.success) {
|
||||
if (response.data.redirect) {
|
||||
//window.location.href = response.data.redirect;
|
||||
}
|
||||
|
||||
document.getElementById('method-' + this.confirm.code).remove();
|
||||
}
|
||||
|
||||
this.confirm.show = false;
|
||||
|
||||
this.$notify({
|
||||
message: response.data.message,
|
||||
timeout: 5000,
|
||||
icon: 'fas fa-bell',
|
||||
type
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.success = false;
|
||||
});
|
||||
},
|
||||
|
||||
// Close modal empty default value
|
||||
cancelDelete() {
|
||||
this.confirm.show = false;
|
||||
},
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
File diff suppressed because one or more lines are too long
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'name' => 'المدفوعات بدون الإتصال بالأنترنت',
|
||||
'description' => 'إنشاء خيارات دفع غير محدودة لاستخدام المسؤول',
|
||||
|
||||
'add_new' => 'إضافة جديد',
|
||||
'edit' => 'تعديل: :method',
|
||||
|
||||
'form' => [
|
||||
'code' => 'الكود',
|
||||
'customer' => 'إظهار للعميل',
|
||||
'order' => 'طلب'
|
||||
],
|
||||
|
||||
'methods' => 'طريقة | طرق',
|
||||
|
||||
'payment_gateways' => 'طرق الدفع بدون أنترنت',
|
||||
|
||||
];
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'name' => 'Offline betalinger',
|
||||
'description' => 'Opret ubegrænsede betalingsmuligheder til admin-brug',
|
||||
|
||||
'add_new' => 'Tilføj ny',
|
||||
'edit' => 'Rediger: :method',
|
||||
|
||||
'form' => [
|
||||
'code' => 'Kode',
|
||||
'customer' => 'Vis til kunde',
|
||||
'order' => 'Bestille'
|
||||
],
|
||||
|
||||
'methods' => 'Metode|Metoder',
|
||||
|
||||
'payment_gateways' => 'Offline betalingsmetoder',
|
||||
|
||||
];
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user