Compare commits

...

331 Commits

Author SHA1 Message Date
e1baac7e3f upgrade vite 2023-04-28 15:45:10 +05:30
05d5ce26fd Adds Zip to the required PHP Extension check (#1146)
* Ignore .DS_Store

* Checks for required ZIP extension
2023-02-19 11:42:34 +05:30
393fe20010 Fix incorrect invoice creation message (#1109)
Creation message now includes the views disk in its path.
2022-12-17 18:20:51 +05:30
57bdbd2897 feat: front-end files bulding (#1098)
Co-authored-by: Aramayis <>
2022-12-17 18:19: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
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
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
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
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
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
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
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
896 changed files with 55458 additions and 18756 deletions

View File

@ -36,3 +36,5 @@ SANCTUM_STATEFUL_DOMAINS=crater.test
SESSION_DOMAIN=crater.test
TRUSTED_PROXIES="*"
CRON_JOB_AUTH_TOKEN=""

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

@ -0,0 +1,161 @@
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: 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
build-nginx:
needs:
- build-application
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
build-args: |
BASE_IMAGE=${{ needs.build-application.outputs.tags }}
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

6
.gitignore vendored
View File

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

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,44 +1,40 @@
FROM php:7.4-fpm-alpine
FROM php:8.1-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# 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
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pecl install imagick \
&& docker-php-ext-enable imagick
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# 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
# Set working directory
WORKDIR /var/www
RUN apk add --no-cache \
$PHPIZE_DEPS \
freetype-dev \
git \
zip \
libzip-dev \
php7-bcmath \
curl \
unzip \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev \
mariadb-client \
sqlite \
php7-json \
php7-openssl \
php7-pdo \
php7-pdo_mysql \
php7-session \
php7-simplexml \
php7-tokenizer \
php7-xml \
imagemagick \
imagemagick-libs \
imagemagick-dev \
php7-imagick \
php7-pcntl \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ gnu-libiconv=1.15-r3
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN printf "\n" | pecl install \
imagick && \
docker-php-ext-enable --ini-name 20-imagick.ini imagick
RUN docker-php-ext-configure zip
RUN docker-php-ext-install zip
RUN docker-php-ext-install iconv pdo pdo_mysql bcmath pcntl exif
RUN docker-php-ext-configure gd --with-jpeg --with-freetype
RUN docker-php-ext-install gd
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.

View File

@ -40,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

@ -52,9 +52,10 @@ class CreateTemplateCommand extends Command
}
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");
$path = resource_path("views/app/pdf/{$type}/{$templateName}.blade.php");
$type = ucfirst($type);
$this->info("{$type} Template created successfully at ".$path);

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

@ -2,6 +2,7 @@
namespace Crater\Console;
use Crater\Models\CompanySetting;
use Crater\Models\RecurringInvoice;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@ -16,7 +17,8 @@ class Kernel extends ConsoleKernel
protected $commands = [
Commands\ResetApp::class,
Commands\UpdateCommand::class,
Commands\CreateTemplateCommand::class
Commands\CreateTemplateCommand::class,
Commands\InstallModuleCommand::class,
];
/**
@ -27,17 +29,21 @@ 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) {
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency);
$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

@ -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

@ -45,6 +45,8 @@ class ForgotPasswordController extends Controller
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{
return response('Email could not be sent to this email address.', 403);
return response()->json([
'error' => 'Email could not be sent to this email address.'
], 403);
}
}

View File

@ -12,6 +12,7 @@ use Crater\Models\Expense;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class DashboardController extends Controller
{
@ -151,8 +152,8 @@ class DashboardController extends Controller
'total_invoice_count' => $total_invoice_count,
'total_estimate_count' => $total_estimate_count,
'recent_due_invoices' => $recent_due_invoices,
'recent_estimates' => $recent_estimates,
'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,

View File

@ -83,6 +83,8 @@ class ConvertEstimateController extends Controller
'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);

View File

@ -21,6 +21,9 @@ class SendEstimatePreviewController extends Controller
$markdown = new Markdown(view(), config('mail.markdown'));
return $markdown->render('emails.send.estimate', ['data' => $estimate->sendEstimateData($request->all())]);
$data = $estimate->sendEstimateData($request->all());
$data['url'] = $estimate->estimatePdfUrl;
return $markdown->render('emails.send.estimate', ['data' => $data]);
}
}

View File

@ -39,7 +39,7 @@ class ExpensesController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Http\Requests\ExpenseRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(ExpenseRequest $request)
@ -67,7 +67,7 @@ class ExpensesController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Http\Requests\ExpenseRequest $request
* @param \Crater\Models\Expense $expense
* @return \Illuminate\Http\JsonResponse
*/

View File

@ -3,19 +3,19 @@
namespace Crater\Http\Controllers\V1\Admin\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UploadExpenseReceiptRequest;
use Crater\Models\Expense;
use Illuminate\Http\Request;
class UploadReceiptController extends Controller
{
/**
* Upload the expense receipts to storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Http\Requests\ExpenseRequest $request
* @param Expense $expense
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request, Expense $expense)
public function __invoke(UploadExpenseReceiptRequest $request, Expense $expense)
{
$this->authorize('update', $expense);

View File

@ -8,6 +8,8 @@ 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;
@ -47,6 +49,17 @@ class BootstrapController extends Controller
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,
@ -56,8 +69,10 @@ class BootstrapController extends Controller
'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

@ -20,6 +20,7 @@ class SearchController extends Controller
$user = $request->user();
$customers = Customer::applyFilters($request->only(['search']))
->whereCompany()
->latest()
->paginate(10);

View File

@ -76,6 +76,8 @@ class CloneInvoiceController extends Controller
'base_tax' => $invoice->tax * $exchange_rate,
'base_due_amount' => $invoice->total * $exchange_rate,
'currency_id' => $invoice->currency_id,
'sales_tax_type' => $invoice->sales_tax_type,
'sales_tax_address_type' => $invoice->sales_tax_address_type,
]);
$newInvoice->unique_hash = Hashids::connection(Invoice::class)->encode($newInvoice->id);

View File

@ -102,7 +102,7 @@ class InvoicesController extends Controller
{
$this->authorize('delete multiple invoices');
Invoice::destroy($request->ids);
Invoice::deleteInvoices($request->ids);
return response()->json([
'success' => true,

View File

@ -21,6 +21,9 @@ class SendInvoicePreviewController extends Controller
$markdown = new Markdown(view(), config('mail.markdown'));
return $markdown->render('emails.send.invoice', ['data' => $invoice->sendInvoiceData($request->all())]);
$data = $invoice->sendInvoiceData($request->all());
$data['url'] = $invoice->invoicePdfUrl;
return $markdown->render('emails.send.invoice', ['data' => $data]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Space\ModuleInstaller;
use Illuminate\Http\Request;
class ApiTokenController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::checkToken($request->api_token);
return $response;
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Space\ModuleInstaller;
use Illuminate\Http\Request;
class CompleteModuleInstallationController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::complete($request->module, $request->version);
return response()->json([
'success' => $response
]);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Space\ModuleInstaller;
use Illuminate\Http\Request;
class CopyModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::copyFiles($request->module, $request->path);
return response()->json([
'success' => $response
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Events\ModuleDisabledEvent;
use Crater\Http\Controllers\Controller;
use Crater\Models\Module as ModelsModule;
use Illuminate\Http\Request;
use Nwidart\Modules\Facades\Module;
class DisableModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, string $module)
{
$this->authorize('manage modules');
$module = ModelsModule::where('name', $module)->first();
$module->update(['enabled' => false]);
$installedModule = Module::find($module->name);
$installedModule->disable();
ModuleDisabledEvent::dispatch($module);
return response()->json(['success' => true]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Space\ModuleInstaller;
use Illuminate\Http\Request;
class DownloadModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::download($request->module, $request->version);
return response()->json($response);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Events\ModuleEnabledEvent;
use Crater\Http\Controllers\Controller;
use Crater\Models\Module as ModelsModule;
use Illuminate\Http\Request;
use Nwidart\Modules\Facades\Module;
class EnableModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, string $module)
{
$this->authorize('manage modules');
$module = ModelsModule::where('name', $module)->first();
$module->update(['enabled' => true]);
$installedModule = Module::find($module->name);
$installedModule->enable();
ModuleEnabledEvent::dispatch($module);
return response()->json(['success' => true]);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\ModuleResource;
use Crater\Space\ModuleInstaller;
use Illuminate\Http\Request;
class ModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, string $module)
{
$this->authorize('manage modules');
$response = ModuleInstaller::getModule($module);
if (! $response->success) {
return response()->json($response);
}
return (new ModuleResource($response->module))
->additional(['meta' => [
'modules' => ModuleResource::collection(collect($response->modules))
]]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Space\ModuleInstaller;
use Illuminate\Http\Request;
class ModulesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::getModules();
return $response;
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UnzipUpdateRequest;
use Crater\Space\ModuleInstaller;
class UnzipModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\UnzipUpdateRequest $request
* @return \Illuminate\Http\Response
*/
public function __invoke(UnzipUpdateRequest $request)
{
$this->authorize('manage modules');
$path = ModuleInstaller::unzip($request->module, $request->path);
return response()->json([
'success' => true,
'path' => $path
]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UploadModuleRequest;
use Crater\Space\ModuleInstaller;
class UploadModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\UploadModuleRequest $request
* @return \Illuminate\Http\Response
*/
public function __invoke(UploadModuleRequest $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::upload($request);
return response()->json($response);
}
}

View File

@ -22,6 +22,7 @@ class PaymentMethodsController extends Controller
$limit = $request->has('limit') ? $request->limit : 5;
$paymentMethods = PaymentMethod::applyFilters($request->all())
->where('type', PaymentMethod::TYPE_GENERAL)
->whereCompany()
->latest()
->paginateData($limit);
@ -68,7 +69,7 @@ class PaymentMethodsController extends Controller
{
$this->authorize('update', $paymentMethod);
$paymentMethod->update($request->validated());
$paymentMethod->update($request->getPaymentMethodPayload());
return new PaymentMethodResource($paymentMethod);
}
@ -83,12 +84,14 @@ class PaymentMethodsController extends Controller
{
$this->authorize('delete', $paymentMethod);
$payments = $paymentMethod->payments;
if ($payments->count() > 0) {
if ($paymentMethod->payments()->exists()) {
return respondJson('payments_attached', 'Payments Attached.');
}
if ($paymentMethod->expenses()->exists()) {
return respondJson('expenses_attached', 'Expenses Attached.');
}
$paymentMethod->delete();
return response()->json([

View File

@ -21,6 +21,9 @@ class SendPaymentPreviewController extends Controller
$markdown = new Markdown(view(), config('mail.markdown'));
return $markdown->render('emails.send.payment', ['data' => $payment->sendPaymentData($request->all())]);
$data = $payment->sendPaymentData($request->all());
$data['url'] = $payment->paymentPdfUrl;
return $markdown->render('emails.send.payment', ['data' => $data]);
}
}

View File

@ -2,24 +2,25 @@
namespace Crater\Http\Controllers\V1\Admin\Report;
use PDF;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Currency;
use Crater\Models\Customer;
use Illuminate\Http\Request;
use Crater\Models\CompanySetting;
use Illuminate\Support\Facades\App;
use PDF;
use Crater\Http\Controllers\Controller;
class CustomerSalesReportController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request, $hash)
{
$company = Company::where('unique_hash', $hash)->first();
@ -47,7 +48,7 @@ class CustomerSalesReportController extends Controller
foreach ($customers as $customer) {
$customerTotalAmount = 0;
foreach ($customer->invoices as $invoice) {
$customerTotalAmount += $invoice->total;
$customerTotalAmount += $invoice->base_total;
}
$customer->totalAmount = $customerTotalAmount;
$totalAmount += $customerTotalAmount;
@ -56,6 +57,7 @@ class CustomerSalesReportController extends Controller
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('Y-m-d', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('Y-m-d', $request->to_date)->format($dateFormat);
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', $company->id));
$colors = [
'primary_text_color',
@ -80,6 +82,7 @@ class CustomerSalesReportController extends Controller
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date,
'currency' => $currency,
]);
$pdf = PDF::loadView('app.pdf.reports.sales-customers');

View File

@ -2,24 +2,25 @@
namespace Crater\Http\Controllers\V1\Admin\Report;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Expense;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use PDF;
use Carbon\Carbon;
use Crater\Models\Company;
use Crater\Models\Expense;
use Crater\Models\Currency;
use Illuminate\Http\Request;
use Crater\Models\CompanySetting;
use Illuminate\Support\Facades\App;
use Crater\Http\Controllers\Controller;
class ExpensesReportController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request, $hash)
{
$company = Company::where('unique_hash', $hash)->first();
@ -43,6 +44,7 @@ class ExpensesReportController extends Controller
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('Y-m-d', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('Y-m-d', $request->to_date)->format($dateFormat);
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', $company->id));
$colors = [
'primary_text_color',
@ -66,6 +68,7 @@ class ExpensesReportController extends Controller
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date,
'currency' => $currency,
]);
$pdf = PDF::loadView('app.pdf.reports.expenses');

View File

@ -2,24 +2,25 @@
namespace Crater\Http\Controllers\V1\Admin\Report;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\InvoiceItem;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use PDF;
use Carbon\Carbon;
use Crater\Models\Company;
use Crater\Models\Currency;
use Illuminate\Http\Request;
use Crater\Models\InvoiceItem;
use Crater\Models\CompanySetting;
use Illuminate\Support\Facades\App;
use Crater\Http\Controllers\Controller;
class ItemSalesReportController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request, $hash)
{
$company = Company::where('unique_hash', $hash)->first();
@ -43,6 +44,7 @@ class ItemSalesReportController extends Controller
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('Y-m-d', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('Y-m-d', $request->to_date)->format($dateFormat);
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', $company->id));
$colors = [
'primary_text_color',
@ -66,6 +68,7 @@ class ItemSalesReportController extends Controller
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date,
'currency' => $currency,
]);
$pdf = PDF::loadView('app.pdf.reports.sales-items');

View File

@ -2,25 +2,26 @@
namespace Crater\Http\Controllers\V1\Admin\Report;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Expense;
use Crater\Models\Invoice;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use PDF;
use Carbon\Carbon;
use Crater\Models\Company;
use Crater\Models\Expense;
use Crater\Models\Payment;
use Crater\Models\Currency;
use Illuminate\Http\Request;
use Crater\Models\CompanySetting;
use Illuminate\Support\Facades\App;
use Crater\Http\Controllers\Controller;
class ProfitLossReportController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request, $hash)
{
$company = Company::where('unique_hash', $hash)->first();
@ -31,10 +32,9 @@ class ProfitLossReportController extends Controller
App::setLocale($locale);
$invoicesAmount = Invoice::whereCompanyId($company->id)
$paymentsAmount = Payment::whereCompanyId($company->id)
->applyFilters($request->only(['from_date', 'to_date']))
->wherePaidStatus(Invoice::STATUS_PAID)
->sum('total');
->sum('base_amount');
$expenseCategories = Expense::with('category')
->whereCompanyId($company->id)
@ -50,6 +50,8 @@ class ProfitLossReportController extends Controller
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('Y-m-d', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('Y-m-d', $request->to_date)->format($dateFormat);
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', $company->id));
$colors = [
'primary_text_color',
@ -68,13 +70,14 @@ class ProfitLossReportController extends Controller
view()->share([
'company' => $company,
'income' => $invoicesAmount,
'income' => $paymentsAmount,
'expenseCategories' => $expenseCategories,
'totalExpense' => $totalAmount,
'colorSettings' => $colorSettings,
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date,
'currency' => $currency,
]);
$pdf = PDF::loadView('app.pdf.reports.profit-loss');

View File

@ -2,24 +2,25 @@
namespace Crater\Http\Controllers\V1\Admin\Report;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Tax;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use PDF;
use Carbon\Carbon;
use Crater\Models\Tax;
use Crater\Models\Company;
use Crater\Models\Currency;
use Illuminate\Http\Request;
use Crater\Models\CompanySetting;
use Illuminate\Support\Facades\App;
use Crater\Http\Controllers\Controller;
class TaxSummaryReportController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $hash
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request, $hash)
{
$company = Company::where('unique_hash', $hash)->first();
@ -44,6 +45,8 @@ class TaxSummaryReportController extends Controller
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
$from_date = Carbon::createFromFormat('Y-m-d', $request->from_date)->format($dateFormat);
$to_date = Carbon::createFromFormat('Y-m-d', $request->to_date)->format($dateFormat);
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', $company->id));
$colors = [
'primary_text_color',
@ -68,6 +71,7 @@ class TaxSummaryReportController extends Controller
'company' => $company,
'from_date' => $from_date,
'to_date' => $to_date,
'currency' => $currency,
]);
$pdf = PDF::loadView('app.pdf.reports.tax-summary');

View File

@ -3,6 +3,8 @@
namespace Crater\Http\Controllers\V1\Admin\Settings;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\AvatarRequest;
use Crater\Http\Requests\CompanyLogoRequest;
use Crater\Http\Requests\CompanyRequest;
use Crater\Http\Requests\ProfileRequest;
use Crater\Http\Resources\CompanyResource;
@ -48,7 +50,7 @@ class CompanyController extends Controller
$this->authorize('manage company', $company);
$company->update($request->only('name'));
$company->update($request->getCompanyPayload());
$company->address()->updateOrCreate(['company_id' => $company->id], $request->address);
@ -58,10 +60,10 @@ class CompanyController extends Controller
/**
* Upload the company logo to storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Http\Requests\CompanyLogoRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function uploadCompanyLogo(Request $request)
public function uploadCompanyLogo(CompanyLogoRequest $request)
{
$company = Company::find($request->header('company'));
@ -69,6 +71,9 @@ class CompanyController extends Controller
$data = json_decode($request->company_logo);
if (isset($request->is_company_logo_removed) && (bool) $request->is_company_logo_removed) {
$company->clearMediaCollection('logo');
}
if ($data) {
$company = Company::find($request->header('company'));
@ -89,13 +94,16 @@ class CompanyController extends Controller
/**
* Upload the Admin Avatar to public storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Http\Requests\AvatarRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function uploadAvatar(Request $request)
public function uploadAvatar(AvatarRequest $request)
{
$user = auth()->user();
if (isset($request->is_admin_avatar_removed) && (bool) $request->is_admin_avatar_removed) {
$user->clearMediaCollection('admin_avatar');
}
if ($user && $request->hasFile('admin_avatar')) {
$user->clearMediaCollection('admin_avatar');

View File

@ -0,0 +1,27 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Settings;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Illuminate\Http\Request;
class CompanyCurrencyCheckTransactionsController 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'));
$this->authorize('manage company', $company);
return response()->json([
'has_transactions' => $company->hasTransactions(),
]);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Settings;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\GetSettingRequest;
use Crater\Models\Setting;
use Illuminate\Http\Request;
class GetSettingsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(GetSettingRequest $request)
{
$this->authorize('manage settings');
$setting = Setting::getSetting($request->key);
return response()->json([
$request->key => $setting
]);
}
}

View File

@ -22,6 +22,7 @@ class TaxTypesController extends Controller
$limit = $request->has('limit') ? $request->limit : 5;
$taxTypes = TaxType::applyFilters($request->all())
->where('type', TaxType::TYPE_GENERAL)
->whereCompany()
->latest()
->paginateData($limit);

View File

@ -6,6 +6,7 @@ use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UpdateSettingsRequest;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Illuminate\Support\Arr;
class UpdateCompanySettingsController extends Controller
{
@ -17,9 +18,23 @@ class UpdateCompanySettingsController extends Controller
*/
public function __invoke(UpdateSettingsRequest $request)
{
$this->authorize('manage company', Company::find($request->header('company')));
$company = Company::find($request->header('company'));
$this->authorize('manage company', $company);
CompanySetting::setSettings($request->settings, $request->header('company'));
$data = $request->settings;
if (
Arr::exists($data, 'currency') &&
(CompanySetting::getSetting('currency', $company->id) !== $data['currency']) &&
$company->hasTransactions()
) {
return response()->json([
'success' => false,
'message' => 'Cannot update company currency after transactions are created.'
]);
}
CompanySetting::setSettings($data, $request->header('company'));
return response()->json([
'success' => true,

View File

@ -0,0 +1,29 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Settings;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\SettingRequest;
use Crater\Models\Setting;
use Illuminate\Http\Request;
class UpdateSettingsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(SettingRequest $request)
{
$this->authorize('manage settings');
Setting::setSettings($request->settings);
return response()->json([
'success' => true,
$request->settings
]);
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Auth;
use Crater\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
use Password;
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;
public function broker()
{
return Password::broker('customers');
}
/**
* 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('Email could not be sent to this email address.', 403);
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\Customer\CustomerLoginRequest;
use Crater\Models\Company;
use Crater\Models\Customer;
use Hash;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class LoginController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\Customer\CustomerLoginRequest $request
* @return \Illuminate\Http\Response
*/
public function __invoke(CustomerLoginRequest $request, Company $company)
{
$user = Customer::where('email', $request->email)
->where('company_id', $company->id)
->first();
if (! $user || ! Hash::check($request->password, $user->password)) {
throw ValidationException::withMessages([
'email' => ['The provided credentials are incorrect.'],
]);
}
if (! $user->enable_portal) {
throw ValidationException::withMessages([
'email' => ['Customer portal not available for this user.'],
]);
}
Auth::guard('customer')->login($user);
return response()->json([
'success' => true
]);
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\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;
use Password;
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::CUSTOMER_HOME;
public function broker()
{
return Password::broker('customers');
}
/**
* 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,36 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\EstimateResource;
use Crater\Models\Company;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AcceptEstimateController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param Estimate $estimate
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Company $company, $id)
{
$estimate = $company->estimates()
->whereCustomer(Auth::guard('customer')->id())
->where('id', $id)
->first();
if (! $estimate) {
return response()->json(['error' => 'estimate_not_found'], 404);
}
$estimate->update($request->only('status'));
return new EstimateResource($estimate);
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\EstimateResource;
use Crater\Models\Company;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class EstimatesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$limit = $request->has('limit') ? $request->limit : 10;
$estimates = Estimate::with([
'items',
'customer',
'taxes',
'creator',
])
->where('status', '<>', 'DRAFT')
->whereCustomer(Auth::guard('customer')->id())
->applyFilters($request->only([
'status',
'estimate_number',
'from_date',
'to_date',
'orderByField',
'orderBy',
]))
->latest()
->paginateData($limit);
return (EstimateResource::collection($estimates))
->additional(['meta' => [
'estimateTotalCount' => Estimate::where('status', '<>', 'DRAFT')->whereCustomer(Auth::guard('customer')->id())->count(),
]]);
}
/**
* Display the specified resource.
*
* @param Estimate $estimate
* @return \Illuminate\Http\Response
*/
public function show(Company $company, $id)
{
$estimate = $company->estimates()
->whereCustomer(Auth::guard('customer')->id())
->where('id', $id)
->first();
if (! $estimate) {
return response()->json(['error' => 'estimate_not_found'], 404);
}
return new EstimateResource($estimate);
}
}

View File

@ -3,41 +3,51 @@
namespace Crater\Http\Controllers\V1\Customer;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\EstimateResource;
use Crater\Mail\EstimateViewedMail;
use Crater\Models\CompanySetting;
use Crater\Models\Customer;
use Crater\Models\EmailLog;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimatePdfController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Estimate $estimate)
public function getPdf(EmailLog $emailLog, Request $request)
{
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
);
$estimate = Estimate::find($emailLog->mailable_id);
if ($notifyEstimateViewed == 'YES') {
$data['estimate'] = Estimate::findOrFail($estimate->id)->toArray();
$data['user'] = Customer::find($estimate->customer_id)->toArray();
$notificationEmail = CompanySetting::getSetting(
'notification_email',
if (! $emailLog->isExpired()) {
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
);
\Mail::to($notificationEmail)->send(new EstimateViewedMail($data));
if ($notifyEstimateViewed == 'YES') {
$data['estimate'] = Estimate::findOrFail($estimate->id)->toArray();
$data['user'] = Customer::find($estimate->customer_id)->toArray();
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$estimate->company_id
);
\Mail::to($notificationEmail)->send(new EstimateViewedMail($data));
}
}
return $estimate->getGeneratedPDFOrStream('estimate');
}
return $estimate->getGeneratedPDFOrStream('estimate');
abort(403, 'Link Expired.');
}
public function getEstimate(EmailLog $emailLog)
{
$estimate = Estimate::find($emailLog->mailable_id);
return new EstimateResource($estimate);
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\ExpenseResource;
use Crater\Models\Company;
use Crater\Models\Expense;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
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', 'creator', 'fields')
->whereUser(Auth::guard('customer')->id())
->applyFilters($request->only([
'expense_category_id',
'from_date',
'to_date',
'orderByField',
'orderBy',
]))
->paginateData($limit);
return (ExpenseResource::collection($expenses))
->additional(['meta' => [
'expenseTotalCount' => Expense::whereCustomer(Auth::guard('customer')->id())->count(),
]]);
}
/**
* Display the specified resource.
*
* @param \Crater\Models\Expense $expense
* @return \Illuminate\Http\Response
*/
public function show(Company $company, $id)
{
$expense = $company->expenses()
->whereUser(Auth::guard('customer')->id())
->where('id', $id)
->first();
if (! $expense) {
return response()->json(['error' => 'expense_not_found'], 404);
}
return new ExpenseResource($expense);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\CustomerResource;
use Crater\Models\Currency;
use Crater\Models\Module;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class BootstrapController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$customer = Auth::guard('customer')->user();
foreach (\Menu::get('customer_portal_menu')->items->toArray() as $data) {
if ($customer) {
$menu[] = [
'title' => $data->title,
'link' => $data->link->path['url'],
];
}
}
return (new CustomerResource($customer))
->additional(['meta' => [
'menu' => $menu,
'current_customer_currency' => Currency::find($customer->currency_id),
'modules' => Module::where('enabled', true)->pluck('name'),
]]);
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\General;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$user = Auth::guard('customer')->user();
$amountDue = Invoice::whereCustomer($user->id)
->where('status', '<>', 'DRAFT')
->sum('due_amount');
$invoiceCount = Invoice::whereCustomer($user->id)
->where('status', '<>', 'DRAFT')
->count();
$estimatesCount = Estimate::whereCustomer($user->id)
->where('status', '<>', 'DRAFT')
->count();
$paymentCount = Payment::whereCustomer($user->id)
->count();
return response()->json([
'due_amount' => $amountDue,
'recentInvoices' => Invoice::whereCustomer($user->id)->where('status', '<>', 'DRAFT')->take(5)->latest()->get(),
'recentEstimates' => Estimate::whereCustomer($user->id)->where('status', '<>', 'DRAFT')->take(5)->latest()->get(),
'invoice_count' => $invoiceCount,
'estimate_count' => $estimatesCount,
'payment_count' => $paymentCount,
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\General;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\Customer\CustomerProfileRequest;
use Crater\Http\Resources\Customer\CustomerResource;
use Crater\Models\Company;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class ProfileController extends Controller
{
public function updateProfile(Company $company, CustomerProfileRequest $request)
{
$customer = Auth::guard('customer')->user();
$customer->update($request->validated());
if (isset($request->is_customer_avatar_removed) && (bool) $request->is_customer_avatar_removed) {
$customer->clearMediaCollection('customer_avatar');
}
if ($customer && $request->hasFile('customer_avatar')) {
$customer->clearMediaCollection('customer_avatar');
$customer->addMediaFromRequest('customer_avatar')
->toMediaCollection('customer_avatar');
}
if ($request->billing !== null) {
$customer->shippingAddress()->delete();
$customer->addresses()->create($request->getShippingAddress());
}
if ($request->shipping !== null) {
$customer->billingAddress()->delete();
$customer->addresses()->create($request->getBillingAddress());
}
return new CustomerResource($customer);
}
public function getUser(Request $request)
{
$customer = Auth::guard('customer')->user();
return new CustomerResource($customer);
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Invoice;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\InvoiceResource;
use Crater\Models\Company;
use Crater\Models\Invoice;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
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', 'customer', 'creator', 'taxes'])
->where('status', '<>', 'DRAFT')
->applyFilters($request->all())
->whereCustomer(Auth::guard('customer')->id())
->latest()
->paginateData($limit);
return (InvoiceResource::collection($invoices))
->additional(['meta' => [
'invoiceTotalCount' => Invoice::where('status', '<>', 'DRAFT')->whereCustomer(Auth::guard('customer')->id())->count(),
]]);
}
public function show(Company $company, $id)
{
$invoice = $company->invoices()
->whereCustomer(Auth::guard('customer')->id())
->where('id', $id)
->first();
if (! $invoice) {
return response()->json(['error' => 'invoice_not_found'], 404);
}
return new InvoiceResource($invoice);
}
}

View File

@ -3,42 +3,59 @@
namespace Crater\Http\Controllers\V1\Customer;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\InvoiceResource as CustomerInvoiceResource;
use Crater\Mail\InvoiceViewedMail;
use Crater\Models\CompanySetting;
use Crater\Models\Customer;
use Crater\Models\EmailLog;
use Crater\Models\Invoice;
use Illuminate\Http\Request;
class InvoicePdfController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Invoice $invoice)
public function getPdf(EmailLog $emailLog, Request $request)
{
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
);
$invoice = Invoice::find($emailLog->mailable_id);
if ($notifyInvoiceViewed == 'YES') {
$data['invoice'] = Invoice::findOrFail($invoice->id)->toArray();
$data['user'] = Customer::find($invoice->customer_id)->toArray();
$notificationEmail = CompanySetting::getSetting(
'notification_email',
if (! $emailLog->isExpired()) {
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
);
\Mail::to($notificationEmail)->send(new InvoiceViewedMail($data));
if ($notifyInvoiceViewed == 'YES') {
$data['invoice'] = Invoice::findOrFail($invoice->id)->toArray();
$data['user'] = Customer::find($invoice->customer_id)->toArray();
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$invoice->company_id
);
\Mail::to($notificationEmail)->send(new InvoiceViewedMail($data));
}
}
if ($request->has('pdf')) {
return $invoice->getGeneratedPDFOrStream('invoice');
}
return view('app')->with([
'customer_logo' => get_company_setting('customer_portal_logo', $invoice->company_id),
'current_theme' => get_company_setting('customer_portal_theme', $invoice->company_id)
]);
}
return $invoice->getGeneratedPDFOrStream('invoice');
abort(403, 'Link Expired.');
}
public function getInvoice(EmailLog $emailLog)
{
$invoice = Invoice::find($emailLog->mailable_id);
return new CustomerInvoiceResource($invoice);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Payment;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\PaymentMethodResource;
use Crater\Models\Company;
use Crater\Models\PaymentMethod;
use Illuminate\Http\Request;
class PaymentMethodController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Company $company)
{
return PaymentMethodResource::collection(PaymentMethod::where('company_id', $company->id)->get());
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Crater\Http\Controllers\V1\Customer\Payment;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\Customer\PaymentResource;
use Crater\Models\Company;
use Crater\Models\Payment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class PaymentsController 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(['customer', 'invoice', 'paymentMethod', 'creator'])
->whereCustomer(Auth::guard('customer')->id())
->leftJoin('invoices', 'invoices.id', '=', 'payments.invoice_id')
->applyFilters($request->only([
'payment_number',
'payment_method_id',
'orderByField',
'orderBy',
]))
->select('payments.*', 'invoices.invoice_number')
->latest()
->paginateData($limit);
return (PaymentResource::collection($payments))
->additional(['meta' => [
'paymentTotalCount' => Payment::whereCustomer(Auth::guard('customer')->id())->count(),
]]);
}
/**
* Display the specified resource.
*
* @param \Crater\Models\Payment $payment
* @return \Illuminate\Http\Response
*/
public function show(Company $company, $id)
{
$payment = $company->payments()
->whereCustomer(Auth::guard('customer')->id())
->where('id', $id)
->first();
if (! $payment) {
return response()->json(['error' => 'payment_not_found'], 404);
}
return new PaymentResource($payment);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Crater\Http\Controllers\V1\Customer;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\PaymentResource;
use Crater\Models\EmailLog;
use Crater\Models\Payment;
use Illuminate\Http\Request;
class PaymentPdfController extends Controller
{
public function getPdf(EmailLog $emailLog, Request $request)
{
if (! $emailLog->isExpired()) {
return $emailLog->mailable->getGeneratedPDFOrStream('payment');
}
abort(403, 'Link Expired.');
}
public function getPayment(EmailLog $emailLog)
{
$payment = Payment::find($emailLog->mailable_id);
return new PaymentResource($payment);
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Crater\Http\Controllers\V1\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Services\Module\ModuleFacade;
use DateTime;
use Illuminate\Support\Arr;
use Request;
class ScriptController extends Controller
{
/**
* Serve the requested script.
*
* @param \Request $request
* @return \Illuminate\Http\Response
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function __invoke(Request $request, string $script)
{
$path = Arr::get(ModuleFacade::allScripts(), $script);
abort_if(is_null($path), 404);
return response(
file_get_contents($path),
200,
[
'Content-Type' => 'application/javascript',
]
)->setLastModified(DateTime::createFromFormat('U', filemtime($path)));
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Crater\Http\Controllers\V1\Modules;
use Crater\Http\Controllers\Controller;
use Crater\Services\Module\ModuleFacade;
use DateTime;
use Illuminate\Support\Arr;
use Request;
class StyleController extends Controller
{
/**
* Serve the requested stylesheet.
*
* @param \Request $request
* @return \Illuminate\Http\Response
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function __invoke(Request $request, string $style)
{
$path = Arr::get(ModuleFacade::allStyles(), $style);
abort_if(is_null($path), 404);
return response(
file_get_contents($path),
200,
[
'Content-Type' => 'text/css',
]
)->setLastModified(DateTime::createFromFormat('U', filemtime($path)));
}
}

View File

@ -17,6 +17,8 @@ class DownloadReceiptController extends Controller
*/
public function __invoke(Expense $expense)
{
$this->authorize('view', $expense);
if ($expense) {
$media = $expense->getFirstMedia('receipts');
if ($media) {

View File

@ -4,6 +4,7 @@ namespace Crater\Http\Controllers\V1\PDF;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimatePdfController extends Controller
{
@ -13,8 +14,13 @@ class EstimatePdfController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Estimate $estimate)
public function __invoke(Request $request, Estimate $estimate)
{
if ($request->has('preview')) {
return $estimate->getPDFData();
}
return $estimate->getGeneratedPDFOrStream('estimate');
}
}

View File

@ -4,6 +4,7 @@ namespace Crater\Http\Controllers\V1\PDF;
use Crater\Http\Controllers\Controller;
use Crater\Models\Invoice;
use Illuminate\Http\Request;
class InvoicePdfController extends Controller
{
@ -13,8 +14,12 @@ class InvoicePdfController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Invoice $invoice)
public function __invoke(Request $request, Invoice $invoice)
{
if ($request->has('preview')) {
return $invoice->getPDFData();
}
return $invoice->getGeneratedPDFOrStream('invoice');
}
}

View File

@ -4,6 +4,7 @@ namespace Crater\Http\Controllers\V1\PDF;
use Crater\Http\Controllers\Controller;
use Crater\Models\Payment;
use Illuminate\Http\Request;
class PaymentPdfController extends Controller
{
@ -13,8 +14,12 @@ class PaymentPdfController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Payment $payment)
public function __invoke(Request $request, Payment $payment)
{
if ($request->has('preview')) {
return view('app.pdf.payment.payment');
}
return $payment->getGeneratedPDFOrStream('payment');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Crater\Http\Controllers\V1\Webhook;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
class CronJobController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
Artisan::call('schedule:run');
return response()->json(['success' => true]);
}
}

View File

@ -69,6 +69,9 @@ class Kernel extends HttpKernel
'redirect-if-unauthenticated' => \Crater\Http\Middleware\RedirectIfUnauthorized::class,
'customer-guest' => \Crater\Http\Middleware\CustomerGuest::class,
'company' => \Crater\Http\Middleware\CompanyMiddleware::class,
'pdf-auth' => \Crater\Http\Middleware\PdfMiddleware::class,
'cron-job' => \Crater\Http\Middleware\CronJobMiddleware::class,
'customer-portal' => \Crater\Http\Middleware\CustomerPortalMiddleware::class,
];
/**

View File

@ -3,7 +3,6 @@
namespace Crater\Http\Middleware;
use Closure;
use Crater\Models\CompanySetting;
use Crater\Models\FileDisk;
class ConfigMiddleware
@ -18,15 +17,6 @@ class ConfigMiddleware
public function handle($request, Closure $next)
{
if (\Storage::disk('local')->has('database_created')) {
$setting = CompanySetting::getSetting('time_zone', $request->header('company'));
$timezone = config('app.timezone');
if ($setting && $setting != null && $setting != $timezone) {
config(['app.timezone' => $setting]);
date_default_timezone_set($setting);
}
if ($request->has('file_disk_id')) {
$file_disk = FileDisk::find($request->file_disk_id);
} else {

View File

@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class CronJobMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ($request->header('x-authorization-token') && $request->header('x-authorization-token') == config('services.cron_job.auth_token')) {
return $next($request);
}
return response()->json(['unauthorized'], 401);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Crater\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CustomerPortalMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
$user = Auth::guard('customer')->user();
if (! $user->enable_portal) {
Auth::guard('customer')->logout();
return response('Unauthorized.', 401);
}
return $next($request);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Crater\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class PdfMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
if (Auth::guard('web')->check() || Auth::guard('sanctum')->check() || Auth::guard('customer')->check()) {
return $next($request);
}
return redirect('/login');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Requests;
use Crater\Rules\Base64Mime;
use Illuminate\Foundation\Http\FormRequest;
class AvatarRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'admin_avatar' => [
'nullable',
'file',
'mimes:gif,jpg,png',
'max:20000'
],
'avatar' => [
'nullable',
new Base64Mime(['gif', 'jpg', 'png'])
]
];
}
}

View File

@ -3,6 +3,7 @@
namespace Crater\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
class CompaniesRequest extends FormRequest
@ -70,7 +71,8 @@ class CompaniesRequest extends FormRequest
'name'
])
->merge([
'owner_id' => $this->user()->id
'owner_id' => $this->user()->id,
'slug' => Str::slug($this->name)
])
->toArray();
}

View File

@ -0,0 +1,34 @@
<?php
namespace Crater\Http\Requests;
use Crater\Rules\Base64Mime;
use Illuminate\Foundation\Http\FormRequest;
class CompanyLogoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'company_logo' => [
'nullable',
new Base64Mime(['gif', 'jpg', 'png'])
]
];
}
}

View File

@ -29,9 +29,22 @@ class CompanyRequest extends FormRequest
'required',
Rule::unique('companies')->ignore($this->header('company'), 'id'),
],
'slug' => [
'nullable'
],
'address.country_id' => [
'required',
],
];
}
public function getCompanyPayload()
{
return collect($this->validated())
->only([
'name',
'slug'
])
->toArray();
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Crater\Http\Requests\Customer;
use Illuminate\Foundation\Http\FormRequest;
class CustomerLoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => [
'required',
'string'
],
'password' => [
'required',
'string'
]
];
}
}

View File

@ -1,43 +1,43 @@
<?php
use Crater\Http\Requests\CustomerRequest;
namespace Crater\Http\Requests\Customer;
test('customer request validation rules', function () {
$request = new CustomerRequest();
use Crater\Models\Address;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
$this->assertEquals(
[
class CustomerProfileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => [
'required',
],
'email' => [
'email',
'nullable',
'unique:customers,email',
],
'password' => [
'nullable',
'min:8',
],
'phone' => [
'nullable',
],
'company_name' => [
'nullable',
],
'contact_name' => [
'nullable',
],
'website' => [
'nullable',
],
'prefix' => [
'nullable',
],
'enable_portal' => [
'nullable',
],
'currency_id' => [
'email' => [
'nullable',
'email',
Rule::unique('customers')->where('company_id', $this->header('company'))->ignore(Auth::id(), 'id'),
],
'billing.name' => [
'nullable',
@ -92,14 +92,31 @@ test('customer request validation rules', function () {
],
'shipping.fax' => [
'nullable',
],
'customer_avatar' => [
'nullable',
'file',
'mimes:gif,jpg,png',
'max:20000'
]
],
$request->rules()
);
});
];
}
test('customer request authorize', function () {
$request = new CustomerRequest();
public function getShippingAddress()
{
return collect($this->shipping)
->merge([
'type' => Address::SHIPPING_TYPE
])
->toArray();
}
$this->assertTrue($request->authorize());
});
public function getBillingAddress()
{
return collect($this->billing)
->merge([
'type' => Address::BILLING_TYPE
])
->toArray();
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace Crater\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CustomerEstimateStatusRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'status' => [
'required',
'in:ACCEPTED,REJECTED',
]
];
}
}

View File

@ -5,7 +5,6 @@ namespace Crater\Http\Requests;
use Crater\Models\Address;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
class CustomerRequest extends FormRequest
@ -55,7 +54,8 @@ class CustomerRequest extends FormRequest
'nullable',
],
'enable_portal' => [
'nullable',
'boolean'
],
'currency_id' => [
'nullable',
@ -120,7 +120,7 @@ class CustomerRequest extends FormRequest
$rules['email'] = [
'email',
'nullable',
Rule::unique('customers')->ignore($this->route('customer')->id),
Rule::unique('customers')->where('company_id', $this->header('company'))->ignore($this->route('customer')->id),
];
};

View File

@ -86,13 +86,15 @@ class EstimatesRequest extends FormRequest
$companyCurrency = CompanySetting::getSetting('currency', $this->header('company'));
$customerCurrency = Customer::find($this->customer_id)->currency_id;
$customer = Customer::find($this->customer_id);
if ((string)$customerCurrency !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
if ($companyCurrency && $customer) {
if ((string)$customer->currency_id !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
}
if ($this->isMethod('PUT')) {
$rules['estimate_number'] = [
@ -115,7 +117,7 @@ class EstimatesRequest extends FormRequest
return collect($this->except('items', 'taxes'))
->merge([
'creator_id' => $this->user()->id,
'creator_id' => $this->user()->id ?? null,
'status' => $this->has('estimateSend') ? Estimate::STATUS_SENT : Estimate::STATUS_DRAFT,
'company_id' => $this->header('company'),
'tax_per_item' => CompanySetting::getSetting('tax_per_item', $this->header('company')) ?? 'NO ',

View File

@ -51,13 +51,21 @@ class ExpenseRequest extends FormRequest
'currency_id' => [
'required'
],
'attachment_receipt' => [
'nullable',
'file',
'mimes:jpg,png,pdf,doc,docx,xls,xlsx,ppt,pptx',
'max:20000'
]
];
if ($companyCurrency !== $this->currency_id) {
$rules['exchange_rate'] = [
'required',
];
};
if ($companyCurrency && $this->currency_id) {
if ($companyCurrency !== $this->currency_id) {
$rules['exchange_rate'] = [
'required',
];
};
}
return $rules;
}

View File

@ -0,0 +1,33 @@
<?php
namespace Crater\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class GetSettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'key' => [
'required',
'string'
]
];
}
}

View File

@ -86,13 +86,15 @@ class InvoicesRequest extends FormRequest
$companyCurrency = CompanySetting::getSetting('currency', $this->header('company'));
$customerCurrency = Customer::find($this->customer_id)->currency_id;
$customer = Customer::find($this->customer_id);
if ((string)$customerCurrency !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
if ($customer && $companyCurrency) {
if ((string)$customer->currency_id !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
}
if ($this->isMethod('PUT')) {
$rules['invoice_number'] = [
@ -115,7 +117,7 @@ class InvoicesRequest extends FormRequest
return collect($this->except('items', 'taxes'))
->merge([
'creator_id' => $this->user()->id,
'creator_id' => $this->user()->id ?? null,
'status' => $this->has('invoiceSend') ? Invoice::STATUS_SENT : Invoice::STATUS_DRAFT,
'paid_status' => Invoice::STATUS_UNPAID,
'company_id' => $this->header('company'),

View File

@ -2,6 +2,7 @@
namespace Crater\Http\Requests;
use Crater\Models\PaymentMethod;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
@ -43,4 +44,14 @@ class PaymentMethodRequest extends FormRequest
return $data;
}
public function getPaymentMethodPayload()
{
return collect($this->validated())
->merge([
'company_id' => $this->header('company'),
'type' => PaymentMethod::TYPE_GENERAL,
])
->toArray();
}
}

View File

@ -65,13 +65,15 @@ class PaymentRequest extends FormRequest
$companyCurrency = CompanySetting::getSetting('currency', $this->header('company'));
$customerCurrency = Customer::find($this->customer_id)->currency_id;
$customer = Customer::find($this->customer_id);
if ((string)$customerCurrency !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
if ($customer && $companyCurrency) {
if ((string)$customer->currency_id !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
}
return $rules;
}

View File

@ -83,13 +83,15 @@ class RecurringInvoiceRequest extends FormRequest
]
];
$customerCurrency = Customer::find($this->customer_id)->currency_id;
$customer = Customer::find($this->customer_id);
if ((string)$customerCurrency !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
if ($customer && $companyCurrency) {
if ((string)$customer->currency_id !== $companyCurrency) {
$rules['exchange_rate'] = [
'required',
];
};
}
return $rules;
}

View File

@ -24,10 +24,7 @@ class SettingRequest extends FormRequest
public function rules()
{
return [
'key' => [
'required',
],
'value' => [
'settings' => [
'required',
],
];

View File

@ -2,6 +2,7 @@
namespace Crater\Http\Requests;
use Crater\Models\TaxType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
@ -28,6 +29,7 @@ class TaxTypeRequest extends FormRequest
'name' => [
'required',
Rule::unique('tax_types')
->where('type', TaxType::TYPE_GENERAL)
->where('company_id', $this->header('company'))
],
'percent' => [
@ -49,6 +51,7 @@ class TaxTypeRequest extends FormRequest
'required',
Rule::unique('tax_types')
->ignore($this->route('tax_type')->id)
->where('type', TaxType::TYPE_GENERAL)
->where('company_id', $this->header('company'))
];
}
@ -60,7 +63,8 @@ class TaxTypeRequest extends FormRequest
{
return collect($this->validated())
->merge([
'company_id' => $this->header('company')
'company_id' => $this->header('company'),
'type' => TaxType::TYPE_GENERAL
])
->toArray();
}

View File

@ -0,0 +1,37 @@
<?php
namespace Crater\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UnzipUpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'path' => [
'required',
'regex:/^[\.\/\w\-]+$/'
],
'module' => [
'required',
'string'
]
];
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace Crater\Http\Requests;
use Crater\Rules\Base64Mime;
use Illuminate\Foundation\Http\FormRequest;
class UploadExpenseReceiptRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'attachment_receipt' => [
'nullable',
new Base64Mime(['gif', 'jpg', 'png'])
]
];
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UploadModuleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'avatar' => [
'required',
'file',
'mimes:zip',
'max:20000'
],
'module' => [
'required',
'string',
'max:100'
]
];
}
}

View File

@ -21,6 +21,7 @@ class CompanyResource extends JsonResource
'logo_path' => $this->logo_path,
'unique_hash' => $this->unique_hash,
'owner_id' => $this->owner_id,
'slug' => $this->slug,
'address' => $this->when($this->address()->exists(), function () {
return new AddressResource($this->address);
}),

View File

@ -2,6 +2,7 @@
namespace Crater\Http\Resources;
use Crater\Models\CompanySetting;
use Illuminate\Http\Resources\Json\JsonResource;
class CustomFieldValueResource extends JsonResource
@ -28,6 +29,7 @@ class CustomFieldValueResource extends JsonResource
'custom_field_id' => $this->custom_field_id,
'company_id' => $this->company_id,
'default_answer' => $this->defaultAnswer,
'default_formatted_answer' => $this->dateTimeFormat(),
'custom_field' => $this->when($this->customField()->exists(), function () {
return new CustomFieldResource($this->customField);
}),
@ -36,4 +38,24 @@ class CustomFieldValueResource extends JsonResource
}),
];
}
public function dateTimeFormat()
{
$key = getCustomFieldValueKey($this->type);
$answer = $this->default_answer;
if (! $answer) {
return null;
}
if ($key == 'date_time_answer') {
return $answer->format('Y-m-d H:i');
}
if ($key == 'date_answer') {
return $answer->format(CompanySetting::getSetting('carbon_date_format', $this->company_id));
}
return $answer;
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Crater\Http\Resources\Customer;
use Illuminate\Http\Resources\Json\ResourceCollection;
class AddressCollection extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Resources\Customer;
use Illuminate\Http\Resources\Json\JsonResource;
class AddressResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'address_street_1' => $this->address_street_1,
'address_street_2' => $this->address_street_2,
'city' => $this->city,
'state' => $this->state,
'country_id' => $this->country_id,
'zip' => $this->zip,
'phone' => $this->phone,
'fax' => $this->fax,
'type' => $this->type,
'user_id' => $this->user_id,
'company_id' => $this->company_id,
'customer_id' => $this->customer_id,
'country' => $this->when($this->country()->exists(), function () {
return new CountryResource($this->country);
}),
'user' => $this->when($this->user()->exists(), function () {
return new UserResource($this->user);
}),
];
}
}

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