Compare commits

...

895 Commits

Author SHA1 Message Date
cba602655d Converted <label> in <BaseLabel> 2023-03-23 17:24:03 +05:30
87495e8055 added dark-mode in BaseInputGroup and BaseLabel 2023-03-22 10:16:06 +05:30
15f3f566e3 Dark sidebar header (#1156)
* add dark mode in sidebar and header

* add dark theme in blade file
2023-03-20 15:50:27 +05:30
98196194e2 Merge branch 'master' of https://github.com/bytefury/crater 2022-12-13 11:38:49 +05:30
7447cc24f9 feat: uffizzi integration (#1091)
Co-authored-by: Aramayis <>
2022-11-21 18:35:59 +05:30
889d22d92c Update php version (#1083)
Version 7.4 no longer works when running docker-compose/setup.sh. Updated to 8.1 in Dockerfile. Issue is now resolved and Crater sets up as expected without version conflicts.
2022-11-03 19:29:16 +05:30
bc8f2cd484 fix tax issue (#953)
* fix tax issue

* remove console log

* update cs fixer package
2022-10-26 19:51:36 +05:30
4e47f58bad fixed - No query results for model [Crater\Models\Currency] (#1070)
* fixed report pdf issue

* Removed telescope service provider file
2022-10-26 19:33:25 +05:30
d8c429912e fix composer issue with pest 2022-10-17 13:04:27 +05:30
df04fd9e53 Merge branch 'master' of https://github.com/bytefury/crater 2022-10-17 12:48:24 +05:30
0aaf0e7e75 Adding object-fit rules so thumbnail image does not appear stretched. (#1065) 2022-10-13 23:44:39 +05:30
3d0b89bb4d bug: fix missing hyphen in setup.sh (#1067)
Co-authored-by: Aramayis <>
2022-10-13 23:40:07 +05:30
38c4b9ebce Patch setup.sh script to deploy without plugins error. (#1034) 2022-09-13 14:52:51 +05:30
7be59e78e0 Formatting + Netherlands rename (#973)
* Formatting + Netherlands rename

* Revert change
2022-07-09 20:03:08 +05:30
189c51cdf4 Merge branch 'master' of https://github.com/bytefury/crater 2022-06-15 20:39:16 +05:30
204483836a 🌐Update: support Thai language (#768)
* add thai language config

* update thai translation

* update thai translation

* add THSarabunNew fonts to using in pdf

* update: pdf file to support thai language by checking isLocale('th') and include thai font-family

* update: thai translation

* remove the index.php file (not used)

* move THSarabunNew fonts to resoureces/static/fonts

* Add .gitkeep to storage/fonts to pre-build the fonts directory

Co-authored-by: Ritthikrai (Champ) Wiengchai <ritthikrai.w@aware.co.th>
2022-06-15 18:17:36 +05:30
33bc9ded65 Bump guzzlehttp/guzzle from 7.4.1 to 7.4.3 (#936)
Bumps [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) from 7.4.1 to 7.4.3.
- [Release notes](https://github.com/guzzle/guzzle/releases)
- [Changelog](https://github.com/guzzle/guzzle/blob/master/CHANGELOG.md)
- [Commits](https://github.com/guzzle/guzzle/compare/7.4.1...7.4.3)

---
updated-dependencies:
- dependency-name: guzzlehttp/guzzle
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-05 14:10:27 +05:30
4271ef451e Php 8 compliant (#914) 2022-06-05 14:09:42 +05:30
6eb44fba93 Update cron.dockerfile (#949) 2022-06-05 14:09:11 +05:30
96e7300583 Make unit clearable (#918) 2022-05-28 11:55:09 +05:30
a479d966d1 Update en.json (#925)
Corrected sentence case from "Expiry date" to "Expiry Date"
2022-05-28 11:54:32 +05:30
bca2794c4c New Crowdin updates (#924)
* New translations en.json (Spanish)

* New translations en.json (Portuguese, Brazilian)
2022-05-24 12:54:42 +05:30
cb88c19059 New Crowdin updates (#910)
* New translations en.json (Lithuanian)

* New translations en.json (Greek)

* New translations en.json (Greek)

* New translations en.json (Greek)
2022-05-03 16:34:03 +05:30
946c7efab4 Also replace variables in subject (#893) 2022-04-25 18:02:21 +05:30
d7b1d15f93 New Crowdin updates (#877)
* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (German)

* New translations en.json (Russian)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (Czech)

* New translations en.json (Czech)

* New translations en.json (Spanish)

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (German)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)

* New translations en.json (Indonesian)
2022-04-25 14:19:41 +05:30
94e1efe115 New Crowdin updates (#875)
* New translations en.json (Hindi)

* New translations en.json (Hindi)
2022-04-01 17:32:59 +05:30
b0e38b74e9 Bump guzzlehttp/psr7 from 2.1.0 to 2.2.1 (#871)
Bumps [guzzlehttp/psr7](https://github.com/guzzle/psr7) from 2.1.0 to 2.2.1.
- [Release notes](https://github.com/guzzle/psr7/releases)
- [Changelog](https://github.com/guzzle/psr7/blob/master/CHANGELOG.md)
- [Commits](https://github.com/guzzle/psr7/compare/2.1.0...2.2.1)

---
updated-dependencies:
- dependency-name: guzzlehttp/psr7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-01 17:32:43 +05:30
bd5f0fe5cf Merge branch 'v-calendar' into 'master'
apply v-calendar

See merge request mohit.panjvani/crater-web!1468
2022-04-01 10:24:57 +00:00
787619b907 add v-calendar 2022-04-01 10:24:56 +00:00
fd70ab9a99 Merge branch 'fix-expense-receipt-delete-issue' into 'master'
Fix expense receipt delete issue while update

See merge request mohit.panjvani/crater-web!1477
2022-04-01 10:24:20 +00:00
33315638df Fix expense receipt delete issue while update 2022-04-01 15:51:12 +05:30
157559cc05 Improve invoice 1 template css (#872)
There is no class "header" that's why I removed it. Also I fixed some whitespace issues
2022-04-01 13:50:27 +05:30
bba14bf51a Merge branch 'master' 2022-04-01 12:04:06 +05:30
9d1484d62d Completed missing french translations (#852) 2022-04-01 10:10:18 +05:30
654dd9e64d New Crowdin updates (#874)
* New translations en.json (Hindi)

* New translations en.json (Hindi)
2022-04-01 10:09:02 +05:30
ea41989034 Merge branch 'fix-expense-receipt-issue' into 'master'
fix expense receipt issue

See merge request mohit.panjvani/crater-web!1473
2022-03-30 09:02:56 +00:00
3f3f83a00a fix expense receipt issue 2022-03-30 09:02:56 +00:00
adc5962071 Merge branch 'fix-invoice-status-issue' into 'master'
Fix invoice status issue

See merge request mohit.panjvani/crater-web!1470
2022-03-30 07:38:38 +00:00
c4c00002d7 Fix invoice status issue 2022-03-30 07:38:38 +00:00
a7c1e12db6 Merge branch 'new-custom-fields' into 'master'
added "Due Amount, Total Amount and PDF Link" new custom fields

See merge request mohit.panjvani/crater-web!1464
2022-03-30 07:35:53 +00:00
32949d1eec added "Due Amount, Total Amount and PDF Link" new custom fields 2022-03-30 07:35:53 +00:00
7718f77f3d Merge branch 'master' of https://github.com/bytefury/crater 2022-03-29 13:16:03 +05:30
7cde971f8b Module upload validation (#857)
https://huntr.dev/bounties/cb9a0393-be34-4021-a06c-00c7791c7622/
2022-03-29 12:55:35 +05:30
4e7441a5cf add default support for Central African currency (#865) 2022-03-28 13:58:43 +05:30
b714833b06 New Crowdin updates (#862)
* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (Dutch)

* New translations en.json (Dutch)
2022-03-28 13:58:23 +05:30
88035ea490 Expense attachment validation fix (#855)
https://huntr.dev/bounties/4d7d4fc9-e0cf-42d3-b89c-6ea57a769045/
2022-03-22 16:58:55 +05:30
a9e54981bf Merge branch 'fix-minor-issues' into 'master'
Fix minor issues

See merge request mohit.panjvani/crater-web!1469
2022-03-21 06:45:14 +00:00
ef35293f8a update company slug help text 2022-03-21 12:13:05 +05:30
5c63770b6b added unique validation and help text for company slug field 2022-03-21 12:04:17 +05:30
80847529fa New Crowdin updates (#833)
* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Spanish)

* New translations en.json (Indonesian)
2022-03-20 21:06:58 +05:30
d130e20c92 Merge branch 'fix-default-custom-value' into 'master'
fixed "Custom fields always set to default value"

See merge request mohit.panjvani/crater-web!1471
2022-03-16 06:04:21 +00:00
586fb1ae10 fixed "Custom fields always set to default value" 2022-03-16 11:28:08 +05:30
20c2502e31 added company slug 2022-03-14 17:45:58 +05:30
0e31f85c18 change company currency if it does not have any transaction. 2022-03-14 12:55:38 +05:30
e7301eb7a3 Fix minor issues 2022-03-14 11:54:13 +05:30
18507ddb6f new build 606 2022-03-06 12:39:21 +05:30
7275f3dd47 Merge branch 'fix-latest-issues' into 'master'
Fix tax per item issue & check currency key

See merge request mohit.panjvani/crater-web!1460
2022-03-06 07:02:58 +00:00
e31f947aba fix conflict 2022-03-06 12:32:24 +05:30
7ba120db31 Merge branch 'fix-invoice-item-create-issue' into 'master'
fix item is not created in invoice->add new item modal

See merge request mohit.panjvani/crater-web!1462
2022-03-06 06:59:07 +00:00
bc73ed8c9e fix conflict 2022-03-06 12:28:51 +05:30
b1689dd2c6 Merge branch 'master' of https://github.com/bytefury/crater 2022-03-06 12:25:44 +05:30
f6c59b7423 New Crowdin updates (#817)
* New translations en.json (Finnish)

* New translations en.json (Italian)

* New translations en.json (Vietnamese)
2022-03-06 10:05:31 +05:30
2cadcad485 Fix currency settings error (#821)
* Fixed issue with currency error on change after transactions

* organized imports
2022-03-06 09:53:31 +05:30
04deade111 fix item is not created in invoice->add new item modal 2022-03-04 17:15:23 +05:30
ee0632f0d3 Merge branch 'fix-default-language-filter-issue' into 'master'
fixed search filter is not working

See merge request mohit.panjvani/crater-web!1461
2022-03-04 10:47:23 +00:00
f6771dafd3 fixed search filter is not working 2022-03-04 15:00:56 +05:30
fadef0ea07 Fix tax per item issue & check currency key 2022-03-04 12:08:03 +05:30
c07e44520a typo: somthing -> something (#820) 2022-03-04 08:21:17 +05:30
6552c4edd6 New translations en.json (Finnish) (#816) 2022-03-03 23:10:11 +05:30
5183a825e6 New Crowdin updates (#815)
* New translations en.json (Romanian)

* New translations en.json (Slovak)

* New translations en.json (Hindi)

* New translations en.json (Latvian)

* New translations en.json (Croatian)

* New translations en.json (Persian)

* New translations en.json (Indonesian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Vietnamese)

* New translations en.json (Chinese Traditional)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (Portuguese)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Lithuanian)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Czech)

* New translations en.json (Arabic)

* New translations en.json (Spanish)

* New translations en.json (Serbian (Latin))
2022-03-03 20:39:44 +05:30
83a7c97e9e fix tests 2022-03-03 20:30:05 +05:30
eea3925fcd new build 605 2022-03-03 17:03:40 +05:30
9a0de9f64f update message and formatting 2022-03-03 17:02:38 +05:30
a23644c9d8 Merge branch 'master' 2022-03-03 16:57:59 +05:30
b884001e87 update comments 2022-03-03 16:57:52 +05:30
bb54edc147 Merge branch 'fix-issue-6.5' into 'master'
Fix issue 6.5

See merge request mohit.panjvani/crater-web!1459
2022-03-03 11:27:12 +00:00
25c43ab4d2 Fix condition 2022-03-03 15:10:53 +05:30
388d00241b Fix recurring invoice condition 2022-03-03 14:07:19 +05:30
69d8c95557 Minor fixes 2022-03-03 13:25:12 +05:30
ea9748ca68 Endpoint to check company currency transaction 2022-03-03 12:56:46 +05:30
66a5501bd2 Solve due date issue in recurring invoice 2022-03-03 12:56:10 +05:30
c897521137 Added preview to invoice, estimate & payment pdfs 2022-03-03 12:55:57 +05:30
adf4b3a74d Merge branch 'change-frequency-label' into 'master'
change label

See merge request mohit.panjvani/crater-web!1458
2022-03-03 07:25:45 +00:00
cc737593b7 Added migration to Change over due status 2022-03-03 12:55:15 +05:30
9356c309a2 change label 2022-03-03 12:49:29 +05:30
35da80103e new build 605 2022-03-03 11:43:03 +05:30
99f553f1c3 fix formatting issues and create update migration 2022-03-03 11:32:30 +05:30
3f4305c7cb Merge branch 'master' of https://github.com/bytefury/crater 2022-03-03 11:30:31 +05:30
a678b4d272 New Crowdin translation updates (#796)
* New translations en.json (Polish)

* New translations en.json (Italian)

* New translations en.json (Italian)

* New translations en.json (Romanian)

* New translations en.json (Slovak)

* New translations en.json (Hindi)

* New translations en.json (Latvian)

* New translations en.json (Croatian)

* New translations en.json (Persian)

* New translations en.json (Indonesian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Vietnamese)

* New translations en.json (Chinese Traditional)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (Portuguese)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Lithuanian)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Czech)

* New translations en.json (Arabic)

* New translations en.json (Spanish)

* New translations en.json (Serbian (Latin))

* Update source file en.json

* New translations en.json (German)

* New translations en.json (Vietnamese)

* New translations en.json (Italian)

* New translations en.json (Croatian)
2022-03-03 11:27:04 +05:30
0c83456866 Merge branch 'add-overdue' into 'master'
add overdue

See merge request mohit.panjvani/crater-web!1457
2022-03-03 05:38:56 +00:00
2cb51b84c7 add overdue 2022-03-02 18:09:41 +05:30
3908878109 Merge branch 'fix-delete-condition' into 'master'
Fix transaction delete issue

See merge request mohit.panjvani/crater-web!1456
2022-03-02 07:28:40 +00:00
6970a4f243 Merge branch 'dialog-issue-fix' into 'master'
fix responsive issue

See merge request mohit.panjvani/crater-web!1455
2022-03-02 07:24:38 +00:00
5720803116 Fix transaction delete issue 2022-03-02 12:17:31 +05:30
351e6617d9 fix responsive issue 2022-02-25 12:02:36 +05:30
ffa7906382 Merge branch 'document-title' into 'master'
add admin_document_title

See merge request mohit.panjvani/crater-web!1447
2022-02-24 12:40:33 +00:00
2a43ec9e9d fix minor issues 2022-02-24 11:29:32 +05:30
48f9da14ba remove unwanted code 2022-02-24 11:06:20 +05:30
4153d10a0a Merge branch 'fix-v6.4-issues' into 'master'
fix invoice status condition
2022-02-24 05:22:32 +00:00
1322ed15dc - fix invoice status not updating issue
- date range selection issues on report for non-english languages
- fix invoice all tab issue (always showing draft even in all tab)
2022-02-24 05:22:32 +00:00
a452ec5eaf add migration 2022-02-23 18:34:12 +05:30
b819307612 refactor helpers 2022-02-23 17:58:07 +05:30
7202fdcbf2 new build 2022-02-22 12:31:28 +05:30
c28fc073e4 fix responsive cropping issue for ios 2022-02-22 12:29:37 +05:30
439fc4e002 add fields 2022-02-21 18:34:04 +05:30
ca15751a5f Merge branch 'master' 2022-02-21 13:34:54 +05:30
50637f5f7c Merge branch 'master' of https://github.com/bytefury/crater 2022-02-21 13:34:32 +05:30
e3219baad2 Merge branch 'fix-pdf-guard-issue' into 'master'
fix guard issue

See merge request mohit.panjvani/crater-web!1449
2022-02-21 07:57:25 +00:00
8de8a07e3e fix guard issue 2022-02-21 13:20:58 +05:30
ab28ba38ce Merge branch 'master' 2022-02-21 10:48:54 +05:30
7a27317f1a Merge branch 'fix-master-issues' into 'master'
Fix master issues

See merge request mohit.panjvani/crater-web!1446
2022-02-19 09:50:46 +00:00
ab153963e4 Fix master issues 2022-02-19 09:50:46 +00:00
65dd1eca01 change default currency to USD 2022-02-19 13:49:38 +05:30
bed05fc21f Arrange Invoice, Recurring Invoices and Estimate Tab groups for a more natural flow (#803) 2022-02-19 09:59:37 +05:30
0578122fc3 add admin_document_title 2022-02-18 12:21:13 +05:30
ce3db7d0c6 Update readme.md (#802)
Fix API Documentation URL
2022-02-18 06:56:27 +05:30
854ae10198 fix formatting 2022-02-17 14:10:36 +05:30
2383e89daa new build 604 2022-02-17 13:48:06 +05:30
6529fa1892 Merge branch 'fix-send-invoice-issue' into 'master'
fix send invoices and payments issues

See merge request mohit.panjvani/crater-web!1443
2022-02-17 08:15:40 +00:00
eef74fd2fc Merge branch 'change-logout-request' into 'master'
fixed customer logout error

See merge request mohit.panjvani/crater-web!1445
2022-02-17 08:14:43 +00:00
2f69b6fa71 fixed customer logout error 2022-02-17 12:39:10 +05:30
7170fb0cef fix send invoices and payments issues 2022-02-16 18:59:49 +05:30
db7a084a19 Merge branch 'set-default-country' into 'master'
set "United States" as default country for company in installation wizard

See merge request mohit.panjvani/crater-web!1442
2022-02-16 09:09:03 +00:00
e24a89fe39 set "United States" as default country for company in installtion wizard 2022-02-16 12:05:08 +05:30
6a3e9e132f fix formatting 2022-02-16 11:19:30 +05:30
68575b69b9 new build 603 2022-02-16 10:47:32 +05:30
8da5f99511 Merge branch 'master' 2022-02-16 10:44:08 +05:30
912dbdc1c5 Merge branch 'fix_all_customer_load' into 'master'
Fix all customer load

See merge request mohit.panjvani/crater-web!1435
2022-02-16 05:13:53 +00:00
771d396bfb Merge branch 'master' of gitlab.com:mohit.panjvani/crater-web into fix_all_customer_load 2022-02-15 18:41:57 +05:30
30dc428b1a apply scroll to load data changes in customer and fixed search with scroll to load data issue in estimate, invoice, recurring invoice and payments 2022-02-15 18:41:05 +05:30
6f7555bdce add 603 update migration 2022-02-15 17:30:33 +05:30
13cbb5439f fix search pagination 2022-02-15 13:01:29 +05:30
a0cd12913d fix template selection issue when image is not loaded 2022-02-15 12:16:01 +05:30
67e93dcb00 Merge branch 'mark-as-default-template' into 'master'
added mark as default changes in estimate and invoice template

See merge request mohit.panjvani/crater-web!1440
2022-02-15 06:16:57 +00:00
7427f8a4ac new build 2022-02-15 11:44:39 +05:30
10ceaa0e2c Merge branch 'master' 2022-02-15 11:40:59 +05:30
15256a19db Merge branch 'fix-download-expense-issue' into 'master'
fixed uploaded attachment not removed

See merge request mohit.panjvani/crater-web!1441
2022-02-15 06:10:04 +00:00
8ba84f68c7 fixed uploaded attachment not removed 2022-02-15 06:10:04 +00:00
9e23f9b9b1 fix search issues 2022-02-15 11:32:30 +05:30
7f4cdfffc6 New Crowdin updates (#791)
* New translations en.json (Romanian)

* New translations en.json (Slovak)

* New translations en.json (Hindi)

* New translations en.json (Latvian)

* New translations en.json (Croatian)

* New translations en.json (Persian)

* New translations en.json (Indonesian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Vietnamese)

* New translations en.json (Chinese Traditional)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (French)

* New translations en.json (Portuguese)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Lithuanian)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Czech)

* New translations en.json (Arabic)

* New translations en.json (Spanish)

* New translations en.json (Serbian (Latin))

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Portuguese)

* New translations en.json (German)
2022-02-15 11:03:54 +05:30
c9d6824f8c Fixed the "Download Expenses File" URL (#785)
* Fixed the download PDF URL

Added the "/reports" prefix to the "Download PDF" Button of the Create.vue file. Now the download redirect works correctly.

Fixed with @SpyrosKoustas.

* Fixed the missing "/reports" prefix

Added the missing "/reports" prefix so that the project must not be rebuilt.

Fixed with @Dimitris-Provatas

Co-authored-by: Spyros Georg Koustas <spyros.koustas@hotmail.com>
2022-02-15 11:00:31 +05:30
84f5890294 Merge branch 'fix_all_customer_load' 2022-02-15 10:51:54 +05:30
ab8089fe98 Merge branch 'master' into fix_all_customer_load 2022-02-15 10:45:50 +05:30
383ba65d7c Merge branch 'master' of https://github.com/bytefury/crater 2022-02-15 10:45:08 +05:30
f34dac9d3f Merge branch 'fix-recurring-invoice-issue' into 'master'
fixed send invoice modal not open in recurring invoice

See merge request mohit.panjvani/crater-web!1439
2022-02-15 05:13:40 +00:00
c3965613b5 Merge branch 'change-logout-request' into 'master'
change from "GET" to "POST" request for logout user or customer

See merge request mohit.panjvani/crater-web!1438
2022-02-15 05:13:22 +00:00
c07e309918 rename variable name 2022-02-14 15:16:26 +05:30
35e71ec110 fix select cutoff issue on invoice create 2022-02-14 14:28:28 +05:30
82dbee4794 Update Crowdin configuration file 2022-02-14 12:08:04 +05:30
d883e89819 fix formatting 2022-02-14 11:24:59 +05:30
00133d66c2 added mark as default changes in estimate and invoice template 2022-02-11 12:23:36 +05:30
e8a88dbad3 change customer logout route method 2022-02-11 09:51:41 +05:30
2b7028b7c8 changed route method 2022-02-11 09:39:11 +05:30
513d43d92f Merge branch 'master' 2022-02-10 11:50:40 +05:30
b781f11175 Merge branch 'master' of https://github.com/bytefury/crater 2022-02-10 11:50:13 +05:30
ca1aa604e3 fixed send modal not open in recurring invoice 2022-02-08 16:27:26 +05:30
e1e1157f2d change from "GET" to "POST" request for logout user or customer 2022-02-08 12:38:52 +05:30
3f2c774f91 refactor and apply scroll to load data in estimates, invoices and payments 2022-02-08 11:57:47 +05:30
9448677dad #773 PDF download naming (#778) 2022-02-08 07:40:14 +05:30
9709489c66 Merge branch 'fix-dashboard-issue' into 'master'
fix dashboard issue

See merge request mohit.panjvani/crater-web!1437
2022-02-07 12:28:53 +00:00
2fcc87180f fix dashboard issue 2022-02-05 18:16:10 +05:30
0c77562d0e minor refactor 2022-02-05 13:31:06 +05:30
5f53138dc5 fix: Poppins semi-bold font 404 error (#771) 2022-02-04 18:18:14 +05:30
2019e9be03 Merge branch 'text-align-extension' into 'master'
Add extension-text-align

See merge request mohit.panjvani/crater-web!1434
2022-02-03 13:36:54 +00:00
938e6f2a9f Merge branch 'fix-expense-receipt' into 'master'
fix receipt not uploading in expense

See merge request mohit.panjvani/crater-web!1436
2022-02-03 12:51:02 +00:00
c82dc94252 fix receipt not uploading in expense 2022-02-03 11:39:18 +05:30
c6b36d78b9 updated customer and category added in first in dropdown list 2022-02-02 18:57:38 +05:30
1d402e0143 add scroll to load invoices and fixed limited category and customer issue in payment and expense 2022-02-02 18:51:32 +05:30
75a0ed1ffc Add extension-text-align 2022-02-02 16:30:19 +05:30
577c015d14 Merge branch 'remove-link' into 'master'
remove links

See merge request mohit.panjvani/crater-web!1428
2022-02-02 09:33:41 +00:00
760f4566aa Customer view field resolve fix (#757)
* fixed customer view field resolve

* fixed customer view field resolve estimate payment
2022-01-29 00:07:26 +05:30
d7ec554eba Merge branch 'admin-portal-logo' into 'master'
add admin portal logo

See merge request mohit.panjvani/crater-web!1427
2022-01-28 07:11:54 +00:00
c194e98a7b add admin portal logo 2022-01-28 07:11:54 +00:00
6a34708a37 Update french translation (#723)
Missing translations
2022-01-27 17:24:03 +05:30
ab863a8d88 Added Czech language (#702) 2022-01-27 17:23:37 +05:30
f594556de0 Merge branch 'invoice-custom-field' into 'master'
fix custom field invoice issue

See merge request mohit.panjvani/crater-web!1432
2022-01-27 10:27:31 +00:00
30f36461c2 fix custom field invoice issue 2022-01-27 15:04:32 +05:30
980de6d492 remove links 2022-01-20 16:26:09 +05:30
ff3cd0f7b9 Customer avatar validation (#732)
* Customer avatar validation

https://huntr.dev/bounties/19f3e5f7-b419-44b1-9c37-7e4404cbec94/

* Customer avatar validation test

https://huntr.dev/bounties/19f3e5f7-b419-44b1-9c37-7e4404cbec94/
2022-01-19 17:08:34 +05:30
323b7d8ea6 Adds Nepali Rupee as currency (#675)
Co-authored-by: Ayush Jha <ayush.jha@wmcglobal.com>
2022-01-18 21:42:18 +05:30
dc7282d6e9 Added Macedonian Denar currency (#736)
* Add Macedonian Denar currency

* Typo fix

* Swap currency symbol
2022-01-18 21:35:18 +05:30
85836c3f9c Update readme.md (#719) 2022-01-13 21:48:16 +05:30
221184df41 new version 2022-01-13 18:19:56 +05:30
f313a8c164 new build 2022-01-13 18:07:39 +05:30
8f4fea3811 Merge branch 'error-message' into 'master'
add error message

See merge request mohit.panjvani/crater-web!1424
2022-01-13 11:52:23 +00:00
dca97e80e7 add error message 2022-01-13 17:19:27 +05:30
9e6b4bd862 Merge branch 'payment-method-delete' into 'master'
solve payment method delete issue

See merge request mohit.panjvani/crater-web!1423
2022-01-13 07:23:19 +00:00
55beed430a solve payment method delete issue 2022-01-13 12:25:46 +05:30
dd324c8bb6 solve payment method delete issue 2022-01-13 12:23:26 +05:30
e3f3809f2d fix formatting errors 2022-01-12 21:12:54 +05:30
d877b16776 add 601 migration 2022-01-12 18:59:35 +05:30
eac1bbb622 sync languages with crowdin 2022-01-12 17:58:25 +05:30
4ef5e7e54b Merge branch 'master' of https://github.com/bytefury/crater 2022-01-12 17:39:26 +05:30
e2bb414efe Fix HTML injection exploit (#682)
Escape html special characters from the $fields array to prevent html injection in the generated pdfs.
2022-01-12 17:39:15 +05:30
941bc4bdb8 Update dompdf version 2022-01-12 11:44:45 +00:00
a14655d73b Update dompdf version 2022-01-12 11:44:45 +00:00
d303b1a71c Patch on French translation (#711)
* Update fr.json

A few updates on some French translation typos (caps mostly).
"Item>Price" also needed to be more accurate, so just added "Unit price".

* Update fr.json

* Clarified pdf_price_label as it was ambiguous
* Translated PDF reports strings
* Few typos & missing words
2022-01-12 13:16:12 +05:30
f677a54c2a fix logo path 2022-01-12 12:33:42 +05:30
37fa96b29a Merge branch 'route' into 'master'
route issue fix

See merge request mohit.panjvani/crater-web!1417
2022-01-11 12:25:42 +00:00
147be77859 route issue fix 2022-01-11 17:27:55 +05:30
6ef2553423 Merge branch 'master' 2022-01-11 16:59:23 +05:30
22f6a48b5b fix csfixer warnings 2022-01-11 16:54:15 +05:30
897d759758 Merge branch 'payment-issue' into 'master'
solve payment issue

See merge request mohit.panjvani/crater-web!1415
2022-01-11 10:45:43 +00:00
bcd80377cf solve payment issue 2022-01-11 15:06:07 +05:30
dcb3ddecb9 update v6 2022-01-10 19:33:59 +05:30
1197215ff6 new build 2022-01-10 19:07:09 +05:30
4ca56de585 Merge branch 'fix-tests-master' into 'master'
Fix tests master

See merge request mohit.panjvani/crater-web!1413
2022-01-10 13:35:31 +00:00
b7c344132d fix web route 2022-01-10 19:03:06 +05:30
9eae813c24 fix tests 2022-01-10 19:02:49 +05:30
54f76f7cbe fix composer lock file 2022-01-10 16:10:49 +05:30
bdea879273 v6 update 2022-01-10 16:06:17 +05:30
6c5dcfe227 Merge branch 'minor-fix' into 'master'
Minor fix

See merge request mohit.panjvani/crater-web!1365
2021-12-31 11:58:54 +00:00
f79becad07 Merge branch 'dompdf-package-issue' into 'master'
downgrade dompdf issue

See merge request mohit.panjvani/crater-web!1366
2021-12-31 11:57:55 +00:00
c150c4edeb downgrade dompdf issue 2021-12-31 15:35:14 +05:30
d2dee7d511 fix customer request 2021-12-31 15:32:50 +05:30
fa9134610c fix test 2021-12-31 15:32:39 +05:30
02aabacd50 Merge branch 'increase-series-length' 2021-12-29 18:20:44 +05:30
a20c0a5ef9 Merge branch 'cron-job-org' into 'master'
add cronjob.org support

See merge request mohit.panjvani/crater-web!1316
2021-12-29 12:48:24 +00:00
df33776873 Merge branch 'fix-parse-condition' into 'master'
fix parse condition

See merge request mohit.panjvani/crater-web!1344
2021-12-29 12:46:17 +00:00
faf1ef0998 run csfixer 2021-12-29 18:05:14 +05:30
65404d5d6f Merge branch 'master' of https://github.com/bytefury/crater 2021-12-29 18:03:39 +05:30
cdc913d16c Unrestricted php file upload fix (#681)
https://huntr.dev/bounties/d7453360-baca-4e56-985f-481275fa38db/
2021-12-29 18:03:20 +05:30
c9d0a63854 Update readme.md (#680) 2021-12-27 20:08:25 +05:30
2fd8d8a5f4 solve trailing data error 2021-12-18 15:08:05 +05:30
2765f35f98 refactor parse condition 2021-12-18 13:14:46 +05:30
9652e3bdf5 fix parse condition 2021-12-18 12:43:20 +05:30
d69b7fd491 Allow invoices to be sent/resent from the invoice view page (#623)
* Allow invoices to be sent/resent from the invoice view page
2021-12-17 20:40:41 +05:30
f5c4f66165 Fix an issue with due date + expiry date not setting correctly & mark as sent button issue 2021-12-17 08:25:57 +00:00
848970fc08 Fix an issue with due date + expiry date not setting correctly & mark as sent button issue 2021-12-17 08:25:56 +00:00
37226fb35b Merge branch 'v5-fix-payment-condition' into 'master'
solve condition for payments migration

See merge request mohit.panjvani/crater-web!1342
2021-12-17 08:23:48 +00:00
f59bae9518 solve condition for payments migration 2021-12-17 13:30:02 +05:30
d2dcc44817 increase series param length to 6 2021-12-16 20:13:49 +05:30
4a85a5d2ab Merge branch 'fix-payment-update-issue' into 'master'
fix payment update issue

See merge request mohit.panjvani/crater-web!1337
2021-12-15 07:50:37 +00:00
7f04781604 Merge branch 'fix-date-formate-issue' into 'master'
date formatting issue fix

See merge request mohit.panjvani/crater-web!1339
2021-12-13 10:00:42 +00:00
99b1cc80c6 date formatting issue fix 2021-12-13 14:27:44 +05:30
6ce74bd59f added migration to calculate base amount for payments table 2021-12-13 11:34:47 +05:30
b24350aba6 fix payment update issue 2021-12-13 10:40:28 +05:30
b770e6277f remove currency tests 2021-12-10 18:04:42 +05:30
67c70d7a11 Merge branch 'master' of https://github.com/bytefury/crater 2021-12-10 18:00:11 +05:30
3a1f5a417f new build 506 2021-12-10 17:48:34 +05:30
f3b527b6b7 fix custom field selection issue 2021-12-10 17:39:59 +05:30
3582ed0f1b Merge branch 'v5-issues-fix' into 'master'
fix pdf issue & payment update issue

See merge request mohit.panjvani/crater-web!1335
2021-12-10 12:00:29 +00:00
0439effa74 Create CODE_OF_CONDUCT.md 2021-12-09 21:32:37 +05:30
725afa9f65 fix pdf issue & payment update issue 2021-12-09 18:06:25 +05:30
8b07632fd7 Merge pull request #631 from davwheat/patch-1
fix: make min item quantity 0 instead of 1
2021-12-09 14:15:28 +05:30
87b6f527a9 Merge pull request #637 from azaricstefan/patch-1
Typo error
2021-12-09 14:15:17 +05:30
24f1fe8685 remove unused imports 2021-12-09 13:42:58 +05:30
afa79e3e8c fix test 2021-12-09 13:40:13 +05:30
b7d2d6f470 new build 405 2021-12-09 12:42:46 +05:30
08c2fc4692 Merge branch 'master' 2021-12-09 12:41:25 +05:30
f4e3688216 fix payment edit issue when invoice selected from url 2021-12-09 12:41:17 +05:30
3af84ad208 Merge branch 'migration-issue' into 'master'
drop unique constraint from customers

See merge request mohit.panjvani/crater-web!1333
2021-12-09 07:10:51 +00:00
562dbfa803 drop unique constraint from customers 2021-12-09 12:30:29 +05:30
769e16cfca Merge branch 'migration-issue' into 'master'
add calculate base expenses migration

See merge request mohit.panjvani/crater-web!1332
2021-12-09 06:24:03 +00:00
f2790e8cf0 add calculate base expenses migration 2021-12-09 11:32:41 +05:30
e7f7b283ec Merge branch 'qty-fix' into 'master'
Qty fix

See merge request mohit.panjvani/crater-web!1331
2021-12-08 13:29:46 +00:00
83c6576033 fix: allow 0 value for quantity 2021-12-08 18:53:26 +05:30
5be3389451 Merge branch 'migration-issue' into 'master'
solve migration issue

See merge request mohit.panjvani/crater-web!1330
2021-12-08 13:10:00 +00:00
2b05ca44bf solve 400 migration 2021-12-08 18:14:37 +05:30
0bbc79b899 solve migration issue 2021-12-08 18:10:34 +05:30
7be4e98511 Merge branch 'migration-issue' into 'master'
solve migration issue

See merge request mohit.panjvani/crater-web!1329
2021-12-08 12:38:46 +00:00
f1cadadfec solve migration issue 2021-12-08 18:06:59 +05:30
faef583c06 Merge branch 'migration-issue' into 'master'
solve migration issue

See merge request mohit.panjvani/crater-web!1327
2021-12-08 12:34:24 +00:00
67d4f5101d Merge branch 'v5-fix-customField-issue' into 'master'
fix expense custom field issue

See merge request mohit.panjvani/crater-web!1328
2021-12-08 12:34:01 +00:00
79208fe596 fix expense custom field issue 2021-12-08 17:40:42 +05:30
ca87133c39 solve migration issue 2021-12-08 17:14:02 +05:30
68db11becf Merge branch 'fix-master-issues-v5' into 'master'
make user_id nullable in payments

See merge request mohit.panjvani/crater-web!1326
2021-12-08 11:08:14 +00:00
57d6ca50e6 make user_id nullable in payments 2021-12-08 16:30:43 +05:30
848bbb5953 fix: quantity min value 2021-12-08 16:27:18 +05:30
5ed62ac1dd Merge branch 'fix-master-issues-v5' into 'master'
fix: profit loss report issue

See merge request mohit.panjvani/crater-web!1325
2021-12-08 10:41:36 +00:00
77ce1d7431 solve migration issue 2021-12-08 15:39:14 +05:30
102a3a809d solve migration issue 2021-12-08 15:06:29 +05:30
f139912c56 solve migration issue 2021-12-08 12:47:42 +05:30
c0c5f42ba1 fix: profit loss report issue 2021-12-08 12:24:25 +05:30
02d803803c Typo error
Fixing a typo in name of schema.
2021-12-08 00:08:38 +01:00
e8b4339237 fix loading indicator and send invoice status error 2021-12-07 17:28:49 +05:30
15cef7c970 Merge branch 'fix-tests-5.0.2' into 'master'
fix-tests-5.0.2

See merge request mohit.panjvani/crater-web!1315
2021-12-07 11:53:56 +00:00
fe66b8bdb8 fix-tests-5.0.2 2021-12-07 11:53:56 +00:00
8001b2ede9 fix: make min quantity 0 instead of 1 2021-12-06 22:29:56 +00:00
5a7b515a03 Merge branch 'master' 2021-12-06 20:10:06 +05:30
b1cc524d3c new update 2021-12-06 18:42:54 +05:30
316a6585b3 new build 504 2021-12-06 18:40:17 +05:30
c14f58c7f1 Merge branch 'custom-field-fixes' into 'master' 2021-12-06 12:51:31 +00:00
603bf637a7 fix custom field issue and report issues 2021-12-06 12:51:31 +00:00
7b6a88ad4e Merge branch 'latest-fix-recurring-invoice' into 'master'
fix recurring invoice starts at condition

See merge request mohit.panjvani/crater-web!1319
2021-12-06 12:06:51 +00:00
7cf099f00e Merge branch 'rec-invoice' into 'master'
fix recurring invoice view page table

See merge request mohit.panjvani/crater-web!1321
2021-12-06 12:05:21 +00:00
8026c205cc solve recurring invoice starts_at condition 2021-12-06 16:13:20 +05:30
2b0477d576 fix recurring invoice view page table 2021-12-06 16:11:24 +05:30
74830e49f1 fix cronjob invoice generation issue with hashids 2021-12-06 14:15:16 +05:30
7e683aa5cc Create Security.MD 2021-12-06 14:04:54 +05:30
b543f6d389 fix recurring invoice starts at condition 2021-12-06 12:47:53 +05:30
72398f0ac9 rename cron job issue 2021-12-04 15:42:45 +05:30
ed6268aa7b add 503 setting migration 2021-12-03 21:15:05 +05:30
8a7ea53ffb new build 2021-12-03 21:13:44 +05:30
aba0a340a4 Merge branch 'master' 2021-12-03 21:09:37 +05:30
423e30b16e fix docker configuration 2021-12-03 21:03:58 +05:30
fbe25517e2 add cronjob.org support 2021-12-03 16:24:43 +05:30
0cafe8c4b8 Update license text 2021-12-02 21:04:21 +05:30
2a1b1ff7b7 Update License to AGPL 2021-12-02 21:01:04 +05:30
e498740466 Update copyright 2021-12-02 19:40:18 +05:30
9b66bb2b5a Merge pull request #614 from Jeffrey-H/readme_update
Checked new functionalities from the 5.0 update.
2021-12-02 19:39:03 +05:30
5321871cda fix: update_version migration 2021-12-02 19:03:01 +05:30
4438d54401 new build 502 2021-12-02 18:01:22 +05:30
8cd384d5ac responsive fix for estimates filters 2021-12-02 17:56:37 +05:30
6022e8997d Checked new functionalities from the 5.0 update. And seperated some combined functionalities 2021-12-02 13:21:52 +01:00
236759ed5c Merge branch 'master' 2021-12-02 17:49:53 +05:30
3934025d67 fix docker issue 2021-12-02 17:49:10 +05:30
468eb40949 Merge branch 'add_status_estimate' into 'master'
add status filter
2021-12-02 12:17:26 +00:00
658e125555 add status filter 2021-12-02 12:17:26 +00:00
5b50dadd91 Merge branch 'add_status' into 'master'
add status dropdown and due tab

See merge request mohit.panjvani/crater-web!1312
2021-12-02 10:32:07 +00:00
04fbbe7b2a restyle invoice filters on medium size screens 2021-12-02 16:00:04 +05:30
cd68d7e2ab Merge branch 'user-delete-issue' into 'master'
solve delete users and create template issue

See merge request mohit.panjvani/crater-web!1310
2021-12-02 10:08:24 +00:00
cb2b5f0ca3 add status dropdown and due tab 2021-12-02 15:11:17 +05:30
887d5d0685 solve template issue 2021-12-02 14:46:53 +05:30
6bdd0f9477 Merge branch 'master' 2021-12-02 14:16:27 +05:30
f99b8b4a1c fix base_due_amount calculation 2021-12-02 14:16:12 +05:30
7a45ed0982 solve delete users and create template issue 2021-12-02 12:38:56 +05:30
d066efd3ce Merge branch 'minor-fixes-v5' into 'master'
fix filter issues

See merge request mohit.panjvani/crater-web!1309
2021-12-02 07:08:49 +00:00
a6654c4519 fix filter issues 2021-12-02 12:18:43 +05:30
90b5a1f906 Merge branch 'payment-reset' into 'master'
fix: on customer change remove selected invoice

See merge request mohit.panjvani/crater-web!1308
2021-12-02 06:44:18 +00:00
0545cdbe6f fix: on customer chanage remove selected invoice 2021-12-02 11:57:33 +05:30
a4becbbc96 Merge branch 'user-ablity' into 'master'
fix: dashboard ability issue

See merge request mohit.panjvani/crater-web!1306
2021-12-02 05:55:36 +00:00
faf8c804a9 fix: dashboard ability issue 2021-12-02 10:31:16 +05:30
6c1fc8e514 fix build errors 501 2021-12-01 19:32:16 +05:30
618d644c14 new build 501 2021-12-01 19:23:31 +05:30
deaab665dd Merge branch 'master' 2021-12-01 19:22:24 +05:30
aa6553233a Fix mark as accepted not updating state 2021-12-01 13:52:12 +00:00
d839962292 Fix mark as accepted not updating state 2021-12-01 13:52:12 +00:00
4d14b1552f new build 501 2021-12-01 19:20:53 +05:30
e1ef208073 Merge branch 'recurring-index-refresh' into 'master'
Recurring index  delete refresh page

See merge request mohit.panjvani/crater-web!1303
2021-12-01 13:44:28 +00:00
40f3415e28 Merge branch 'compnay-fix' into 'master'
fix: company save loader on duplicate name error

See merge request mohit.panjvani/crater-web!1304
2021-12-01 13:28:38 +00:00
5c39525a2b fix: company save loader on duplicate name error 2021-12-01 18:57:33 +05:30
3a5901c70d Merge branch 'master' of https://gitlab.com/mohit.panjvani/crater-web into recurring-index-refresh 2021-12-01 18:35:30 +05:30
d978557366 fix 2021-12-01 18:35:13 +05:30
f97868d98a Merge branch 'quantity-fix' into 'master'
fix: exchange rate

See merge request mohit.panjvani/crater-web!1302
2021-12-01 12:57:12 +00:00
91e369ddcc new build 2021-12-01 18:02:08 +05:30
8806fe76ad Merge branch 'overlap-page' into 'master'
fix : overlap page in view and index pages

See merge request mohit.panjvani/crater-web!1299
2021-12-01 12:26:50 +00:00
cfc7e2231c fix: some minor changes 2021-12-01 17:53:26 +05:30
64326dd5f3 Merge branch 'v5-issues' into 'master'
V5 issues

See merge request mohit.panjvani/crater-web!1301
2021-12-01 12:08:37 +00:00
dee14455bb fix: exchange rate 2021-12-01 17:21:37 +05:30
9403fe265e fix expense currency issue 2021-12-01 17:06:20 +05:30
e30b99a730 fix currency issue 2021-12-01 16:24:23 +05:30
c1fb29bdbf Merge branch 'master' 2021-12-01 16:19:18 +05:30
6ea74a79bb Merge branch 'fix-unit-tests-master' into 'master'
solve unit tests

See merge request mohit.panjvani/crater-web!1298
2021-12-01 10:49:04 +00:00
8d94f4efbe fix code style 2021-12-01 16:18:27 +05:30
cc52cde16c add predis 2021-12-01 16:14:11 +05:30
e16e4c6d52 fix : overlap page in view and index pages 2021-12-01 16:04:55 +05:30
e22f60ff16 fix issues 2021-12-01 14:46:25 +05:30
88bfb38b56 solve unit tests 2021-12-01 13:25:24 +05:30
f57fa41640 Merge branch 'quantity-fix' into 'master'
fix: quantity decimal value not allow

See merge request mohit.panjvani/crater-web!1297
2021-12-01 06:57:09 +00:00
0f99568eaf fix: quantity decimal value not allow 2021-12-01 11:48:32 +05:30
f3dad8d48b fix issues 2021-11-30 21:55:25 +05:30
9629771d22 fix migration error 2021-11-30 19:20:51 +05:30
082d5cacf2 v5.0.0 update 2021-11-30 18:58:19 +05:30
d332712c22 Merge branch 'master' of https://github.com/bytefury/crater 2021-11-30 15:37:00 +05:30
f434c3e0d1 Merge pull request #577 from manythingsatonce/master
Added the Polish language localization.
2021-10-26 17:40:26 +05:30
c810ad5246 Merge pull request #574 from luzpaz/typos
Fix source comment and documentation typos
2021-10-26 17:38:06 +05:30
29705662e3 Added the Polish language localization. 2021-10-14 15:43:27 +02:00
31bfaadfad Fix source comment and documentation typos
Found via `codespell-q 3`
2021-10-10 07:17:18 -04:00
e2299794ad fix formatting 2021-09-15 11:24:13 +05:30
7d71cc1607 Merge branch 'fix-file-disk-pdf-issue' into 'master'
Solve issue of pdf store to local disk

See merge request mohit.panjvani/crater-web!996
2021-09-14 13:15:25 +00:00
40d9ecfe02 Solve issue of pdf store to local disk 2021-09-14 17:17:38 +05:30
3d3d7d0ec0 Merge branch 'master' 2021-09-07 11:33:00 +05:30
63b1ee5849 Merge pull request #480 from patricklucas/no_drafts_on_dashboard
Only show non-draft invoices on dashboard
2021-09-07 10:05:29 +05:30
bfe13ef79d Merge branch 'ob-clean-issue' into 'master'
solve empty buffer clean issue

See merge request mohit.panjvani/crater-web!909
2021-08-17 06:18:41 +00:00
010c7b02ed solve empty buffer clean issue 2021-08-16 18:29:41 +05:30
81739d4db7 add debit & credit notes to roadmap 2021-08-16 12:21:15 +05:30
05110526a7 new build 2021-07-30 19:12:19 +05:30
15bff7cd3f Merge branch 'master' of https://github.com/bytefury/crater 2021-07-30 19:12:07 +05:30
37470fe7a2 Merge pull request #513 from patricklucas/add_tax_column
Add tax column to invoices
2021-07-30 19:11:59 +05:30
1a50aca26d Merge branch 'master' of https://github.com/bytefury/crater 2021-07-30 19:09:56 +05:30
8219d19222 fix partial payment issue 2021-07-30 19:08:07 +05:30
8fa0252779 Add translation 2021-07-21 14:08:58 +02:00
6bfab30f14 Add tax column to invoices
When an invoice has tax per item enabled, include a tax column so that
it's clear how much tax is being applied to each item.
2021-07-21 14:07:07 +02:00
d972279adc Merge pull request #505 from michelmelo/patch-1
add support português Portugal
2021-07-16 12:42:34 +05:30
900a18c479 Merge pull request #502 from ytilotti/ytilotti-patch-1
Delete limit 255 description estimate
2021-07-16 12:41:53 +05:30
433c6a7c44 fix tax test failure 2021-07-16 12:00:28 +05:30
9f673d7eb3 fix tax-per-item issue display for estimates 2021-07-16 11:56:18 +05:30
d3a745605e fix tax-per-item issue 2021-07-16 11:49:56 +05:30
b004e7e379 Update i18n.js 2021-07-10 09:00:48 +01:00
9893108539 Delete limit 255 description estimate
There is a limit on the description of the estimate vue which is not necessary.
The field in the database is in TEXT.
2021-07-07 15:51:23 +02:00
2b80082996 Merge branch 'negative-tax-options' into 'master'
Solved negative tax options issue

See merge request mohit.panjvani/crater-web!735
2021-06-30 06:52:23 +00:00
8d596f5c19 Merge branch 'payment-unable-click' into 'master'
ref solve issue in create payment unable to click
2021-06-28 07:50:16 +00:00
ce4335d8fa Merge branch 'pdf-issue' into 'master' 2021-06-28 07:49:27 +00:00
5eaea3ad59 solve empty address issue on pdf 2021-06-28 07:49:27 +00:00
375d4d428e ref solve issue in create payment unable to click 2021-06-28 13:18:31 +05:30
2ec87baa6f fix mysql & mariadb requirement checks on installation 2021-06-25 16:24:18 +05:30
18a2e83348 Merge branch 'version-check-issue' into 'master'
solve version check issue

See merge request mohit.panjvani/crater-web!792
2021-06-25 10:14:54 +00:00
d53e227b08 solve version check issue 2021-06-25 15:43:30 +05:30
7721bf6f93 disable autocomplete and lpignore 2021-06-25 05:25:51 +00:00
76977c3d2a disable autocomplete and lpignore 2021-06-25 05:25:50 +00:00
512983deee update composer lock file 2021-06-24 15:27:54 +05:30
f5c23b33da fix code style 2021-06-24 14:21:43 +05:30
a0898a1fa0 build 420 2021-06-24 14:18:02 +05:30
236db087ba Merge branch 'master' of https://github.com/bytefury/crater 2021-06-24 14:15:50 +05:30
4772079d13 Merge branch 'foreign-key-issue' into 'master'
drop foreign issue solved

See merge request mohit.panjvani/crater-web!787
2021-06-24 08:12:48 +00:00
0e0ef1d99e drop foreign issue solved 2021-06-24 13:39:35 +05:30
3d9a73f9ec new build 2021-06-24 13:00:16 +05:30
b452c3f173 Merge branch 'feat/version-check' into 'master' 2021-06-24 07:28:36 +00:00
87667be90c add domain verify feature 2021-06-24 07:28:35 +00:00
31481739f1 update translations from crowdin 2021-06-23 12:57:56 +05:30
da43797d9c update deps 2021-06-23 11:39:46 +05:30
e1fcf0695c Merge branch 'drop-foreign-issue' into 'master'
solve drop foreign issue on sqlite

See merge request mohit.panjvani/crater-web!781
2021-06-22 13:20:38 +00:00
a52d5bc582 solve drop foreign issue on sqlite 2021-06-22 18:44:02 +05:30
e7bf86f9c0 remove pcntl_fork, generate new encryption key on onboarding & update minimum php version 2021-06-22 16:03:59 +05:30
fca7d164a6 update minimum php version 2021-06-22 12:48:53 +05:30
4b603f8823 build 420 2021-06-19 17:51:01 +05:30
4552138787 Add File based templates 2021-06-19 12:11:22 +00:00
d1dd704cdf Add File based templates 2021-06-19 12:11:21 +00:00
00961bcae1 update json file indent_size 2021-06-18 15:23:56 +05:30
98ba17e56a Add Domain Verification on Onboarding Wizard 2021-06-18 09:51:19 +00:00
8eb47b553e Add Domain Verification on Onboarding Wizard 2021-06-18 09:51:19 +00:00
2fb46a4ab3 Merge branch 'number-validation' into 'master'
change message for number validation

See merge request mohit.panjvani/crater-web!770
2021-06-17 13:29:11 +00:00
6fcddd6feb refactor message 2021-06-17 18:58:08 +05:30
43c871f374 refactor unique number message 2021-06-17 18:57:17 +05:30
4ec9b2e817 change message for number validation 2021-06-17 16:23:06 +05:30
f2c6e06c54 Merge pull request #488 from pgrimaud/master
docs: fix typos
2021-06-15 14:14:31 +05:30
f95b292717 docs: fix typos 2021-06-15 10:42:35 +02:00
6ecd9728d4 add mariadb-client to fix backups 2021-06-08 18:09:06 +05:30
b2d4b7212b Added invoice test with negative tax 2021-06-02 16:25:20 +05:30
b4956d38f7 Minor fix taxtype test 2021-06-01 16:33:07 +05:30
ed966b02eb Added test for negative taxtype test 2021-06-01 16:32:06 +05:30
bcbffdcf30 Solved negative tax options issue 2021-06-01 14:18:08 +05:30
3cf70135f3 Only show non-draft invoices on dashboard
An invoice cannot be considered due if it has not been sent (and thus
still a 'DRAFT').

This change adds a `WHERE status != 'DRAFT'` to each invoice query in
the dashboard controller.

Additionally, this change replaces `->get()->count()` calls to just
`->count()`, which should be equivalent and more efficient.
2021-05-26 10:49:08 +02:00
90bb90cd99 remove trailing_comma_in_multiline_array from csfixer config 2021-05-25 13:24:30 +05:30
ebad76c8d7 remove extra cs-fixer config file 2021-05-25 13:20:22 +05:30
c35b00493c remove extra semicolon 2021-05-25 12:47:19 +05:30
e5ae937a88 Merge branch 'helper-get-custom-field-bySlug' into 'master'
Helper for custom field to get by slug

See merge request mohit.panjvani/crater-web!707
2021-05-25 07:07:07 +00:00
736df5fcae Merge branch 'proxies-issue' into 'master'
allow to customize trusted proxies

See merge request mohit.panjvani/crater-web!709
2021-05-25 06:55:35 +00:00
89c264c6a9 update implementation 2021-05-25 12:22:27 +05:30
1837bf3f3e allow to customize trusted proxies 2021-05-24 13:13:46 +05:30
83234cfac3 get custom field by slug in models 2021-05-22 13:52:30 +05:30
5ccc9eba4c Helper for custom field to get by slug 2021-05-22 13:24:10 +05:30
3f0008ec95 Merge branch 'master' of gitlab.com:mohit.panjvani/crater-web 2021-05-21 17:28:45 +05:30
9e98a96d61 Implement PHP CS Fixer and a coding standard to follow (#471)
* Create PHP CS Fixer config and add to CI workflow

* Run php cs fixer on project

* Add newline at end of file

* Update to use PHP CS Fixer v3

* Run v3 config on project

* Run seperate config in CI
2021-05-21 17:27:51 +05:30
27bc89bf76 Merge branch 'fix-invoice-template-issue' into 'master'
Clone Invoice Template issue

See merge request mohit.panjvani/crater-web!700
2021-05-20 06:59:04 +00:00
e4c2b44da5 Clone Invoice Template issue 2021-05-20 12:08:48 +05:30
633cad9b89 add update migration 2021-05-05 12:10:14 +05:30
f5bbe68a4b new build 2021-05-05 12:00:12 +05:30
1fac9c9dde Merge branch 'master' of https://github.com/bytefury/crater 2021-05-05 11:58:36 +05:30
1208d3a924 new build 2021-05-05 11:58:14 +05:30
3257b18d58 update translations from crowdin 2021-05-05 11:25:30 +05:30
16a941f787 Bump axios from 0.19.2 to 0.21.1 (#337)
Bumps [axios](https://github.com/axios/axios) from 0.19.2 to 0.21.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.19.2...v0.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-03 23:51:00 +05:30
4f5cd9fba1 Bump composer/composer from 2.0.11 to 2.0.13 (#447)
Bumps [composer/composer](https://github.com/composer/composer) from 2.0.11 to 2.0.13.
- [Release notes](https://github.com/composer/composer/releases)
- [Changelog](https://github.com/composer/composer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/composer/composer/compare/2.0.11...2.0.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-03 23:50:46 +05:30
80e6a3c757 Bump elliptic from 6.5.3 to 6.5.4 (#411)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-03 23:50:36 +05:30
d4e7420640 Bump laravel/framework from 8.33.1 to 8.40.0 (#448)
Bumps [laravel/framework](https://github.com/laravel/framework) from 8.33.1 to 8.40.0.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/8.x/CHANGELOG-8.x.md)
- [Commits](https://github.com/laravel/framework/compare/v8.33.1...v8.40.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-03 23:48:51 +05:30
ac30ba599b Update Vietnamese, Initial Japanese and Korean language (#436)
* Update Vietnamese locate
* Add Japanese and Korean Language


Co-authored-by: Dung <dung.phan@mediabridge.vn>
2021-05-03 16:59:30 +05:30
6dd0ccce8b update translations from crowdin 2021-05-03 16:37:12 +05:30
2f32ff4d5b temporarily disable the user tests 2021-04-13 13:06:07 +05:30
54a5ca83f8 new build 2021-04-13 13:00:35 +05:30
eede2fc17f fix notification module issues 2021-04-13 05:42:28 +00:00
e586adde26 update default email description 2021-04-12 16:43:07 +05:30
1ffb1b2eec bug: notification issues solved 2021-04-12 16:02:44 +05:30
55d838371a new build 2021-04-12 14:42:40 +05:30
cdaa1ff103 refactor estimate & invoice templates 2021-04-12 14:40:59 +05:30
63f7cdec82 fix customer update notification not firing 2021-04-12 14:40:22 +05:30
fadba7fa3a fix send email tests 2021-04-12 14:40:10 +05:30
d0f6e207ee add App namespace to models 2021-04-12 12:09:54 +05:30
845f01f170 fix conflicts and issue with add_number_length migration 2021-04-12 11:53:03 +05:30
7f9938c80d Make SMTP username & password optional in mail configuration
Fixes #438
2021-04-10 07:46:32 +00:00
16e4212300 Fixes #439 2021-04-10 07:45:14 +00:00
109de237b1 update: SMTP username & password not mandatory in mail configuraiton 2021-04-10 12:56:09 +05:30
82cf63f200 fix: Custom optional Date field issue 2021-04-10 12:38:50 +05:30
03fc0fd659 Add New SweetAlert & Notification Components 2021-04-09 12:35:50 +00:00
c3d3e5e35f Add New SweetAlert & Notification Components 2021-04-09 12:35:50 +00:00
909e4f93e4 fix(attachments): Fixed language on pdf attachments (#434) 2021-03-27 18:33:54 +05:30
bfd9850bf6 Add invoice/estimate/payment number length setting (#425)
* Add invoice/estimate/payment number length setting
2021-03-26 13:01:43 +05:30
3f7db2793f add fallback language and generate public files 2021-03-24 17:01:38 +05:30
8693672b09 Slovak language (#428)
* Add Slovak Language

Co-authored-by: Mohit Panjwani <mohit.panjvani@gmail.com>
2021-03-24 16:59:12 +05:30
a9b0d62cd6 generate public files 2021-03-24 14:09:18 +05:30
9f57a4200f Merge branch 'master' of https://github.com/bytefury/crater 2021-03-24 14:07:17 +05:30
9e130b3db8 Add VietNamese Locale (#431)
Co-authored-by: Dung <dung.phan@mediabridge.vn>
2021-03-24 14:06:53 +05:30
7c9a846090 update spacewind version 2021-03-24 13:47:45 +05:30
b2e08dda7f fix php8 dompdf issue 2021-03-23 13:31:40 +05:30
a2026fbc8b Merge pull request #427 from TheZoker/add-ci
Add test ci
2021-03-23 13:31:00 +05:30
db1b0db461 update dompdf version 2021-03-23 13:14:34 +05:30
17c00c322d Add test ci 2021-03-22 16:52:01 +01:00
331b8ea44e Merge pull request #426 from TheZoker/fix-invoice-address-capitalize
Don't capitalize address on invoice
2021-03-22 19:20:05 +05:30
428be640c3 Don't capitalize address on invoice 2021-03-22 14:49:31 +01:00
51f79433b9 feat: Added MAD (Moroccan dirham) currency (#355)
Add MAD (Moroccan dirham) currency
2021-03-22 17:33:36 +05:30
8008ed0527 Merge pull request #423 from TheZoker/add-more-translation
Add more translation
2021-03-22 14:59:04 +05:30
57b302666a Address review comments 2021-03-22 10:17:01 +01:00
ee1d1ccff4 update readme and fix formatting on utilities 2021-03-22 13:05:02 +05:30
81e7109ad1 new build 2021-03-22 13:02:17 +05:30
784bf39df5 fix max-discount issue on estimates and generate new public files 2021-03-22 12:57:46 +05:30
f66755c4aa Merge pull request #365 from DjKhireddine/patch-1
Update Item.vue
2021-03-22 12:56:37 +05:30
b4e1e99d37 Merge pull request #354 from habibhaidari1/master
Fixed small typo that caused wrong breadcrumb
2021-03-22 12:42:33 +05:30
d8aa3dc8a6 Merge pull request #336 from romanobarassi/barassi-crater-fix1
Update composer.json
2021-03-22 12:32:45 +05:30
9af51660cb Merge pull request #405 from itsaboutcode/show_field_min_length
Showing length error for Payment, Note and ItemUnit Model Views
2021-03-22 12:26:41 +05:30
38d0da9618 Merge pull request #419 from TheZoker/translate-pdf-title
Translate PDF titles
2021-03-22 12:22:41 +05:30
761c0143ec Merge pull request #420 from TheZoker/adjust-money-format
Adjust money format to respect swap_currency_symbol
2021-03-22 12:12:13 +05:30
fdc4de5093 Merge pull request #407 from sebastiancretu/send_inv_est_pay_as_attachment
Send invoices, estimates and payments as attachments
2021-03-22 12:06:06 +05:30
f8591f96a9 Write € symbol after amount 2021-03-21 13:05:49 +01:00
e47cb01ce2 Translate badges 2021-03-21 00:45:43 +01:00
454ad3091a Add some missing translations 2021-03-21 00:45:37 +01:00
cc73a8a842 Adjust money format to respect swap_currency_symbol 2021-03-20 17:49:57 +01:00
cea8405ace Translate PDF titles 2021-03-20 14:35:22 +01:00
49a6e03e9d Merge pull request #408 from sebastiancretu/fix_unit_name_in_emails
fix(items): added unit name after quantity in the pdf templates
2021-03-15 16:18:54 +05:30
f9d6e8b0cc fix(items): added unit name after quantity in the pdf templates 2021-03-03 17:09:05 +01:00
2b78aacc83 feat(emails): implemented sending invoice, estimates and payments as attachements 2021-03-02 21:49:03 +01:00
1932c5a75e a 2021-03-02 21:19:16 +01:00
449968ae88 Showing length error for Payment, Note and ItemUnit Model Views 2021-03-02 10:50:27 +05:00
02a2db4417 Merge pull request #372 from makakken/master
Fixes #371
2021-02-24 15:40:34 +05:30
a53582f916 Merge pull request #398 from renzocastillo/master
added new currency: peruvian soles
2021-02-24 15:40:10 +05:30
340bf3be06 added new currency: peruvian soles 2021-02-22 11:34:25 -05:00
7f0da9dc36 fix conflict 2021-02-12 13:19:56 +05:30
c4ace76275 Merge branch 'master' of gitlab.com:mohit.panjvani/crater-web 2021-02-12 13:18:03 +05:30
553bcc053b Merge pull request #375 from sebastiancretu/fix_payment_receipt_currency
fix(payments): display the currency in receipts
2021-02-12 11:54:19 +05:30
375a59a504 fix(payments): display the currency in receipts 2021-02-08 20:42:10 +01:00
cfc0a1ef75 Regenerated assets 2021-02-05 20:53:34 +01:00
392f6f469b Send Invoices/Estimates/Payments as email attachments 2021-02-05 20:24:56 +01:00
6cb8d30915 Update invoice3.blade.php
Fix Exception: 'box_sizing' is not a recognized CSS property.
2021-02-04 11:02:59 +01:00
9b55e84724 Update invoice2.blade.php
Fix Exception: 'box_sizing' is not a recognized CSS property.
2021-02-04 11:02:32 +01:00
cf5da7684b Update invoice1.blade.php
fix box_sizing DOMPDF Bug
2021-02-04 11:01:57 +01:00
f47029ca78 fix payment invalid-number issue 2021-02-03 14:25:05 +05:30
761df2ffac Merge branch 'mail-name-issue' into 'master'
invoice mail name issue fix

See merge request mohit.panjvani/crater-web!669
2021-02-03 07:19:32 +00:00
8fbc257b23 payment from mail name 2021-02-03 12:24:28 +05:30
baebfedf37 invoice and estimate from mail name issue 2021-02-03 12:21:03 +05:30
9321eb9d86 Merge branch 'payment_issue' into 'master'
fix payment currency issue

See merge request mohit.panjvani/crater-web!668
2021-02-03 06:31:23 +00:00
70bed01e7b invoice mail name issue fix 2021-02-03 11:38:59 +05:30
739efcce79 Update Item.vue
There is an error in calculating maxDiscount. 
maxDiscount = item.price * item.quantity
2021-02-02 19:23:32 +01:00
3695e7d075 fix payment currency issue 2021-02-02 17:22:44 +05:30
8f2033f621 Fixed small type that caused wrong breadcrumb 2021-01-23 19:29:26 +01:00
7b95ccb5fc fix company logo issue 2021-01-22 19:00:37 +05:30
b7370ed85c update version on migration 2021-01-22 14:49:05 +05:30
818f2fbaf7 build 404 2021-01-22 14:27:30 +05:30
91a1dbf91c new build 2021-01-22 14:17:08 +05:30
a4d556f41e fix tax rounding issues 2021-01-22 14:15:44 +05:30
83de1c47ee fix tax rounding errors and styling issues 2021-01-22 13:44:59 +05:30
678ace744a fix purgecss issue and insert-note z-index 2021-01-22 12:00:10 +05:30
9e26fee1b0 upgrade tailwind 2021-01-21 18:31:11 +05:30
e455c3de50 Merge branch 'date-issue' into 'master'
solve date issue

See merge request mohit.panjvani/crater-web!665
2021-01-15 10:17:51 +00:00
c4db50d3f0 Merge branch 'logo-issue' into 'master'
fix logo display issue

See merge request mohit.panjvani/crater-web!664
2021-01-15 10:16:28 +00:00
411ee57946 solve date issue 2021-01-15 14:26:35 +05:30
9c5e9e56f5 fix logo display issue 2021-01-15 14:22:42 +05:30
8eeafd3fed fix tailwind-v2 issues 2021-01-06 21:12:22 +05:30
ed978d0174 upgrade tailwind version and laravel-mix 2021-01-06 14:18:41 +05:30
607b1795bb Merge branch 'discount-issue' into 'master'
fix total discount issue

See merge request mohit.panjvani/crater-web!655
2021-01-06 06:58:07 +00:00
a6c3c815b5 Update composer.json 2021-01-04 18:59:07 +01:00
ead0ebb012 fix note button z-index issue 2021-01-04 11:43:00 +05:30
d4550e62f8 add 403 migration 2020-12-31 15:39:01 +05:30
ff3846137e fix translations & build 403 2020-12-31 12:33:56 +05:30
b55f8e5391 fix floating errors 2020-12-31 12:16:04 +05:30
0f1d7627ea fix next number issue on estimate & invoice 2020-12-31 11:52:42 +05:30
1be462ef82 fix eslint and prettier config 2020-12-31 11:52:10 +05:30
8b04e94446 fix total discount issue 2020-12-24 13:43:29 +05:30
fa512629d9 build 402 2020-12-23 11:43:31 +05:30
0f99be6cf1 change template button and note-button styles 2020-12-23 11:41:23 +05:30
fae3af2592 fix infinite-looping issue 2020-12-22 17:48:21 +05:30
d1e70c8989 Merge branch 'template-refactor' into 'master'
Template Refactor

See merge request mohit.panjvani/crater-web!653
2020-12-22 08:16:47 +00:00
63094e8112 re-style template selection modals 2020-12-22 13:46:15 +05:30
1b46bddf56 Merge branch 'master' of https://gitlab.com/mohit.panjvani/crater-web into template-refactor 2020-12-22 13:15:55 +05:30
422bf74600 refactor template 2020-12-22 13:15:09 +05:30
d003e61d41 Merge branch 'master' 2020-12-22 13:07:06 +05:30
09f74eb37c Merge branch 'master-date-refactor' into 'master'
Refactor Date Issue

See merge request mohit.panjvani/crater-web!652
2020-12-22 07:24:03 +00:00
9227973a7a refactor date issue 2020-12-22 12:51:44 +05:30
5011543198 Merge branch 'master' 2020-12-22 12:15:27 +05:30
d07b63c365 Merge branch 'fix-user-issue' into 'master'
fix isLoading issue

See merge request mohit.panjvani/crater-web!646
2020-12-22 06:43:23 +00:00
c12e27dbfe remove unnecessary comment 2020-12-22 12:12:58 +05:30
4ea32b94ed Merge branch fix-amount issue on payment 2020-12-22 12:00:28 +05:30
fe93d5236c Merge branch 'fix-price-issue' into 'master'
fix amount int issue

See merge request mohit.panjvani/crater-web!648
2020-12-22 06:29:44 +00:00
5992394bca remove change emit from BaseDatePicker 2020-12-22 11:55:59 +05:30
6c9f5800e5 Sync language files from crowdin 2020-12-22 11:55:47 +05:30
227cebcb0b update license readme 2020-12-19 14:57:50 +05:30
6fd4cc6b3f Merge branch 'master' of https://github.com/bytefury/crater 2020-12-19 14:55:57 +05:30
594c8965c1 Merge pull request #311 from artfuld/master
Swedish locale
2020-12-18 14:03:03 +05:30
2241145a17 Merge branch 'master' into master 2020-12-18 09:31:40 +01:00
34f252b1c9 fix reset-app 2020-12-15 21:02:22 +05:30
89e1d7bc84 no message 2020-12-14 19:21:24 +01:00
f0368deda2 no message 2020-12-14 19:20:42 +01:00
4028551fd8 no message 2020-12-14 19:07:31 +01:00
06f385a28e More corrections after using the program 2020-12-14 19:05:11 +01:00
44aeff425b fix amount int issue 2020-12-14 19:17:54 +05:30
35a38d719c Merge pull request #314 from azaricstefan/SerbianLang
update code for SR
2020-12-14 10:03:32 +05:30
f6ba81e8b7 Some more changes after using the translation 2020-12-12 12:25:53 +01:00
64cb55fd5d Skatt => Moms
Fixed a misspelling
2020-12-12 12:23:26 +01:00
13fe38517c Merge pull request #307 from azaricstefan/SerbianLang
Serbian lang
2020-12-12 16:06:42 +05:30
3bdb501d1d update code for SR 2020-12-12 11:21:08 +01:00
b8adbf4b07 Merge pull request #306 from edevrob/master
PDF templates fix
2020-12-11 20:11:25 +05:30
aa85a9950c no message 2020-12-11 11:31:17 +01:00
8e63efee1b Fullständig översättning till svenska 2020-12-11 11:17:03 +01:00
ea98f03aeb fix isLoading issue 2020-12-11 14:23:04 +05:30
90cd6226be Snart klar med översättningen 2020-12-11 01:38:23 +01:00
9d2df64b2e yarn run production 2020-12-10 23:42:35 +01:00
bade86a24f yarn run dev 2020-12-09 23:35:05 +01:00
c3b57b4888 Adapt Serbian language to 4.0.1 2020-12-09 23:22:05 +01:00
fcfedc5414 Adapt Serbian language to 4.0.1 2020-12-09 23:21:51 +01:00
8dee0da434 PDF templates fix
DomPDF font-weight problems fix
2020-12-09 21:13:56 +02:00
e4ab024422 Svenska 2020-12-09 12:04:42 +01:00
2bd01c4014 update readme and fix #303 2020-12-09 15:10:13 +05:30
034c7e385c fix translation issues & formatting 2020-12-09 11:36:14 +05:30
c9086747a3 remove delete_files validation on update 2020-12-08 20:32:41 +05:30
ab1ed269fd fix update-app description style 2020-12-08 20:27:05 +05:30
f7a823e9bc fix reset pass validation message and add 401 migration 2020-12-08 19:52:32 +05:30
b6301b08f8 new build 4.0.1 2020-12-08 19:00:49 +05:30
265c219fdc Merge branch 'localhost-img-issue' into 'master'
fix localhost img display issue

See merge request mohit.panjvani/crater-web!638
2020-12-08 12:15:57 +00:00
729db694a3 Merge branch 'timezone' into 'master'
Fix Timezone issue

See merge request mohit.panjvani/crater-web!642
2020-12-08 12:03:36 +00:00
e2e6415cb6 fix timezone issue 2020-12-08 16:31:44 +05:30
419104a4ec check system using file disk type 2020-12-08 15:07:57 +05:30
f18eac2001 replace env with config 2020-12-08 14:43:21 +05:30
7bffbe59ed Merge branch 'change-datatype' into 'master'
change notes & description column type

See merge request mohit.panjvani/crater-web!639
2020-12-08 09:07:59 +00:00
bf53b4f5eb Merge branch 'fix-toastr' into 'master'
remove multiple toastr call

See merge request mohit.panjvani/crater-web!640
2020-12-08 09:07:12 +00:00
21440230f3 Merge branch 'pdf-ext' into 'master'
fix pdf extenstion issue

See merge request mohit.panjvani/crater-web!641
2020-12-08 09:06:43 +00:00
99c27ba8ef fix pdf extenstion issue 2020-12-08 14:14:52 +05:30
cb7a925cd0 remove multiple toastr call 2020-12-08 13:19:06 +05:30
d2e11bd7df change notes & description column type 2020-12-08 12:55:28 +05:30
1b74a3720e fix localhost img display issue 2020-12-08 11:39:47 +05:30
e222af335e Merge branch 'date-range' into 'master'
fix date range issue in reports

See merge request mohit.panjvani/crater-web!635
2020-12-07 12:52:58 +00:00
599e6270e8 fix date range issue in reports 2020-12-07 12:34:12 +05:30
da7ddcd4f1 Merge branch 'fix-reset-pass-layout' into 'master'
fix layout issue

See merge request mohit.panjvani/crater-web!632
2020-12-07 06:43:07 +00:00
bd01039fb8 Merge branch 'reset-password' into 'master'
Fix reset password

See merge request mohit.panjvani/crater-web!634
2020-12-07 06:42:32 +00:00
718f01ccd4 Merge branch 'unique-hash' into 'master'
Unique hash

See merge request mohit.panjvani/crater-web!633
2020-12-07 06:42:26 +00:00
fd3742b926 fix reset password issue 2020-12-07 10:34:22 +05:30
e8b954d1bd generate unique hash ids 2020-12-05 17:06:22 +05:30
58042decd5 fix layout issue 2020-12-05 15:43:35 +05:30
fa500b3865 add cmd for app key generate 2020-12-05 13:35:46 +05:30
e03924fe9d Merge branch 'master' of https://github.com/bytefury/crater 2020-12-04 11:46:49 +05:30
3f308a2d3b update composer file 2020-12-04 11:46:32 +05:30
6cdd93bab0 Merge pull request #288 from MakerLab-Dev/master
Password reset update
2020-12-04 11:43:02 +05:30
69c6c883c2 Password reset update 2020-12-03 19:04:50 +01:00
69dcf1299b More descriptive errors 2020-12-03 18:00:09 +01:00
b6cd78ca4c update readme 2020-12-03 20:38:49 +05:30
d18116bd7d fix conflicts 2020-12-03 20:35:27 +05:30
6b30c2028b new build 400 2020-12-03 19:43:50 +05:30
8c4a358072 Merge branch 'delete-file-ability' into 'master'
add ability to delete file from UI

See merge request mohit.panjvani/crater-web!629
2020-12-03 14:06:16 +00:00
fe8482fc71 add ability to delete file from UI 2020-12-03 17:47:16 +05:30
28217df654 add ability to delete files on update 2020-12-03 12:49:37 +05:30
3723697add restrict update if the system requirements do not match 2020-12-02 19:05:39 +05:30
b3e3839fb5 fix default seeder 2020-12-02 18:52:25 +05:30
89ee58590c build version 400 2020-12-02 17:54:08 +05:30
326508e567 Merge branch 'version-320' into 'master'
Version 320

See merge request mohit.panjvani/crater-web!623
2020-12-02 07:31:01 +00:00
21e01bc1db remove use from EventServiceProvider 2020-12-02 12:32:13 +05:30
ed58dfaef6 remove optimized cmd 2020-12-02 12:31:16 +05:30
c2c0e2809c remove listener & add version320 migration 2020-12-02 12:23:30 +05:30
bafda5ca46 Merge branch 'master' of https://gitlab.com/mohit.panjvani/crater-web into version-230 2020-12-02 10:29:52 +05:30
a7eaf5dbe4 fix updater issue & add optimize clear cmd 2020-12-02 10:29:46 +05:30
805a287129 Merge branch 'version-230' into 'master'
Version 230

See merge request mohit.panjvani/crater-web!620
2020-12-01 06:44:00 +00:00
61fe16cab4 new build for version230 2020-12-01 12:09:46 +05:30
33085a0e3c add v-html for description 2020-12-01 12:08:24 +05:30
2df09a20f1 fix updater issue and run production 2020-12-01 11:05:45 +05:30
a7d61b802d hideupdate button for version 4.0.0 2020-12-01 11:02:32 +05:30
88bcb1c2b4 add listener to provider 2020-11-09 17:45:05 +05:30
af194c1851 add 320 listener 2020-11-09 13:31:30 +05:30
71193727c9 new build 2020-11-09 13:20:35 +05:30
bc7571832a Merge branch 'virsion-check' into 'master'
Version check

See merge request mohit.panjvani/crater-web!470
2020-11-09 07:48:24 +00:00
e379e13802 fix update validation toaster 2020-11-06 19:09:17 +05:30
4484765358 add version check validation 2020-11-05 19:02:55 +05:30
5d4ea2a308 transfer code from update controller to updater class 2020-11-03 12:19:51 +05:30
0db9f9df0c get current virsions of php and extensions 2020-10-30 16:57:39 +05:30
9301e67e3f build public files 2020-09-10 13:39:26 +05:30
a019403b1b Merge pull request #262 from Xoshbin/patch-1
Added Iraqi Dinar in currencies table
2020-09-03 14:26:25 +05:30
c99d7ee677 Added Iraqi Dinar in currencies table 2020-09-02 22:17:29 +03:00
94a2306b7f Merge pull request #253 from loduis/patch-2
Add missing key resend_invoice in the spanish
2020-08-05 07:57:48 +05:30
73bd28aeb8 Add missing key resend_invoice in the spanish 2020-08-04 18:24:42 -05:00
904f2641c5 Merge pull request #250 from loduis/patch-1
Add copy_pdf_url missing key in spanish
2020-08-04 18:09:29 +05:30
4372195547 Add copy_pdf_url missing key in spanish 2020-08-04 06:39:55 -05:00
14f8094a9d Merge branch 'invoice-refactor' into 'master'
Refactor DUE status

See merge request mohit.panjvani/crater-web!251
2020-08-01 08:24:35 +00:00
4770c27d7d Merge pull request #244 from azaricstefan/master
Serbian language support
2020-07-27 11:55:43 +05:30
f4baf308a4 merge 2020-07-26 23:15:43 +02:00
6f852ab88a merge 2020-07-26 23:11:06 +02:00
14bb6edec8 Serbian language support (latin) made better 2020-07-26 23:09:19 +02:00
b4a7c724db Serbian language support (latin) made better 2020-07-26 23:07:49 +02:00
9fb4b4dec5 Merge pull request #239 from Loosie94/master
Improved Dutch translation
2020-07-04 14:02:32 +05:30
4bbc92ccaf Merge branch 'master' of https://github.com/bytefury/crater 2020-07-01 10:44:44 +05:30
dd12662b17 change 2020-06-25 20:23:38 +02:00
c364de1b17 Cap case 2020-06-25 19:09:41 +02:00
a06e8e3039 Link 2020-06-24 00:15:56 +02:00
b9021cb664 confirm_delete 2020-06-23 23:56:38 +02:00
a2c3fa2cc5 clone string 2020-06-23 22:56:24 +02:00
517f3bd1b8 Merge branch 'table-factory' into 'master'
refactor factories

See merge request mohit.panjvani/crater-web!259
2020-06-23 08:49:07 +00:00
29b4b92fab Better 2020-06-22 21:07:58 +02:00
e8f046f02e refactor factories 2020-06-22 17:07:35 +05:30
2bf6778c8a better intro 2020-06-22 12:47:16 +02:00
e11c713ce3 Typo 2020-06-22 12:19:04 +02:00
b7189595bd Merge pull request #232 from Loosie94/master
Improved Dutch version
2020-06-22 14:46:42 +05:30
c5d4a62930 Last improvements 2020-06-21 13:25:58 +02:00
378f216f6d More Dutch improvements 2020-06-21 11:58:29 +02:00
7654c30b1b Few typo's 2020-06-21 11:41:40 +02:00
f4767ffb26 json file 2020-06-20 20:35:15 +02:00
e06639daa5 Improved Dutch version 3.1.1 2020-06-20 20:29:16 +02:00
9bd23ffac8 Merge pull request #225 from jpmurray/correct-gitingore
Added last slash so it ignores everything in the folder
2020-06-19 14:03:47 +05:30
60f5d29570 Serbian language support (latin) made better 2020-06-12 01:11:30 +02:00
b2497e5f81 Serbian language support (latin) made better 2020-06-12 00:25:42 +02:00
771a447e2c Added last slash so it ignores everything in the folder
.gitignore's magic still eludes me it seems!
2020-06-09 09:34:56 -04:00
a964f1d841 Serbian language support (latin) made better 2020-06-08 22:24:06 +02:00
57d5356bfe Merge pull request #221 from jpmurray/persis-database
[Docker] Dive the direction to persist database on the host rather than a volume if desired
2020-06-08 18:12:44 +05:30
fd29487121 Merge pull request #222 from jpmurray/php-upload
[Docker] Modify php and nginx config to change upload file size
2020-06-08 17:40:52 +05:30
5fb6797577 revert docker-compose 8080 port 2020-06-08 02:44:29 +02:00
3d0f77ab0b Added Serbian translation. Živela Srbija! 2020-06-08 02:43:33 +02:00
dbc249b6bc Added Serbian Latin translation. Živela Srbija! 2020-06-08 02:22:45 +02:00
08c6218440 Modify php and nginx to change upload file size 2020-06-06 16:16:19 -04:00
737c933b8c give the option to persist the database to the host 2020-06-06 15:44:05 -04:00
b9ab87a308 refactor due status 2020-06-03 17:45:35 +05:30
2e5cb58c39 build 311 2020-06-01 16:11:29 +05:30
db622e7458 Merge branch 'refactor-new-issues' into 'master'
Refactor issues

See merge request mohit.panjvani/crater-web!241
2020-05-30 16:07:53 +00:00
09bbf98e61 Merge branch 'master' into refactor-new-issues 2020-05-30 21:36:49 +05:30
ca90ff2767 Merge branch 'master' 2020-05-30 21:10:43 +05:30
368dd16c9b Merge branch 'wizard-refactor' into 'master'
refactor checkValidUrl method

See merge request mohit.panjvani/crater-web!248
2020-05-30 15:39:31 +00:00
251648f53c fix email layout on mobile 2020-05-30 20:30:09 +05:30
ffa5b6b2ad refactor checkValidUrl method 2020-05-28 21:02:11 +05:30
bd9beaa343 Merge master branch 2020-05-28 19:34:47 +05:30
3e4decdfb9 update nginx port 2020-05-27 20:56:54 +05:30
165907d144 fix docker errors 2020-05-27 16:01:37 +05:30
6278417423 refactor docker setup 2020-05-27 14:18:29 +05:30
dc37f565c4 add credit to akaunting 2020-05-21 15:01:47 +05:30
532196a9b4 Merge branch 'master' of https://github.com/bytefury/crater 2020-05-21 14:53:42 +05:30
6a4009e13a add credit to akaunting 2020-05-21 14:53:27 +05:30
a8f98e51bb Update readme 2020-05-21 14:31:30 +05:30
2b03bc798e new build 310 2020-05-21 11:26:26 +05:30
482556d378 Merge branch 'resend-email' into 'master'
Add Resend Email Option

See merge request mohit.panjvani/crater-web!236
2020-05-21 05:51:36 +00:00
deb525af6e build 310 2020-05-19 13:22:33 +05:30
cb2bfbb91c Add steps for update app 2020-05-19 07:50:58 +00:00
654395a175 Add steps for update app 2020-05-19 07:50:58 +00:00
e31b60bc48 Refactor Self Update Endpoints and Add Update Console Command 2020-05-17 07:04:43 +00:00
183953f4c4 Refactor Self Update Endpoints and Add Update Console Command 2020-05-17 07:04:43 +00:00
98d15143c2 refactor language problem 2020-05-13 21:16:37 +05:30
a24d8d3ebc fix updater issue 2020-05-13 16:50:45 +05:30
4ca574c581 fix migration errors 2020-05-13 12:47:06 +05:30
c7ce8c87dd new build 2020-05-13 11:31:37 +05:30
f64d546672 refactor 310 update listener 2020-05-13 11:12:33 +05:30
96187870b4 refactoe issues 2020-05-12 21:11:36 +05:30
d4a1f1a784 fix item selection and item loader 2020-05-12 13:23:06 +05:30
e07532961e reset items on selection 2020-05-12 13:11:29 +05:30
450c265ded Merge branch 'refactor-report-pdfs' into 'master'
Refactor report pdfs

See merge request mohit.panjvani/crater-web!233
2020-05-11 15:48:49 +00:00
f8502c3ca8 Merge branch 'customer-delete' into 'master'
Customer delete label

See merge request mohit.panjvani/crater-web!237
2020-05-11 15:47:33 +00:00
899da6990d Merge branch 'new-issues' into 'master'
New issues

See merge request mohit.panjvani/crater-web!239
2020-05-11 15:47:03 +00:00
e7675f938e refactor estimate to invoice endpoint 2020-05-11 19:05:50 +05:30
b08138e9e0 refactor estimate to invoice endpoint 2020-05-11 18:34:20 +05:30
5df4abdc4b add aws-sdk-php package 2020-05-11 18:15:36 +05:30
a2fa8afa72 fix translation issue 2020-05-11 18:09:34 +05:30
7670cd67dc Merge branch 'template-refactor' into 'master'
refactor invoice2

See merge request mohit.panjvani/crater-web!238
2020-05-11 12:24:22 +00:00
8446ac2b27 refactor invoice2 2020-05-11 16:19:02 +05:30
63a80e44d5 Customer delete label 2020-05-11 14:33:11 +05:30
076df75322 Merge branch 'template-refactor' into 'master'
Template refactor

See merge request mohit.panjvani/crater-web!232
2020-05-11 07:03:45 +00:00
11db99da73 refactor invoice 1 style 2020-05-09 18:50:58 +05:30
050dca5a50 Add copy pdf url option 2020-05-09 14:37:22 +05:30
3c096f1386 Add Resend Email Option 2020-05-09 14:22:13 +05:30
0f3e8fce3b refactor heading text in payment 2020-05-08 20:55:00 +05:30
325f90bba5 Fix issues on invoice template 2020-05-08 18:49:02 +05:30
a739a938fc Fix estimate template issues 2020-05-08 16:52:48 +05:30
b30e3a9b11 merge with github 2020-05-08 11:11:57 +05:30
fc1a7c7438 refactor reports pdfs 2020-05-07 18:59:50 +05:30
6046113cb1 Refactor Invoice and Payment templates 2020-05-07 16:42:04 +05:30
611ffafec5 refactor sales customers pdf 2020-05-06 20:41:15 +05:30
c497b906df refactor taxt report pdf 2020-05-06 20:32:10 +05:30
c68fce19f9 refactor expenses pdf 2020-05-06 19:02:02 +05:30
f8913531b6 refactor profit loss pdfs 2020-05-06 18:09:28 +05:30
30f76e2088 Refactor Estimate templates 2020-05-06 18:02:27 +05:30
39556892cd refactor sales customers 2020-05-05 20:58:20 +05:30
2fd66bf748 refactor sales items and customer pdfs 2020-05-05 20:49:51 +05:30
d4f1428d5f refactor sales customers pdf template 2020-05-05 20:03:51 +05:30
189141c84d Refactor estimate pdf template 2020-05-05 18:21:25 +05:30
f8ccfece09 update templates 2020-05-05 13:12:26 +05:30
9a7c926d53 fix 310 update issues 2020-05-02 18:53:51 +05:30
c5c1674153 Merge branch 'master' 2020-05-02 13:37:36 +05:30
8562ee5414 Merge branch 'settings-customization-payments' into 'master'
Payments and UnitItems in doubles issue fixed...

See merge request mohit.panjvani/crater-web!218
2020-04-27 16:09:25 +00:00
06c66a756c Payments and UnitItems in doubles issue fixed... 2020-04-27 18:54:24 +05:30
b66d07d21b Merge pull request #201 from rexlManu/master
Updated German Language
2020-04-27 12:14:23 +05:30
05001b6a79 Merge pull request #170 from RobinDev/patch-1
Update french language
2020-04-21 14:52:02 +05:30
f02f4ba9d3 Updated German Language 2020-04-21 07:31:33 +02:00
fbace98aac add missing translation 2020-04-20 21:12:03 +02:00
8f0af3dcd6 Merge branch 'master' of https://github.com/bytefury/crater 2020-04-20 11:23:00 +05:30
e8e44c5dc8 Merge pull request #180 from alessandrofuda/master
IT Italian translation
2020-04-18 13:38:21 +05:30
ac33164342 Merge branch '3.1.0' into 'master'
add listener 310

See merge request mohit.panjvani/crater-web!202
2020-04-18 07:29:08 +00:00
5c7c0d84ea Merge branch 'refactor-crater-3.0.0' into 'master'
Refactor line-chart

See merge request mohit.panjvani/crater-web!203
2020-04-18 07:15:52 +00:00
7ca725ac37 refactor line-chart 2020-04-17 19:53:08 +05:30
510a4b3dbb add listener 310 2020-04-17 19:05:10 +05:30
0f130ab1b8 Update fr langugage 2020-04-17 09:57:38 +02:00
25114009e3 remove unused components and update eslint + prettier config 2020-03-30 11:40:45 +05:30
79c16d74ce IT Italian translation 2020-03-20 18:18:27 +01:00
742e1e445a Merge branch 'expense-refactor' into 'master'
add customer in expense

See merge request mohit.panjvani/crater-web!172
2020-03-20 07:12:39 +00:00
386f96d60e Merge branch 'version301' into 'master'
add new minor version update 3.0.1

See merge request mohit.panjvani/crater-web!169
2020-03-20 07:12:27 +00:00
82d85af672 refactor and merge backend 2020-03-18 18:21:53 +05:30
4d1b267688 Merge branch 'expense-refactor' of https://gitlab.com/mohit.panjvani/crater-web into expense-refactor 2020-03-18 17:41:15 +05:30
bc99ad63a6 add user to expense 2020-03-18 17:40:03 +05:30
4bb44f8c93 add customer filter on index 2020-03-18 17:19:09 +05:30
c72265ed50 add languages 2020-03-17 19:38:59 +05:30
b8958c9eb6 add customer in expense 2020-03-17 19:20:42 +05:30
e33e314cb7 new frontend build 2020-03-09 15:20:59 +05:30
84cebee9da Merge branch 'master' of https://github.com/bytefury/crater 2020-03-09 15:19:54 +05:30
34d3cf7ae8 Merge branch 'item-refactor' into 'master'
refactor item search problem

See merge request mohit.panjvani/crater-web!171
2020-03-09 09:49:26 +00:00
93d0da836a Merge pull request #172 from digitalsign/master
Change project name in composer.json
2020-02-26 14:35:21 +05:30
fd51276948 Change project name in composer.json 2020-02-26 13:31:57 +08:00
d6274854ba refactor search problem 2020-02-19 19:10:43 +05:30
ea4bd1a31d Merge pull request #154 from lukasmu/bugfix/expenses-note
Fixed small bug that might occur when an expense is updated
2020-02-09 12:01:43 +05:30
286e047963 Merge pull request #129 from deanhouseholder/master
Detect if no .env file exists and add it on composer commands.
2020-02-09 12:01:25 +05:30
be16f48f3d Merge pull request #153 from MakerLab-Dev/patch-3
Improved error handling
2020-02-09 12:00:23 +05:30
ebea1e0813 add new minor version update 3.0.1 2020-02-07 17:20:32 +05:30
cc8d08f829 Merge pull request #142 from miraro3/master
Added Kyrgyzstani som
2020-02-07 16:42:15 +05:30
aacffc22eb fix merge conflict 2020-02-03 21:15:07 +05:30
d71ca4ffb9 Fixed small bug that might occur when an expense is updated
Previoulsy a string with contents "null" is transmitted and saved to the database when updating an expense with an empty note. This fix prevents that.
Please note that this fix still needs to be compiled with npm.
2020-02-01 14:52:07 +01:00
186004f7f8 fix merge conflicts 2020-01-31 14:28:16 +05:30
c2eb22d666 Merge pull request #137 from MakerLab-Dev/patch-1
cross-env should only be in devDependencies
2020-01-31 01:26:32 +05:30
af189b15b6 Small fix 2020-01-30 20:48:16 +01:00
1c19be85c3 Improved error handling 2020-01-30 20:47:51 +01:00
4bb4362d23 Removed unnecessary notification
Removed unnecessary notification as the improved error handler will show it
2020-01-30 20:45:39 +01:00
f6f66b3ae6 Merge pull request #152 from mdpoulter/email-subject
More descriptive email fields.
2020-01-31 00:21:29 +05:30
b4ccecbcf1 Merge pull request #149 from proea/master
Fix for "Empty PDF rendered in Docker #69"
2020-01-31 00:11:51 +05:30
92f1f196bb Update Dockerfile 2020-01-27 22:38:47 +03:00
ee14070a7b Update Dockerfile
slight change
2020-01-27 22:37:41 +03:00
8ce7e14a02 Add name in From field. 2020-01-27 20:37:25 +02:00
3401ca049e Make viewed emails more descriptive. 2020-01-27 14:47:02 +02:00
5dcc7b9efd Add more descriptive subject lines. 2020-01-27 14:45:40 +02:00
06a538bb81 Merge branch 'build-version300' into 'master'
Build version300

See merge request mohit.panjvani/crater-web!162
2020-01-27 09:26:58 +00:00
7ab0419f27 build version300 2020-01-27 14:47:45 +05:30
a7275aaa42 fix report download & payments delete issue 2020-01-27 14:46:40 +05:30
bc4e6a05ea fix Surround DB_PASSWORD with quotes #104 issue 2020-01-27 14:22:21 +05:30
ca170f5a87 fix dashbord & using FROM_MAIL_ADDRESS issues 2020-01-27 13:43:48 +05:30
22e7e96dfa fix new lines in address field issue 2020-01-27 11:57:47 +05:30
fcfd1ddb7a build 300 2020-01-27 11:19:22 +05:30
daf8c9265b fix tab & language issue 2020-01-27 11:18:11 +05:30
406d098172 Update Dockerfile
Generation does not work due to:
iconv(): Wrong charset, conversion from `UTF-8' to `UTF-8//IGNORE' is not allowed

Installing the library gnu-libiconv will solve the problem
2020-01-26 23:18:15 +03:00
824d2e3e8d update app version 2020-01-26 12:32:57 +05:30
3cd975dbbd new build 2020-01-25 13:33:50 +05:30
8e50c36a71 Merge branch 'master' 2020-01-25 13:12:39 +05:30
b499741ab4 change button style of primary actions on view pages 2020-01-25 13:12:20 +05:30
b409cdb913 Merge branch 'auto-update' into 'master'
fix auto update issue in dev

See merge request mohit.panjvani/crater-web!160
2020-01-22 16:10:36 +00:00
13e56105e3 fix auto update issue in dev 2020-01-22 13:39:59 +05:30
f68e86e4cf Added Kyrgyzstani som 2020-01-20 22:37:03 +01:00
da996c1f33 Merge branch 'master' of https://github.com/bytefury/crater 2020-01-19 11:49:35 +05:30
0990ce4678 cross-env should only be in devDependencies 2020-01-18 16:29:48 +01:00
bb6fb2f49d Merge pull request #131 from jjoseba/master
Spanish corrections
2020-01-08 15:39:16 +05:30
400296575e Updated Spanish translation 2020-01-08 10:58:26 +01:00
d58c790b1f Merge branch 'build-300' into 'master'
fix mailgun config issue & build 300

See merge request mohit.panjvani/crater-web!153
2020-01-07 08:32:04 +00:00
c674c2ab9e build verison 300 2020-01-07 13:10:55 +05:30
d79692cf3b mail configuration issue 2020-01-07 12:33:03 +05:30
353c2479f1 Detect if no .env file exists and add it on composer commands. 2020-01-06 10:55:34 -07:00
0176a854b8 Merge branch 'refactor-master' into 'master'
refactor payment view and mutation

See merge request mohit.panjvani/crater-web!151
2020-01-06 16:08:53 +00:00
00548ea908 refactor payment view 2020-01-06 19:03:08 +05:30
09e335a8a7 fix conflicts 2020-01-06 14:48:08 +05:30
53e2ed253f Merge branch 'master' 2020-01-06 14:47:06 +05:30
06b035d9ac Merge branch 'build-300' into 'master'
fix payment issue & build version 300

See merge request mohit.panjvani/crater-web!150
2020-01-06 09:16:49 +00:00
5c88cbcc42 Merge branch 'master' 2020-01-06 14:45:09 +05:30
d9b175a676 fix payment issue & build version 300 2020-01-06 14:08:29 +05:30
f5b9bc95c6 Merge branch 'build-300' into 'master'
build version 300

See merge request mohit.panjvani/crater-web!149
2020-01-06 06:47:08 +00:00
586dcdea0d build version 300 2020-01-06 12:02:12 +05:30
50957fc179 Merge pull request #127 from hypnodev/typo-fix-crop-popup
Typo fix crop popup
2020-01-05 23:41:51 +05:30
c725e4744b Compiled assets 2020-01-05 19:00:29 +01:00
7479ce237e Typo fix #126 2020-01-05 18:57:46 +01:00
84420441c0 Merge pull request #2 from bytefury/master
Merge pull request #2 from bytefury/master
2020-01-05 14:03:26 +01:00
ac96721e87 build 220 2020-01-05 13:50:08 +05:30
db4c7f5e32 fix merge conflicts 2020-01-05 13:45:10 +05:30
87dc78eea0 Merge pull request #115 from hypnodev/add-available-lang-to-onboarding
Added available languages to Onboarding
2020-01-05 13:39:02 +05:30
e9c2898056 Merge pull request #119 from hypnodev/fix-http-mixed-request
Fix http mixed request
2020-01-05 13:37:27 +05:30
b9c4570137 Merge pull request #121 from MakerLab-Dev/translations-updates
Translations Updates
2020-01-05 13:35:01 +05:30
8e2525cc6c new build 220 2020-01-05 13:34:01 +05:30
8862a93f23 fix border-left jump on active selection 2020-01-05 13:08:42 +05:30
82efd88920 Merge branch 'sidebar-view' into 'master'
sidebar-view modified

See merge request mohit.panjvani/crater-web!132
2020-01-05 07:24:12 +00:00
0ef528d296 Merge branch 'payment_receipt' into 'master' 2020-01-05 07:22:36 +00:00
4c33a5d88c Fix Invoice/Estimate template issues and Add Payment Receipt, Custom Payment Modes and Item units 2020-01-05 07:22:36 +00:00
d64d06181b Translations Updates
Spanish translation: 100%
Removed a blank space in English translation
Changed the copyright year to 2020 in all translations
2020-01-03 17:21:43 +01:00
ef9cf2db22 Fix mixed content when use endpoint for categories list 2020-01-03 00:14:05 +01:00
96c295a003 Added available languages to Onboarding 2019-12-31 10:20:13 +01:00
22528f5b66 Merge pull request #1 from bytefury/master
Same as bytefury/crater
2019-12-31 10:15:17 +01:00
1cd9c72537 Merge pull request #108 from hypnodev/fix-postgresql-case-sensitiive-bug
Fix case sensitive PostgreSQL bug
2019-12-31 09:26:46 +05:30
7253b43eb4 Fix case sensitive PostgreSQL bug 2019-12-29 14:50:03 +01:00
181964cf03 Merge pull request #105 from PHClement/patch-1
Update fr.json
2019-12-28 21:13:42 +05:30
5914245ae4 Merge pull request #106 from cilas/feature/translate-app-to-portuguese
Feature/translate app to portuguese
2019-12-28 21:11:32 +05:30
1bf3d28d4e Update fr.json
Correct some mistake, please approve it, thank you ;)
2019-12-28 01:45:25 +01:00
dbcbd93ace Translate to Brazilian Portuguese Complete 2019-12-27 21:45:15 -03:00
1729c6a308 Translated partial wizard section 2019-12-27 17:42:54 -03:00
019493cbfa Translated settings section 2019-12-27 15:55:34 -03:00
60540ba966 Translated reports section 2019-12-27 13:14:53 -03:00
601ad419ec Translated login section 2019-12-27 12:54:21 -03:00
80e7bab891 Translated expenses section 2019-12-27 12:50:37 -03:00
f5c8befbf0 Translated payments section 2019-12-27 12:33:56 -03:00
09c984baa7 Translated credit_notes section 2019-12-27 12:27:42 -03:00
0d93260672 Translated invoice section 2019-12-27 12:24:59 -03:00
3e9e217f92 Translate estimate session 2019-12-27 00:53:16 -03:00
3cd8859c62 add Brazilian Portuguese language to CompanyController 2019-12-27 00:14:57 -03:00
4493b4a419 add language pt_BR to plugins 2019-12-27 00:11:41 -03:00
79e3e70bd6 add pt_BR language option 2019-12-26 22:47:09 -03:00
56a955befd delete yarnlock file 2019-12-25 19:29:22 +05:30
496c28f80d remove transifex from readme 2019-12-25 19:27:41 +05:30
7a59f3fe0c refactor variable in estimate view scss 2019-12-23 21:05:48 +05:30
3d6875a532 refactor css variables 2019-12-23 21:00:26 +05:30
15bf380f4f Merge pull request #93 from surajjdhv/master
Fixed incorrectly named language (ar.json) file
2019-12-23 12:54:04 +05:30
0b910db039 Fixed incorrectly named language (ar.json) file 2019-12-22 21:47:30 +05:30
0e5e8f602f update error message for db file permission issue 2019-12-21 23:02:05 +05:30
d9db0f9401 Merge pull request #80 from eboye/master
Add Serbian Dinar currency
2019-12-21 14:08:10 +05:30
c0da7c7339 Merge pull request #89 from claretnnamocha/master
Docs
2019-12-20 19:15:16 +05:30
7e7599b4a7 Merge branch 'master' into master 2019-12-20 09:35:03 +01:00
99cd88e6c6 Revert "Update CompanyController.php"
This reverts commit 053a06229c.
2019-12-20 09:32:29 +01:00
053a06229c Update CompanyController.php 2019-12-20 09:30:15 +01:00
1a6e8280a8 update readme 2019-12-18 20:58:44 +05:30
125e8be83c Merge pull request #87 from hsnapps/master
Added the Arabic language localization
2019-12-18 20:56:06 +05:30
4d89ca2101 Added the Arabic language localization 2019-12-18 10:18:04 +03:00
e8aee3bb32 Add Serbian Dinar currency 2019-12-17 11:32:58 +01:00
d3c7ca75f0 Documenting web routes 2019-12-16 20:41:59 +01:00
694d5f56d5 Documenting Controllers 2019-12-16 20:17:43 +01:00
a48439785c Merge pull request #68 from BirkhoffLee/master
Docker: fix update functionality
2019-12-14 21:23:24 +05:30
7c9bd84f00 Docker: fix update functionality
Added php zip extension
2019-12-14 15:43:01 +00:00
799d212d9b refactor classes on invoice and estimate view page 2019-12-10 11:15:49 +05:30
fa15502ce7 refactor primary color-var 2019-12-09 19:20:11 +05:30
1f4d3bf784 sidebar-view modified 2019-12-09 18:58:53 +05:30
1842 changed files with 165758 additions and 83916 deletions

View File

@ -19,4 +19,7 @@ indent_size = 2
indent_size = 2
[*.js]
indent_size = 2
indent_size = 2
[*.json]
indent_size = 2

View File

@ -9,12 +9,13 @@ DB_HOST=db
DB_PORT=3306
DB_DATABASE=crater
DB_USERNAME=crater
DB_PASSWORD=crater
DB_PASSWORD="crater"
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=1440
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
@ -31,6 +32,9 @@ PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
PROXY_OAUTH_CLIENT_ID=2
PROXY_OAUTH_CLIENT_SECRET=SECRET-GENERATED-KEY-HERE
PROXY_OAUTH_GRANT_TYPE=password
SANCTUM_STATEFUL_DOMAINS=crater.test
SESSION_DOMAIN=crater.test
TRUSTED_PROXIES="*"
CRON_JOB_AUTH_TOKEN=""

View File

@ -2,3 +2,12 @@ APP_ENV=testing
APP_DEBUG=true
APP_KEY=base64:IdDlpLmYyWA9z4Ruj5st1FSYrhCR7lPOscLGCz2Jf4I=
DB_CONNECTION=sqlite
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=ff538f0e1037f4
MAIL_PASSWORD=c04c81145fcb73
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="admin@craterapp.com"
MAIL_FROM_NAME="John Doe"

View File

@ -1,10 +0,0 @@
{
"root": true,
"extends": [
"plugin:vue/recommended",
"standard"
],
"rules": {
"vue/max-attributes-per-line" : 3
}
}

14
.eslintrc.js Normal file
View File

@ -0,0 +1,14 @@
// .eslintrc.js
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
"plugin:vue/vue3-recommended",
"prettier",
],
rules: {
// override/add rules settings here, such as:
// 'vue/no-unused-vars': 'error'
},
};

37
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,37 @@
name: CI
on: [push, pull_request]
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0']
name: PHP ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: exif
- name: Install PHP 7 dependencies
run: composer update --no-interaction --no-progress
if: "matrix.php < 8"
- name: Install PHP 8 dependencies
run: composer update --ignore-platform-req=php --no-interaction --no-progress
if: "matrix.php >= 8"
- name: Check coding style
run: ./vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --config=.php-cs-fixer.dist.php
- name: Unit Tests
run: php ./vendor/bin/pest

162
.github/workflows/uffizzi-build.yml vendored Normal file
View File

@ -0,0 +1,162 @@
name: Build PR Image
on:
pull_request:
types: [opened,synchronize,reopened,closed]
jobs:
build-application:
name: Build and Push `application`
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate UUID image name
id: uuid
run: echo "UUID_TAG_APP=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: registry.uffizzi.com/${{ env.UUID_TAG_APP }}
tags: type=raw,value=60d
- name: Build and Push Image to registry.uffizzi.com ephemeral registry
uses: docker/build-push-action@v2
with:
push: true
context: ./
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./uffizzi/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-nginx:
name: Build and Push `nginx`
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate UUID image name
id: uuid
run: echo "UUID_TAG_NGINX=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: registry.uffizzi.com/${{ env.UUID_TAG_NGINX }}
tags: type=raw,value=60d
- name: Build and Push Image to Uffizzi ephemeral registry
uses: docker/build-push-action@v2
with:
push: true
context: ./
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./uffizzi/nginx/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-crond:
name: Build and Push `crond`
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate UUID image name
id: uuid
run: echo "UUID_TAG_CROND=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: registry.uffizzi.com/${{ env.UUID_TAG_CROND }}
tags: type=raw,value=60d
- name: Build and Push Image to registry.uffizzi.com ephemeral registry
uses: docker/build-push-action@v2
with:
push: true
context: ./
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./uffizzi/crond/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
render-compose-file:
name: Render Docker Compose File
# Pass output of this workflow to another triggered by `workflow_run` event.
runs-on: ubuntu-latest
outputs:
compose-file-cache-key: ${{ steps.hash.outputs.hash }}
needs:
- build-application
- build-nginx
- build-crond
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Render Compose File
run: |
APP_IMAGE=$(echo ${{ needs.build-application.outputs.tags }})
export APP_IMAGE
NGINX_IMAGE=$(echo ${{ needs.build-nginx.outputs.tags }})
export NGINX_IMAGE
CROND_IMAGE=$(echo ${{ needs.build-crond.outputs.tags }})
export CROND_IMAGE
# Render simple template from environment variables.
envsubst < ./uffizzi/docker-compose.uffizzi.yml > docker-compose.rendered.yml
cat docker-compose.rendered.yml
- name: Upload Rendered Compose File as Artifact
uses: actions/upload-artifact@v3
with:
name: preview-spec
path: docker-compose.rendered.yml
retention-days: 2
- name: Serialize PR Event to File
run: |
cat << EOF > event.json
${{ toJSON(github.event) }}
EOF
- name: Upload PR Event as Artifact
uses: actions/upload-artifact@v3
with:
name: preview-spec
path: event.json
retention-days: 2
delete-preview:
name: Call for Preview Deletion
runs-on: ubuntu-latest
if: ${{ github.event.action == 'closed' }}
steps:
# If this PR is closing, we will not render a compose file nor pass it to the next workflow.
- name: Serialize PR Event to File
run: echo '${{ toJSON(github.event) }}' > event.json
- name: Upload PR Event as Artifact
uses: actions/upload-artifact@v3
with:
name: preview-spec
path: event.json
retention-days: 2

84
.github/workflows/uffizzi-preview.yml vendored Normal file
View File

@ -0,0 +1,84 @@
name: Deploy Uffizzi Preview
on:
workflow_run:
workflows:
- "Build PR Image"
types:
- completed
jobs:
cache-compose-file:
name: Cache Compose File
runs-on: ubuntu-latest
outputs:
compose-file-cache-key: ${{ env.COMPOSE_FILE_HASH }}
pr-number: ${{ env.PR_NUMBER }}
steps:
- name: 'Download artifacts'
# Fetch output (zip archive) from the workflow run that triggered this workflow.
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "preview-spec"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/preview-spec.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip preview-spec.zip
- name: Read Event into ENV
run: |
echo 'EVENT_JSON<<EOF' >> $GITHUB_ENV
cat event.json >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Hash Rendered Compose File
id: hash
# If the previous workflow was triggered by a PR close event, we will not have a compose file artifact.
if: ${{ fromJSON(env.EVENT_JSON).action != 'closed' }}
run: echo "COMPOSE_FILE_HASH=$(md5sum docker-compose.rendered.yml | awk '{ print $1 }')" >> $GITHUB_ENV
- name: Cache Rendered Compose File
if: ${{ fromJSON(env.EVENT_JSON).action != 'closed' }}
uses: actions/cache@v3
with:
path: docker-compose.rendered.yml
key: ${{ env.COMPOSE_FILE_HASH }}
- name: Read PR Number From Event Object
id: pr
run: echo "PR_NUMBER=${{ fromJSON(env.EVENT_JSON).number }}" >> $GITHUB_ENV
- name: DEBUG - Print Job Outputs
if: ${{ runner.debug }}
run: |
echo "PR number: ${{ env.PR_NUMBER }}"
echo "Compose file hash: ${{ env.COMPOSE_FILE_HASH }}"
cat event.json
deploy-uffizzi-preview:
name: Use Remote Workflow to Preview on Uffizzi
needs:
- cache-compose-file
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2.6.1
with:
# If this workflow was triggered by a PR close event, cache-key will be an empty string
# and this reusable workflow will delete the preview deployment.
compose-file-cache-key: ${{ needs.cache-compose-file.outputs.compose-file-cache-key }}
compose-file-cache-path: docker-compose.rendered.yml
server: https://app.uffizzi.com/
pr-number: ${{ needs.cache-compose-file.outputs.pr-number }}
permissions:
contents: read
pull-requests: write
id-token: write

8
.gitignore vendored
View File

@ -1,3 +1,4 @@
/Modules
/node_modules
/public/storage
/public/hot
@ -11,5 +12,8 @@ Homestead.yaml
.rnd
/.expo
/.vscode
docker-compose.yml
docker-compose.yaml
/docker-compose/db/data/
.gitkeep
/public/docs
/.scribe
!storage/fonts/.gitkeep

42
.php-cs-fixer.dist.php Normal file
View File

@ -0,0 +1,42 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude(['bootstrap', 'storage', 'vendor'])
->name('*.php')
->name('_ide_helper')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
$rules = [
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'concat_space' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
'property' => 'one',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
];
return (new PhpCsFixer\Config())
->setUsingCache(true)
->setRules($rules)
->setFinder($finder);

5
.prettierrc.json Normal file
View File

@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2
}

128
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
info@craterapp.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,52 +1,40 @@
##### STAGE 1 #####
FROM php:8.1-fpm
FROM composer as composer
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Copy composer files from project root into composer container's working dir
COPY composer.* /app/
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
libzip-dev \
libmagickwand-dev \
mariadb-client
# Copy database directory for autoloader optimization
COPY database /app/database
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Run composer to build dependencies in vendor folder
RUN composer install --no-scripts --no-suggest --no-interaction --prefer-dist --optimize-autoloader
RUN pecl install imagick \
&& docker-php-ext-enable imagick
# Copy everything from project root into composer container's working dir
COPY . /app
RUN composer dump-autoload --optimize --classmap-authoritative
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
##### STAGE 2 #####
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
FROM php:7.3.12-fpm-alpine
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN apk add --no-cache libpng-dev libxml2-dev oniguruma-dev && \
docker-php-ext-install bcmath ctype json gd mbstring pdo pdo_mysql tokenizer xml
# Set container's working dir
WORKDIR /app
# Copy everything from project root into php container's working dir
COPY . /app
# Copy vendor folder from composer container into php container
COPY --from=composer /app/vendor /app/vendor
RUN touch database/database.sqlite && \
cp .env.example .env && \
php artisan config:cache && \
php artisan passport:keys && \
php artisan key:generate && \
chown -R www-data:www-data . && \
chmod -R 755 . && \
chmod -R 775 storage/framework/ && \
chmod -R 775 storage/logs/ && \
chmod -R 775 bootstrap/cache/
EXPOSE 9000
CMD ["php-fpm", "--nodaemonize"]
# Set working directory
WORKDIR /var/www
USER $user

702
LICENSE
View File

@ -1,47 +1,661 @@
Copyright (c) 2019 by Bytefury
Crater Invoice * https://www.craterapp.com
"Easy Invoicing"
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
All Rights Reserved
ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the conditions below are met.
These conditions require a modest attribution to CraterApp.com (the
"Author"), who hopes that its promotional value may help justify the
thousands of dollars in otherwise billable time invested in writing
this and other freely available, open-source software.
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
1. Redistributions of source code, in whole or part and with or without
modification (the "Code"), must prominently display this GPG-signed
text in verifiable form.
2. Redistributions of the Code in binary form must be accompanied by
this GPG-signed text in any documentation and, each time the resulting
executable program or a program dependent thereon is launched, a
prominent display (e.g., splash screen or banner text) of the Author's
attribution information, which includes:
(a) Name ("Bytefury"),
(b) Professional identification ("Crater Invoice"), and
(c) URL ("https://www.craterapp.com").
3. Neither the name nor any trademark of the Author may be used to
endorse or promote products derived from this software without specific
prior written permission.
4. Users are entirely responsible, to the exclusion of the Author and
any other persons, for compliance with (1) regulations set by owners or
administrators of employed equipment, (2) licensing terms of any other
software, and (3) local regulations regarding use, including those
regarding import, export, and use of encryption software.
Preamble
THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS;
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

5
SECURITY.md Normal file
View File

@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please email security@craterapp.com to report any security vulnerabilities. We will acknowledge receipt of your vulnerability and strive to send you regular updates about our progress. If you're curious about the status of your disclosure please feel free to email us again.

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
use Crater\User;
use Crater\Country;
class Address extends Model
{
const BILLING_TYPE = 'BILLING';
const SHIPPING_TYPE = 'SHIPPING';
protected $fillable = [
'name',
'address_street_1',
'address_street_2',
'city',
'state',
'country_id',
'zip',
'phone',
'fax',
'type',
'user_id'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
}

View File

@ -1,36 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
use Crater\User;
use Crater\CompanySetting;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
class Company extends Model implements HasMedia
{
use HasMediaTrait;
protected $fillable = ['name', 'logo', 'unique_hash'];
protected $appends=['logo'];
public function getLogoAttribute()
{
$logo = $this->getMedia('logo')->first();
if ($logo) {
return asset($logo->getUrl());
}
return ;
}
public function user()
{
return $this->hasOne(User::class);
}
public function settings()
{
return $this->hasMany(CompanySetting::class);
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
class CompanySetting extends Model
{
protected $fillable = ['company_id', 'option', 'value'];
public function company()
{
return $this->belongsTo(Company::class);
}
public static function setSetting($key, $setting, $company_id)
{
$old = self::whereOption($key)->whereCompany($company_id)->first();
if ($old) {
$old->value = $setting;
$old->save();
return;
}
$set = new CompanySetting();
$set->option = $key;
$set->value = $setting;
$set->company_id = $company_id;
$set->save();
}
public static function getSetting($key, $company_id)
{
$setting = static::whereOption($key)->whereCompany($company_id)->first();
if ($setting) {
return $setting->value;
} else {
return null;
}
}
public function scopeWhereCompany($query, $company_id)
{
$query->where('company_id', $company_id);
}
}

View File

@ -1,9 +1,10 @@
<?php
namespace Crater\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Crater\Estimate;
use Crater\Models\Estimate;
use Illuminate\Console\Command;
class CheckEstimateStatus extends Command
{
@ -39,7 +40,7 @@ class CheckEstimateStatus extends Command
public function handle()
{
$date = Carbon::now();
$status = array(Estimate::STATUS_ACCEPTED, Estimate::STATUS_REJECTED, Estimate::STATUS_EXPIRED);
$status = [Estimate::STATUS_ACCEPTED, Estimate::STATUS_REJECTED, Estimate::STATUS_EXPIRED];
$estimates = Estimate::whereNotIn('status', $status)->whereDate('expiry_date', '<', $date)->get();
foreach ($estimates as $estimate) {

View File

@ -1,9 +1,10 @@
<?php
namespace Crater\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Crater\Invoice;
use Crater\Models\Invoice;
use Illuminate\Console\Command;
class CheckInvoiceStatus extends Command
{
@ -39,10 +40,13 @@ class CheckInvoiceStatus extends Command
public function handle()
{
$date = Carbon::now();
$invoices = Invoice::where('status', '<>', Invoice::STATUS_COMPLETED)->whereDate('due_date', '<',$date)->get();
$invoices = Invoice::whereNotIn('status', [Invoice::STATUS_COMPLETED, Invoice::STATUS_DRAFT])
->where('overdue', false)
->whereDate('due_date', '<', $date)
->get();
foreach ($invoices as $invoice) {
$invoice->status = Invoice::STATUS_OVERDUE;
$invoice->overdue = true;
printf("Invoice %s is OVERDUE \n", $invoice->invoice_number);
$invoice->save();
}

View File

@ -0,0 +1,64 @@
<?php
namespace Crater\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class CreateTemplateCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:template {name} {--type=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create estimate or invoice pdf template. ';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$templateName = $this->argument('name');
$type = $this->option('type');
if (! $type) {
$type = $this->choice('Create a template for?', ['invoice', 'estimate']);
}
if (Storage::disk('views')->exists("/app/pdf/{$type}/{$templateName}.blade.php")) {
$this->info("Template with given name already exists.");
return 0;
}
Storage::disk('views')->copy("/app/pdf/{$type}/{$type}1.blade.php", "/app/pdf/{$type}/{$templateName}.blade.php");
copy(public_path("/build/img/PDF/{$type}1.png"), public_path("/build/img/PDF/{$templateName}.png"));
copy(resource_path("/static/img/PDF/{$type}1.png"), resource_path("/static/img/PDF/{$templateName}.png"));
$path = resource_path("app/pdf/{$type}/{$templateName}.blade.php");
$type = ucfirst($type);
$this->info("{$type} Template created successfully at ".$path);
return 0;
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Crater\Console\Commands;
use Crater\Space\ModuleInstaller;
use Illuminate\Console\Command;
class InstallModuleCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'install:module {module} {version}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install cloned module.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ModuleInstaller::complete($this->argument('module'), $this->argument('version'));
return Command::SUCCESS;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Crater\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Support\Facades\Artisan;
class ResetApp extends Command
{
use ConfirmableTrait;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reset:app {--force}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Clean database, database_created and public/storage folder';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return;
}
$this->info('Running migrate:fresh');
Artisan::call('migrate:fresh --seed --force');
$this->info('Seeding database');
Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]);
$path = base_path('.env');
if (file_exists($path)) {
file_put_contents($path, str_replace(
'APP_DEBUG=true',
'APP_DEBUG=false',
file_get_contents($path)
));
}
$this->info('App has been reset successfully');
}
}

View File

@ -0,0 +1,241 @@
<?php
namespace Crater\Console\Commands;
use Crater\Models\Setting;
use Crater\Space\Updater;
use Illuminate\Console\Command;
// Implementation taken from Akaunting - https://github.com/akaunting/akaunting
class UpdateCommand extends Command
{
public $installed;
public $version;
public $response;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'crater:update';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Automatically update your crater app';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
set_time_limit(3600); // 1 hour
$this->installed = $this->getInstalledVersion();
$this->response = $this->getLatestVersionResponse();
$this->version = ($this->response) ? $this->response->version : false;
if ($this->response == 'extension_required') {
$this->info('Sorry! Your system does not meet the minimum requirements for this update.');
$this->info('Please retry after installing the required version/extensions.');
return;
}
if (! $this->version) {
$this->info('No Update Available! You are already on the latest version.');
return;
}
if (! $this->confirm("Do you wish to update to {$this->version}?")) {
return;
}
if (! $path = $this->download()) {
return;
}
if (! $path = $this->unzip($path)) {
return;
}
if (! $this->copyFiles($path)) {
return;
}
if (isset($this->response->deleted_files) && ! empty($this->response->deleted_files)) {
if (! $this->deleteFiles($this->response->deleted_files)) {
return;
}
}
if (! $this->migrateUpdate()) {
return;
}
if (! $this->finish()) {
return;
}
$this->info('Successfully updated to '.$this->version);
}
public function getInstalledVersion()
{
return Setting::getSetting('version');
}
public function getLatestVersionResponse()
{
$this->info('Your currently installed version is '.$this->installed);
$this->line('');
$this->info('Checking for update...');
try {
$response = Updater::checkForUpdate($this->installed);
if ($response->success) {
$extensions = $response->version->extensions;
$is_required = false;
foreach ($extensions as $key => $extension) {
if (! $extension) {
$is_required = true;
$this->info('❌ '.$key);
}
$this->info('✅ '.$key);
}
if ($is_required) {
return 'extension_required';
}
return $response->version;
}
return false;
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
}
public function download()
{
$this->info('Downloading update...');
try {
$path = Updater::download($this->version, 1);
if (! is_string($path)) {
$this->error('Download exception');
return false;
}
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return $path;
}
public function unzip($path)
{
$this->info('Unzipping update package...');
try {
$path = Updater::unzip($path);
if (! is_string($path)) {
$this->error('Unzipping exception');
return false;
}
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return $path;
}
public function copyFiles($path)
{
$this->info('Copying update files...');
try {
Updater::copyFiles($path);
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
public function deleteFiles($files)
{
$this->info('Deleting unused old files...');
try {
Updater::deleteFiles($files);
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
public function migrateUpdate()
{
$this->info('Running Migrations...');
try {
Updater::migrateUpdate();
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
public function finish()
{
$this->info('Finishing update...');
try {
Updater::finishUpdate($this->installed, $this->version);
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
}

View File

@ -1,6 +1,9 @@
<?php
namespace Crater\Console;
use Crater\Models\CompanySetting;
use Crater\Models\RecurringInvoice;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@ -12,7 +15,10 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
Commands\ResetApp::class,
Commands\UpdateCommand::class,
Commands\CreateTemplateCommand::class,
Commands\InstallModuleCommand::class,
];
/**
@ -23,11 +29,22 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('check:invoices:status')
if (\Storage::disk('local')->has('database_created')) {
$schedule->command('check:invoices:status')
->daily();
$schedule->command('check:estimates:status')
$schedule->command('check:estimates:status')
->daily();
$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$timeZone = CompanySetting::getSetting('time_zone', $recurringInvoice->company_id);
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency)->timezone($timeZone);
}
}
}
/**

View File

@ -1,17 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
class Currency extends Model
{
protected $fillable = [
'name',
'code',
'symbol',
'precision',
'thousand_separator',
'decimal_separator',
'position'
];
}

View File

@ -1,237 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
use Crater\CompanySetting;
use Carbon\Carbon;
class Estimate extends Model
{
const STATUS_DRAFT = 'DRAFT';
const STATUS_SENT = 'SENT';
const STATUS_VIEWED = 'VIEWED';
const STATUS_EXPIRED = 'EXPIRED';
const STATUS_ACCEPTED = 'ACCEPTED';
const STATUS_REJECTED = 'REJECTED';
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
'estimate_date',
'expiry_date'
];
protected $appends = [
'formattedExpiryDate',
'formattedEstimateDate'
];
protected $fillable = [
'estimate_date',
'expiry_date',
'estimate_number',
'user_id',
'company_id',
'reference_number',
'estimate_template_id',
'discount',
'discount_type',
'discount_val',
'status',
'sub_total',
'tax_per_item',
'discount_per_item',
'total',
'tax',
'notes',
'unique_hash'
];
protected $casts = [
'total' => 'integer',
'tax' => 'integer',
'sub_total' => 'integer',
'discount' => 'float',
'discount_val' => 'integer',
];
public static function getNextEstimateNumber($value)
{
// Get the last created order
$lastOrder = Estimate::where('estimate_number', 'LIKE', $value . '-%')
->orderBy('created_at', 'desc')
->first();
if (!$lastOrder) {
// We get here if there is no order at all
// If there is no number set it to 0, which will be 1 at the end.
$number = 0;
} else {
$number = explode("-",$lastOrder->estimate_number);
$number = $number[1];
}
// If we have ORD000001 in the database then we only want the number
// So the substr returns this 000001
// Add the string in front and higher up the number.
// the %05d part makes sure that there are always 6 numbers in the string.
// so it adds the missing zero's when needed.
return sprintf('%06d', intval($number) + 1);
}
public function items()
{
return $this->hasMany('Crater\EstimateItem');
}
public function user()
{
return $this->belongsTo('Crater\User');
}
public function taxes()
{
return $this->hasMany(Tax::class);
}
public function estimateTemplate()
{
return $this->belongsTo('Crater\EstimateTemplate');
}
public function getEstimateNumAttribute()
{
$position = $this->strposX($this->estimate_number, "-", 1) + 1;
return substr($this->estimate_number, $position);
}
public function getEstimatePrefixAttribute()
{
$prefix = explode("-",$this->estimate_number)[0];
return $prefix;
}
private function strposX($haystack, $needle, $number)
{
if ($number == '1') {
return strpos($haystack, $needle);
} elseif ($number > '1') {
return strpos(
$haystack,
$needle,
$this->strposX($haystack, $needle, $number - 1) + strlen($needle)
);
} else {
return error_log('Error: Value for parameter $number is out of range');
}
}
public function getFormattedExpiryDateAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
return Carbon::parse($this->expiry_date)->format($dateFormat);
}
public function getFormattedEstimateDateAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
return Carbon::parse($this->estimate_date)->format($dateFormat);
}
public function scopeEstimatesBetween($query, $start, $end)
{
return $query->whereBetween(
'estimates.estimate_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
);
}
public function scopeWhereStatus($query, $status)
{
return $query->where('estimates.status', $status);
}
public function scopeWhereEstimateNumber($query, $estimateNumber)
{
return $query->where('estimates.estimate_number', $estimateNumber);
}
public function scopeWhereSearch($query, $search)
{
foreach (explode(' ', $search) as $term) {
$query->whereHas('user', function ($query) use ($term) {
$query->where('name', 'LIKE', '%'.$term.'%')
->orWhere('contact_name', 'LIKE', '%'.$term.'%')
->orWhere('company_name', 'LIKE', '%'.$term.'%');
});
}
}
public function scopeApplyFilters($query, array $filters)
{
$filters = collect($filters);
if ($filters->get('search')) {
$query->whereSearch($filters->get('search'));
}
if ($filters->get('estimate_number')) {
$query->whereEstimateNumber($filters->get('estimate_number'));
}
if ($filters->get('status')) {
$query->whereStatus($filters->get('status'));
}
if ($filters->get('from_date') && $filters->get('to_date')) {
$start = Carbon::createFromFormat('d/m/Y', $filters->get('from_date'));
$end = Carbon::createFromFormat('d/m/Y', $filters->get('to_date'));
$query->estimatesBetween($start, $end);
}
if ($filters->get('customer_id')) {
$query->whereCustomer($filters->get('customer_id'));
}
if ($filters->get('orderByField') || $filters->get('orderBy')) {
$field = $filters->get('orderByField') ? $filters->get('orderByField') : 'estimate_number';
$orderBy = $filters->get('orderBy') ? $filters->get('orderBy') : 'asc';
$query->whereOrder($field, $orderBy);
}
}
public function scopeWhereOrder($query, $orderByField, $orderBy)
{
$query->orderBy($orderByField, $orderBy);
}
public function scopeWhereCompany($query, $company_id)
{
$query->where('estimates.company_id', $company_id);
}
public function scopeWhereCustomer($query, $customer_id)
{
$query->where('estimates.user_id', $customer_id);
}
public static function deleteEstimate($id)
{
$estimate = Estimate::find($id);
if ($estimate->items()->exists()) {
$estimate->items()->delete();
}
if ($estimate->taxes()->exists()) {
$estimate->taxes()->delete();
}
$estimate->delete();
return true;
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
use Crater\Estimate;
class EstimateTemplate extends Model
{
protected $fillable = ['path', 'view', 'name'];
public function estimates()
{
return $this->hasMany(Estimate::class);
}
public function getPathAttribute($value)
{
return url($value);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Crater\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ModuleDisabledEvent
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $module;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($module)
{
$this->module = $module;
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Crater\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ModuleEnabledEvent
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $module;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($module)
{
$this->module = $module;
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Crater\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ModuleInstalledEvent
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $module;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($module)
{
$this->module = $module;
}
}

View File

@ -2,13 +2,7 @@
namespace Crater\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class UpdateFinished
{
@ -25,7 +19,7 @@ class UpdateFinished
*/
public function __construct($old, $new)
{
$this->old = $old;
$this->new = $new;
$this->old = $old;
$this->new = $new;
}
}

View File

@ -1,8 +1,9 @@
<?php
namespace Crater\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
@ -30,10 +31,10 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
@ -42,10 +43,10 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}

View File

@ -1,140 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
use Crater\ExpenseCategory;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
class Expense extends Model implements HasMedia
{
use HasMediaTrait;
protected $fillable = [
'expense_category_id',
'amount',
'company_id',
'expense_date',
'notes',
'attachment_receipt'
];
protected $appends = [
'formattedExpenseDate',
'formattedCreatedAt',
'receipt'
];
public function category()
{
return $this->belongsTo(ExpenseCategory::class, 'expense_category_id');
}
public function getFormattedExpenseDateAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
return Carbon::parse($this->expense_date)->format($dateFormat);
}
public function getFormattedCreatedAtAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
return Carbon::parse($this->created_at)->format($dateFormat);
}
public function getReceiptAttribute($value)
{
$media = $this->getFirstMedia('receipts');
if($media) {
return $media->getPath();
}
return null;
}
public function scopeExpensesBetween($query, $start, $end)
{
return $query->whereBetween(
'expenses.expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
);
}
public function scopeWhereCategoryName($query, $search)
{
foreach (explode(' ', $search) as $term) {
$query->whereHas('category', function ($query) use ($term) {
$query->where('name', 'LIKE', '%'.$term.'%');
});
}
}
public function scopeWhereNotes($query, $search)
{
$query->where('notes', 'LIKE', '%'.$search.'%');
}
public function scopeWhereCategory($query, $categoryId)
{
return $query->where('expenses.expense_category_id', $categoryId);
}
public function scopeApplyFilters($query, array $filters)
{
$filters = collect($filters);
if ($filters->get('expense_category_id')) {
$query->whereCategory($filters->get('expense_category_id'));
}
if ($filters->get('from_date') && $filters->get('to_date')) {
$start = Carbon::createFromFormat('d/m/Y', $filters->get('from_date'));
$end = Carbon::createFromFormat('d/m/Y', $filters->get('to_date'));
$query->expensesBetween($start, $end);
}
if ($filters->get('orderByField') || $filters->get('orderBy')) {
$field = $filters->get('orderByField') ? $filters->get('orderByField') : 'expense_date';
$orderBy = $filters->get('orderBy') ? $filters->get('orderBy') : 'asc';
$query->whereOrder($field, $orderBy);
}
if ($filters->get('search')) {
$query->whereSearch($filters->get('search'));
}
}
public function scopeWhereSearch($query, $search)
{
foreach (explode(' ', $search) as $term) {
$query->whereHas('category', function ($query) use ($term) {
$query->where('name', 'LIKE', '%'.$term.'%');
})
->orWhere('notes', 'LIKE', '%'.$term.'%');
}
}
public function scopeWhereOrder($query, $orderByField, $orderBy)
{
$query->orderBy($orderByField, $orderBy);
}
public function scopeWhereCompany($query, $company_id)
{
$query->where('expenses.company_id', $company_id);
}
public function scopeExpensesAttributes($query)
{
$query->select(
DB::raw('
count(*) as expenses_count,
sum(amount) as total_amount,
expense_category_id'
)
)
->groupBy('expense_category_id');
}
}

View File

@ -1,39 +0,0 @@
<?php
namespace Crater;
use Illuminate\Database\Eloquent\Model;
use Crater\Expense;
use Carbon\Carbon;
class ExpenseCategory extends Model
{
protected $fillable = ['name', 'company_id', 'description'];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['amount', 'formattedCreatedAt'];
public function expenses()
{
return $this->hasMany(Expense::class);
}
public function getFormattedCreatedAtAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
return Carbon::parse($this->created_at)->format($dateFormat);
}
public function getAmountAttribute()
{
return $this->expenses()->sum('amount');
}
public function scopeWhereCompany($query, $company_id)
{
$query->where('company_id', $company_id);
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace Crater\Generators;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Support\PathGenerator\PathGenerator;
class CustomPathGenerator implements PathGenerator
{
public function getPath(Media $media): string
{
return $this->getBasePath($media).'/';
}
public function getPathForConversions(Media $media): string
{
return $this->getBasePath($media).'/conversations/';
}
public function getPathForResponsiveImages(Media $media): string
{
return $this->getBasePath($media).'/responsive-images/';
}
/*
* Get a unique base path for the given media.
*/
protected function getBasePath(Media $media): string
{
$folderName = null;
if ($media->model_type == Invoice::class) {
$folderName = 'Invoices';
} elseif ($media->model_type == Estimate::class) {
$folderName = 'Estimates';
} elseif ($media->model_type == Payment::class) {
$folderName = 'Payments';
} else {
$folderName = $media->getKey();
}
return $folderName;
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Crater\Http\Controllers;
use Crater\Models\Setting;
use Illuminate\Http\Request;
class AppVersionController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$version = Setting::getSetting('version');
return response()->json([
'version' => $version,
]);
}
}

View File

@ -1,194 +0,0 @@
<?php
namespace Crater\Http\Controllers\Auth;
use Crater\Proxy\HttpKernelProxy;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\ValidationException;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Validator;
use Hash;
use Crater\User;
use Auth;
use Crater\Http\Controllers\Controller;
class AccessTokensController extends Controller
{
use ThrottlesLogins;
/**
* A tool for proxying requests to the existing application.
*
* @var HttpKernelProxy
*/
protected $proxy;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct(HttpKernelProxy $proxy)
{
$this->middleware('api')->except(['store', 'update']);
$this->proxy = $proxy;
}
/**
* Get the login username to be used by the controller.
*
* @return string
*/
public function username()
{
return 'email';
}
/**
* Generate a new access token.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'username' => 'required|email',
'password' => 'required|string|min:8',
]);
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
return $this->requestPasswordGrant($request);
}
/**
* Refresh an access token.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$token = $request->cookie('refresh_token');
if (!$token) {
throw ValidationException::withMessages([
'refresh_token' => trans('oauth.missing_refresh_token')
]);
}
$response = $this->proxy->postJson('oauth/token', [
'client_id' => config('auth.proxy.client_id'),
'client_secret' => config('auth.proxy.client_secret'),
'grant_type' => 'refresh_token',
'refresh_token' => $token,
'scopes' => '[*]',
]);
if ($response->isSuccessful()) {
return $this->sendSuccessResponse($response);
}
return response($response->getContent(), $response->getStatusCode());
}
/**
* Get the guard to be used during authentication.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Auth::guard('api');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request)
{
$accessToken = Auth::user()->token();
\DB::table('oauth_refresh_tokens')
->where('access_token_id', $accessToken->id)
->update([
'revoked' => true
]);
$accessToken->revoke();
return response()->json(null, 200);
}
/**
* Create a new access token from a password grant client.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function requestPasswordGrant(Request $request)
{
$response = $this->proxy->postJson('oauth/token', [
'client_id' => config('auth.proxy.client_id'),
'client_secret' => config('auth.proxy.client_secret'),
'grant_type' => config('auth.proxy.grant_type'),
'username' => $request->username,
'password' => $request->password,
'scopes' => '[*]'
]);
$user = User::where('email', $request->username)->first();
if ($response->isSuccessful()) {
$this->clearLoginAttempts($request);
return $this->sendSuccessResponse($response, $user);
}
$this->incrementLoginAttempts($request);
return response($response->getContent(), $response->getStatusCode());
}
/**
* Return a successful response for requesting an api token.
*
* @param \Illuminate\Http\Response $response
* @return \Illuminate\Http\Response
*/
public function sendSuccessResponse(Response $response, $user)
{
$data = json_decode($response->getContent());
$content = [
'access_token' => $data->access_token,
'expires_in' => $data->expires_in,
];
return response($content, $response->getStatusCode())->cookie(
'refresh_token',
$data->refresh_token,
10 * 24 * 60,
"",
"",
true,
true
);
}
public function isRegistered(Request $request)
{
if (User::whereEmail($request->email)->first()) {
return 'true';
} else {
return 'false';
}
}
}

View File

@ -1,310 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\User;
use Crater\Setting;
use Crater\Company;
use Crater\Address;
use Crater\Http\Requests\SettingRequest;
use Crater\Http\Requests\SettingKeyRequest;
use Crater\Http\Requests\ProfileRequest;
use Crater\Http\Requests\CompanyRequest;
use Crater\Http\Requests\CompanySettingRequest;
use Crater\Http\Requests\NotificationSettingsRequest;
use Crater\Space\CurrencyFormatter;
use Crater\Space\DateFormatter;
use Crater\Space\TimeZones;
use Crater\Currency;
use Crater\CompanySetting;
class CompanyController extends Controller
{
public function getAdmin()
{
return User::find(1);
}
public function updateAdminProfile(ProfileRequest $request)
{
$verifyEmail = User::where('email', $request->email)->first();
$user = auth()->user();
if ($verifyEmail) {
if ($verifyEmail->id !== $user->id) {
return response()->json([
'error' => 'Email already in use'
]);
}
}
$user->name = $request->name;
$user->email = $request->email;
if ($request->has('password')) {
$user->password = bcrypt($request->password);
}
$user->save();
return response()->json([
'user' => $user,
'success' => true
]);
}
public function getAdminCompany()
{
$user = User::with(['addresses', 'addresses.country', 'company'])->find(1);
return response()->json([
'user' => $user
]);
}
public function updateAdminCompany(CompanyRequest $request)
{
$user = User::find(1);
$company = $user->company;
$company->name = $request->name;
$company->save();
if ($request->has('logo')) {
$company->clearMediaCollection('logo');
$company->addMediaFromRequest('logo')->toMediaCollection('logo');
}
$fields = $request->only(['address_street_1', 'address_street_2', 'city', 'state', 'country_id', 'zip', 'phone']);
$address = Address::updateOrCreate(['user_id' => 1], $fields);
$user = User::with(['addresses', 'addresses.country', 'company'])->find(1);
return response()->json([
'user' => $user,
'success' => true
]);
}
public function getGeneralSettings(Request $request)
{
$date_formats = DateFormatter::get_list();
$time_zones = TimeZones::get_list();
$fiscal_years = [
['key' => 'january-december' , 'value' => '1-12'],
['key' => 'february-january' , 'value' => '2-1'],
['key' => 'march-february' , 'value' => '3-2'],
['key' => 'april-march' , 'value' => '4-3'],
['key' => 'may-april' , 'value' => '5-4'],
['key' => 'june-may' , 'value' => '6-5'],
['key' => 'july-june' , 'value' => '7-6'],
['key' => 'august-july' , 'value' => '8-7'],
['key' => 'september-august' , 'value' => '9-8'],
['key' => 'october-september', 'value' => '10-9'],
['key' => 'november-october' , 'value' => '11-10'],
['key' => 'december-november', 'value' => '12-11'],
];
$language = CompanySetting::getSetting('language', $request->header('company'));
$carbon_date_format = CompanySetting::getSetting('carbon_date_format', $request->header('company'));
$moment_date_format = CompanySetting::getSetting('moment_date_format', $request->header('company'));
$time_zone = CompanySetting::getSetting('time_zone', $request->header('company'));
$currency = CompanySetting::getSetting('currency', $request->header('company'));
$fiscal_year = CompanySetting::getSetting('fiscal_year', $request->header('company'));
$languages = [
["code"=>"en", "name" => "English"],
["code"=>"fr", "name" => "French"],
["code"=>"es", "name" => "Spanish"]
];
return response()->json([
'languages' => $languages,
'date_formats' => $date_formats,
'time_zones' => $time_zones,
'time_zone' => $time_zone,
'currencies' => Currency::all(),
'fiscal_years' => $fiscal_years,
'fiscal_year' => $fiscal_year,
'selectedLanguage' => $language,
'selectedCurrency' => $currency,
'carbon_date_format' => $carbon_date_format,
'moment_date_format' => $moment_date_format,
]);
}
public function updateGeneralSettings(CompanySettingRequest $request)
{
$sets = [
'currency',
'time_zone',
'language',
'carbon_date_format',
'fiscal_year',
'moment_date_format'
];
foreach ($sets as $key) {
CompanySetting::setSetting($key, $request->$key, $request->header('company'));
}
return response()->json([
'success' => true
]);
}
public function getCustomizeSetting (Request $request)
{
$invoice_prefix = CompanySetting::getSetting('invoice_prefix', $request->header('company'));
$invoice_auto_generate = CompanySetting::getSetting('invoice_auto_generate', $request->header('company'));
$estimate_prefix = CompanySetting::getSetting('estimate_prefix', $request->header('company'));
$estimate_auto_generate = CompanySetting::getSetting('estimate_auto_generate', $request->header('company'));
$payment_prefix = CompanySetting::getSetting('payment_prefix', $request->header('company'));
$payment_auto_generate = CompanySetting::getSetting('payment_auto_generate', $request->header('company'));
return response()->json([
'invoice_prefix' => $invoice_prefix,
'invoice_auto_generate' => $invoice_auto_generate,
'estimate_prefix' => $estimate_prefix,
'estimate_auto_generate' => $estimate_auto_generate,
'payment_prefix' => $payment_prefix,
'payment_auto_generate' => $payment_auto_generate,
]);
}
public function updateCustomizeSetting (Request $request)
{
$sets = [];
if ($request->type == "PAYMENTS") {
$sets = [
'payment_prefix'
];
}
if ($request->type == "INVOICES") {
$sets = [
'invoice_prefix',
];
}
if ($request->type == "ESTIMATES") {
$sets = [
'estimate_prefix',
];
}
foreach ($sets as $key) {
CompanySetting::setSetting($key, $request->$key, $request->header('company'));
}
return response()->json([
'success' => true
]);
}
public function updateSetting(SettingRequest $request)
{
CompanySetting::setSetting($request->key, $request->value, $request->header('company'));
return response()->json([
'success' => true
]);
}
public function getSetting(SettingKeyRequest $request)
{
$setting = CompanySetting::getSetting($request->key, $request->header('company'));
return response()->json([
$request->key => $setting
]);
}
public function getColors(Request $request)
{
$colors = [
'invoice_primary_color',
'invoice_column_heading',
'invoice_field_label',
'invoice_field_value',
'invoice_body_text',
'invoice_description_text',
'invoice_border_color',
'primary_text_color',
'heading_text_color',
'section_heading_text_color',
'border_color',
'body_text_color',
'footer_text_color',
'footer_total_color',
'footer_bg_color',
'date_text_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($request->header('company'))
->get();
return response()->json([
'colorSettings' => $colorSettings
]);
}
/**
* Upload the company logo to storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function uploadCompanyLogo(Request $request)
{
$data = json_decode($request->company_logo);
if($data) {
$company = Company::find($request->header('company'));
if($company) {
$company->clearMediaCollection('logo');
$company->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('logo');
}
}
return response()->json([
'success' => true
]);
}
/**
* Upload the Admin Avatar to public storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function uploadAdminAvatar(Request $request)
{
$data = json_decode($request->admin_avatar);
if($data) {
$user = auth()->user();
if($user) {
$user->clearMediaCollection('admin_avatar');
$user->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('admin_avatar');
}
}
return response()->json([
'user' => $user,
'success' => true
]);
}
}

View File

@ -1,12 +1,15 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}

View File

@ -1,231 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Crater\Conversation;
use Crater\Group;
use Crater\Http\Requests;
use Crater\Notifications\CustomerAdded;
use Crater\User;
use Illuminate\Support\Facades\Hash;
use Crater\Currency;
use Crater\CompanySetting;
use Crater\Address;
use Illuminate\Support\Facades\DB;
class CustomersController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$customers = User::customer()
->applyFilters($request->only([
'search',
'contact_name',
'display_name',
'phone',
'orderByField',
'orderBy'
]))
->whereCompany($request->header('company'))
->select('users.*',
DB::raw('sum(invoices.due_amount) as due_amount')
)
->groupBy('users.id')
->leftJoin('invoices', 'users.id', '=', 'invoices.user_id')
->paginate($limit);
$siteData = [
'customers' => $customers
];
return response()->json($siteData);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Requests\CustomerRequest $request)
{
$verifyEmail = User::where('email', $request->email)->first();
$customer = new User();
$customer->name = $request->name;
$customer->currency_id = $request->currency_id;
$customer->company_id = $request->header('company');
$customer->email = $request->email;
$customer->phone = $request->phone;
$customer->company_name = $request->company_name;
$customer->contact_name = $request->contact_name;
$customer->website = $request->website;
$customer->enable_portal = $request->enable_portal;
$customer->role = 'customer';
$customer->password = Hash::make($request->password);
$customer->save();
if ($request->addresses) {
foreach ($request->addresses as $address) {
$newAddress = new Address();
$newAddress->name = $address["name"];
$newAddress->address_street_1 = $address["address_street_1"];
$newAddress->address_street_2 = $address["address_street_2"];
$newAddress->city = $address["city"];
$newAddress->state = $address["state"];
$newAddress->country_id = $address["country_id"];
$newAddress->zip = $address["zip"];
$newAddress->phone = $address["phone"];
$newAddress->type = $address["type"];
$newAddress->user_id = $customer->id;
$newAddress->save();
$customer->addresses()->save($newAddress);
}
}
$customer = User::with('billingAddress', 'shippingAddress')->find($customer->id);
return response()->json([
'customer' => $customer,
'success' => true
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$customer = User::with([
'billingAddress',
'shippingAddress',
'billingAddress.country',
'shippingAddress.country',
])->find($id);
return response()->json([
'customer' => $customer
]);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$customer = User::with('billingAddress', 'shippingAddress')->findOrFail($id);
$currency = $customer->currency;
$currencies = Currency::all();
return response()->json([
'customer' => $customer,
'currencies' => $currencies,
'currency' => $currency
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update($id, Requests\CustomerRequest $request)
{
$customer = User::find($id);
if ($request->email != null) {
$verifyEmail = User::where('email', $request->email)->first();
if ($verifyEmail) {
if ($verifyEmail->id !== $customer->id) {
return response()->json([
'success' => false,
'error' => 'Email already in use'
]);
}
}
}
if ($request->has('password')) {
$customer->password = Hash::make($request->password);
}
$customer->name = $request->name;
$customer->currency_id = $request->currency_id;
$customer->email = $request->email;
$customer->phone = $request->phone;
$customer->company_name = $request->company_name;
$customer->contact_name = $request->contact_name;
$customer->website = $request->website;
$customer->enable_portal = $request->enable_portal;
$customer->save();
$customer->addresses()->delete();
if ($request->addresses) {
foreach ($request->addresses as $address) {
$newAddress = $customer->addresses()->firstOrNew(['type' => $address["type"]]);
$newAddress->name = $address["name"];
$newAddress->address_street_1 = $address["address_street_1"];
$newAddress->address_street_2 = $address["address_street_2"];
$newAddress->city = $address["city"];
$newAddress->state = $address["state"];
$newAddress->country_id = $address["country_id"];
$newAddress->zip = $address["zip"];
$newAddress->phone = $address["phone"];
$newAddress->type = $address["type"];
$newAddress->user_id = $customer->id;
$newAddress->save();
}
}
$customer = User::with('billingAddress', 'shippingAddress')->find($customer->id);
return response()->json([
'customer' => $customer,
'success' => true
]);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
User::deleteCustomer($id);
return response()->json([
'success' => true
]);
}
public function delete(Request $request)
{
foreach ($request->id as $id) {
User::deleteCustomer($id);
}
return response()->json([
'success' => true
]);
}
}

View File

@ -1,155 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Estimate;
use Crater\Http\Requests;
use Crater\Invoice;
use Crater\CompanySetting;
use Crater\Expense;
use Crater\Payment;
use Carbon\Carbon;
use Crater\User;
use Illuminate\Support\Facades\DB;
class DashboardController extends Controller
{
public function index(Request $request)
{
$invoiceTotals = [];
$expenseTotals = [];
$receiptTotals = [];
$netProfits = [];
$i = 0;
$months = [];
$monthEnds = [];
$monthCounter = 0;
$fiscalYear = CompanySetting::getSetting('fiscal_year', $request->header('company'));
$startDate = Carbon::now();
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
if ($terms[0] < $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
} else {
$startDate->subYear()->month($terms[0])->startOfMonth();
$start->subYear()->month($terms[0])->startOfMonth();
$end->subYear()->month($terms[0])->endOfMonth();
}
if ($request->has('previous_year')) {
$startDate->subYear()->startOfMonth();
$start->subYear()->startOfMonth();
$end->subYear()->endOfMonth();
}
while ($monthCounter < 12) {
array_push(
$invoiceTotals,
Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany($request->header('company'))
->sum('total')
);
array_push(
$expenseTotals,
Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany($request->header('company'))
->sum('amount')
);
array_push(
$receiptTotals,
Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany($request->header('company'))
->sum('amount')
);
array_push(
$netProfits,
($receiptTotals[$i] - $expenseTotals[$i])
);
$i++;
array_push($months, $start->format('M'));
$monthCounter++;
$end->startOfMonth();
$start->addMonth()->startOfMonth();
$end->addMonth()->endOfMonth();
}
$start->subMonth()->endOfMonth();
$salesTotal = Invoice::whereCompany($request->header('company'))
->whereBetween(
'invoice_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->sum('total');
$totalReceipts = Payment::whereCompany($request->header('company'))
->whereBetween(
'payment_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->sum('amount');
$totalExpenses = Expense::whereCompany($request->header('company'))
->whereBetween(
'expense_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->sum('amount');
$netProfit = (int)$totalReceipts - (int)$totalExpenses;
$chartData = [
'months' => $months,
'invoiceTotals' => $invoiceTotals,
'expenseTotals' => $expenseTotals,
'receiptTotals' => $receiptTotals,
'netProfits' => $netProfits
];
$customersCount = User::customer()->whereCompany($request->header('company'))->get()->count();
$invoicesCount = Invoice::whereCompany($request->header('company'))->get()->count();
$estimatesCount = Estimate::whereCompany($request->header('company'))->get()->count();
$totalDueAmount = Invoice::whereCompany($request->header('company'))->sum('due_amount');
$dueInvoices = Invoice::with('user')->whereCompany($request->header('company'))->where('due_amount', '>', 0)->take(5)->latest()->get();
$estimates = Estimate::with('user')->whereCompany($request->header('company'))->take(5)->latest()->get();
return response()->json([
'dueInvoices' => $dueInvoices,
'estimates' => $estimates,
'estimatesCount' => $estimatesCount,
'totalDueAmount' => $totalDueAmount,
'invoicesCount' => $invoicesCount,
'customersCount' => $customersCount,
'chartData' => $chartData,
'salesTotal' => $salesTotal,
'totalReceipts' => $totalReceipts,
'totalExpenses' => $totalExpenses,
'netProfit' => $netProfit
]);
}
public function getExpenseChartData(Request $request)
{
$expensesCategories = Expense::with('category')
->whereCompany($request->header('company'))
->expensesAttributes()
->get();
$amounts = $expensesCategories->pluck('total_amount');
$names = $expensesCategories->pluck('category.name');
return response()->json([
'amounts' => $amounts,
'categories' => $names,
]);
}
}

View File

@ -1,495 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Estimate;
use Crater\EstimateItem;
use Crater\EstimateTemplate;
use Carbon\Carbon;
use Crater\Http\Requests\EstimatesRequest;
use Crater\Invoice;
use Crater\Currency;
use Crater\User;
use Crater\Item;
use Validator;
use Crater\CompanySetting;
use Crater\Company;
use Crater\Mail\EstimatePdf;
use Crater\TaxType;
use Crater\Tax;
class EstimatesController extends Controller
{
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$estimates = Estimate::with([
'items',
'user',
'estimateTemplate',
'taxes'
])
->join('users', 'users.id', '=', 'estimates.user_id')
->applyFilters($request->only([
'status',
'customer_id',
'estimate_number',
'from_date',
'to_date',
'search',
'orderByField',
'orderBy'
]))
->whereCompany($request->header('company'))
->select('estimates.*', 'users.name')
->latest()
->paginate($limit);
$siteData = [
'estimates' => $estimates,
'estimateTotalCount' => Estimate::count()
];
return response()->json($siteData);
}
public function create(Request $request)
{
$estimate_prefix = CompanySetting::getSetting('estimate_prefix', $request->header('company'));
$estimate_num_auto_generate = CompanySetting::getSetting('estimate_auto_generate', $request->header('company'));
$nextEstimateNumberAttribute = null;
$nextEstimateNumber = Estimate::getNextEstimateNumber($estimate_prefix);
if ($estimate_num_auto_generate == "YES") {
$nextEstimateNumberAttribute = $nextEstimateNumber;
}
$tax_per_item = CompanySetting::getSetting('tax_per_item', $request->header('company'));
$discount_per_item = CompanySetting::getSetting('discount_per_item', $request->header('company'));
$customers = User::where('role', 'customer')->get();
return response()->json([
'customers' => $customers,
'nextEstimateNumberAttribute' => $nextEstimateNumberAttribute,
'nextEstimateNumber' => $estimate_prefix.'-'.$nextEstimateNumber,
'taxes' => Tax::whereCompany($request->header('company'))->latest()->get(),
'items' => Item::whereCompany($request->header('company'))->get(),
'tax_per_item' => $tax_per_item,
'discount_per_item' => $discount_per_item,
'estimateTemplates' => EstimateTemplate::all(),
'shareable_link' => '',
'estimate_prefix' => $estimate_prefix
]);
}
public function store(EstimatesRequest $request)
{
$estimate_number = explode("-",$request->estimate_number);
$number_attributes['estimate_number'] = $estimate_number[0].'-'.sprintf('%06d', intval($estimate_number[1]));
Validator::make($number_attributes, [
'estimate_number' => 'required|unique:estimates,estimate_number'
])->validate();
$estimate_date = Carbon::createFromFormat('d/m/Y', $request->estimate_date);
$expiry_date = Carbon::createFromFormat('d/m/Y', $request->expiry_date);
$status = Estimate::STATUS_DRAFT;
$tax_per_item = CompanySetting::getSetting(
'tax_per_item',
$request->header('company')
) ? CompanySetting::getSetting(
'tax_per_item',
$request->header('company')
) : 'NO';
if ($request->has('estimateSend')) {
$status = Estimate::STATUS_SENT;
}
$discount_per_item = CompanySetting::getSetting(
'discount_per_item',
$request->header('company')
) ? CompanySetting::getSetting(
'discount_per_item',
$request->header('company')
) : 'NO';
$estimate = Estimate::create([
'estimate_date' => $estimate_date,
'expiry_date' => $expiry_date,
'estimate_number' => $number_attributes['estimate_number'],
'reference_number' => $request->reference_number,
'user_id' => $request->user_id,
'company_id' => $request->header('company'),
'estimate_template_id' => $request->estimate_template_id,
'status' => $status,
'discount' => $request->discount,
'discount_type' => $request->discount_type,
'discount_val' => $request->discount_val,
'sub_total' => $request->sub_total,
'total' => $request->total,
'tax_per_item' => $tax_per_item,
'discount_per_item' => $discount_per_item,
'tax' => $request->tax,
'notes' => $request->notes,
'unique_hash' => str_random(60)
]);
$estimateItems = $request->items;
foreach ($estimateItems as $estimateItem) {
$estimateItem['company_id'] = $request->header('company');
$item = $estimate->items()->create($estimateItem);
if (array_key_exists('taxes', $estimateItem) && $estimateItem['taxes']) {
foreach ($estimateItem['taxes'] as $tax) {
if (gettype($tax['amount']) !== "NULL") {
$tax['company_id'] = $request->header('company');
$item->taxes()->create($tax);
}
}
}
}
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
if (gettype($tax['amount']) !== "NULL") {
$tax['company_id'] = $request->header('company');
$estimate->taxes()->create($tax);
}
}
}
if ($request->has('estimateSend')) {
$data['estimate'] = $estimate->toArray();
$userId = $data['estimate']['user_id'];
$data['user'] = User::find($userId)->toArray();
$data['company'] = Company::find($estimate->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);
if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}
if (!$notificationEmail) {
return response()->json([
'error' => 'notification_email_does_not_exist'
]);
}
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
}
$estimate = Estimate::with([
'items',
'user',
'estimateTemplate',
'taxes'
])->find($estimate->id);
return response()->json([
'estimate' => $estimate,
'url' => url('/estimates/pdf/'.$estimate->unique_hash),
]);
}
public function show(Request $request, $id)
{
$estimate = Estimate::with([
'items',
'items.taxes',
'user',
'estimateTemplate',
'taxes',
'taxes.taxType'
])->find($id);
$siteData = [
'estimate' => $estimate,
'shareable_link' => url('/estimates/pdf/'.$estimate->unique_hash)
];
return response()->json($siteData);
}
public function edit(Request $request,$id)
{
$estimate = Estimate::with([
'items',
'items.taxes',
'user',
'estimateTemplate',
'taxes',
'taxes.taxType'
])->find($id);
$customers = User::where('role', 'customer')->get();
return response()->json( [
'customers' => $customers,
'nextEstimateNumber' => $estimate->getEstimateNumAttribute(),
'taxes' => Tax::latest()->whereCompany($request->header('company'))->get(),
'estimate' => $estimate,
'items' => Item::whereCompany($request->header('company'))->latest()->get(),
'estimateTemplates' => EstimateTemplate::all(),
'tax_per_item' => $estimate->tax_per_item,
'discount_per_item' => $estimate->discount_per_item,
'shareable_link' => url('/estimates/pdf/'.$estimate->unique_hash),
'estimate_prefix' => $estimate->getEstimatePrefixAttribute()
]);
}
public function update(EstimatesRequest $request, $id)
{
$estimate_number = explode("-",$request->estimate_number);
$number_attributes['estimate_number'] = $estimate_number[0].'-'.sprintf('%06d', intval($estimate_number[1]));
Validator::make($number_attributes, [
'estimate_number' => 'required|unique:estimates,estimate_number'.','.$id
])->validate();
$estimate_date = Carbon::createFromFormat('d/m/Y', $request->estimate_date);
$expiry_date = Carbon::createFromFormat('d/m/Y', $request->expiry_date);
$estimate = Estimate::find($id);
$estimate->estimate_date = $estimate_date;
$estimate->expiry_date = $expiry_date;
$estimate->estimate_number = $number_attributes['estimate_number'];
$estimate->reference_number = $request->reference_number;
$estimate->user_id = $request->user_id;
$estimate->estimate_template_id = $request->estimate_template_id;
$estimate->discount = $request->discount;
$estimate->discount_type = $request->discount_type;
$estimate->discount_val = $request->discount_val;
$estimate->sub_total = $request->sub_total;
$estimate->total = $request->total;
$estimate->tax = $request->tax;
$estimate->notes = $request->notes;
$estimate->save();
$oldItems = $estimate->items->toArray();
$oldTaxes = $estimate->taxes->toArray();
$estimateItems = $request->items;
foreach ($oldItems as $oldItem) {
EstimateItem::destroy($oldItem['id']);
}
foreach ($oldTaxes as $oldTax) {
Tax::destroy($oldTax['id']);
}
foreach ($estimateItems as $estimateItem) {
$estimateItem['company_id'] = $request->header('company');
$item = $estimate->items()->create($estimateItem);
if (array_key_exists('taxes', $estimateItem) && $estimateItem['taxes']) {
foreach ($estimateItem['taxes'] as $tax) {
if (gettype($tax['amount']) !== "NULL") {
$tax['company_id'] = $request->header('company');
$item->taxes()->create($tax);
}
}
}
}
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
if (gettype($tax['amount']) !== "NULL") {
$tax['company_id'] = $request->header('company');
$estimate->taxes()->create($tax);
}
}
}
$estimate = Estimate::with([
'items',
'user',
'estimateTemplate',
'taxes'
])->find($estimate->id);
return response()->json([
'estimate' => $estimate,
'url' => url('/estimates/pdf/'.$estimate->unique_hash),
]);
}
public function destroy($id)
{
Estimate::deleteEstimate($id);
return response()->json([
'success' => true
]);
}
public function sendEstimate(Request $request)
{
$estimate = Estimate::findOrFail($request->id);
$data['estimate'] = $estimate->toArray();
$userId = $data['estimate']['user_id'];
$data['user'] = User::find($userId)->toArray();
$data['company'] = Company::find($estimate->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);
if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}
if (!$notificationEmail) {
return response()->json([
'error' => 'notification_email_does_not_exist'
]);
}
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
if ($estimate->status == Estimate::STATUS_DRAFT) {
$estimate->status = Estimate::STATUS_SENT;
$estimate->save();
}
return response()->json([
'success' => true
]);
}
public function markEstimateAccepted(Request $request)
{
$estimate = Estimate::find($request->id);
$estimate->status = Estimate::STATUS_ACCEPTED;
$estimate->save();
return response()->json([
'success' => true
]);
}
public function markEstimateRejected(Request $request)
{
$estimate = Estimate::find($request->id);
$estimate->status = Estimate::STATUS_REJECTED;
$estimate->save();
return response()->json([
'success' => true
]);
}
public function markEstimateSent(Request $request)
{
$estimate = Estimate::find($request->id);
$estimate->status = Estimate::STATUS_SENT;
$estimate->save();
return response()->json([
'success' => true
]);
}
public function estimateToInvoice(Request $request, $id)
{
$estimate = Estimate::with(['items', 'items.taxes', 'user', 'estimateTemplate', 'taxes'])->find($id);
$invoice_date = Carbon::parse($estimate->estimate_date);
$due_date = Carbon::parse($estimate->estimate_date)->addDays(7);
$tax_per_item = CompanySetting::getSetting(
'tax_per_item',
$request->header('company')
) ? CompanySetting::getSetting(
'tax_per_item',
$request->header('company')
) : 'NO';
$discount_per_item = CompanySetting::getSetting(
'discount_per_item',
$request->header('company')
) ? CompanySetting::getSetting(
'discount_per_item',
$request->header('company')
) : 'NO';
$invoice = Invoice::create([
'invoice_date' => $invoice_date,
'due_date' => $due_date,
'invoice_number' => "INV-".Invoice::getNextInvoiceNumber(),
'reference_number' => $estimate->reference_number,
'user_id' => $estimate->user_id,
'company_id' => $request->header('company'),
'invoice_template_id' => 1,
'status' => Invoice::STATUS_DRAFT,
'paid_status' => Invoice::STATUS_UNPAID,
'sub_total' => $estimate->sub_total,
'discount' => $estimate->discount,
'discount_type' => $estimate->discount_type,
'discount_val' => $estimate->discount_val,
'total' => $estimate->total,
'due_amount' => $estimate->total,
'tax_per_item' => $tax_per_item,
'discount_per_item' => $discount_per_item,
'tax' => $estimate->tax,
'notes' => $estimate->notes,
'unique_hash' => str_random(60)
]);
$invoiceItems = $estimate->items->toArray();
foreach ($invoiceItems as $invoiceItem) {
$invoiceItem['company_id'] = $request->header('company');
$invoiceItem['name'] = $invoiceItem['name'];
$item = $invoice->items()->create($invoiceItem);
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $request->header('company');
if ($tax['amount']) {
$item->taxes()->create($tax);
}
}
}
}
if ($estimate->taxes) {
foreach ($estimate->taxes->toArray() as $tax) {
$tax['company_id'] = $request->header('company');
$invoice->taxes()->create($tax);
}
}
$invoice = Invoice::with([
'items',
'user',
'invoiceTemplate',
'taxes'
])->find($invoice->id);
return response()->json([
'invoice' => $invoice
]);
}
public function delete(Request $request)
{
foreach ($request->id as $id) {
Estimate::deleteEstimate($id);
}
return response()->json([
'success' => true
]);
}
}

View File

@ -1,122 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Crater\ExpenseCategory;
use Crater\Expense;
use Crater\User;
use Illuminate\Http\Request;
use Crater\Http\Requests\ExpenseCategoryRequest;
class ExpenseCategoryController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$categories = ExpenseCategory::whereCompany($request->header('company'))->get();
return response()->json([
'categories' => $categories
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
// return view('app.categories.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ExpenseCategoryRequest $request)
{
$category = new ExpenseCategory();
$category->name = $request->name;
$category->description = $request->description;
$category->company_id = $request->header('company');
$category->save();
return response()->json([
'category' => $category,
'success' => true
]);
}
/**
* Display the specified resource.
*
* @param \Crater\ExpenseCategory $ExpenseCategory
* @return \Illuminate\Http\Response
*/
public function show(ExpenseCategory $ExpenseCategory)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \Crater\ExpensesCategory $ExpensesCategory
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$category = ExpenseCategory::findOrFail($id);
return response()->json([
'category' => $category
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\ExpenseCategory $ExpenseCategory
* @return \Illuminate\Http\Response
*/
public function update(ExpenseCategoryRequest $request, $id)
{
$category = ExpenseCategory::findOrFail($id);
$category->name = $request->name;
$category->description = $request->description;
$category->save();
return response()->json([
'category' => $category,
'success' => true
]);
}
/**
* Remove the specified resource from storage.
*
* @param \Crater\ExpensesCategory $expensesCategory
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$category = ExpenseCategory::find($id);
if ($category->expenses() && $category->expenses()->count() > 0) {
return response()->json([
'success' => false
]);
}
$category->delete();
return response()->json([
'success' => true
]);
}
}

View File

@ -1,260 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Crater\Expense;
use Crater\User;
use Crater\Currency;
use Crater\Company;
use Crater\CompanySetting;
use Illuminate\Http\Request;
use Crater\ExpenseCategory;
use Crater\Http\Requests\ExpenseRequest;
use Carbon\Carbon;
use Intervention\Image\Facades\Image;
class ExpensesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$expenses = Expense::with('category')
->join('expense_categories', 'expense_categories.id', '=', 'expenses.expense_category_id')
->applyFilters($request->only([
'expense_category_id',
'search',
'from_date',
'to_date',
'orderByField',
'orderBy'
]))
->whereCompany($request->header('company'))
->select('expenses.*', 'expense_categories.name')
->paginate($limit);
return response()->json([
'expenses' => $expenses,
'currency' => Currency::findOrFail(
CompanySetting::getSetting('currency', $request->header('company'))
)
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$categories = ExpenseCategory::whereCompany($request->header('company'))->get();
return response()->json([
'categories' => $categories
]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ExpenseRequest $request)
{
$expense_date = Carbon::createFromFormat('d/m/Y', $request->expense_date);
$expense = new Expense();
$expense->notes = $request->notes;
$expense->expense_category_id = $request->expense_category_id;
$expense->amount = $request->amount;
$expense->company_id = $request->header('company');
$expense->expense_date = $expense_date;
$expense->save();
if ($request->hasFile('attachment_receipt')) {
$expense->addMediaFromRequest('attachment_receipt')->toMediaCollection('receipts', 'local');
}
return response()->json([
'expense' => $expense,
'success' => true
]);
}
/**
* Display the specified resource.
*
* @param \Crater\Expense $expense
* @return \Illuminate\Http\Response
*/
public function show(Expense $expense)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param $id
* @return \Illuminate\Http\Response
*/
public function edit(Request $request,$id)
{
$categories = ExpenseCategory::whereCompany($request->header('company'))->get();
$customers = User::where('role', 'customer')->whereCompany($request->header('company'))->get();
$expense = Expense::with('category')->where('id', $id)->first();
return response()->json([
'categories' => $categories,
'customers' => $customers,
'expense' => $expense
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Expense $expense
* @return \Illuminate\Http\Response
*/
public function update(ExpenseRequest $request, Expense $expense)
{
$expense_date = Carbon::createFromFormat('d/m/Y', $request->expense_date);
$expense = Expense::findOrFail($expense->id);
$expense->notes = $request->notes;
$expense->expense_category_id = $request->expense_category_id;
$expense->amount = $request->amount;
$expense->expense_date = $expense_date;
$expense->save();
if ($request->hasFile('attachment_receipt')) {
$expense->clearMediaCollection('receipts');
$expense->addMediaFromRequest('attachment_receipt')->toMediaCollection('receipts', 'local');
}
return response()->json([
'expense' => $expense,
'success' => true
]);
}
/**
* Remove the specified resource from storage.
*
* @param \Crater\Expense $expense
* @return \Illuminate\Http\Response
*/
public function destroy(Expense $expense)
{
$expense->delete();
return response()->json([
'success' => true
]);
}
public function delete(Request $request)
{
Expense::destroy($request->id);
return response()->json([
'success' => true
]);
}
/**
* Upload the expense receipts to storage.
*
* @param \Illuminate\Http\Request $request
* @param $id
* @return \Illuminate\Http\Response
*/
public function uploadReceipts(Request $request, $id)
{
$data = json_decode($request->attachment_receipt);
if($data) {
$expense = Expense::find($id);
if($expense) {
if($request->type === 'edit') {
$expense->clearMediaCollection('receipts');
}
$expense->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('receipts', 'local');
}
}
return response()->json([
'success' => 'Expense receipts uploaded successfully'
]);
}
public function showReceipt($id)
{
$expense = Expense::find($id);
$imagePath = null;
if($expense) {
$media = $expense->getFirstMedia('receipts');
if($media) {
$imagePath = $media->getPath();
} else {
return response()->json([
'error' => 'receipt_does_not_exist'
]);
}
}
$type = \File::mimeType($imagePath);
$image = 'data:'.$type.';base64,'.base64_encode(file_get_contents($imagePath));
return response()->json([
'image' => $image,
'type' => $type
]);
}
public function downloadReceipt($id, $hash)
{
$company = Company::where('unique_hash', $hash)->first();
$expense = Expense::whereCompany($company->id)
->where('id', $id)
->first();
$imagePath = null;
if($expense) {
$media = $expense->getFirstMedia('receipts');
if($media) {
$imagePath = $media->getPath();
$filename = $media->getPath();
$type = \File::mimeType($imagePath);
$headers = array(
'Content-Type' => $type,
);
$response = \Response::download($imagePath, $media->file_name);
ob_end_clean();
return $response;
}
}
return response()->json([
'error' => 'receipt_not_found'
]);
}
}

View File

@ -1,374 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Invoice;
use PDF;
use Crater\CompanySetting;
use Crater\Estimate;
use Crater\User;
use Crater\Company;
use Crater\InvoiceTemplate;
use Crater\EstimateTemplate;
use Crater\Mail\EstimateViewed;
use Crater\Mail\InvoiceViewed;
class FrontendController extends Controller
{
public function home()
{
return view('front.index');
}
public function getCustomerEstimatePdf($id)
{
$estimate = Estimate::with(
'user',
'items',
'user.billingAddress',
'user.shippingAddress'
)
->where('unique_hash', $id)
->first();
$taxTypes = [];
$taxes = [];
$labels = [];
if ($estimate->tax_per_item === 'YES') {
foreach ($estimate->items as $item) {
foreach ($item->taxes as $tax) {
if (!in_array($tax->name, $taxTypes)) {
array_push($taxTypes, $tax->name);
array_push($labels, $tax->name.' ('.$tax->percent.'%)');
}
}
}
foreach ($taxTypes as $taxType) {
$total = 0;
foreach ($estimate->items as $item) {
foreach ($item->taxes as $tax) {
if($tax->name == $taxType) {
$total += $tax->amount;
}
}
}
array_push($taxes, $total);
}
}
$estimateTemplate = EstimateTemplate::find($estimate->estimate_template_id);
$company = Company::find($estimate->company_id);
$logo = $company->getMedia('logo')->first();
if($logo) {
$logo = $logo->getFullUrl();
}
if ($estimate && ($estimate->status == Estimate::STATUS_SENT || $estimate->status == Estimate::STATUS_DRAFT)) {
$estimate->status = Estimate::STATUS_VIEWED;
$estimate->save();
$notifyEstimateViewed = CompanySetting::getSetting(
'notify_estimate_viewed',
$estimate->company_id
);
if ($notifyEstimateViewed == 'YES') {
$data['estimate'] = Estimate::findOrFail($estimate->id)->toArray();
$data['user'] = User::find($estimate->user_id)->toArray();
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$estimate->company_id
);
\Mail::to($notificationEmail)->send(new EstimateViewed($data));
}
}
$companyAddress = User::with(['addresses', 'addresses.country'])->find(1);
$colors = [
'invoice_primary_color',
'invoice_column_heading',
'invoice_field_label',
'invoice_field_value',
'invoice_body_text',
'invoice_description_text',
'invoice_border_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($estimate->company_id)
->get();
view()->share([
'estimate' => $estimate,
'logo' => $logo ?? null,
'company_address' => $companyAddress,
'colors' => $colorSettings,
'labels' => $labels,
'taxes' => $taxes
]);
$pdf = PDF::loadView('app.pdf.estimate.'.$estimateTemplate->view);
return $pdf->stream();
}
public function getCustomerInvoicePdf($id)
{
$invoice = Invoice::with([
'items',
'items.taxes',
'user',
'invoiceTemplate',
'taxes'
])
->where('unique_hash', $id)
->first();
$taxTypes = [];
$taxes = [];
$labels = [];
if ($invoice->tax_per_item === 'YES') {
foreach ($invoice->items as $item) {
foreach ($item->taxes as $tax) {
if (!in_array($tax->name, $labels)) {
array_push($taxTypes, $tax->name);
array_push($labels, $tax->name.' ('.$tax->percent.'%)');
}
}
}
foreach ($taxTypes as $taxType) {
$total = 0;
foreach ($invoice->items as $item) {
foreach ($item->taxes as $tax) {
if($tax->name == $taxType) {
$total += $tax->amount;
}
}
}
array_push($taxes, $total);
}
}
$invoiceTemplate = InvoiceTemplate::find($invoice->invoice_template_id);
$company = Company::find($invoice->company_id);
$logo = $company->getMedia('logo')->first();
if($logo) {
$logo = $logo->getFullUrl();
}
if ($invoice && ($invoice->status == Invoice::STATUS_SENT || $invoice->status == Invoice::STATUS_DRAFT)) {
$invoice->status = Invoice::STATUS_VIEWED;
$invoice->viewed = true;
$invoice->save();
$notifyInvoiceViewed = CompanySetting::getSetting(
'notify_invoice_viewed',
$invoice->company_id
);
if ($notifyInvoiceViewed == 'YES') {
$data['invoice'] = Invoice::findOrFail($invoice->id)->toArray();
$data['user'] = User::find($invoice->user_id)->toArray();
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$invoice->company_id
);
\Mail::to($notificationEmail)->send(new InvoiceViewed($data));
}
}
$companyAddress = User::with(['addresses', 'addresses.country'])->find(1);
$colors = [
'invoice_primary_color',
'invoice_column_heading',
'invoice_field_label',
'invoice_field_value',
'invoice_body_text',
'invoice_description_text',
'invoice_border_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($invoice->company_id)
->get();
view()->share([
'invoice' => $invoice,
'colors' => $colorSettings,
'company_address' => $companyAddress,
'logo' => $logo ?? null,
'labels' => $labels,
'taxes' => $taxes
]);
$pdf = PDF::loadView('app.pdf.invoice.'.$invoiceTemplate->view);
return $pdf->stream();
}
public function getEstimatePdf($id)
{
$estimate = Estimate::with([
'items',
'items.taxes',
'user',
'estimateTemplate',
'taxes',
'taxes.taxType'
])
->where('unique_hash', $id)
->first();
$taxTypes = [];
$taxes = [];
$labels = [];
if ($estimate->tax_per_item === 'YES') {
foreach ($estimate->items as $item) {
foreach ($item->taxes as $tax) {
if (!in_array($tax->name, $taxTypes)) {
array_push($taxTypes, $tax->name);
array_push($labels, $tax->name.' ('.$tax->percent.'%)');
}
}
}
foreach ($taxTypes as $taxType) {
$total = 0;
foreach ($estimate->items as $item) {
foreach ($item->taxes as $tax) {
if($tax->name == $taxType) {
$total += $tax->amount;
}
}
}
array_push($taxes, $total);
}
}
$estimateTemplate = EstimateTemplate::find($estimate->estimate_template_id);
$company = Company::find($estimate->company_id);
$companyAddress = User::with(['addresses', 'addresses.country'])->find(1);
$logo = $company->getMedia('logo')->first();
if($logo) {
$logo = $logo->getFullUrl();
}
$colors = [
'invoice_primary_color',
'invoice_column_heading',
'invoice_field_label',
'invoice_field_value',
'invoice_body_text',
'invoice_description_text',
'invoice_border_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($estimate->company_id)
->get();
view()->share([
'estimate' => $estimate,
'logo' => $logo ?? null,
'company_address' => $companyAddress,
'colors' => $colorSettings,
'labels' => $labels,
'taxes' => $taxes
]);
$pdf = PDF::loadView('app.pdf.estimate.'.$estimateTemplate->view);
return $pdf->stream();
}
public function getInvoicePdf($id)
{
$invoice = Invoice::with([
'items',
'items.taxes',
'user',
'invoiceTemplate',
'taxes'
])
->where('unique_hash', $id)
->first();
$taxTypes = [];
$taxes = [];
$labels = [];
if ($invoice->tax_per_item === 'YES') {
foreach ($invoice->items as $item) {
foreach ($item->taxes as $tax) {
if (!in_array($tax->name, $taxTypes)) {
array_push($taxTypes, $tax->name);
array_push($labels, $tax->name.' ('.$tax->percent.'%)');
}
}
}
foreach ($taxTypes as $taxType) {
$total = 0;
foreach ($invoice->items as $item) {
foreach ($item->taxes as $tax) {
if($tax->name == $taxType) {
$total += $tax->amount;
}
}
}
array_push($taxes, $total);
}
}
$invoiceTemplate = InvoiceTemplate::find($invoice->invoice_template_id);
$company = Company::find($invoice->company_id);
$companyAddress = User::with(['addresses', 'addresses.country'])->find(1);
$logo = $company->getMedia('logo')->first();
if($logo) {
$logo = $logo->getFullUrl();
}
$colors = [
'invoice_primary_color',
'invoice_column_heading',
'invoice_field_label',
'invoice_field_value',
'invoice_body_text',
'invoice_description_text',
'invoice_border_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($invoice->company_id)
->get();
view()->share([
'invoice' => $invoice,
'company_address' => $companyAddress,
'logo' => $logo ?? null,
'colors' => $colorSettings,
'labels' => $labels,
'taxes' => $taxes
]);
$pdf = PDF::loadView('app.pdf.invoice.'.$invoiceTemplate->view);
return $pdf->stream();
}
}

View File

@ -1,470 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\CompanySetting;
use Crater\Company;
use Illuminate\Support\Collection;
use Crater\Currency;
use Crater\InvoiceTemplate;
use Crater\Http\Requests;
use Crater\Invoice;
use Crater\InvoiceItem;
use Carbon\Carbon;
use Crater\Item;
use Crater\Mail\invoicePdf;
use function MongoDB\BSON\toJSON;
use Illuminate\Support\Facades\Log;
use Crater\User;
use Mailgun\Mailgun;
use PDF;
use Validator;
use Crater\TaxType;
use Crater\Tax;
class InvoicesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$invoices = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])
->join('users', 'users.id', '=', 'invoices.user_id')
->applyFilters($request->only([
'status',
'paid_status',
'customer_id',
'invoice_number',
'from_date',
'to_date',
'orderByField',
'orderBy',
'search',
]))
->whereCompany($request->header('company'))
->select('invoices.*', 'users.name')
->latest()
->paginate($limit);
return response()->json([
'invoices' => $invoices,
'invoiceTotalCount' => Invoice::count()
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$tax_per_item = CompanySetting::getSetting('tax_per_item', $request->header('company'));
$discount_per_item = CompanySetting::getSetting('discount_per_item', $request->header('company'));
$invoice_prefix = CompanySetting::getSetting('invoice_prefix', $request->header('company'));
$invoice_num_auto_generate = CompanySetting::getSetting('invoice_auto_generate', $request->header('company'));
$nextInvoiceNumberAttribute = null;
$nextInvoiceNumber = Invoice::getNextInvoiceNumber($invoice_prefix);
if ($invoice_num_auto_generate == "YES") {
$nextInvoiceNumberAttribute = $nextInvoiceNumber;
}
return response()->json([
'nextInvoiceNumberAttribute' => $nextInvoiceNumberAttribute,
'nextInvoiceNumber' => $invoice_prefix.'-'.$nextInvoiceNumber,
'items' => Item::with('taxes')->whereCompany($request->header('company'))->get(),
'invoiceTemplates' => InvoiceTemplate::all(),
'tax_per_item' => $tax_per_item,
'discount_per_item' => $discount_per_item,
'invoice_prefix' => $invoice_prefix
]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Requests\InvoicesRequest $request)
{
$invoice_number = explode("-",$request->invoice_number);
$number_attributes['invoice_number'] = $invoice_number[0].'-'.sprintf('%06d', intval($invoice_number[1]));
Validator::make($number_attributes, [
'invoice_number' => 'required|unique:invoices,invoice_number'
])->validate();
$invoice_date = Carbon::createFromFormat('d/m/Y', $request->invoice_date);
$due_date = Carbon::createFromFormat('d/m/Y', $request->due_date);
$status = Invoice::STATUS_DRAFT;
$tax_per_item = CompanySetting::getSetting('tax_per_item', $request->header('company')) ?? 'NO';
$discount_per_item = CompanySetting::getSetting('discount_per_item', $request->header('company')) ?? 'NO';
if ($request->has('invoiceSend')) {
$status = Invoice::STATUS_SENT;
}
$invoice = Invoice::create([
'invoice_date' => $invoice_date,
'due_date' => $due_date,
'invoice_number' => $number_attributes['invoice_number'],
'reference_number' => $request->reference_number,
'user_id' => $request->user_id,
'company_id' => $request->header('company'),
'invoice_template_id' => $request->invoice_template_id,
'status' => $status,
'paid_status' => Invoice::STATUS_UNPAID,
'sub_total' => $request->sub_total,
'discount' => $request->discount,
'discount_type' => $request->discount_type,
'discount_val' => $request->discount_val,
'total' => $request->total,
'due_amount' => $request->total,
'tax_per_item' => $tax_per_item,
'discount_per_item' => $discount_per_item,
'tax' => $request->tax,
'notes' => $request->notes,
'unique_hash' => str_random(60)
]);
$invoiceItems = $request->items;
foreach ($invoiceItems as $invoiceItem) {
$invoiceItem['company_id'] = $request->header('company');
$item = $invoice->items()->create($invoiceItem);
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $request->header('company');
if (gettype($tax['amount']) !== "NULL") {
$item->taxes()->create($tax);
}
}
}
}
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
$tax['company_id'] = $request->header('company');
if (gettype($tax['amount']) !== "NULL") {
$invoice->taxes()->create($tax);
}
}
}
if ($request->has('invoiceSend')) {
$data['invoice'] = Invoice::findOrFail($invoice->id)->toArray();
$data['user'] = User::find($request->user_id)->toArray();
$data['company'] = Company::find($invoice->company_id);
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);
$email = $data['user']['email'];
if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}
if (!$notificationEmail) {
return response()->json([
'error' => 'notification_email_does_not_exist'
]);
}
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
}
$invoice = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])->find($invoice->id);
return response()->json([
'url' => url('/invoices/pdf/'.$invoice->unique_hash),
'invoice' => $invoice
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(Request $request, $id)
{
$invoice = Invoice::with([
'items',
'items.taxes',
'user',
'invoiceTemplate',
'taxes.taxType'
])->find($id);
$siteData = [
'invoice' => $invoice,
'shareable_link' => url('/invoices/pdf/' . $invoice->unique_hash)
];
return response()->json($siteData);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit(Request $request,$id)
{
$invoice = Invoice::with([
'items',
'items.taxes',
'user',
'invoiceTemplate',
'taxes.taxType'
])->find($id);
return response()->json([
'nextInvoiceNumber' => $invoice->getInvoiceNumAttribute(),
'invoice' => $invoice,
'invoiceTemplates' => InvoiceTemplate::all(),
'tax_per_item' => $invoice->tax_per_item,
'discount_per_item' => $invoice->discount_per_item,
'shareable_link' => url('/invoices/pdf/'.$invoice->unique_hash),
'invoice_prefix' => $invoice->getInvoicePrefixAttribute()
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Requests\InvoicesRequest $request, $id)
{
$invoice_number = explode("-",$request->invoice_number);
$number_attributes['invoice_number'] = $invoice_number[0].'-'.sprintf('%06d', intval($invoice_number[1]));
Validator::make($number_attributes, [
'invoice_number' => 'required|unique:invoices,invoice_number'.','.$id
])->validate();
$invoice_date = Carbon::createFromFormat('d/m/Y', $request->invoice_date);
$due_date = Carbon::createFromFormat('d/m/Y', $request->due_date);
$invoice = Invoice::find($id);
$oldAmount = $invoice->total;
if ($oldAmount != $request->total) {
$oldAmount = (int)round($request->total) - (int)$oldAmount;
} else {
$oldAmount = 0;
}
$invoice->due_amount = ($invoice->due_amount + $oldAmount);
if ($invoice->due_amount == 0 && $invoice->paid_status != Invoice::STATUS_PAID) {
$invoice->status = Invoice::STATUS_COMPLETED;
$invoice->paid_status = Invoice::STATUS_PAID;
} elseif ($invoice->due_amount < 0 && $invoice->paid_status != Invoice::STATUS_UNPAID) {
return response()->json([
'error' => 'invalid_due_amount'
]);
} elseif ($invoice->due_amount != 0 && $invoice->paid_status == Invoice::STATUS_PAID) {
$invoice->status = $invoice->getPreviousStatus();
$invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID;
}
$invoice->invoice_date = $invoice_date;
$invoice->due_date = $due_date;
$invoice->invoice_number = $number_attributes['invoice_number'];
$invoice->reference_number = $request->reference_number;
$invoice->user_id = $request->user_id;
$invoice->invoice_template_id = $request->invoice_template_id;
$invoice->sub_total = $request->sub_total;
$invoice->total = $request->total;
$invoice->discount = $request->discount;
$invoice->discount_type = $request->discount_type;
$invoice->discount_val = $request->discount_val;
$invoice->tax = $request->tax;
$invoice->notes = $request->notes;
$invoice->save();
$oldItems = $invoice->items->toArray();
$oldTaxes = $invoice->taxes->toArray();
$invoiceItems = $request->items;
foreach ($oldItems as $oldItem) {
InvoiceItem::destroy($oldItem['id']);
}
foreach ($oldTaxes as $oldTax) {
Tax::destroy($oldTax['id']);
}
foreach ($invoiceItems as $invoiceItem) {
$invoiceItem['company_id'] = $request->header('company');
$item = $invoice->items()->create($invoiceItem);
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $request->header('company');
if (gettype($tax['amount']) !== "NULL") {
$item->taxes()->create($tax);
}
}
}
}
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
$tax['company_id'] = $request->header('company');
if (gettype($tax['amount']) !== "NULL") {
$invoice->taxes()->create($tax);
}
}
}
$invoice = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])->find($invoice->id);
return response()->json([
'url' => url('/invoices/pdf/' . $invoice->unique_hash),
'invoice' => $invoice,
'success' => true
]);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$invoice = Invoice::find($id);
if ($invoice->payments()->exists() && $invoice->payments()->count() > 0) {
return response()->json([
'error' => 'payment_attached'
]);
}
$invoice = Invoice::destroy($id);
return response()->json([
'success' => true
]);
}
public function delete(Request $request)
{
foreach ($request->id as $id) {
$invoice = Invoice::find($id);
if ($invoice->payments()->exists() && $invoice->payments()->count() > 0) {
return response()->json([
'error' => 'payment_attached'
]);
}
}
$invoice = Invoice::destroy($request->id);
return response()->json([
'success' => true
]);
}
public function sendInvoice(Request $request)
{
$invoice = Invoice::findOrFail($request->id);
$data['invoice'] = $invoice->toArray();
$userId = $data['invoice']['user_id'];
$data['user'] = User::find($userId)->toArray();
$data['company'] = Company::find($invoice->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);
if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}
if (!$notificationEmail) {
return response()->json([
'error' => 'notification_email_does_not_exist'
]);
}
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
if ($invoice->status == Invoice::STATUS_DRAFT) {
$invoice->status = Invoice::STATUS_SENT;
$invoice->sent = true;
$invoice->save();
}
return response()->json([
'success' => true
]);
}
public function markAsSent(Request $request)
{
$invoice = Invoice::findOrFail($request->id);
$invoice->status = Invoice::STATUS_SENT;
$invoice->sent = true;
$invoice->save();
return response()->json([
'success' => true
]);
}
public function markAsPaid(Request $request)
{
$invoice = Invoice::findOrFail($request->id);
$invoice->status = Invoice::STATUS_COMPLETED;
$invoice->paid_status = Invoice::STATUS_PAID;
$invoice->due_amount = 0;
$invoice->save();
return response()->json([
'success' => true
]);
}
public function getCustomersUnpaidInvoices(Request $request, $id)
{
$invoices = Invoice::where('paid_status', '<>', Invoice::STATUS_PAID)
->where('user_id', $id)->where('due_amount', '>', 0)
->whereCompany($request->header('company'))
->get();
return response()->json([
'invoices' => $invoices
]);
}
}

View File

@ -1,134 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Http\Requests;
use Crater\Item;
use Crater\TaxType;
use Crater\Tax;
use Crater\User;
class ItemsController extends Controller
{
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$items = Item::applyFilters($request->only([
'search',
'price',
'unit',
'orderByField',
'orderBy'
]))
->whereCompany($request->header('company'))
->latest()
->paginate($limit);
return response()->json([
'items' => $items,
'taxTypes' => TaxType::latest()->get()
]);
}
public function edit(Request $request, $id)
{
$item = Item::with('taxes')->find($id);
return response()->json([
'item' => $item,
'taxes' => Tax::whereCompany($request->header('company'))
->latest()
->get()
]);
}
public function store(Requests\ItemsRequest $request)
{
$item = new Item();
$item->name = $request->name;
$item->unit = $request->unit;
$item->description = $request->description;
$item->company_id = $request->header('company');
$item->price = $request->price;
$item->save();
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
$tax['company_id'] = $request->header('company');
$item->taxes()->create($tax);
}
}
$item = Item::with('taxes')->find($item->id);
return response()->json([
'item' => $item
]);
}
public function update(Requests\ItemsRequest $request, $id)
{
$item = Item::find($id);
$item->name = $request->name;
$item->unit = $request->unit;
$item->description = $request->description;
$item->price = $request->price;
$item->save();
$oldTaxes = $item->taxes->toArray();
foreach ($oldTaxes as $oldTax) {
Tax::destroy($oldTax['id']);
}
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
$tax['company_id'] = $request->header('company');
$item->taxes()->create($tax);
}
}
$item = Item::with('taxes')->find($item->id);
return response()->json([
'item' => $item
]);
}
public function destroy($id)
{
$data = Item::deleteItem($id);
if (!$data) {
return response()->json([
'error' => 'item_attached'
]);
}
return response()->json([
'success' => $data
]);
}
public function delete(Request $request)
{
$items = [];
foreach ($request->id as $id) {
$item = Item::deleteItem($id);
if (!$item) {
array_push($items, $id);
}
}
if (empty($items)) {
return response()->json([
'success' => true
]);
}
return response()->json([
'items' => $items
]);
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Country;
class LocationController extends Controller
{
public function getCountries()
{
return response()->json([
'countries' => Country::all()
]);
}
}

View File

@ -1,295 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\User;
use Crater\Company;
use Crater\Address;
use Crater\Http\Requests\ProfileRequest;
use Crater\Http\Requests\CompanyRequest;
use Crater\Http\Requests\CompanySettingRequest;
use Crater\Space\DateFormatter;
use Crater\Space\TimeZones;
use Crater\Currency;
use Crater\Setting;
use Crater\CompanySetting;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Artisan;
class OnboardingController extends Controller
{
public function getOnboardingData(Request $request)
{
if (!\Storage::disk('local')->has('database_created')) {
return response()->json([
'profile_complete' => '0'
]);
}
$setting = Setting::getSetting('profile_complete');
if ($setting !== 'COMPLETED' && $setting < 4){
return response()->json([
'profile_complete' => $setting
]);
}
$date_formats = DateFormatter::get_list();
$time_zones = TimeZones::get_list();
$languages = [
["code"=>"en", "name" => "English"],
["code"=>"fr", "name" => "French"],
["code"=>"es", "name" => "Spanish"]
];
$fiscal_years = [
['key' => 'january-december' , 'value' => '1-12'],
['key' => 'february-january' , 'value' => '2-1'],
['key' => 'march-february' , 'value' => '3-2'],
['key' => 'april-march' , 'value' => '4-3'],
['key' => 'may-april' , 'value' => '5-4'],
['key' => 'june-may' , 'value' => '6-5'],
['key' => 'july-june' , 'value' => '7-6'],
['key' => 'august-july' , 'value' => '8-7'],
['key' => 'september-august' , 'value' => '9-8'],
['key' => 'october-september', 'value' => '10-9'],
['key' => 'november-october' , 'value' => '11-10'],
['key' => 'december-november', 'value' => '12-11'],
];
$user = User::with([
'addresses',
'addresses.country',
'company'
])->find(1);
return response()->json([
'user' => $user,
'profile_complete' => $setting,
'languages' => $languages,
'date_formats' => $date_formats,
'time_zones' => $time_zones,
'fiscal_years' => $fiscal_years,
'currencies' => Currency::all()
]);
}
public function adminProfile(ProfileRequest $request)
{
$setting = Setting::getSetting('profile_complete');
if ($setting == '1' || $setting == 'COMPLETED') {
return response()->json(['error' => 'Profile already created.']);
} else {
Setting::setSetting('profile_complete', 5);
}
$user = User::find(1);
$user->name = $request->name;
$user->email = $request->email;
if ($request->has('password')) {
$user->password = bcrypt($request->password);
}
$user->save();
return response()->json([
'user' => $user
]);
}
public function uploadAdminAvatar(Request $request)
{
$setting = Setting::getSetting('profile_complete');
if ($setting == '1' || $setting == 'COMPLETED') {
return response()->json(['error' => 'Profile already created.']);
}
$data = json_decode($request->admin_avatar);
if($data) {
$user = User::find($data->id);
if($user) {
$user->clearMediaCollection('admin_avatar');
$user->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('admin_avatar');
}
}
return response()->json([
'user' => $user,
'success' => true
]);
}
public function adminCompany(CompanyRequest $request)
{
$setting = Setting::getSetting('profile_complete');
if ($setting == '6' || $setting == 'COMPLETED') {
return response()->json(['error' => 'Company already created.']);
} else {
Setting::setSetting('profile_complete', 6);
}
$user = User::find(1);
$company = $user->company;
if (!$company) {
$company = new Company();
}
$company->name = $request->name;
$company->unique_hash = str_random(60);
$company->save();
$user->company()->associate($company);
$user->save();
if ($request->has('logo') && $request->logo !== null && $request->logo !== 'undefined' ) {
$company->addMediaFromRequest('logo')->toMediaCollection('logo');
}
$fields = $request->only([
'address_street_1',
'address_street_2',
'city',
'state',
'country_id',
'zip',
'phone'
]);
$address = Address::updateOrCreate(['user_id' => 1], $fields);
$user = User::with('addresses', 'company')->find(1);
CompanySetting::setSetting(
'notification_email',
$user->email,
$company->id
);
return response()->json([
'user' => $user
]);
}
public function companySettings(CompanySettingRequest $request)
{
$setting = Setting::getSetting('profile_complete');
if($setting == 'COMPLETED') {
return response()->json(['error' => 'Settings already saved.']);
} else {
Setting::setSetting('profile_complete', 'COMPLETED');
}
$user = User::find(1);
$sets = ['currency',
'time_zone',
'language',
'carbon_date_format',
'moment_date_format',
'fiscal_year'
];
foreach ($sets as $key) {
CompanySetting::setSetting(
$key,
$request->$key,
$user->company_id
);
}
$invoices = [
'invoice_auto_generate' => 'YES',
'invoice_prefix' => 'INV'
];
foreach ($invoices as $key => $value) {
CompanySetting::setSetting(
$key,
$value,
$user->company_id
);
}
$estimates = [
'estimate_prefix' => 'EST',
'estimate_auto_generate' => 'YES'
];
foreach ($estimates as $key => $value) {
CompanySetting::setSetting(
$key,
$value,
$user->company_id
);
}
$payments = [
'payment_prefix' => 'PAY',
'payment_auto_generate' => 'YES'
];
foreach ($payments as $key => $value) {
CompanySetting::setSetting(
$key,
$value,
$user->company_id
);
}
$colors = [
'primary_text_color' => '#5851D8',
'heading_text_color' => '#595959',
'section_heading_text_color' => '#040405',
'border_color' => '#EAF1FB',
'body_text_color' => '#595959',
'footer_text_color' => '#595959',
'footer_total_color' => '#5851D8',
'footer_bg_color' => '#F9FBFF',
'date_text_color' => '#A5ACC1',
'invoice_primary_color' => '#5851D8',
'invoice_column_heading' => '#55547A',
'invoice_field_label' => '#55547A',
'invoice_field_value' => '#040405',
'invoice_body_text' => '#040405',
'invoice_description_text' => '#595959',
'invoice_border_color' => '#EAF1FB'
];
foreach ($colors as $key => $value) {
CompanySetting::setSetting(
$key,
$value,
$user->company_id
);
}
Setting::setSetting('version', config('crater.version'));
Artisan::call('passport:install --force');
$client = DB::table('oauth_clients')->find(2);
$path = base_path('.env');
if (file_exists($path)) {
file_put_contents($path, str_replace(
'PROXY_OAUTH_CLIENT_SECRET='.config('auth.proxy.client_secret'),
'PROXY_OAUTH_CLIENT_SECRET='.$client->secret,
file_get_contents($path)
));
file_put_contents($path, str_replace(
'APP_DEBUG=true',
'APP_DEBUG=false',
file_get_contents($path)
));
}
$data['token'] = $user->createToken('password')->accessToken;
return response()->json($data);
}
}

View File

@ -1,279 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\CompanySetting;
use Crater\Currency;
use Crater\Invoice;
use Crater\Payment;
use Carbon\Carbon;
use function MongoDB\BSON\toJSON;
use Crater\User;
use Crater\Http\Requests\PaymentRequest;
use Validator;
class PaymentController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$payments = Payment::with('user', 'invoice')
->join('users', 'users.id', '=', 'payments.user_id')
->leftJoin('invoices', 'invoices.id', '=', 'payments.invoice_id')
->applyFilters($request->only([
'search',
'payment_number',
'payment_mode',
'customer_id',
'orderByField',
'orderBy'
]))
->whereCompany($request->header('company'))
->select('payments.*', 'users.name', 'invoices.invoice_number')
->latest()
->paginate($limit);
return response()->json([
'payments' => $payments
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$payment_prefix = CompanySetting::getSetting('payment_prefix', $request->header('company'));
$payment_num_auto_generate = CompanySetting::getSetting('payment_auto_generate', $request->header('company'));
$nextPaymentNumberAttribute = null;
$nextPaymentNumber = Payment::getNextPaymentNumber($payment_prefix);
if ($payment_num_auto_generate == "YES") {
$nextPaymentNumberAttribute = $nextPaymentNumber;
}
return response()->json([
'customers' => User::where('role', 'customer')
->whereCompany($request->header('company'))
->get(),
'nextPaymentNumberAttribute' => $nextPaymentNumberAttribute,
'nextPaymentNumber' => $payment_prefix.'-'.$nextPaymentNumber,
'payment_prefix' => $payment_prefix
]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(PaymentRequest $request)
{
$payment_number = explode("-",$request->payment_number);
$number_attributes['payment_number'] = $payment_number[0].'-'.sprintf('%06d', intval($payment_number[1]));
Validator::make($number_attributes, [
'payment_number' => 'required|unique:payments,payment_number'
])->validate();
$payment_date = Carbon::createFromFormat('d/m/Y', $request->payment_date);
if ($request->has('invoice_id') && $request->invoice_id != null) {
$invoice = Invoice::find($request->invoice_id);
if ($invoice && $invoice->due_amount == $request->amount) {
$invoice->status = Invoice::STATUS_COMPLETED;
$invoice->paid_status = Invoice::STATUS_PAID;
$invoice->due_amount = 0;
} elseif ($invoice && $invoice->due_amount != $request->amount) {
$invoice->due_amount = (int)$invoice->due_amount - (int)$request->amount;
if ($invoice->due_amount < 0) {
return response()->json([
'error' => 'invalid_amount'
]);
}
$invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID;
}
$invoice->save();
}
$payment = Payment::create([
'payment_date' => $payment_date,
'payment_number' => $number_attributes['payment_number'],
'user_id' => $request->user_id,
'company_id' => $request->header('company'),
'invoice_id' => $request->invoice_id,
'payment_mode' => $request->payment_mode,
'amount' => $request->amount,
'notes' => $request->notes,
]);
return response()->json([
'payment' => $payment,
'success' => true
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit(Request $request, $id)
{
$payment = Payment::with('user', 'invoice')->find($id);
$invoices = Invoice::where('paid_status', '<>', Invoice::STATUS_PAID)
->where('user_id', $payment->user_id)->where('due_amount', '>', 0)
->whereCompany($request->header('company'))
->get();
return response()->json([
'customers' => User::where('role', 'customer')
->whereCompany($request->header('company'))
->get(),
'nextPaymentNumber' => $payment->getPaymentNumAttribute(),
'payment_prefix' => $payment->getPaymentPrefixAttribute(),
'payment' => $payment,
'invoices' => $invoices
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(PaymentRequest $request, $id)
{
$payment_number = explode("-",$request->payment_number);
$number_attributes['payment_number'] = $payment_number[0].'-'.sprintf('%06d', intval($payment_number[1]));
Validator::make($number_attributes, [
'payment_number' => 'required|unique:payments,payment_number'.','.$id
])->validate();
$payment_date = Carbon::createFromFormat('d/m/Y', $request->payment_date);
$payment = Payment::find($id);
$oldAmount = $payment->amount;
if ($request->has('invoice_id') && $request->invoice_id && ($oldAmount != $request->amount)) {
$amount = (int)$request->amount - (int)$oldAmount;
$invoice = Invoice::find($request->invoice_id);
$invoice->due_amount = (int)$invoice->due_amount - (int)$amount;
if ($invoice->due_amount < 0) {
return response()->json([
'error' => 'invalid_amount'
]);
}
if ($invoice->due_amount == 0) {
$invoice->status = Invoice::STATUS_COMPLETED;
$invoice->paid_status = Invoice::STATUS_PAID;
} else {
$invoice->status = $invoice->getPreviousStatus();
$invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID;
}
$invoice->save();
}
$payment->payment_date = $payment_date;
$payment->payment_number = $number_attributes['payment_number'];
$payment->user_id = $request->user_id;
$payment->invoice_id = $request->invoice_id;
$payment->payment_mode = $request->payment_mode;
$payment->amount = $request->amount;
$payment->notes = $request->notes;
$payment->save();
return response()->json([
'payment' => $payment,
'success' => true
]);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$payment = Payment::find($id);
if ($payment->invoice_id != null) {
$invoice = Invoice::find($payment->invoice_id);
$invoice->due_amount = ((int)$invoice->due_amount + (int)$payment->amount);
if ($invoice->due_amount == $invoice->total) {
$invoice->paid_status = Invoice::STATUS_UNPAID;
} else {
$invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID;
}
$invoice->status = $invoice->getPreviousStatus();
$invoice->save();
}
$payment->delete();
return response()->json([
'success' => true
]);
}
public function delete(Request $request)
{
foreach ($request->id as $id) {
$payment = Payment::find($id);
if ($payment->invoice_id != null) {
$invoice = Invoice::find($payment->invoice_id);
$invoice->due_amount = ((int)$invoice->due_amount + (int)$payment->amount);
if ($invoice->due_amount == $invoice->total) {
$invoice->paid_status = Invoice::STATUS_UNPAID;
} else {
$invoice->paid_status = Invoice::STATUS_PARTIALLY_PAID;
}
$invoice->status = $invoice->getPreviousStatus();
$invoice->save();
}
$payment->delete();
}
return response()->json([
'success' => true
]);
}
}

View File

@ -1,293 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\User;
use Crater\Invoice;
use Crater\Company;
use Crater\InvoiceItem;
use Crater\Expense;
use Crater\CompanySetting;
use Crater\Tax;
use PDF;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class ReportController extends Controller
{
public function customersSalesReport($hash, Request $request)
{
$company = Company::where('unique_hash', $hash)->first();
$start = Carbon::createFromFormat('d/m/Y', $request->from_date);
$end = Carbon::createFromFormat('d/m/Y', $request->to_date);
$customers = User::with(['invoices' => function ($query) use ($start, $end) {
$query->whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
);
}])
->customer()
->whereCompany($company->id)
->applyInvoiceFilters($request->only(['from_date', 'to_date']))
->get();
$totalAmount = 0;
foreach ($customers as $customer) {
$customerTotalAmount = 0;
foreach ($customer->invoices as $invoice) {
$customerTotalAmount += $invoice->total;
}
$customer->totalAmount = $customerTotalAmount;
$totalAmount += $customerTotalAmount;
}
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('d/m/Y', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('d/m/Y', $request->to_date)->format($dateFormat);
$colors = [
'primary_text_color',
'heading_text_color',
'section_heading_text_color',
'border_color',
'body_text_color',
'footer_text_color',
'footer_total_color',
'footer_bg_color',
'date_text_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($company->id)
->get();
view()->share([
'customers' => $customers,
'totalAmount' => $totalAmount,
'colorSettings' => $colorSettings,
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date
]);
$pdf = PDF::loadView('app.pdf.reports.sales-customers');
if ($request->has('download')) {
return $pdf->download();
}
return $pdf->stream();
}
public function itemsSalesReport($hash, Request $request)
{
$company = Company::where('unique_hash', $hash)->first();
$items = InvoiceItem::whereCompany($company->id)
->applyInvoiceFilters($request->only(['from_date', 'to_date']))
->itemAttributes()
->get();
$totalAmount = 0;
foreach ($items as $item) {
$totalAmount += $item->total_amount;
}
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('d/m/Y', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('d/m/Y', $request->to_date)->format($dateFormat);
$colors = [
'primary_text_color',
'heading_text_color',
'section_heading_text_color',
'border_color',
'body_text_color',
'footer_text_color',
'footer_total_color',
'footer_bg_color',
'date_text_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($company->id)
->get();
view()->share([
'items' => $items,
'colorSettings' => $colorSettings,
'totalAmount' => $totalAmount,
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date
]);
$pdf = PDF::loadView('app.pdf.reports.sales-items');
if ($request->has('download')) {
return $pdf->download();
}
return $pdf->stream();
}
public function expensesReport($hash, Request $request)
{
$company = Company::where('unique_hash', $hash)->first();
$expenseCategories = Expense::with('category')
->whereCompany($company->id)
->applyFilters($request->only(['from_date', 'to_date']))
->expensesAttributes()
->get();
$totalAmount = 0;
foreach ($expenseCategories as $category) {
$totalAmount += $category->total_amount;
}
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('d/m/Y', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('d/m/Y', $request->to_date)->format($dateFormat);
$colors = [
'primary_text_color',
'heading_text_color',
'section_heading_text_color',
'border_color',
'body_text_color',
'footer_text_color',
'footer_total_color',
'footer_bg_color',
'date_text_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($company->id)
->get();
view()->share([
'expenseCategories' => $expenseCategories,
'colorSettings' => $colorSettings,
'totalExpense' => $totalAmount,
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date
]);
$pdf = PDF::loadView('app.pdf.reports.expenses');
if ($request->has('download')) {
return $pdf->download();
}
return $pdf->stream();
}
public function taxSummery($hash, Request $request)
{
$company = Company::where('unique_hash', $hash)->first();
$taxTypes = Tax::with('taxType', 'invoice', 'invoiceItem')
->whereCompany($company->id)
->whereInvoicesFilters($request->only(['from_date', 'to_date']))
->taxAttributes()
->get();
$totalAmount = 0;
foreach ($taxTypes as $taxType) {
$totalAmount += $taxType->total_tax_amount;
}
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('d/m/Y', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('d/m/Y', $request->to_date)->format($dateFormat);
$colors = [
'primary_text_color',
'heading_text_color',
'section_heading_text_color',
'border_color',
'body_text_color',
'footer_text_color',
'footer_total_color',
'footer_bg_color',
'date_text_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($company->id)
->get();
view()->share([
'taxTypes' => $taxTypes,
'totalTaxAmount' => $totalAmount,
'colorSettings' => $colorSettings,
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date
]);
$pdf = PDF::loadView('app.pdf.reports.tax-summary');
if ($request->has('download')) {
return $pdf->download();
}
return $pdf->stream();
}
public function profitLossReport($hash, Request $request)
{
$company = Company::where('unique_hash', $hash)->first();
$invoicesAmount = Invoice::whereCompany($company->id)
->applyFilters($request->only(['from_date', 'to_date']))
->wherePaidStatus(Invoice::STATUS_PAID)
->sum('total');
$expenseCategories = Expense::with('category')
->whereCompany($company->id)
->applyFilters($request->only(['from_date', 'to_date']))
->expensesAttributes()
->get();
$totalAmount = 0;
foreach ($expenseCategories as $category) {
$totalAmount += $category->total_amount;
}
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('d/m/Y', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('d/m/Y', $request->to_date)->format($dateFormat);
$colors = [
'primary_text_color',
'heading_text_color',
'section_heading_text_color',
'border_color',
'body_text_color',
'footer_text_color',
'footer_total_color',
'footer_bg_color',
'date_text_color'
];
$colorSettings = CompanySetting::whereIn('option', $colors)
->whereCompany($company->id)
->get();
view()->share([
'company' => $company,
'income' => $invoicesAmount,
'expenseCategories' => $expenseCategories,
'totalExpense' => $totalAmount,
'colorSettings' => $colorSettings,
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date
]);
$pdf = PDF::loadView('app.pdf.reports.profit-loss');
if ($request->has('download')) {
return $pdf->download();
}
return $pdf->stream();
}
}

View File

@ -1,19 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Setting;
class SettingsController extends Controller
{
public function getAppVersion(Request $request)
{
$version = Setting::getSetting('version');
return response()->json([
'version' => $version,
]);
}
}

View File

@ -1,126 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Crater\TaxType;
use Crater\User;
use Crater\Http\Requests\TaxTypeRequest;
use Illuminate\Http\Request;
class TaxTypeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$taxTypes = TaxType::whereCompany($request->header('company'))
->latest()
->get();
return response()->json([
'taxTypes' => $taxTypes
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(TaxTypeRequest $request)
{
$taxType = new TaxType();
$taxType->name = $request->name;
$taxType->percent = $request->percent;
$taxType->description = $request->description;
if ($request->has('compound_tax')) {
$taxType->compound_tax = $request->compound_tax;
}
$taxType->company_id = $request->header('company');
$taxType->save();
return response()->json([
'taxType' => $taxType,
]);
}
/**
* Display the specified resource.
*
* @param \Crater\TaxType $taxType
* @return \Illuminate\Http\Response
*/
public function show(TaxType $taxType)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \Crater\TaxType $taxType
* @return \Illuminate\Http\Response
*/
public function edit(TaxType $taxType)
{
return response()->json([
'taxType' => $taxType
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\TaxType $taxType
* @return \Illuminate\Http\Response
*/
public function update(TaxTypeRequest $request, TaxType $taxType)
{
$taxType->name = $request->name;
$taxType->percent = $request->percent;
$taxType->description = $request->description;
if ($request->has('collective_tax')) {
$taxType->collective_tax = $request->collective_tax;
}
$taxType->compound_tax = $request->compound_tax;
$taxType->save();
return response()->json([
'taxType' => $taxType,
]);
}
/**
* Remove the specified resource from storage.
*
* @param \Crater\TaxType $taxType
* @return \Illuminate\Http\Response
*/
public function destroy(TaxType $taxType)
{
if ($taxType->taxes() && $taxType->taxes()->count() > 0) {
return response()->json([
'success' => false
]);
}
$taxType->delete();
return response()->json([
'success' => true
]);
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Space\Updater;
use Crater\Space\SiteApi;
class UpdateController extends Controller
{
public function update(Request $request)
{
set_time_limit(600); // 10 minutes
$json = Updater::update($request->installed, $request->version);
return response()->json($json);
}
public function finishUpdate(Request $request)
{
$json = Updater::finishUpdate($request->installed, $request->version);
return response()->json($json);
}
public function checkLatestVersion(Request $request)
{
set_time_limit(600); // 10 minutes
$json = Updater::checkForUpdate();
return response()->json($json);
}
}

View File

@ -1,74 +0,0 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Http\Request;
use Crater\Http\Requests;
use Crater\User;
use Crater\Currency;
use Crater\Setting;
use Crater\Item;
use Crater\TaxType;
use DB;
use Carbon\Carbon;
use Auth;
use Crater\Company;
use Crater\CompanySetting;
class UsersController extends Controller
{
public function getBootstrap(Request $request)
{
$user = Auth::user();
$company = $request->header('company') ?? 1;
$customers = User::with('billingAddress', 'shippingAddress')
->customer()
->whereCompany($company)
->latest()
->get();
$currencies = Currency::latest()->get();
$default_language = CompanySetting::getSetting('language', $company);
$default_currency = Currency::findOrFail(
CompanySetting::getSetting('currency', $company)
);
$moment_date_format = CompanySetting::getSetting(
'moment_date_format',
$request->header('company')
);
$fiscal_year = CompanySetting::getSetting(
'fiscal_year',
$request->header('company')
);
$items = Item::all();
$taxTypes = TaxType::latest()->get();
return response()->json([
'user' => $user,
'customers' => $customers,
'currencies' => $currencies,
'default_currency' => $default_currency,
'default_language' => $default_language,
'company' => $user->company,
'companies' => Company::all(),
'items' => $items,
'taxTypes' => $taxTypes,
'moment_date_format' => $moment_date_format,
'fiscal_year' => $fiscal_year,
]);
}
public function ping()
{
return response()->json([
'success' => 'crater-self-hosted'
]);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Get the response for a successful password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetLinkResponse(Request $request, $response)
{
return response()->json([
'message' => 'Password reset email sent.',
'data' => $response,
]);
}
/**
* Get the response for a failed password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{
return response()->json([
'error' => 'Email could not be sent to this email address.'
], 403);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Models\User;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => $data['password'],
]);
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Get the response for a successful password reset.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetResponse(Request $request, $response)
{
return response()->json([
'message' => 'Password reset successfully.',
]);
}
/**
* Reset the given user's password.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $password
* @return void
*/
protected function resetPassword($user, $password)
{
$user->password = $password;
$user->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
}
/**
* Get the response for a failed password reset.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetFailedResponse(Request $request, $response)
{
return response('Failed, Invalid Token.', 403);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@ -0,0 +1,22 @@
<?php
// Implementation taken from nova-backup-tool - https://github.com/spatie/nova-backup-tool/
namespace Crater\Http\Controllers\V1\Admin\Backup;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
class ApiController extends Controller
{
/**
*
* @return JsonResponse
*/
public function respondSuccess(): JsonResponse
{
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,99 @@
<?php
// Implementation taken from nova-backup-tool - https://github.com/spatie/nova-backup-tool/
namespace Crater\Http\Controllers\V1\Admin\Backup;
use Crater\Jobs\CreateBackupJob;
use Crater\Rules\Backup\PathToZip;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Spatie\Backup\BackupDestination\Backup;
use Spatie\Backup\BackupDestination\BackupDestination;
use Spatie\Backup\Helpers\Format;
class BackupsController extends ApiController
{
/**
* Display a listing of the resource.
*
* @return JsonResponse
*/
public function index(Request $request)
{
$this->authorize('manage backups');
$configuredBackupDisks = config('backup.backup.destination.disks');
try {
$backupDestination = BackupDestination::create(config('filesystems.default'), config('backup.backup.name'));
$backups = Cache::remember("backups-{$request->file_disk_id}", now()->addSeconds(4), function () use ($backupDestination) {
return $backupDestination
->backups()
->map(function (Backup $backup) {
return [
'path' => $backup->path(),
'created_at' => $backup->date()->format('Y-m-d H:i:s'),
'size' => Format::humanReadableSize($backup->size()),
];
})
->toArray();
});
return response()->json([
'backups' => $backups,
'disks' => $configuredBackupDisks,
]);
} catch (\Exception $e) {
return response()->json([
'backups' => [],
'error' => 'invalid_disk_credentials',
'error_message' => $e->getMessage(),
'disks' => $configuredBackupDisks,
]);
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return JsonResponse
*/
public function store(Request $request)
{
$this->authorize('manage backups');
dispatch(new CreateBackupJob($request->all()))->onQueue(config('backup.queue.name'));
return $this->respondSuccess();
}
/**
* Remove the specified resource from storage.
*
* @param \Illuminate\Http\Request $request
* @return JsonResponse
*/
public function destroy($disk, Request $request)
{
$this->authorize('manage backups');
$validated = $request->validate([
'path' => ['required', new PathToZip()],
]);
$backupDestination = BackupDestination::create(config('filesystems.default'), config('backup.backup.name'));
$backupDestination
->backups()
->first(function (Backup $backup) use ($validated) {
return $backup->path() === $validated['path'];
})
->delete();
return $this->respondSuccess();
}
}

View File

@ -0,0 +1,59 @@
<?php
// Implementation taken from nova-backup-tool - https://github.com/spatie/nova-backup-tool/
namespace Crater\Http\Controllers\V1\Admin\Backup;
use Crater\Rules\Backup\PathToZip;
use Illuminate\Http\Request;
use Spatie\Backup\BackupDestination\Backup;
use Spatie\Backup\BackupDestination\BackupDestination;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
class DownloadBackupController extends ApiController
{
public function __invoke(Request $request)
{
$this->authorize('manage backups');
$validated = $request->validate([
'path' => ['required', new PathToZip()],
]);
$backupDestination = BackupDestination::create(config('filesystems.default'), config('backup.backup.name'));
$backup = $backupDestination->backups()->first(function (Backup $backup) use ($validated) {
return $backup->path() === $validated['path'];
});
if (! $backup) {
return response('Backup not found', Response::HTTP_UNPROCESSABLE_ENTITY);
}
return $this->respondWithBackupStream($backup);
}
public function respondWithBackupStream(Backup $backup): StreamedResponse
{
$fileName = pathinfo($backup->path(), PATHINFO_BASENAME);
$downloadHeaders = [
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
'Content-Type' => 'application/zip',
'Content-Length' => $backup->size(),
'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
'Pragma' => 'public',
];
return response()->stream(function () use ($backup) {
$stream = $backup->stream();
fpassthru($stream);
if (is_resource($stream)) {
fclose($stream);
}
}, 200, $downloadHeaders);
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Company;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\CompaniesRequest;
use Crater\Http\Resources\CompanyResource;
use Crater\Models\Company;
use Crater\Models\User;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
use Vinkla\Hashids\Facades\Hashids;
class CompaniesController extends Controller
{
public function store(CompaniesRequest $request)
{
$this->authorize('create company');
$user = $request->user();
$company = Company::create($request->getCompanyPayload());
$company->unique_hash = Hashids::connection(Company::class)->encode($company->id);
$company->save();
$company->setupDefaultData();
$user->companies()->attach($company->id);
$user->assign('super admin');
if ($request->address) {
$company->address()->create($request->address);
}
return new CompanyResource($company);
}
public function destroy(Request $request)
{
$company = Company::find($request->header('company'));
$this->authorize('delete company', $company);
$user = $request->user();
if ($request->name !== $company->name) {
return respondJson('company_name_must_match_with_given_name', 'Company name must match with given name');
}
if ($user->loadCount('companies')->companies_count <= 1) {
return respondJson('You_cannot_delete_all_companies', 'You cannot delete all companies');
}
$company->deleteCompany($user);
return response()->json([
'success' => true
]);
}
public function transferOwnership(Request $request, User $user)
{
$company = Company::find($request->header('company'));
$this->authorize('transfer company ownership', $company);
if ($user->hasCompany($company->id)) {
return response()->json([
'success' => false,
'message' => 'User does not belongs to this company.'
]);
}
$company->update(['owner_id' => $user->id]);
BouncerFacade::sync($user)->roles(['super admin']);
return response()->json([
'success' => true
]);
}
public function getUserCompanies(Request $request)
{
$companies = $request->user()->companies;
return CompanyResource::collection($companies);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Company;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CompanyResource;
use Crater\Models\Company;
use Illuminate\Http\Request;
class CompanyController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$company = Company::find($request->header('company'));
return new CompanyResource($company);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Config;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class FiscalYearsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'fiscal_years' => config('crater.fiscal_years'),
]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Config;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class LanguagesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'languages' => config('crater.languages'),
]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Config;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class RetrospectiveEditsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'retrospective_edits' => config('crater.retrospective_edits'),
]);
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\CustomField;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\CustomFieldRequest;
use Crater\Http\Resources\CustomFieldResource;
use Crater\Models\CustomField;
use Illuminate\Http\Request;
class CustomFieldsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$this->authorize('viewAny', CustomField::class);
$limit = $request->has('limit') ? $request->limit : 5;
$customFields = CustomField::applyFilters($request->all())
->whereCompany()
->latest()
->paginateData($limit);
return CustomFieldResource::collection($customFields);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\CustomFieldRequest $request
* @return \Illuminate\Http\Response
*/
public function store(CustomFieldRequest $request)
{
$this->authorize('create', CustomField::class);
$customField = CustomField::createCustomField($request);
return new CustomFieldResource($customField);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(CustomField $customField)
{
$this->authorize('view', $customField);
return new CustomFieldResource($customField);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(CustomFieldRequest $request, CustomField $customField)
{
$this->authorize('update', $customField);
$customField->updateCustomField($request);
return new CustomFieldResource($customField);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(CustomField $customField)
{
$this->authorize('delete', $customField);
if ($customField->customFieldValues()->exists()) {
$customField->customFieldValues()->delete();
}
$customField->forceDelete();
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,143 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Customer;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CustomerResource;
use Crater\Models\CompanySetting;
use Crater\Models\Customer;
use Crater\Models\Expense;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
class CustomerStatsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Customer $customer)
{
$this->authorize('view', $customer);
$i = 0;
$months = [];
$invoiceTotals = [];
$expenseTotals = [];
$receiptTotals = [];
$netProfits = [];
$monthCounter = 0;
$fiscalYear = CompanySetting::getSetting('fiscal_year', $request->header('company'));
$startDate = Carbon::now();
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
if ($terms[0] <= $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
} else {
$startDate->subYear()->month($terms[0])->startOfMonth();
$start->subYear()->month($terms[0])->startOfMonth();
$end->subYear()->month($terms[0])->endOfMonth();
}
if ($request->has('previous_year')) {
$startDate->subYear()->startOfMonth();
$start->subYear()->startOfMonth();
$end->subYear()->endOfMonth();
}
while ($monthCounter < 12) {
array_push(
$invoiceTotals,
Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('total') ?? 0
);
array_push(
$expenseTotals,
Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->whereUser($customer->id)
->sum('amount') ?? 0
);
array_push(
$receiptTotals,
Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('amount') ?? 0
);
array_push(
$netProfits,
($receiptTotals[$i] - $expenseTotals[$i])
);
$i++;
array_push($months, $start->format('M'));
$monthCounter++;
$end->startOfMonth();
$start->addMonth()->startOfMonth();
$end->addMonth()->endOfMonth();
}
$start->subMonth()->endOfMonth();
$salesTotal = Invoice::whereBetween(
'invoice_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->where('status', '<>', Invoice::STATUS_DRAFT)
->sum('total');
$totalReceipts = Payment::whereBetween(
'payment_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('amount');
$totalExpenses = Expense::whereBetween(
'expense_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->whereUser($customer->id)
->sum('amount');
$netProfit = (int) $totalReceipts - (int) $totalExpenses;
$chartData = [
'months' => $months,
'invoiceTotals' => $invoiceTotals,
'expenseTotals' => $expenseTotals,
'receiptTotals' => $receiptTotals,
'netProfit' => $netProfit,
'netProfits' => $netProfits,
'salesTotal' => $salesTotal,
'totalReceipts' => $totalReceipts,
'totalExpenses' => $totalExpenses,
];
$customer = Customer::find($customer->id);
return (new CustomerResource($customer))
->additional(['meta' => [
'chartData' => $chartData
]]);
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Customer;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests;
use Crater\Http\Requests\DeleteCustomersRequest;
use Crater\Http\Resources\CustomerResource;
use Crater\Models\Customer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class CustomersController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request)
{
$this->authorize('viewAny', Customer::class);
$limit = $request->has('limit') ? $request->limit : 10;
$customers = Customer::with('creator')
->whereCompany()
->applyFilters($request->all())
->select(
'customers.*',
DB::raw('sum(invoices.base_due_amount) as base_due_amount'),
DB::raw('sum(invoices.due_amount) as due_amount'),
)
->groupBy('customers.id')
->leftJoin('invoices', 'customers.id', '=', 'invoices.customer_id')
->paginateData($limit);
return (CustomerResource::collection($customers))
->additional(['meta' => [
'customer_total_count' => Customer::whereCompany()->count(),
]]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(Requests\CustomerRequest $request)
{
$this->authorize('create', Customer::class);
$customer = Customer::createCustomer($request);
return new CustomerResource($customer);
}
/**
* Display the specified resource.
*
* @param Customer $customer
* @return \Illuminate\Http\JsonResponse
*/
public function show(Customer $customer)
{
$this->authorize('view', $customer);
return new CustomerResource($customer);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\Customer $customer
* @return \Illuminate\Http\JsonResponse
*/
public function update(Requests\CustomerRequest $request, Customer $customer)
{
$this->authorize('update', $customer);
$customer = Customer::updateCustomer($request, $customer);
if (is_string($customer)) {
return respondJson('you_cannot_edit_currency', 'Cannot change currency once transactions created');
}
return new CustomerResource($customer);
}
/**
* Remove a list of Customers along side all their resources (ie. Estimates, Invoices, Payments and Addresses)
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function delete(DeleteCustomersRequest $request)
{
$this->authorize('delete multiple customers');
Customer::deleteCustomers($request->ids);
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,168 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Dashboard;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Customer;
use Crater\Models\Estimate;
use Crater\Models\Expense;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class DashboardController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request)
{
$company = Company::find($request->header('company'));
$this->authorize('view dashboard', $company);
$invoice_totals = [];
$expense_totals = [];
$receipt_totals = [];
$net_income_totals = [];
$i = 0;
$months = [];
$monthCounter = 0;
$fiscalYear = CompanySetting::getSetting('fiscal_year', $request->header('company'));
$startDate = Carbon::now();
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
if ($terms[0] <= $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
} else {
$startDate->subYear()->month($terms[0])->startOfMonth();
$start->subYear()->month($terms[0])->startOfMonth();
$end->subYear()->month($terms[0])->endOfMonth();
}
if ($request->has('previous_year')) {
$startDate->subYear()->startOfMonth();
$start->subYear()->startOfMonth();
$end->subYear()->endOfMonth();
}
while ($monthCounter < 12) {
array_push(
$invoice_totals,
Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_total')
);
array_push(
$expense_totals,
Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount')
);
array_push(
$receipt_totals,
Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount')
);
array_push(
$net_income_totals,
($receipt_totals[$i] - $expense_totals[$i])
);
$i++;
array_push($months, $start->format('M'));
$monthCounter++;
$end->startOfMonth();
$start->addMonth()->startOfMonth();
$end->addMonth()->endOfMonth();
}
$start->subMonth()->endOfMonth();
$total_sales = Invoice::whereBetween(
'invoice_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->where('status', '<>', Invoice::STATUS_DRAFT)
->whereCompany()
->sum('base_total');
$total_receipts = Payment::whereBetween(
'payment_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount');
$total_expenses = Expense::whereBetween(
'expense_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount');
$total_net_income = (int)$total_receipts - (int)$total_expenses;
$chart_data = [
'months' => $months,
'invoice_totals' => $invoice_totals,
'expense_totals' => $expense_totals,
'receipt_totals' => $receipt_totals,
'net_income_totals' => $net_income_totals,
];
$total_customer_count = Customer::whereCompany()->count();
$total_invoice_count = Invoice::whereCompany()
->count();
$total_estimate_count = Estimate::whereCompany()->count();
$total_amount_due = Invoice::whereCompany()
->sum('base_due_amount');
$recent_due_invoices = Invoice::with('customer')
->whereCompany()
->where('base_due_amount', '>', 0)
->where('status', '<>', Invoice::STATUS_DRAFT)
->take(5)
->latest()
->get();
$recent_estimates = Estimate::with('customer')->whereCompany()->take(5)->latest()->get();
return response()->json([
'total_amount_due' => $total_amount_due,
'total_customer_count' => $total_customer_count,
'total_invoice_count' => $total_invoice_count,
'total_estimate_count' => $total_estimate_count,
'recent_due_invoices' => BouncerFacade::can('view-invoice', Invoice::class) ? $recent_due_invoices : [],
'recent_estimates' => BouncerFacade::can('view-estimate', Estimate::class) ? $recent_estimates : [],
'chart_data' => $chart_data,
'total_sales' => $total_sales,
'total_receipts' => $total_receipts,
'total_expenses' => $total_expenses,
'total_net_income' => $total_net_income,
]);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class ChangeEstimateStatusController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param Estimate $estimate
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$estimate->update($request->only('status'));
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,134 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\InvoiceResource;
use Crater\Models\CompanySetting;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Services\SerialNumberFormatter;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Vinkla\Hashids\Facades\Hashids;
class ConvertEstimateController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\Estimate $estimate
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Estimate $estimate, Invoice $invoice)
{
$this->authorize('create', Invoice::class);
$estimate->load(['items', 'items.taxes', 'customer', 'taxes']);
$invoice_date = Carbon::now();
$due_date = null;
$dueDateEnabled = CompanySetting::getSetting(
'invoice_set_due_date_automatically',
$request->header('company')
);
if ($dueDateEnabled === 'YES') {
$dueDateDays = CompanySetting::getSetting(
'invoice_due_date_days',
$request->header('company')
);
$due_date = Carbon::now()->addDays($dueDateDays)->format('Y-m-d');
}
$serial = (new SerialNumberFormatter())
->setModel($invoice)
->setCompany($estimate->company_id)
->setCustomer($estimate->customer_id)
->setNextNumbers();
$templateName = $estimate->getInvoiceTemplateName();
$exchange_rate = $estimate->exchange_rate;
$invoice = Invoice::create([
'creator_id' => Auth::id(),
'invoice_date' => $invoice_date->format('Y-m-d'),
'due_date' => $due_date,
'invoice_number' => $serial->getNextNumber(),
'sequence_number' => $serial->nextSequenceNumber,
'customer_sequence_number' => $serial->nextCustomerSequenceNumber,
'reference_number' => $serial->getNextNumber(),
'customer_id' => $estimate->customer_id,
'company_id' => $request->header('company'),
'template_name' => $templateName,
'status' => Invoice::STATUS_DRAFT,
'paid_status' => Invoice::STATUS_UNPAID,
'sub_total' => $estimate->sub_total,
'discount' => $estimate->discount,
'discount_type' => $estimate->discount_type,
'discount_val' => $estimate->discount_val,
'total' => $estimate->total,
'due_amount' => $estimate->total,
'tax_per_item' => $estimate->tax_per_item,
'discount_per_item' => $estimate->discount_per_item,
'tax' => $estimate->tax,
'notes' => $estimate->notes,
'exchange_rate' => $exchange_rate,
'base_discount_val' => $estimate->discount_val * $exchange_rate,
'base_sub_total' => $estimate->sub_total * $exchange_rate,
'base_total' => $estimate->total * $exchange_rate,
'base_tax' => $estimate->tax * $exchange_rate,
'currency_id' => $estimate->currency_id,
'sales_tax_type' => $estimate->sales_tax_type,
'sales_tax_address_type' => $estimate->sales_tax_address_type,
]);
$invoice->unique_hash = Hashids::connection(Invoice::class)->encode($invoice->id);
$invoice->save();
$invoiceItems = $estimate->items->toArray();
foreach ($invoiceItems as $invoiceItem) {
$invoiceItem['company_id'] = $request->header('company');
$invoiceItem['name'] = $invoiceItem['name'];
$estimateItem['exchange_rate'] = $exchange_rate;
$estimateItem['base_price'] = $invoiceItem['price'] * $exchange_rate;
$estimateItem['base_discount_val'] = $invoiceItem['discount_val'] * $exchange_rate;
$estimateItem['base_tax'] = $invoiceItem['tax'] * $exchange_rate;
$estimateItem['base_total'] = $invoiceItem['total'] * $exchange_rate;
$item = $invoice->items()->create($invoiceItem);
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $request->header('company');
if ($tax['amount']) {
$item->taxes()->create($tax);
}
}
}
}
if ($estimate->taxes) {
foreach ($estimate->taxes->toArray() as $tax) {
$tax['company_id'] = $request->header('company');
$tax['exchange_rate'] = $exchange_rate;
$tax['base_amount'] = $tax['amount'] * $exchange_rate;
$tax['currency_id'] = $estimate->currency_id;
unset($tax['estimate_id']);
$invoice->taxes()->create($tax);
}
}
$estimate->checkForEstimateConvertAction();
$invoice = Invoice::find($invoice->id);
return new InvoiceResource($invoice);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimateTemplatesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('viewAny', Estimate::class);
$estimateTemplates = Estimate::estimateTemplates();
return response()->json([
'estimateTemplates' => $estimateTemplates
]);
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\DeleteEstimatesRequest;
use Crater\Http\Requests\EstimatesRequest;
use Crater\Http\Resources\EstimateResource;
use Crater\Jobs\GenerateEstimatePdfJob;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimatesController extends Controller
{
public function index(Request $request)
{
$this->authorize('viewAny', Estimate::class);
$limit = $request->has('limit') ? $request->limit : 10;
$estimates = Estimate::whereCompany()
->join('customers', 'customers.id', '=', 'estimates.customer_id')
->applyFilters($request->all())
->select('estimates.*', 'customers.name')
->latest()
->paginateData($limit);
return (EstimateResource::collection($estimates))
->additional(['meta' => [
'estimate_total_count' => Estimate::whereCompany()->count(),
]]);
}
public function store(EstimatesRequest $request)
{
$this->authorize('create', Estimate::class);
$estimate = Estimate::createEstimate($request);
if ($request->has('estimateSend')) {
$estimate->send($request->title, $request->body);
}
GenerateEstimatePdfJob::dispatch($estimate);
return new EstimateResource($estimate);
}
public function show(Request $request, Estimate $estimate)
{
$this->authorize('view', $estimate);
return new EstimateResource($estimate);
}
public function update(EstimatesRequest $request, Estimate $estimate)
{
$this->authorize('update', $estimate);
$estimate = $estimate->updateEstimate($request);
GenerateEstimatePdfJob::dispatch($estimate, true);
return new EstimateResource($estimate);
}
public function delete(DeleteEstimatesRequest $request)
{
$this->authorize('delete multiple estimates');
Estimate::destroy($request->ids);
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\SendEstimatesRequest;
use Crater\Models\Estimate;
class SendEstimateController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\SendEstimatesRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(SendEstimatesRequest $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$response = $estimate->send($request->all());
return response()->json($response);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\SendEstimatesRequest;
use Crater\Models\Estimate;
use Illuminate\Mail\Markdown;
class SendEstimatePreviewController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\SendEstimatesRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(SendEstimatesRequest $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$markdown = new Markdown(view(), config('mail.markdown'));
$data = $estimate->sendEstimateData($request->all());
$data['url'] = $estimate->estimatePdfUrl;
return $markdown->render('emails.send.estimate', ['data' => $data]);
}
}

View File

@ -0,0 +1,117 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\ExchangeRate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\ExchangeRateProviderRequest;
use Crater\Http\Resources\ExchangeRateProviderResource;
use Crater\Models\ExchangeRateProvider;
use Illuminate\Http\Request;
class ExchangeRateProviderController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$this->authorize('viewAny', ExchangeRateProvider::class);
$limit = $request->has('limit') ? $request->limit : 5;
$exchangeRateProviders = ExchangeRateProvider::whereCompany()->paginate($limit);
return ExchangeRateProviderResource::collection($exchangeRateProviders);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ExchangeRateProviderRequest $request)
{
$this->authorize('create', ExchangeRateProvider::class);
$query = ExchangeRateProvider::checkActiveCurrencies($request);
if (count($query) !== 0) {
return respondJson('currency_used', 'Currency used.');
}
$checkConverterApi = ExchangeRateProvider::checkExchangeRateProviderStatus($request);
if ($checkConverterApi->status() == 200) {
$exchangeRateProvider = ExchangeRateProvider::createFromRequest($request);
return new ExchangeRateProviderResource($exchangeRateProvider);
}
return $checkConverterApi;
}
/**
* Display the specified resource.
*
* @param \Crater\Models\ExchangeRateProvider $exchangeRateProvider
* @return \Illuminate\Http\Response
*/
public function show(ExchangeRateProvider $exchangeRateProvider)
{
$this->authorize('view', $exchangeRateProvider);
return new ExchangeRateProviderResource($exchangeRateProvider);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\ExchangeRateProvider $exchangeRateProvider
* @return \Illuminate\Http\Response
*/
public function update(ExchangeRateProviderRequest $request, ExchangeRateProvider $exchangeRateProvider)
{
$this->authorize('update', $exchangeRateProvider);
$query = $exchangeRateProvider->checkUpdateActiveCurrencies($request);
if (count($query) !== 0) {
return respondJson('currency_used', 'Currency used.');
}
$checkConverterApi = ExchangeRateProvider::checkExchangeRateProviderStatus($request);
if ($checkConverterApi->status() == 200) {
$exchangeRateProvider->updateFromRequest($request);
return new ExchangeRateProviderResource($exchangeRateProvider);
}
return $checkConverterApi;
}
/**
* Remove the specified resource from storage.
*
* @param \Crater\Models\ExchangeRateProvider $exchangeRateProvider
* @return \Illuminate\Http\Response
*/
public function destroy(ExchangeRateProvider $exchangeRateProvider)
{
$this->authorize('delete', $exchangeRateProvider);
if ($exchangeRateProvider->active == true) {
return respondJson('provider_active', 'Provider Active.');
}
$exchangeRateProvider->delete();
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\ExchangeRate;
use Crater\Http\Controllers\Controller;
use Crater\Models\Currency;
use Crater\Models\ExchangeRateProvider;
use Illuminate\Http\Request;
class GetActiveProviderController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Currency $currency)
{
$query = ExchangeRateProvider::whereCompany()->whereJsonContains('currencies', $currency->code)
->where('active', true)
->get();
if (count($query) !== 0) {
return response()->json([
'success' => true,
'message' => 'provider_active',
], 200);
}
return response()->json([
'error' => 'no_active_provider',
], 200);
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\ExchangeRate;
use Crater\Http\Controllers\Controller;
use Crater\Models\CompanySetting;
use Crater\Models\Currency;
use Crater\Models\ExchangeRateLog;
use Crater\Models\ExchangeRateProvider;
use Crater\Traits\ExchangeRateProvidersTrait;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
class GetExchangeRateController extends Controller
{
use ExchangeRateProvidersTrait;
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Currency $currency)
{
$settings = CompanySetting::getSettings(['currency'], $request->header('company'));
$baseCurrency = Currency::findOrFail($settings['currency']);
$query = ExchangeRateProvider::whereJsonContains('currencies', $currency->code)
->where('active', true)
->get()
->toArray();
$exchange_rate = ExchangeRateLog::where('base_currency_id', $currency->id)
->where('currency_id', $baseCurrency->id)
->orderBy('created_at', 'desc')
->value('exchange_rate');
if ($query) {
$filter = Arr::only($query[0], ['key', 'driver', 'driver_config']);
$exchange_rate_value = $this->getExchangeRate($filter, $currency->code, $baseCurrency->code);
if ($exchange_rate_value->status() == 200) {
return $exchange_rate_value;
}
}
if ($exchange_rate) {
return response()->json([
'exchangeRate' => [$exchange_rate],
], 200);
}
return response()->json([
'error' => 'no_exchange_rate_available',
], 200);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\ExchangeRate;
use Crater\Http\Controllers\Controller;
use Crater\Models\ExchangeRateProvider;
use Crater\Traits\ExchangeRateProvidersTrait;
use Illuminate\Http\Request;
class GetSupportedCurrenciesController extends Controller
{
use ExchangeRateProvidersTrait;
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('viewAny', ExchangeRateProvider::class);
return $this->getSupportedCurrencies($request);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\ExchangeRate;
use Crater\Http\Controllers\Controller;
use Crater\Models\ExchangeRateProvider;
use Illuminate\Http\Request;
class GetUsedCurrenciesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('viewAny', ExchangeRateProvider::class);
$providerId = $request->provider_id;
$activeExchangeRateProviders = ExchangeRateProvider::where('active', true)
->whereCompany()
->when($providerId, function ($query) use ($providerId) {
return $query->where('id', '<>', $providerId);
})
->pluck('currencies');
$activeExchangeRateProvider = [];
foreach ($activeExchangeRateProviders as $data) {
if (is_array($data)) {
for ($limit = 0; $limit < count($data); $limit++) {
$activeExchangeRateProvider[] = $data[$limit];
}
}
}
$allExchangeRateProviders = ExchangeRateProvider::whereCompany()->pluck('currencies');
$allExchangeRateProvider = [];
foreach ($allExchangeRateProviders as $data) {
if (is_array($data)) {
for ($limit = 0; $limit < count($data); $limit++) {
$allExchangeRateProvider[] = $data[$limit];
}
}
}
return response()->json([
'allUsedCurrencies' => $allExchangeRateProvider ? $allExchangeRateProvider : [],
'activeUsedCurrencies' => $activeExchangeRateProvider ? $activeExchangeRateProvider : [],
]);
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\ExpenseCategoryRequest;
use Crater\Http\Resources\ExpenseCategoryResource;
use Crater\Models\ExpenseCategory;
use Illuminate\Http\Request;
class ExpenseCategoriesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$this->authorize('viewAny', ExpenseCategory::class);
$limit = $request->has('limit') ? $request->limit : 5;
$categories = ExpenseCategory::applyFilters($request->all())
->whereCompany()
->latest()
->paginateData($limit);
return ExpenseCategoryResource::collection($categories);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ExpenseCategoryRequest $request)
{
$this->authorize('create', ExpenseCategory::class);
$category = ExpenseCategory::create($request->getExpenseCategoryPayload());
return new ExpenseCategoryResource($category);
}
/**
* Display the specified resource.
*
* @param \Crater\Models\ExpenseCategory $category
* @return \Illuminate\Http\Response
*/
public function show(ExpenseCategory $category)
{
$this->authorize('view', $category);
return new ExpenseCategoryResource($category);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\ExpenseCategory $ExpenseCategory
* @return \Illuminate\Http\Response
*/
public function update(ExpenseCategoryRequest $request, ExpenseCategory $category)
{
$this->authorize('update', $category);
$category->update($request->getExpenseCategoryPayload());
return new ExpenseCategoryResource($category);
}
/**
* Remove the specified resource from storage.
*
* @param \Crater\ExpensesCategory $category
* @return \Illuminate\Http\Response
*/
public function destroy(ExpenseCategory $category)
{
$this->authorize('delete', $category);
if ($category->expenses() && $category->expenses()->count() > 0) {
return respondJson('expense_attached', 'Expense Attached');
}
$category->delete();
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\DeleteExpensesRequest;
use Crater\Http\Requests\ExpenseRequest;
use Crater\Http\Resources\ExpenseResource;
use Crater\Models\Expense;
use Illuminate\Http\Request;
class ExpensesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request)
{
$this->authorize('viewAny', Expense::class);
$limit = $request->has('limit') ? $request->limit : 10;
$expenses = Expense::with('category', 'creator', 'fields')
->whereCompany()
->leftJoin('customers', 'customers.id', '=', 'expenses.customer_id')
->join('expense_categories', 'expense_categories.id', '=', 'expenses.expense_category_id')
->applyFilters($request->all())
->select('expenses.*', 'expense_categories.name', 'customers.name as user_name')
->paginateData($limit);
return (ExpenseResource::collection($expenses))
->additional(['meta' => [
'expense_total_count' => Expense::whereCompany()->count(),
]]);
}
/**
* Store a newly created resource in storage.
*
* @param \Crater\Http\Requests\ExpenseRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(ExpenseRequest $request)
{
$this->authorize('create', Expense::class);
$expense = Expense::createExpense($request);
return new ExpenseResource($expense);
}
/**
* Display the specified resource.
*
* @param \Crater\Models\Expense $expense
* @return \Illuminate\Http\JsonResponse
*/
public function show(Expense $expense)
{
$this->authorize('view', $expense);
return new ExpenseResource($expense);
}
/**
* Update the specified resource in storage.
*
* @param \Crater\Http\Requests\ExpenseRequest $request
* @param \Crater\Models\Expense $expense
* @return \Illuminate\Http\JsonResponse
*/
public function update(ExpenseRequest $request, Expense $expense)
{
$this->authorize('update', $expense);
$expense->updateExpense($request);
return new ExpenseResource($expense);
}
public function delete(DeleteExpensesRequest $request)
{
$this->authorize('delete multiple expenses');
Expense::destroy($request->ids);
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Models\Expense;
class ShowReceiptController extends Controller
{
/**
* Retrieve details of an expense receipt from storage.
*
* @param \Crater\Models\Expense $expense
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Expense $expense)
{
$this->authorize('view', $expense);
if ($expense) {
$media = $expense->getFirstMedia('receipts');
if ($media) {
return response()->file($media->getPath());
}
return respondJson('receipt_does_not_exist', 'Receipt does not exist.');
}
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UploadExpenseReceiptRequest;
use Crater\Models\Expense;
class UploadReceiptController extends Controller
{
/**
* Upload the expense receipts to storage.
*
* @param \Crater\Http\Requests\ExpenseRequest $request
* @param Expense $expense
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(UploadExpenseReceiptRequest $request, Expense $expense)
{
$this->authorize('update', $expense);
$data = json_decode($request->attachment_receipt);
if ($data) {
if ($request->type === 'edit') {
$expense->clearMediaCollection('receipts');
}
$expense->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('receipts');
}
return response()->json([
'success' => 'Expense receipts uploaded successfully',
], 200);
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CompanyResource;
use Crater\Http\Resources\UserResource;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Currency;
use Crater\Models\Module;
use Crater\Models\Setting;
use Crater\Traits\GeneratesMenuTrait;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class BootstrapController extends Controller
{
use GeneratesMenuTrait;
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request)
{
$current_user = $request->user();
$current_user_settings = $current_user->getAllSettings();
$main_menu = $this->generateMenu('main_menu', $current_user);
$setting_menu = $this->generateMenu('setting_menu', $current_user);
$companies = $current_user->companies;
$current_company = Company::find($request->header('company'));
if ((! $current_company) || ($current_company && ! $current_user->hasCompany($current_company->id))) {
$current_company = $current_user->companies()->first();
}
$current_company_settings = CompanySetting::getAllSettings($current_company->id);
$current_company_currency = $current_company_settings->has('currency')
? Currency::find($current_company_settings->get('currency'))
: Currency::first();
BouncerFacade::refreshFor($current_user);
$global_settings = Setting::getSettings([
'api_token',
'admin_portal_theme',
'admin_portal_logo',
'login_page_logo',
'login_page_heading',
'login_page_description',
'admin_page_title',
'copyright_text'
]);
return response()->json([
'current_user' => new UserResource($current_user),
'current_user_settings' => $current_user_settings,
'current_user_abilities' => $current_user->getAbilities(),
'companies' => CompanyResource::collection($companies),
'current_company' => new CompanyResource($current_company),
'current_company_settings' => $current_company_settings,
'current_company_currency' => $current_company_currency,
'config' => config('crater'),
'global_settings' => $global_settings,
'main_menu' => $main_menu,
'setting_menu' => $setting_menu,
'modules' => Module::where('enabled', true)->pluck('name'),
]);
}
}

View File

@ -0,0 +1,128 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\BulkExchangeRateRequest;
use Crater\Models\CompanySetting;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Crater\Models\Tax;
class BulkExchangeRateController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(BulkExchangeRateRequest $request)
{
$bulkExchangeRate = CompanySetting::getSetting('bulk_exchange_rate_configured', $request->header('company'));
if ($bulkExchangeRate == 'NO') {
if ($request->currencies) {
foreach ($request->currencies as $currency) {
$currency['exchange_rate'] = $currency['exchange_rate'] ?? 1;
$invoices = Invoice::where('currency_id', $currency['id'])->get();
if ($invoices) {
foreach ($invoices as $invoice) {
$invoice->update([
'exchange_rate' => $currency['exchange_rate'],
'base_discount_val' => $invoice->sub_total * $currency['exchange_rate'],
'base_sub_total' => $invoice->sub_total * $currency['exchange_rate'],
'base_total' => $invoice->total * $currency['exchange_rate'],
'base_tax' => $invoice->tax * $currency['exchange_rate'],
'base_due_amount' => $invoice->due_amount * $currency['exchange_rate']
]);
$this->items($invoice);
}
}
$estimates = Estimate::where('currency_id', $currency['id'])->get();
if ($estimates) {
foreach ($estimates as $estimate) {
$estimate->update([
'exchange_rate' => $currency['exchange_rate'],
'base_discount_val' => $estimate->sub_total * $currency['exchange_rate'],
'base_sub_total' => $estimate->sub_total * $currency['exchange_rate'],
'base_total' => $estimate->total * $currency['exchange_rate'],
'base_tax' => $estimate->tax * $currency['exchange_rate']
]);
$this->items($estimate);
}
}
$taxes = Tax::where('currency_id', $currency['id'])->get();
if ($taxes) {
foreach ($taxes as $tax) {
$tax->base_amount = $tax->base_amount * $currency['exchange_rate'];
$tax->save();
}
}
$payments = Payment::where('currency_id', $currency['id'])->get();
if ($payments) {
foreach ($payments as $payment) {
$payment->exchange_rate = $currency['exchange_rate'];
$payment->base_amount = $payment->amount * $currency['exchange_rate'];
$payment->save();
}
}
}
}
$settings = [
'bulk_exchange_rate_configured' => 'YES'
];
CompanySetting::setSettings($settings, $request->header('company'));
return response()->json([
'success' => true
]);
}
return response()->json([
'error' => false
]);
}
public function items($model)
{
foreach ($model->items as $item) {
$item->update([
'exchange_rate' => $model->exchange_rate,
'base_discount_val' => $item->discount_val * $model->exchange_rate,
'base_price' => $item->price * $model->exchange_rate,
'base_tax' => $item->tax * $model->exchange_rate,
'base_total' => $item->total * $model->exchange_rate
]);
$this->taxes($item);
}
$this->taxes($model);
}
public function taxes($model)
{
if ($model->taxes()->exists()) {
$model->taxes->map(function ($tax) use ($model) {
$tax->update([
'exchange_rate' => $model->exchange_rate,
'base_amount' => $tax->amount * $model->exchange_rate,
]);
});
}
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ConfigController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
$request->key => config('crater.'.$request->key),
]);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CountryResource;
use Crater\Models\Country;
use Illuminate\Http\Request;
class CountriesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request)
{
$countries = Country::all();
return CountryResource::collection($countries);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CurrencyResource;
use Crater\Models\Currency;
use Illuminate\Http\Request;
class CurrenciesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$currencies = Currency::latest()->get();
return CurrencyResource::collection($currencies);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Space\DateFormatter;
use Illuminate\Http\Request;
class DateFormatsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'date_formats' => DateFormatter::get_list(),
]);
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Models\Currency;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Crater\Models\Tax;
use Illuminate\Http\Request;
class GetAllUsedCurrenciesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$invoices = Invoice::where('exchange_rate', null)->pluck('currency_id')->toArray();
$taxes = Tax::where('exchange_rate', null)->pluck('currency_id')->toArray();
$estimates = Estimate::where('exchange_rate', null)->pluck('currency_id')->toArray();
$payments = Payment::where('exchange_rate', null)->pluck('currency_id')->toArray();
$currencies = array_merge($invoices, $taxes, $estimates, $payments);
return response()->json([
'currencies' => Currency::whereIn('id', $currencies)->get()
]);
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Crater\Services\SerialNumberFormatter;
use Illuminate\Http\Request;
class NextNumberController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Invoice $invoice, Estimate $estimate, Payment $payment)
{
$key = $request->key;
$nextNumber = null;
$serial = (new SerialNumberFormatter())
->setCompany($request->header('company'))
->setCustomer($request->userId);
try {
switch ($key) {
case 'invoice':
$nextNumber = $serial->setModel($invoice)
->setModelObject($request->model_id)
->getNextNumber();
break;
case 'estimate':
$nextNumber = $serial->setModel($estimate)
->setModelObject($request->model_id)
->getNextNumber();
break;
case 'payment':
$nextNumber = $serial->setModel($payment)
->setModelObject($request->model_id)
->getNextNumber();
break;
default:
return;
}
} catch (\Exception $exception) {
return response()->json([
'success' => false,
'message' => $exception->getMessage()
]);
}
return response()->json([
'success' => true,
'nextNumber' => $nextNumber,
]);
}
}

View File

@ -0,0 +1,92 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\NotesRequest;
use Crater\Http\Resources\NoteResource;
use Crater\Models\Note;
use Illuminate\Http\Request;
class NotesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$this->authorize('view notes');
$limit = $request->limit ?? 10;
$notes = Note::latest()
->whereCompany()
->applyFilters($request->all())
->paginate($limit);
return NoteResource::collection($notes);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(NotesRequest $request)
{
$this->authorize('manage notes');
$note = Note::create($request->getNotesPayload());
return new NoteResource($note);
}
/**
* Display the specified resource.
*
* @param \Crater\Models\Note $note
* @return \Illuminate\Http\Response
*/
public function show(Note $note)
{
$this->authorize('view notes');
return new NoteResource($note);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\Note $note
* @return \Illuminate\Http\Response
*/
public function update(NotesRequest $request, Note $note)
{
$this->authorize('manage notes');
$note->update($request->getNotesPayload());
return new NoteResource($note);
}
/**
* Remove the specified resource from storage.
*
* @param \Crater\Models\Note $note
* @return \Illuminate\Http\Response
*/
public function destroy(Note $note)
{
$this->authorize('manage notes');
$note->delete();
return response()->json([
'success' => true,
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\General;
use Crater\Http\Controllers\Controller;
use Crater\Services\SerialNumberFormatter;
use Illuminate\Http\Request;
class NumberPlaceholdersController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
if ($request->format) {
$placeholders = SerialNumberFormatter::getPlaceholders($request->format);
} else {
$placeholders = [];
}
return response()->json([
'success' => true,
'placeholders' => $placeholders,
]);
}
}

Some files were not shown because too many files have changed in this diff Show More