Compare commits

...

259 Commits

Author SHA1 Message Date
merdan d97777d0af business completed 2022-11-08 18:20:39 +05:00
ilmedova 5eca68413a contract crud controller updates 2022-11-08 18:20:39 +05:00
merdan 10770c1709 business completed 2022-11-08 18:20:39 +05:00
ilmedova 2e38e7e373 contracts updated 2022-11-08 18:20:39 +05:00
merdan 8b4d6fcbcc business completed 2022-11-08 18:20:33 +05:00
merdan f502e4f89c business completed 2022-11-08 18:20:33 +05:00
merdan affc74879c business completed 2022-11-08 18:20:33 +05:00
merdan 44e909c919 business completed 2022-11-08 18:20:33 +05:00
merdan 8687c6245c business completed 2022-11-08 18:20:33 +05:00
merdan c45a89d6c1 company completed 2022-11-08 18:20:33 +05:00
merdan 0c2dcdaa4c client completed 2022-11-08 18:20:33 +05:00
merdan d46bd03533 clientda galdym 2022-11-08 18:20:33 +05:00
merdan ae581bdaeb clientda galdym 2022-11-08 18:20:33 +05:00
merdan 893f076c60 dashbord 2022-11-08 18:20:33 +05:00
merdan 525c0823a3 side menu translate 2022-11-08 18:20:33 +05:00
merdan a78e497c14 translate accounts 2022-11-08 18:20:33 +05:00
merdan fce95880ec translate accounts 2022-11-08 18:20:33 +05:00
merdan 8e659500e6 translate accounts 2022-11-08 18:20:33 +05:00
merdan 1ece90e342 translate accounts 2022-11-08 18:20:33 +05:00
merdan 7af6e5b1ec translate accounts 2022-11-08 18:20:33 +05:00
merdan 58784d3bce contract 2022-11-08 18:20:33 +05:00
merdan 2ab944e430 contract 2022-11-08 18:20:33 +05:00
merdan 60ba8a1342 contract 2022-11-08 18:20:33 +05:00
merdan e0b782ed3b contract 2022-11-08 18:20:32 +05:00
merdan 76f53f7722 contract 2022-11-08 18:20:32 +05:00
merdan e130a6e8fd contract 2022-11-08 18:20:32 +05:00
merdan c3f5fb2b9b contract 2022-11-08 18:20:32 +05:00
merdan 21bcb76e77 ticket 2022-11-08 18:20:32 +05:00
merdan c38eab7252 ticket 2022-11-08 18:20:32 +05:00
merdan ea3595fd4e added status 'refine' to application statuses 2022-11-08 18:20:32 +05:00
merdan e54250ec06 contract resource 2022-11-08 18:20:32 +05:00
merdan 6165cdf8a0 contract resource 2022-11-08 18:20:32 +05:00
merdan cd3ea48774 contract resource 2022-11-08 18:20:32 +05:00
Mahri Ilmedova 6e986e5ff8 test the updates for dotnet programm 2022-11-08 18:20:32 +05:00
Mahri Ilmedova f1e12f4bde api fixes contracts 2022-11-08 18:20:32 +05:00
merdan 3b067880a3 import api for contracts 2022-11-08 18:20:32 +05:00
merdan 478a394c9e docx 2022-11-08 18:20:32 +05:00
Mahri Ilmedova f3b2a6205b elfinder configs, application on edit fields fixed 2022-11-08 18:20:32 +05:00
merdan 2571a774e8 admin fix 2022-11-08 18:20:32 +05:00
merdan 841ca765da attachment storage path 2022-11-08 18:20:32 +05:00
merdan e10577ff3a attachment storage path 2022-11-08 18:20:32 +05:00
merdan 140df8e6b9 application ticket 2022-11-08 18:20:32 +05:00
merdan 4decf8ce7a contracts api documentation 2022-11-08 18:20:32 +05:00
merdan afb282f8d3 contracts api 2022-11-08 18:20:32 +05:00
Mahri Ilmedova 2bed2bebe1 model and admin controller ready 2022-11-08 18:20:32 +05:00
merdan cdca84ddd9 contracts api 2022-11-08 18:20:32 +05:00
Mahri Ilmedova e31ad8fd65 create user from account preview finished 2022-11-08 18:20:27 +05:00
merdan 528375d2e1 test 2022-11-08 18:20:27 +05:00
merdan 2f81561173 test 2022-11-08 18:20:27 +05:00
merdan e7f0b43f53 test 2022-11-08 18:20:27 +05:00
merdan f00cafee09 test 2022-11-08 18:20:27 +05:00
merdan 86cc77a010 test 2022-11-08 18:20:27 +05:00
merdan 3f6c91752a test 2022-11-08 18:20:27 +05:00
merdan 9750fd000e test 2022-11-08 18:20:27 +05:00
merdan 1f7969566c test 2022-11-08 18:20:26 +05:00
merdan e6f82322dd test 2022-11-08 18:20:26 +05:00
Mahri Ilmedova 11fd9d18d7 tickets finished 2022-11-08 18:20:21 +05:00
Mahri Ilmedova cd27bc0ceb filter in documents table fixed 2022-11-08 18:20:21 +05:00
Mahri Ilmedova 6dc98a4b6e tickets APi fixed for the last sender 2022-11-08 18:20:21 +05:00
merdan acf8ab54ac add client api 2022-11-08 18:20:21 +05:00
merdan 9c9b87de88 add client api 2022-11-08 18:20:15 +05:00
merdan 1d74b2d2e7 add client api 2022-11-08 18:20:15 +05:00
merdan 76052522a1 add client api 2022-11-08 18:20:15 +05:00
Mahri Ilmedova a808f052da Application preview ticket creating almost ready 2022-11-08 18:20:15 +05:00
Mahri Ilmedova f20f4fc54c mail fixed for dynamic email from settings db 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 84a4f285c0 tickets api done 2022-11-08 18:20:15 +05:00
Mahri Ilmedova e964faf05a localization files ready, ticketing account ready 2022-11-08 18:20:15 +05:00
Mahri Ilmedova a8c6e7dd6d controller fixed for exports 2022-11-08 18:20:15 +05:00
Mahri Ilmedova e041dfa424 fix error in generating company profile 2022-11-08 18:20:15 +05:00
Mahri Ilmedova a4bdd2dd88 test company template in word 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 2ad79db195 businesses export template ready and tested 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 18a036e8f9 business export to excel ready 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 6629bb5442 export for business last check 2022-11-08 18:20:15 +05:00
Mahri Ilmedova f858950d14 business template for export ready 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 183f6a1a07 business done for word + libre office 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 7627fd66a2 test2 in word 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 1d2e22924e test business blade in word 2022-11-08 18:20:15 +05:00
Mahri Ilmedova d967d7ac03 route check exports 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 912eb46e32 use export controller route fixed 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 2cc9c963e0 route fixed for export admin side 2022-11-08 18:20:15 +05:00
Mahri Ilmedova aeb5e58bdb admin account export test 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 0108b5a680 applications preview test in word 2022-11-08 18:20:15 +05:00
merdan 04d42556ca validation 2022-11-08 18:20:15 +05:00
Mahri Ilmedova bcc1d46d3b filters in documents done 2022-11-08 18:20:15 +05:00
merdan a2f4adb78c lang 2022-11-08 18:20:15 +05:00
Mahri Ilmedova a07352dd4c filters added, application state changed applied 2022-11-08 18:20:15 +05:00
Mahri Ilmedova b0ac22078c fixed routes 2022-11-08 18:20:15 +05:00
Mahri Ilmedova a068f2e582 download doc fixed 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 1861bc48ef attachemnets table fixed 2022-11-08 18:20:15 +05:00
Mahri Ilmedova f72032da61 preview application route fixed 2022-11-08 18:20:15 +05:00
merdan e884e324fa lang 2022-11-08 18:20:15 +05:00
Mahri Ilmedova ceb636f6f6 admin applications preview ready 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 14368289be company export errors fixed 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 1ecaceed40 business exportable doc test, errors fixed 2022-11-08 18:20:15 +05:00
Mahri Ilmedova 74a7973e53 address null safety 2022-11-08 18:20:15 +05:00
merdan 55f69ddaed lang 2022-11-08 18:20:15 +05:00
merdan 4866cf0901 attachment order 2022-11-08 18:20:07 +05:00
merdan e31be9c9ad attachment order 2022-11-08 18:20:07 +05:00
merdan 6d4aa2d8da attachment order 2022-11-08 18:20:07 +05:00
merdan 5a5f6abb31 attachment order 2022-11-08 18:20:07 +05:00
merdan 94280bd7a4 attachment order 2022-11-08 18:20:07 +05:00
merdan a76514d2b3 attachment order 2022-11-08 18:20:07 +05:00
merdan 5829bea0f0 attachment order 2022-11-08 18:20:07 +05:00
merdan 1be3b0a4a3 oprosnik download doc 2022-11-08 18:20:07 +05:00
merdan 612357ccdc all country 2022-11-08 18:20:07 +05:00
merdan a1b5af1cd5 all country 2022-11-08 18:20:07 +05:00
merdan 7ec6933551 all country 2022-11-08 18:20:07 +05:00
merdan c3912543d4 all country 2022-11-08 18:20:07 +05:00
merdan 605228a79a all country 2022-11-08 18:20:07 +05:00
merdan 13d55eeeaa all country 2022-11-08 18:20:07 +05:00
merdan 963ca8fef1 all country 2022-11-08 18:20:07 +05:00
merdan 6e6ff87de1 profile strategi encha 2022-11-08 18:20:07 +05:00
merdan e70111a491 profile strategi encha 2022-11-08 18:20:07 +05:00
merdan 95ab061f0d api app doc changed
addded business,company fields to document
2022-11-08 18:20:07 +05:00
merdan 833e897d94 api app doc changed
addded business,company fields to document
2022-11-08 18:20:07 +05:00
merdan fb9ca2e68e api app doc changed
addded business,company fields to document
2022-11-08 18:20:07 +05:00
merdan 13c56075b5 api app doc changed
addded business,company fields to document
2022-11-08 18:20:07 +05:00
Mahri Ilmedova bd63960764 Admin almost ready, exports ready 2022-11-08 18:20:07 +05:00
Mahri Ilmedova d55212489d duplicate mail_encryption in settings seeder fixed 2022-11-08 18:20:07 +05:00
Mahri Ilmedova cab4f65e1b all notes done 2022-11-08 18:20:07 +05:00
Mahri Ilmedova 808dda08a6 test custom field for account profile names select 2022-11-08 18:20:07 +05:00
Mahri Ilmedova 8cc5e5d49a almost done todo list for admin panel 2022-11-08 18:20:07 +05:00
Mahri Ilmedova 9a02e83579 check custom column for profile name 2022-11-08 18:20:07 +05:00
Mahri Ilmedova bf6b4ae0fe admin main stuff part 1 - done 2022-11-08 18:20:07 +05:00
Mahri Ilmedova f6493a2d89 dashboard fixes 2022-11-08 18:20:07 +05:00
Mahri Ilmedova 6e9d5ffd97 animation added to cards, account preview changes 2022-11-08 18:20:07 +05:00
Mahri Ilmedova 116543290a dashboard with links done, applied some filters 2022-11-08 18:20:07 +05:00
merdan 57e2017eb4 client is verified 2022-11-08 18:20:07 +05:00
merdan eeb23a870b translation messages for english 2022-11-08 18:20:07 +05:00
merdan f53708a390 translation messages for english 2022-11-08 18:20:07 +05:00
merdan 8ccf5f47a2 translation messages for english 2022-11-08 18:20:07 +05:00
merdan 9761f6e32c translation messages for english 2022-11-08 18:20:07 +05:00
merdan 2b7b5ab6a2 translation messages for english 2022-11-08 18:20:07 +05:00
Mahri Ilmedova d2b69d543d ticket testing filtering 2022-11-08 18:20:02 +05:00
merdan 05ee64a4ec apply post fx4 2022-11-08 18:20:02 +05:00
merdan f6f73e8ef9 apply post fx4 test 2022-11-08 18:20:02 +05:00
merdan f1e2ebb257 apply post fx3 2022-11-08 18:20:02 +05:00
merdan 6200270fb4 apply post fx2 2022-11-08 18:20:02 +05:00
merdan 8558e730e2 apply post fx 2022-11-08 18:20:02 +05:00
merdan 1f25ab76c5 apply post fx 2022-11-08 18:20:02 +05:00
merdan 71f0b80034 apply post fx 2022-11-08 18:20:02 +05:00
merdan 3116318e62 apply post fx 2022-11-08 18:20:02 +05:00
merdan 6730475627 ready for shablon 2022-11-08 18:20:02 +05:00
merdan c18836608a word generate test 2022-11-08 18:20:02 +05:00
merdan 4bfe01b9c1 word generate test 2022-11-08 18:20:01 +05:00
merdan 4fa970b7bd word generate test 2022-11-08 18:20:01 +05:00
merdan 3243231120 applic 2022-11-08 18:20:01 +05:00
merdan acfbb69918 file upoad documentation 2022-11-08 18:20:01 +05:00
Mahri Ilmedova a7b2a30805 created at added, test filter added 2022-11-08 18:20:01 +05:00
merdan febc3bb19f file upoad documentation 2022-11-08 18:20:01 +05:00
merdan 6c92fb2286 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan 03b69a767d file upoad documentation 2022-11-08 18:20:01 +05:00
merdan ec9b6892e1 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan 89dcb68f9a file upoad documentation 2022-11-08 18:20:01 +05:00
merdan d941b60340 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan d220aa914a file upoad documentation 2022-11-08 18:20:01 +05:00
merdan d340e6f0ad file upoad documentation 2022-11-08 18:20:01 +05:00
merdan d1e5e10125 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan 86225b971d file upoad documentation 2022-11-08 18:20:01 +05:00
merdan 2e1507eec9 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan bd261d3278 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan a45640db11 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan c3985a9070 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan 5b5538b331 file upoad documentation 2022-11-08 18:20:01 +05:00
merdan ecfc95b50e file upoad documentation 2022-11-08 18:20:01 +05:00
merdan e93d77929b file upoad documentation 2022-11-08 18:20:01 +05:00
merdan d3a402b3d6 attachment fix 2022-11-08 18:20:01 +05:00
merdan 5153b771c0 attachment fix 2022-11-08 18:20:01 +05:00
merdan c4bd4ffe5a attachment fix 2022-11-08 18:20:01 +05:00
merdan b73cffbc33 attachment fix 2022-11-08 18:20:01 +05:00
merdan dc7c21c549 attachment fix 2022-11-08 18:20:01 +05:00
merdan 0f573ea0b3 attachment fix 2022-11-08 18:20:01 +05:00
merdan 724d180afb documents list fix 2022-11-08 18:20:01 +05:00
merdan 2f2b88d61b date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan c6dac5ba81 date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan 1f99d029d7 date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan 8d95becb35 date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan 4a80cb1528 date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan 330b75ccfe date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan d4d26a59a4 date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan 3d4d6dd824 date format valiodaiton 2022-11-08 18:20:01 +05:00
merdan 3134788d98 Document fix 2022-11-08 18:20:01 +05:00
merdan d21d294b8c Document fix 2022-11-08 18:20:01 +05:00
Mahri Ilmedova 0b3c523b8b migrations done, account preview done 2022-11-08 18:20:01 +05:00
Mahri Ilmedova 5579fea5eb Accounts preview almost done 2022-11-08 18:20:01 +05:00
Mahri Ilmedova b2c6bfccf8 tables for documents and groups fixed 2022-11-08 18:20:01 +05:00
Mahri Ilmedova b23e9896e1 documents fixed 2022-11-08 18:20:01 +05:00
merdan 12243207e7 Document fix 2022-11-08 18:19:52 +05:00
Mahri Ilmedova 5f96a1977f documents and documents groups done 2022-11-08 18:19:45 +05:00
Mahri Ilmedova fe017dbc7f test account preview if working 2022-11-08 18:19:41 +05:00
Mahri Ilmedova dec0abcfc2 docuemnt groups fixed 2022-11-08 18:19:36 +05:00
Mahri Ilmedova d1adc95cf1 document groups fixed 2022-11-08 18:19:36 +05:00
merdan 258393a2be Document fix 2022-11-08 18:19:36 +05:00
merdan b0547cbc11 Document fix 2022-11-08 18:19:31 +05:00
merdan ad4fcbc02f Document fix 2022-11-08 18:19:31 +05:00
merdan 7363a98610 Document fix 2022-11-08 18:19:31 +05:00
merdan e76fe7fe5b Document fix 2022-11-08 18:19:30 +05:00
merdan ccbbcaaf2a Document fix 2022-11-08 18:19:25 +05:00
merdan 3516d1ecf9 Document fix 2022-11-08 18:19:25 +05:00
merdan 15dd2a5e24 Application status 2022-11-08 18:19:25 +05:00
Mahri Ilmedova b6bc5e5b40 documents admin fixed, lang fixed 2022-11-08 18:19:25 +05:00
Mahri Ilmedova fa56831f99 admin dashboard stats +added new migration (paths) 2022-11-08 18:19:20 +05:00
merdan 55fc31b293 upload file 2022-11-08 18:19:20 +05:00
merdan de26f3a4a1 create && get applications 2022-11-08 18:19:15 +05:00
merdan d315e09a76 create && get applications 2022-11-08 18:19:15 +05:00
merdan 24d239596c profile save fix 2022-11-08 18:19:15 +05:00
merdan abbdd8a54d prof test 2022-11-08 18:19:09 +05:00
merdan b5ef158348 prof test 2022-11-08 18:19:09 +05:00
merdan 9c584ce475 prof test 2022-11-08 18:19:05 +05:00
merdan 1fc55f2f69 nul decode 2022-11-08 18:19:00 +05:00
merdan 78cc9ba4cf Business profile migration 2022-11-08 18:19:00 +05:00
merdan ca45745cb7 account profile api docs fx 2022-11-08 18:19:00 +05:00
Mahri Ilmedova 7c0123567f faqs almost ready 2022-11-08 18:18:47 +05:00
merdan 0a939ecf1c account profile api docs fx 2022-11-08 18:18:47 +05:00
merdan f8e0dca5dc account bank contact resources 2022-11-08 18:18:47 +05:00
merdan a97e8323fa account bank contact resources 2022-11-08 18:18:47 +05:00
Mahri Ilmedova 07a9087cc0 last_sender added to tickets 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 6e7e49d3cd ticketing Sapar notes finished 2022-11-08 18:18:41 +05:00
Mahri Ilmedova ac46d29664 ticketing admin panel bugs fixed 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 63cf29a853 admin and client seeders ready 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 0f8d77dc63 rules fixed logic 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 99c249ed8e rules fixed 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 4bde8c0df8 rules are fixed 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 525d0616e7 message request authorised 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 1b3273ee88 validation errors in ticketing module fixed 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 97a33aca17 client post message fixed 2022-11-08 18:18:41 +05:00
merdan c885fc7df0 tiket api dok 2022-11-08 18:18:41 +05:00
merdan b9f5f77aac tiket api dok 2022-11-08 18:18:41 +05:00
merdan 7633ff1451 morph fix 2022-11-08 18:18:41 +05:00
merdan 97dae824a3 morph fix 2022-11-08 18:18:41 +05:00
merdan 20ef7eae9e Company profile update api routes fx 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 3527800bd9 ticketing admin_id nullable 2022-11-08 18:18:41 +05:00
Mahri Ilmedova 96ad91156c ticketing admin name + category added 2022-11-08 18:18:41 +05:00
merdan 89b8910a9e Company profile update api routes fx 2022-11-08 18:18:41 +05:00
merdan 8faa11a265 Company profile update api routes fx 2022-11-08 18:18:41 +05:00
merdan 8dd2e5eee8 Company profile update api routes fx 2022-11-08 18:18:41 +05:00
merdan 87ebd40e6c Company profile update api 2022-11-08 18:18:41 +05:00
Guljahan d6237b3d5b categories bug fixed 2022-11-08 18:18:41 +05:00
Guljahan 3142a283db account created in db seeder client 2022-11-08 18:18:41 +05:00
Guljahan cec6e049fb client seeder bug fixed 2022-11-08 18:18:41 +05:00
Guljahan 4a5a636e85 client seeder done 2022-11-08 18:18:41 +05:00
Guljahan 2d3a9df449 client seeder added 2022-11-08 18:18:41 +05:00
Guljahan a5d29c9b4c category_id bug fixed, added category_id fillable 2022-11-08 18:18:41 +05:00
Guljahan 6ef8e64881 ticket post category_id added 2022-11-08 18:18:41 +05:00
Guljahan bef34c8470 category_id bug fixed in ticketrequest 2022-11-08 18:18:41 +05:00
Guljahan a1f8f63332 categorycrud controller added localization 2022-11-08 18:18:41 +05:00
Guljahan 9d9e2d9aaa categories seeder added 2022-11-08 18:18:41 +05:00
Guljahan 3259aba6dc api auth sanctum 2022-11-08 18:18:41 +05:00
merdan cf3b39205f account get fix 2022-11-08 18:18:41 +05:00
merdan 7b68024dd9 account get fix 2022-11-08 18:18:31 +05:00
merdan 3958796d93 account get fix 2022-11-08 18:18:31 +05:00
merdan af81d51f0d guarded id removed 2022-11-08 18:18:31 +05:00
merdan 0590950146 acccoun constrauctor bug fx 2022-11-08 18:18:31 +05:00
merdan f488b7e9e9 acccoun constrauctor bug fx 2022-11-08 18:18:24 +05:00
merdan 3c3cbbe4c8 update company profile 2022-11-08 18:18:10 +05:00
merdan ab4a22f160 update company profile 2022-11-08 18:17:28 +05:00
merdan e96a8af32f Profile types with strategy 2022-11-08 18:17:28 +05:00
merdan b73cca8c1f Profile types with strategy 2022-11-08 18:17:28 +05:00
merdan 4d16d4931e Profile types with strategy 2022-11-08 18:13:56 +05:00
178 changed files with 6884 additions and 4060 deletions

View File

@ -5,24 +5,114 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\API\BankAccountRequest;
use App\Http\Requests\API\ContactsRequest;
<<<<<<< HEAD
use App\Http\Requests\API\DocumentRequest;
<<<<<<< HEAD
use App\Http\Requests\API\ManagementRequest;
use App\Http\Requests\API\ProfileRequest;
=======
>>>>>>> 76551f4 (update company profile)
=======
>>>>>>> 2daf9e4 (acccoun constrauctor bug fx)
use App\Http\Resources\AccountResource;
<<<<<<< HEAD
use App\Models\Account;
use App\Models\Business;
use App\Models\Company;
=======
use App\Http\Resources\BankResource;
use App\Http\Resources\ContactResource;
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> e1b332b (account bank contact resources)
=======
use App\Models\Account;
>>>>>>> 879eb8f (documents admin fixed, lang fixed)
=======
>>>>>>> 93fd73e (translation messages for english)
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AccountController extends Controller
{
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->account = Auth::user()
->account()
->with('profile')
->first();
return $next($request);
});
}
>>>>>>> 1462988 (Document fix)
public function account(Request $request){
$account = Account::with('profile')->find($request->user()->account_id);
=======
public function __construct()
{
$this->middleware(function ($request, $next) {
if(!empty($account)){
return AccountResource::make($account);
$this->account = Auth::user()
->account()
->with('profile')
->first();
return $next($request);
});
}
=======
>>>>>>> 98cb007 (upload file)
/**
* @OA\GET(
* path="/api/account",
* summary=" - Get client account",
* tags = {"Account"},
* security={
* {"bearerAuth": {}}
* },
* @OA\Response(
* response="200",
* description="OK"
* ),
* @OA\Response(
* response="401",
* description="Unauthorized"
* )
* )
*/
public function account(Request $request)
{
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> 3824a3c (Profile types with strategy)
=======
>>>>>>> a7619eb (acccoun constrauctor bug fx)
=======
return $this->account;
>>>>>>> a3584c5 (prof test)
=======
>>>>>>> 85d6dda (profile save fix)
=======
return $this->account;
>>>>>>> 37d2505 (add client api)
=======
>>>>>>> c96ba50 (test)
if(!empty($this->account)){
return AccountResource::make($this->account);
}
return response()->json([
@ -32,30 +122,49 @@ public function account(Request $request){
public function storeContacts(ContactsRequest $request){
<<<<<<< HEAD
<<<<<<< HEAD
$account = Account::with('profile')->find($request->user()->account_id);
$data['contacts'] = json_encode($request->only($account->getContactFillables()));
$account->fill($data)->save();
=======
$contacts = $request->only(array_keys($request->rules()));
if(!empty($account)){
return AccountResource::make($account);
$this->account->fill(['contacts' => json_encode($contacts)]);
>>>>>>> 76551f4 (update company profile)
if($this->account->save()){
return new ContactResource((object)$contacts);
}
return response()->json([
'message'=> trans('app.account.not_found')
],404 );
=======
>>>>>>> 3824a3c (Profile types with strategy)
}
public function storeBankAccount(BankAccountRequest $request){
$account = Account::with('profile')->find($request->user()->account_id);
$bank = $request->only(array_keys($request->rules()));
$this->account->fill(['bank' => json_encode($bank)]);
<<<<<<< HEAD
$data['bank'] = json_encode($request->only($account->getBankFillables()));
$account->fill($data)->save();
if(!empty($account)){
return AccountResource::make($account);
=======
if($this->account->save()){
<<<<<<< HEAD
return AccountResource::make($this->account);
>>>>>>> 76551f4 (update company profile)
=======
return BankResource::make((object)$bank);
>>>>>>> e1b332b (account bank contact resources)
}
return response()->json([
@ -64,6 +173,8 @@ public function storeBankAccount(BankAccountRequest $request){
}
<<<<<<< HEAD
<<<<<<< HEAD
public function storePersonal(DocumentRequest $request){
$account = Account::with('profile')->find($request->user()->account_id);
@ -102,6 +213,61 @@ public function storeProfile(ProfileRequest $request){
return response()->json([
'message'=> trans('app.account.not_found')
],404 );
=======
public function storeProfileInfo()
{
//Profile type using Strategy pattern
$type = config('account.'.$this->account->type.'.class');
$profileStrategy = new $type;
return $profileStrategy->updateProfileInfo($this->account->profile);
>>>>>>> 3824a3c (Profile types with strategy)
}
public function storeProfileDocInfo(Request $request){
//Profile type using Strategy pattern
$type = config('account.'.$this->account->type.'.class');
$profileStrategy = new $type;
return $profileStrategy->updateProfileDocInfo($this->account->profile);
}
=======
public function storeProfile()
{
//Profile type using Strategy pattern
$type = config('account.'.$this->account->type.'.class');
$profileStrategy = new $type;
$profileStrategy->validateRequest();
if($profile = $profileStrategy->updateProfile($this->account->profile)){
return $profile;
}
return response()->json(['message' => trans('app.account.update_account_error')],400);
}
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> 76551f4 (update company profile)
=======
=======
public function previewAccountAdmin($id){
$account = Account::with('profile')->with('country')->with('clients')->with('applications')->find($id);
return view('admin.preview');
}
=======
>>>>>>> 27e2969 (documents and documents groups done)
>>>>>>> 77d99a4 (test account preview if working)
>>>>>>> 879eb8f (documents admin fixed, lang fixed)
}

View File

@ -0,0 +1,216 @@
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Http\Requests\API\DocumentUploadRequest;
use App\Http\Resources\ApplicationResource;
use App\Models\Application;
use App\Models\Attachment;
use App\Models\Document;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
class ApplicationController extends Controller
{
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->account = Auth::user()
->account()
->with('profile')
->first();
return $next($request);
});
}
/**
* Create new Legalization Application
* @return ApplicationResource|\Illuminate\Http\Response
*/
public function create()
{
//validate if profile is filled
if(is_null($this->account) || is_null($this->account->profile))
{
return response([
'success' => false,
'message' => trans('app.application.fill_profile_message'),
],422);
}
//validate legalization number exists
elseif( !empty($this->account->legalization_number) || //legalizasia nomeri bar bolsa
(!empty( $this->account->expires_at) && //legalizasia srogy
$this->account->expires_at->lte(Carbon::now()->subMonth()))){//eger srogyn gutarmagyna 1 ay galmadyk bolsa
return response([
'success' => false,
'message' => trans('app.application.expire_message')
],422);
}
//delete old application??? Should we replace it???
if($app = $this->account->last_application())
{
if($app->state != 'approved')
return ApplicationResource::make($app);
else{
$app->state = 'archive';
$app->save();
}
}
//upload etmeli dokumentlaryn spisogy
$documents = Document::where($this->account->type,true)
->where(fn($query) => $query->where('all_country',true)
->orWhereHas('countries',function(Builder $query)
{
$query->where('countries.id',$this->account->country_id);
}))
->get();
if($documents->count() == 0)
{
return response([
'success' => false,
'message' => trans('application.list_not_found')
],404);
}
$application = Application::create([
'account_id' => $this->account->id,
// 'state' => 'new' //default mysql value is new
]);
foreach ($documents as $document){
$attachment = new Attachment([
'name' => $document->name,
'document_id' => $document->id
]);
$application->attachments()->save($attachment);
}
return ApplicationResource::make($application);
}
/**
* Get accounts legalization application
* @return ApplicationResource
*/
public function get()
{
$appication = $this->account
->applications()
->latest()
->with('attachments')
->first();
if($appication){
return ApplicationResource::make($appication);
}
return response()->json(['success' => false,'message' =>'Not Found'],404);
}
public function apply()
{
$app = $this->account
->applications()
->whereIn('state',['new','refine'])
->with('attachments')
->latest()
->first();
if( $app )
{
// $unAttachedDocumentsCount = $app->attachments->whereNull('file')->count();
//
// if($unAttachedDocumentsCount >0)
// {
// return response([
// 'success' => false,
// 'message' => trans('app.application.required_docs_message')
// ],422);
// }
$app->state = 'applied';
$app->save();
//todo send email to operators
return response([
'success' => true,
'message' => trans('app.application.app_success_message')
]);
}
return response([
'success' => false,
'message' => trans('app.application.app_error_message')
],400);
}
public function upload(DocumentUploadRequest $request,$attachment_id)
{
$attachment = Attachment::with(['application','document'])->find($attachment_id);
if(!$attachment || !$attachment->application || $attachment->application->account_id != $this->account->id ){
return response()->json(['success' => false, 'message' =>'Bad request'],400);
}
$uploadedFile = $request->file('file');
// Log::info($uploadedFile->getSize());
if($attachment->document->max_size != 0
&& $uploadedFile->getSize() > $attachment->document->max_size * 1024){//max size in kilobytes
return response()->json(['success' => false, 'message' =>trans('app.application.upload_max_size')],422);
}
if($attachment->file){
//todo delete or replace old file
// Stor
}
$filename = Str::snake($attachment->name).'.'.$uploadedFile->getClientOriginalExtension();
$directory = 'documents/'.Carbon::today()->year.'/'.$this->account->id;
$path = $uploadedFile->storePubliclyAs($directory,$filename);
if(!$path){
return response()->json(['success' => false, 'message' =>trans('app.application.upload_failure')],400);
}
$attachment->file = $directory.'/'.$filename;
$attachment->size = number_format($uploadedFile->getSize()/1024, 2, '.', '');
$attachment->type = $uploadedFile->getClientOriginalExtension();
$attachment->save();
return response()->json(['success' => true, 'message' =>trans('app.app.application.upload_success')]);
//todo make attachment relation
}
public function downloadQuestionaire(){
$headers = [
"Content-type"=>"text/html",
"Content-Disposition"=>"attachment;Filename=myGeneratefile.doc"
];
$content = view('oprosniki.'.$this->account->type,$this->account->profile)->render();
return \Response::make($content,200, $headers);
}
}

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers\API;
use App\Http\Requests\API\AddClientRequest;
use App\Http\Requests\API\LoginRequest;
use App\Http\Requests\API\RegisterRequest;
use App\Http\Requests\API\ClientRequest;
@ -13,34 +14,37 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Lang;
use App\Http\Controllers\Controller;
class AuthController extends Controller
class ClientController extends Controller
{
public function login(LoginRequest $request){
$client = Client::where('email', $request->input('email'))->first();
if($client){
if($client->is_suspended){
if($client)
{
if($client->is_suspended)
{
return response()->json([
'message' => 'Account with this email is suspended'
], 403);
'message' => trans('auth.auth.suspended')
], 422);
}
elseif (!$client->is_verified)
{
return response()->json([
'message' => trans('auth.not_verified')
], 422);
}
if (!Hash::check(request()->password, $client->password)){
return response()->json([
'message' => 'Unauthorized'
], 401);
}
elseif ($client->is_suspended){
return response()->json([
'message' => 'Account suspended'
], 401);
'message' => trans('auth.unauthorized')
], 422);
}
$credentials = $request->only('email', 'password');
@ -56,7 +60,7 @@ public function login(LoginRequest $request){
return response()->json(['message' => Lang::get('auth.email_not_found')], 404);
}
public function register(RegisterRequest $request){
public function signup(RegisterRequest $request){
$client = new Client($request->only(['email','firstname','lastname']));
$client->password = Hash::make($request->input('password'));
@ -67,13 +71,14 @@ public function register(RegisterRequest $request){
{
$client->verification_token = rand(10000, 99999);
try{
//try{
Mail::to($request->email)
->queue(new EmailVerification($request->firstname, $client->verification_token));
}catch (\Exception $ex){
//eger email ugradyp bolmasa verification edip bolmaz
$client->is_verified = true;
}
// }catch (\Exception $ex){
// //eger email ugradyp bolmasa verification edip bolmaz
// $client->is_verified = true;
// Log::error($ex->getMessage());
// }
}
@ -117,7 +122,7 @@ public function verifyEmail(Request $request){
}
else{
return response()->json([
'message' => 'no such client'
'message' => trans('auth.auth.user_not_found')
], 404);
}
}
@ -127,7 +132,7 @@ public function client(Request $request) {
return ClientResource::make($client);
}
return response()->json([
'message' => 'token_expired'
'message' => trans('auth.token_expired')
], 401);
}
@ -145,16 +150,18 @@ public function sendPasswordResetLinkEmail(Request $request) {
$user = Client::where('email', $request->email)->first();
if (!$user) {
return response()->json([
'message' => 'user with provided email not found'
'message' => trans('auth.auth.user_not_found')
], 404);
}
$token = rand(1000, 9999);
$user['verification_token'] = $token;
$user->save();
Mail::to($request->email)->queue(new ResetPassword($user->firstname, $token));
$user['verification_token'] = $token;
$user->save();
return response()->json([
'message' => 'sent reset code'
], 200);
@ -185,13 +192,13 @@ public function updatePassword(Request $request) {
}
return response()->json([
'message' => 'not_found'
'message' => trans('auth.auth.user_not_found')
], 404);
}
catch(\Exception $e){
return response()->json([
'message' => $e->getMessage()
], 500);
], 400);
}
}
@ -213,7 +220,28 @@ public function updateClient(ClientRequest $request){
}
return response()->json([
'message' => 'Your account has not been updated.',
],500);
'message' => trans('auth.app.account.update_profile_error')
],400);
}
public function registerClient(AddClientRequest $request)
{
$client = new Client($request->only(['email','firstname','lastname']));
$client->password = Hash::make($request->input('password'));
$client->is_verified = true;
$client->account_id = $request->user()->account_id;
if($client->save()){
return ClientResource::make($client);
}
return response()->json([
'message' => trans('auth.app.account.update_profile_error')
],400);
}
public function accountClients(){
return ClientResource::collection(request()->user()->account->clients);
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Http\Requests\API\ContractRequest;
use App\Http\Resources\ContractResource;
use App\Models\Contract;
use Illuminate\Http\Request;
class ContractController extends Controller
{
public function contract(ContractRequest $request){
<<<<<<< HEAD
if($contract = Contract::where('InputNumber',$request->get('number'))->first()){
return ContractResource::make($contract);
}
return response(["message" => "Not Found",'success' => false],);
=======
$contract = Contract::find($request->get('number'));
return ContractResource::make($contract);
>>>>>>> 9f9066f (contracts updated)
}
public function import(Request $request){
foreach($request->all() as $item){
$contract['foreign_ID'] = $item['ID'];
$contract['InputNumber'] = $item['InputNumber'];
$contract['InputDate'] = $item['InputDate'];
$contract['RegDate'] = $item['RegDate'];
$contract['MarkerSpec'] = $item['MarkerSpec'];
$contract['Workflow_ID'] = $item['Workflow_ID'];
$contract['Note'] = $item['Note'];
$contract['Remark'] = $item['Remark'];
$record = Contract::where('InputNumber', $contract['InputNumber'])->first();
if($record != null){
$record->fill($contract);
$record->save();
}
else{
Contract::create($contract);
}
}
return 'ok';
}
}

View File

@ -2,15 +2,88 @@
namespace App\Http\Controllers\API;
use App\Http\Requests\API\ContractRequest;
use App\Http\Resources\ContractResource;
use App\Http\Resources\CountryResource;
use App\Http\Resources\CategoryResource;
use App\Models\Contract;
use App\Models\Country;
use App\Models\Category;
use App\Http\Controllers\Controller;
use App\Http\Resources\QuestionResource;
use App\Models\Account;
use App\Models\Application;
use App\Models\Client;
use App\Models\Question;
use Illuminate\Http\Request;
class ResourceController extends Controller
{
public function countries(){
public function countries()
{
return CountryResource::collection(Country::all());
}
public function categories()
{
return CategoryResource::collection(Category::all());
}
public function faqs()
{
return QuestionResource::collection(Question::all());//todo investigate do we need all??
}
public function previewAccountAdmin($id)
{
$account = Account::with(['country','profile','clients','applications'])//tormoz etdirer todo fix this
->find($id);
return view('admin.preview',[
'account' => $account
]);
}
public function previewApplicationAdmin($id){
$application = Application::with(['account', 'attachments', 'ticket'])->find($id);
//dd($application->tickets);
return view('admin.application_preview',[
'application' => $application
]);
}
public function approveApplication(Request $request){
$application = Application::find($request->id);
$application->state = 'approved';
$application->save();
$account = Account::find($application->account_id);
$account->legalization_number = $request->legalization_number;
$account->expires_at = $request->expires_at;
$account->save();
return redirect()->back();
}
<<<<<<< HEAD
public function createAccountClient($account_id){
return view('admin.account_client_create',[
'account_id' => $account_id
]);
}
public function createClient(Request $request){
$data = $request->only('firstname', 'lastname', 'email', 'password', 'account_id');
$data['is_verified'] = false;
$data['is_suspended'] = false;
$client = new Client($data);
$client->save();
return redirect()->to('/admin/preview/' . $request->account_id . '#users');
}
=======
public function contract(ContractRequest $request){
return new ContactResource();
}
>>>>>>> dfccbbc (contracts api)
}

View File

@ -4,8 +4,10 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\API\TicketRequest;
use App\Http\Requests\API\MessageRequest;
use App\Http\Resources\MessageResource;
use App\Http\Resources\TicketResource;
use App\Models\Account;
use App\Models\Message;
use App\Models\Status;
use App\Models\Ticket;
@ -14,41 +16,103 @@
class TicketController extends Controller
{
public function chat(Request $request){
return view('admin.messages');
public function chat(Request $request)
{
$ticket = Ticket::with('account')->find($request->ticket_id);
return view('admin.messages',[
'ticket' => $ticket
]);
}
public function getTicketMessages(Request $request){
$messages = Message::where('ticket_id', $request->ticket_id)->orderBy('id', 'asc')->get();
return MessageResource::collection($messages);
public function getTicketMessages(Request $request)
{
if(Ticket::find($request->ticket_id))
{
$messages = Message::where('ticket_id', $request->ticket_id)
->orderBy('id', 'asc')
->paginate($request->per_page ?? 10);
return MessageResource::collection($messages);
}
return response()->json([
"message" => trans('app.ticket.not_found', ['id' => $request->ticket_id]),
"errors" => [
"ticket_id" => [trans('app.ticket.not_found', ['id' => $request->ticket_id])
]
]
], 404);
}
public function postMessage(Request $request){
public function postMessage(MessageRequest $request)
{
try{
$data = $request->all();
$message = new Message($data);
$message = new Message($request->only(['ticket_id', 'content']));
$message['is_client'] = true;
$message['client_id'] = $request->user()->id;
$message->save();
$ticket = Ticket::find($request->ticket_id);
$ticket['last_sender'] = 'client';
$ticket->save();
return MessageResource::make($message);
}
catch(\Exception $e){
return $e->getMessage();
}
}
public function getTickets(Request $request){
public function postMessageAdmin(MessageRequest $request)
{
try{
$message = new Message($request->only(['ticket_id', 'content', 'admin_id', 'status_id']));
$message['is_client'] = false;
$message->save();
$ticket = Ticket::find($request->ticket_id);
$ticket['last_sender'] = 'admin';
$ticket->save();
return MessageResource::make($message);
}
catch(\Exception $e){
return $e->getMessage();
}
}
public function getTickets(Request $request)
{
$client = $request->user();
$tickets = Ticket::with('status')->where('client_id', $client->id)->get();
$account = Account::find($client->account_id);
$tickets = Ticket::with('status')
->where('client_id', $account->id)
->orderBy('created_at', 'desc')
->paginate($request->per_page ?? 10);
return TicketResource::collection($tickets);
}
public function postTicket(TicketRequest $request){
$ticket = new Ticket($request->only('content', 'title'));
public function postTicket(TicketRequest $request)
{
$ticket = new Ticket($request->only('content', 'title','category_id'));
$client = $request->user();
$ticket['client_id'] = $client->id;
$status = Status::where('name', 'LIKE', '%' . 'open' . '%')->firstOrFail();
$account = Account::find($client->account_id);
$ticket['client_id'] = $account->id;
$status = Status::where('name', 'Open')->firstOrFail();
$ticket['status_id'] = $status->id;
$ticket['last_sender'] = 'client';
$ticket->save();
Message::create(['ticket_id' => $ticket->id, 'content' => $request->get("content"),'is_client' => true]);
return TicketResource::make($ticket);
}
//create ticket inside application preview - admin panel
public function createAppTicket(Request $request){
$ticket = new Ticket($request->only('content', 'title','category_id', 'client_id', 'account_id', 'application_id'));
$ticket['status_id'] = 1;
$ticket->save();
return redirect()->to('/admin/chat?ticket_id=' . $ticket->id);
}
}

View File

@ -16,7 +16,7 @@
class AccountCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
// use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
@ -29,7 +29,18 @@ public function setup()
{
CRUD::setModel(\App\Models\Account::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/account');
CRUD::setEntityNameStrings('account', 'accounts');
CRUD::setEntityNameStrings(trans('app.account.title'), trans('app.account.list_title'));
$this->crud->addFilter([
'name' => 'type',
'type' => 'dropdown',
'label' => trans('app.account.filter.type')
], [
'business' => trans('app.account.filter.business'),
'company' => trans('app.account.filter.company'),
], function ($value) { // if the filter is active
$this->crud->addClause('where', 'type', $value);
});
}
/**
@ -40,22 +51,18 @@ public function setup()
*/
protected function setupListOperation()
{
CRUD::column('type');
CRUD::column('vat');
CRUD::column('country_id');
CRUD::column('legalization_number');
CRUD::addColumn(['name'=>'account_type', 'type'=>'text','label'=> trans('app.account.filter.type')]);
CRUD::addColumn([
'name' => 'profile',
'label' => trans('app.account.name'),
'type' => 'profile_name'
]);
CRUD::addColumn(['name'=>'legalization_number', 'type'=>'text','label'=> trans('app.account.legalization_number')]);
CRUD::addColumn(['name'=>'expires_at', 'type'=>'text','label'=> trans('app.account.expires_at')]);
CRUD::addColumn(['name'=>'country_id', 'type'=>'select','label'=> trans('app.account.country'), 'entity' => 'country' ,'model' => 'App\Model\Country','attribute' => 'name']);
// $this->crud->addFilter([
// 'name' => 'status',
// 'type' => 'dropdown',
// 'label' => 'Account type'
// ], [
// 'company' => 'Company',
// 'business' => 'Business'
// ], function($value) { // if the filter is active
// $this->crud->addClause('where', 'type', $value);
// });
$this->crud->addButtonFromModelFunction('line', 'preview_button', 'preview', 'beginning');
$this->crud->addButtonFromModelFunction('line', 'export_button', 'export_account', 'beginning');
}
/**
@ -70,53 +77,58 @@ protected function setupCreateOperation()
$this->crud->addFields([
[
'name' => 'contacts',
'label' => 'Contacts',
'type' => 'table',
'entity_singular' => 'option', // used on the "Add X" button
'columns' => [
'address' => 'Address',
'phone' => 'Phone',
'email' => 'Email',
'fax' => 'Fax'
],
'max' => 15, // maximum rows allowed in the table
'min' => 0, // minimum rows allowed in the table
'name' => 'legalization_number',
'label' => trans('app.account.legalization_number'),
'type' => 'text',
'tab' => trans('app.account.tab_legalization')
],
[
'name' => 'expires_at',
'label' => trans('app.account.expires_at'),
'type' => 'date',
'tab' => trans('app.account.tab_legalization')
],
[
'name' => 'bank',
'label' => 'Bank',
'label' => trans('app.account.bank'),
'type' => 'table',
'entity_singular' => 'option', // used on the "Add X" button
'columns' => [
'account_number' => 'Account number',
'account_date' => 'Account date',
'currency' => 'Currency',
'iban' => 'IBAN',
'bank_name' => 'Bank name',
'country' => 'Country'
'account_number' => trans('app.account.account_number'),
'account_date' => trans('app.account.account_date'),
'currency' => trans('app.account.currency'),
'iban' => trans('app.account.iban'),
'bank_name' => trans('app.account.bank_name'),
'country' => trans('app.account.country'),
],
'max' => 15, // maximum rows allowed in the table
'min' => 0, // minimum rows allowed in the table
'tab' => trans('app.account.tab_bank'),
],
[
'name' => 'vat',
'label' => 'VAT',
'type' => 'text'
'name' => 'contacts',
'label' => trans('app.account.contacts'),
'type' => 'table',
'entity_singular' => 'option', // used on the "Add X" button
'columns' => [
'address' => trans('app.account.address'),
'phone' => trans('app.account.phone'),
'email' => trans('app.account.email'),
'fax' => trans('app.account.fax'),
],
'max' => 15, // maximum rows allowed in the table
'min' => 0, // minimum rows allowed in the table
'tab' => trans('app.account.tab_contacts'),
],
[
'name' => 'country_id',
'label' => 'Country',
'label' => trans('app.account.country'),
'type' => 'select',
'entity' => 'country',
'model' => "App\Models\Country", // related model
'attribute' => 'name', // foreign key attribute that is shown to user
'tab' => trans('app.account.tab_country'),
],
[
'name' => 'legalization_number',
'label' => 'Legalization number',
'type' => 'text'
]
]);

View File

@ -14,10 +14,9 @@
class ApplicationCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
// use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
@ -28,7 +27,34 @@ public function setup()
{
CRUD::setModel(\App\Models\Application::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/application');
CRUD::setEntityNameStrings('application', 'applications');
CRUD::setEntityNameStrings('application', trans('app.application.list_title'));
$this->crud->addFilter([
'name' => 'state',
'type' => 'dropdown',
'label' => trans('app.application.state')
], [
'new' => trans('app.application.new'),
'applied' => trans('app.application.applied'),
'refine' => trans('app.application.refine'),
'approved' => trans('app.application.approved'),
'archive' => trans('app.application.archived')
], function ($value) { // if the filter is active
$this->crud->addClause('where', 'state', $value);
});
$this->crud->addFilter([
'type' => 'date_range',
'name' => 'from_to',
'label' => trans('app.application.date_filter'),
],
false,
function ($value) { // if the filter is active, apply these constraints
$dates = json_decode($value);
$this->crud->addClause('where', 'created_at', '>=', $dates->from);
$this->crud->addClause('where', 'created_at', '<=', $dates->to . ' 23:59:59');
});
}
/**
@ -39,7 +65,49 @@ public function setup()
*/
protected function setupListOperation()
{
$this->crud->setFromDb();
$this->crud->addColumns([
[
'name' => 'profile',
'type' => 'account_profile_name',
'label' => trans('app.application.account'),
],
[ // SelectMultiple = n-n relationship (with pivot table)
'label' => trans('app.account.account_type'),
'type' => 'select',
'name' => 'account_type', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'model' => "App\Models\Account", // foreign key model
'attribute' => 'type',
],
[ // SelectMultiple = n-n relationship (with pivot table)
'label' => trans('app.application.leg_number'),
'type' => 'select',
'name' => 'account_legnumber', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'model' => "App\Models\Account", // foreign key model
'attribute' => 'legalization_number',
],
[ // SelectMultiple = n-n relationship (with pivot table)
'label' => trans('app.application.expires_at'),
'type' => 'select',
'name' => 'account_exp_date', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'model' => "App\Models\Account", // foreign key model
'attribute' => 'expires_at',
],
[
'name' => 'state',
'label' => trans('app.application.state'),
'type' => 'badge',
],
[
'name' => 'created_at',
'label' => trans('app.application.created_at'),
]
]);
$this->crud->addButtonFromModelFunction('line', 'preview_button', 'preview', 'beginning');
}
/**
@ -48,14 +116,33 @@ protected function setupListOperation()
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(ApplicationRequest::class);
$this->crud->addFields([
['name' => 'account_id', 'type' => 'select', 'label' => 'Account', 'entity' => 'account', 'model' => "App\Models\Account", 'attribute' => 'vat'],
['name' => 'status','label' => 'Status','type' => 'checkbox']
]);
}
// protected function setupCreateOperation()
// {
// CRUD::setValidation(ApplicationRequest::class);
// $this->crud->addFields([
// [ // SelectMultiple = n-n relationship (with pivot table)
// 'label' => trans('app.application.account'),
// 'type' => 'custom_select_account',
// 'name' => 'account_id', // the method that defines the relationship in your Model
// 'entity' => 'account', // the method that defines the relationship in your Model
// 'model' => "App\Models\Account", // foreign key model
// 'attribute_1' => 'name', // foreign key attribute that is shown to user
// 'attribute_2' => 'surname',
// ],
// [
// 'name' => 'state',
// 'label' => trans('app.application.state'),
// 'type' => 'select_from_array',
// 'options' => [
// 'new' => trans('app.application.new'),
// 'applied' => trans('app.application.applied'),
// 'refine' => trans('app.application.refine'),
// 'approved' => trans('app.application.approved'),
// 'archive' => trans('app.application.archived')
// ]
// ]
// ]);
// }
/**
* Define what happens when the Update operation is loaded.
@ -65,7 +152,20 @@ protected function setupCreateOperation()
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
$this->crud->setFromDb();
CRUD::setValidation(ApplicationRequest::class);
$this->crud->addFields([
[
'name' => 'state',
'label' => 'State',
'type' => 'select_from_array',
'options' => [
'new' => trans('app.application.new'),
'applied' => trans('app.application.applied'),
'refine' => trans('app.application.refine'),
'approved' => trans('app.application.approved'),
'archive' => trans('app.application.archived')
]
]
]);
}
}

View File

@ -16,7 +16,7 @@
class BusinessCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation { store as traitStore; }
// use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation { store as traitStore; }
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
@ -30,7 +30,7 @@ public function setup()
{
CRUD::setModel(\App\Models\Business::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/business');
CRUD::setEntityNameStrings('business', 'businesses');
CRUD::setEntityNameStrings(trans('app.business.title'), trans('app.business.list_title'));
}
/**
@ -42,19 +42,19 @@ public function setup()
protected function setupListOperation()
{
CRUD::addColumn([
'name' => 'personal',
'type' => 'json',
'label' => 'Personal'
'name' => 'name',
'type' => 'text',
'label' => trans('app.business.name')
]);
CRUD::addColumn([
'name' => 'document',
'type' => 'json',
'label' => 'Document'
'name' => 'surname',
'type' => 'text',
'label' => trans('app.business.surname')
]);
CRUD::addColumn([
'name' => 'job',
'type' => 'json',
'label' => 'Job'
'name' => 'patronomic_name',
'type' => 'text',
'label' => trans('app.business.patronomic_name')
]);
@ -77,58 +77,42 @@ protected function setupCreateOperation()
$this->crud->addFields([
[
'name' => 'personal',
'label' => 'Personal',
'type' => 'table',
'entity_singular' => 'option', // used on the "Add X" button
'columns' => [
'name' => 'Name',
'surname' => 'Surname',
'patronomic_name' => 'Patronomic name',
'date_of_birth' => 'Date of birth',
'birth_place' => 'Birth place',
'citizenship_id' => 'Citizenship ID',
'registration_address' => 'Registration address'
],
'max' => 15,
'min' => 0,
'name' => 'name',
'label' => trans('app.business.name'),
'type' => 'text',
],
[
'name' => 'document',
'label' => 'Document',
'type' => 'table',
'entity_singular' => 'option',
'columns' => [
'doc_name' => 'Doc name',
'doc_series' => 'Doc series',
'doc_number' => 'Doc number',
'doc_date' => 'Doc date',
'doc_given_by' => 'Doc given by'
],
'max' => 15,
'min' => 0,
'name' => 'surname',
'label' => trans('app.business.surname'),
'type' => 'text',
],
[
'name' => 'job',
'label' => 'Job',
'type' => 'table',
'entity_singular' => 'option', // used on the "Add X" button
'columns' => [
'work_place' => 'Work place',
'position' => 'Position',
'business_type' => 'Business type',
'licenses' => 'Licenses',
],
'max' => 15, // maximum rows allowed in the table
'min' => 0, // minimum rows allowed in the table
'name' => 'patronomic_name',
'label' => trans('app.business.patronomic_name'),
'type' => 'text',
],
[
'label' => "profile",
'name' => 'date_of_birth',
'label' => trans('app.business.date_of_birth'),
'type' => 'date',
],
[
'name' => 'birth_place',
'label' => trans('app.business.birth_place'),
'type' => 'text',
],
[
'name' => 'registration_address',
'label' => trans('app.business.registration_address'),
'type' => 'text',
],
[
'label' =>trans('app.business.citizenship'),
'type' => 'select',
'name' => 'account.id', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'attribute' => 'id', // foreign key attribute that is shown to user
'model' => "App\Models\Account", // foreign key model
'name' => 'citizenship', // the method that defines the relationship in your Model
'entity' => 'citizenship', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
'model' => "App\Models\Country", // foreign key model
]
]);

View File

@ -39,9 +39,7 @@ public function setup()
*/
protected function setupListOperation()
{
CRUD::column('name_en');
CRUD::column('name_ru');
CRUD::column('name_tm');
CRUD::column('name');
/**
* Columns can be defined using the fluent syntax or array syntax:
@ -60,9 +58,7 @@ protected function setupCreateOperation()
{
CRUD::setValidation(CategoryRequest::class);
CRUD::field('name_en');
CRUD::field('name_ru');
CRUD::field('name_tm');
CRUD::field('name');
/**
* Fields can be defined using the fluent syntax or array syntax:

View File

@ -14,10 +14,9 @@
class ClientCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
// use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
@ -28,7 +27,29 @@ public function setup()
{
CRUD::setModel(\App\Models\Client::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/client');
CRUD::setEntityNameStrings('client', 'clients');
CRUD::setEntityNameStrings(trans('app.client.title'), trans('app.client.list_title'));
$this->crud->addFilter([
'name' => 'is_verified',
'type' => 'dropdown',
'label' => trans('app.client.is_verified')
], [
1 => trans('app.yes'),
0 => trans('app.no'),
], function ($value) { // if the filter is active
$this->crud->addClause('where', 'is_verified', $value);
});
$this->crud->addFilter([
'name' => 'is_suspended',
'type' => 'dropdown',
'label' => trans('app.client.is_suspended'),
], [
1 => trans('app.yes'),
0 => trans('app.no'),
], function ($value) { // if the filter is active
$this->crud->addClause('where', 'is_suspended', $value);
});
}
/**
@ -39,13 +60,29 @@ public function setup()
*/
protected function setupListOperation()
{
CRUD::column('firstname');
CRUD::column('lastname');
CRUD::column('email');
CRUD::column('status');
CRUD::column('account_id');
CRUD::column('created_at');
CRUD::column('updated_at');
CRUD::addColumns([
['name' => 'firstname','type'=>'text','label'=> trans('app.client.firstname')],
['name' => 'lastname','type'=>'text','label'=> trans('app.client.lastname')],
['name' => 'email','type'=>'text','label'=> trans('app.client.email')],
[
'name' => 'is_verified',
'type' => 'radio',
'label' => trans('app.client.is_verified'),
'options' => [
1 => trans('app.yes'),
0 => trans('app.no'),
]
],
[
'name' => 'is_suspended',
'type' => 'radio',
'label' => trans('app.client.is_suspended'),
'options' => [
1 => trans('app.yes'),
0 => trans('app.no'),
]
]
]);
}
/**
@ -58,14 +95,15 @@ protected function setupCreateOperation()
{
CRUD::setValidation(ClientRequest::class);
CRUD::field('firstname');
CRUD::field('lastname');
CRUD::field('email');
CRUD::field('status');
CRUD::field('is_suspended');
CRUD::field('account_id');
CRUD::field('created_at');
CRUD::field('updated_at');
CRUD::addFields([
['name' => 'firstname','type'=>'text','label'=> trans('app.client.firstname')],
['name' => 'lastname','type'=>'text','label'=> trans('app.client.lastname')],
['name' => 'email','type'=>'text','label'=> trans('app.client.email')],
['name' => 'is_suspended', 'type' => 'switch', 'label' => trans('app.client.is_suspended')],
['name' => 'is_verified', 'type' => 'switch', 'label' => trans('app.client.is_verified')]
]);
}
/**

View File

@ -15,7 +15,7 @@
class CompanyCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation { store as traitStore; }
// use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation { store as traitStore; }
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
@ -29,7 +29,7 @@ public function setup()
{
CRUD::setModel(\App\Models\Company::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/company');
CRUD::setEntityNameStrings('company', 'companies');
CRUD::setEntityNameStrings(trans('app.company.title'), trans('app.company.list_title'));
}
/**
@ -40,30 +40,28 @@ public function setup()
*/
protected function setupListOperation()
{
CRUD::column('name');
CRUD::column('short_name');
CRUD::column('registration_number');
CRUD::addColumn([ // Date
'name' => 'registration_date',
'label' => 'Regitration date',
'type' => 'date'
CRUD::addColumns([
['name' => 'name', 'type' => 'text', 'label' => trans('app.company.name')],
['name' => 'short_name', 'type' => 'text', 'label' => trans('app.company.short_name')],
['name' => 'registration_number', 'type' => 'text', 'label' => trans('app.company.registration_number')],
['name' => 'state_registration_agency', 'type' => 'text', 'label' => trans('app.company.state_registration_agency')],
['name' => 'registration_place', 'type' => 'text', 'label' => trans('app.company.registration_place')],
['name' => 'registration_address', 'type' => 'text', 'label' => trans('app.company.registration_address')],
[ // Date
'name' => 'registration_date',
'label' => trans('app.company.registration_date'),
'type' => 'date'
]
]);
CRUD::column('state_registration_agency');
CRUD::column('registration_place');
CRUD::column('registration_address');
CRUD::column('fond_capital');
CRUD::column('management_types');
CRUD::column('signers');
CRUD::column('share_holders');
CRUD::column('organizational_form');
CRUD::column('is_agent');
}
protected function setupShowOperation()
{
$this->setupListOperation();
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
}
/**
@ -75,45 +73,20 @@ protected function setupListOperation()
protected function setupCreateOperation()
{
CRUD::setValidation(CompanyRequest::class);
CRUD::field('name');
CRUD::field('short_name');
CRUD::field('registration_number');
CRUD::addFields([
['name' => 'name', 'type' => 'text', 'label' => trans('app.company.name')],
['name' => 'short_name', 'type' => 'text', 'label' => trans('app.company.short_name')],
['name' => 'registration_number', 'type' => 'text', 'label' => trans('app.company.registration_number')],
['name' => 'state_registration_agency', 'type' => 'text', 'label' => trans('app.company.state_registration_agency')],
['name' => 'registration_place', 'type' => 'text', 'label' => trans('app.company.registration_place')],
['name' => 'registration_address', 'type' => 'text', 'label' => trans('app.company.registration_address')],
]);
CRUD::addField([ // Date
'name' => 'registration_date',
'label' => 'Regitration date',
'label' => trans('app.company.registration_date'),
'type' => 'date'
]);
CRUD::field('state_registration_agency');
CRUD::field('registration_place');
CRUD::field('registration_address');
CRUD::field('fond_capital');
CRUD::field('management_types');
CRUD::field([
'name' => 'signers',
'label' => 'Signers',
'type' => 'table',
'entity_singular' => 'option', // used on the "Add X" button
'columns' => [
'fullname' => 'Fullname',
'birthdate_n_birthplace' => 'Birthdate, place',
'citizenzhip' => 'Citizenship',
'registratino_address' => 'Registration address',
'' => '',
],
'max' => 15, // maximum rows allowed in the table
'min' => 0, // minimum rows allowed in the table
]);
CRUD::field('share_holders');
CRUD::field('organizational_form');
CRUD::field('is_agent');
CRUD::addField([
'label' => "profile",
'type' => 'select',
'name' => 'account.id', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'attribute' => 'id', // foreign key attribute that is shown to user
'model' => "App\Models\Account", // foreign key model
]);
/**
* Fields can be defined using the fluent syntax or array syntax:

View File

@ -0,0 +1,108 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\ContractRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
use Illuminate\Support\Facades\Lang;
/**
* Class ContractCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class ContractCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\Contract::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/contract');
CRUD::setEntityNameStrings('contract', 'contracts');
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('id');
CRUD::column('foreign_ID');
CRUD::column('InputNumber');
CRUD::column('InputDate');
CRUD::column('RegDate');
CRUD::addColumn([
'name' => 'MarkerSpec',
'label' => 'MarkerSpec',
'type' => 'closure',
'function' => function($entry) {
return Lang::get('imported.markerspec.' . $entry->MarkerSpec);
}
]);
CRUD::addColumn([
'name' => 'Workflow_ID',
'label' => 'Workflow',
'type' => 'closure',
'function' => function($entry) {
return Lang::get('imported.workflow.' . $entry->Workflow_ID);
}
]);
CRUD::column('Note');
CRUD::column('Remark');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
}
/**
* Define what happens when the Create operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(ContractRequest::class);
CRUD::field('InputNumber');
CRUD::field('InputDate');
CRUD::field('RegDate');
CRUD::field('MarkerSpec');
CRUD::field('Workflow_ID');
CRUD::field('Note');
CRUD::field('Remark');
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Requests\DocumentRequest;
use App\Models\Country;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
@ -17,7 +18,6 @@ class DocumentCrudController extends CrudController
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
@ -29,6 +29,54 @@ public function setup()
CRUD::setModel(\App\Models\Document::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/document');
CRUD::setEntityNameStrings('document', 'documents');
$this->crud->addFilter([
'name' => 'business',
'type' => 'dropdown',
'label' => 'Business'
], [
1 => 'yes',
0 => 'no'
], function ($value) { // if the filter is active
$this->crud->addClause('where', 'business', $value);
});
$this->crud->addFilter([
'name' => 'company',
'type' => 'dropdown',
'label' => 'Company'
], [
1 => 'yes',
0 => 'no'
], function ($value) { // if the filter is active
$this->crud->addClause('where', 'company', $value);
});
$this->crud->addFilter([
'name' => 'all_country',
'type' => 'dropdown',
'label' => 'All country'
], [
1 => 'yes',
0 => 'no'
], function ($value) {
$this->crud->addClause('where', 'all_country', $value);
});
// select2_multiple filter
$this->crud->addFilter([
'name' => 'countries',
'type' => 'select2_multiple',
'label' => 'Countries'
], function() {
return Country::all()->pluck('name', 'id')->toArray();
}, function($values) {
foreach ($values as $key => $value) {
$this->crud->query = $this->crud->query->whereHas('countries', function ($query) use ($value) {
$query->where('country_id', $value);
});
}
});
}
/**
@ -39,7 +87,66 @@ public function setup()
*/
protected function setupListOperation()
{
$this->crud->setFromDb();
$this->crud->addColumns([
[
'name' => 'name',
'type' => 'text',
'label' => 'Name'
],
[
'name' => 'max_size',
'type' => 'number',
'label' => 'Max size (KBytes)',
'default' => 0
],
[
'name' => 'order',
'type' => 'number',
'label' => 'Position',
'default' => 0
],
[
'name' => 'business',
'type' => 'radio',
'label' => 'Enterpreneurs',
'options' => [
1 => 'Yes',
0 => 'No'
]
],
[
'name' => 'company',
'type' => 'radio',
'label' => 'Companies',
'options' => [
1 => 'Yes',
0 => 'No'
]
],
[
'name' => 'all_country',
'type' => 'radio',
'label' => 'All countries',
'options' => [
1 => 'Yes',
0 => 'No'
]
],
[
'label' => "Document Countries",
'type' => 'select_multiple',
'name' => 'countries',
'entity' => 'countries',
'model' => "App\Models\Country",
'attribute' => 'name',
'pivot' => true,
'options' => (function ($query) {
return $query->orderBy('name', 'ASC')->get();
}),
],
]);
}
/**
@ -62,11 +169,72 @@ protected function setupCreateOperation()
'type' => 'textarea',
'label' => 'Description'
],
[
'name' => 'max_size',
'type' => 'number',
'label' => 'Max size (KBytes)',
'default' => 0
],
[
'name' => 'order',
'type' => 'number',
'label' => 'Position',
'default' => 0
],
[ // Checkbox
'name' => 'business',
'label' => 'Enterpreneurs',
'type' => 'checkbox'
],
[ // Checkbox
'name' => 'company',
'label' => 'Companies',
'type' => 'checkbox'
],
[ // Checkbox
'name' => 'all_country',
'label' => 'All countries',
'type' => 'checkbox'
],
// [ // SelectMultiple = n-n relationship (with pivot table)
// 'label' => "Document Groups",
// 'type' => 'select_multiple',
// 'name' => 'groups', // the method that defines the relationship in your Model
// // optional
// 'entity' => 'groups', // the method that defines the relationship in your Model
// 'model' => "App\Models\Documentgroup", // foreign key model
// 'attribute' => 'name', // foreign key attribute that is shown to user
// 'pivot' => true, // on create&update, do you need to add/delete pivot table entries?
// // also optional
// 'options' => (function ($query) {
// return $query->orderBy('name', 'ASC')->get();
// }), // force the related options to be a custom query, instead of all(); you can use this to filter the results show in the select
// ],
[
'label' => "Document Countries",
'type' => 'select2_multiple',
'name' => 'countries',
'entity' => 'countries',
'model' => "App\Models\Country",
'attribute' => 'name',
'pivot' => true,
'options' => (function ($query) {
return $query->orderBy('name', 'ASC')->get();
}),
],
[
'name' => 'max_size',
'type' => 'text',
'label' => 'Max size'
'label' => 'Max size (KBytes)'
]
<<<<<<< HEAD
>>>>>>> 5059220 (Document fix)
=======
>>>>>>> bcf57dd (documents fixed)
]);
}

View File

@ -17,7 +17,6 @@ class DocumentgroupCrudController extends CrudController
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
@ -39,7 +38,38 @@ public function setup()
*/
protected function setupListOperation()
{
$this->crud->setFromDb();
$this->crud->addColumns([
[
'name' => 'name',
'type' => 'text',
'label' => 'Name'
],
[
'name' => 'type',
'type' => 'select_from_array',
'label' => 'Type',
'options' => [
'business' => 'business',
'company' => 'company'
]
],
[ // SelectMultiple = n-n relationship (with pivot table)
'label' => "Countries",
'type' => 'select_multiple',
'name' => 'countries', // the method that defines the relationship in your Model
// optional
'entity' => 'countries', // the method that defines the relationship in your Model
'model' => "App\Models\Country", // foreign key model
'attribute' => 'name', // foreign key attribute that is shown to user
'pivot' => true, // on create&update, do you need to add/delete pivot table entries?
// also optional
'options' => (function ($query) {
return $query->orderBy('name', 'ASC')->get();
}), // force the related options to be a custom query, instead of all(); you can use this to filter the results show in the select
],
]);
}
/**
@ -52,7 +82,7 @@ protected function setupCreateOperation()
{
CRUD::setValidation(DocumentgroupRequest::class);
$this->crud->addField([
$this->crud->addFields([
[
'name' => 'name',
'type' => 'text',
@ -65,9 +95,29 @@ protected function setupCreateOperation()
],
[
'name' => 'type',
'type' => 'text',
'label' => 'Type'
]
'type' => 'select_from_array',
'label' => 'Type',
'options' => [
'business' => 'business',
'company' => 'company'
]
],
[ // SelectMultiple = n-n relationship (with pivot table)
'label' => "Countries",
'type' => 'select_multiple',
'name' => 'countries', // the method that defines the relationship in your Model
// optional
'entity' => 'countries', // the method that defines the relationship in your Model
'model' => "App\Models\Country", // foreign key model
'attribute' => 'name', // foreign key attribute that is shown to user
'pivot' => true, // on create&update, do you need to add/delete pivot table entries?
// also optional
'options' => (function ($query) {
return $query->orderBy('name', 'ASC')->get();
}), // force the related options to be a custom query, instead of all(); you can use this to filter the results show in the select
],
]);
}

View File

@ -21,7 +21,7 @@ class DocumentgroupDocumentCrudController extends CrudController
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
*
* @return void
*/
public function setup()
@ -33,24 +33,18 @@ public function setup()
/**
* Define what happens when the List operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
$this->crud->setFromDb();
}
/**
* Define what happens when the Create operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
@ -58,18 +52,12 @@ protected function setupCreateOperation()
{
CRUD::setValidation(DocumentgroupDocumentRequest::class);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
$this->crud->setFromDb();
}
/**
* Define what happens when the Update operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
class LocalizationController extends Controller
{
public function setLang(Request $request){
if($request->lang == 'ru'){
$request->session()->put('locale', $request->lang);
App::setLocale('ru');
}
elseif($request->lang == 'tm'){
$request->session()->put('locale', $request->lang);
App::setLocale('tm');
}
else{
$request->session()->put('locale', $request->lang);
App::setLocale('en');
}
return redirect()->back();
}
}

View File

@ -39,7 +39,18 @@ public function setup()
*/
protected function setupListOperation()
{
$this->crud->setFromDb();
CRUD::addColumns([
[
'name' => 'question_text',
'type' => 'text',
'label' => 'Question text'
],
[
'name' => 'options',
'type' => 'text',
'label' => 'Options'
]
]);
}
/**
@ -55,7 +66,7 @@ protected function setupCreateOperation()
CRUD::addFields([
[
'name' => 'question_text',
'type' => 'textarea',
'type' => 'text',
'label' => 'Question text'
],
[

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Requests\TicketRequest;
use App\Models\Status;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
@ -27,7 +28,18 @@ public function setup()
{
CRUD::setModel(\App\Models\Ticket::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/ticket');
CRUD::setEntityNameStrings('ticket', 'tickets');
CRUD::setEntityNameStrings(trans('app.ticket.title'), trans('app.ticket.list_title'));
// select2 filter
$this->crud->addFilter([
'name' => 'status',
'type' => 'select2',
'label' => trans('app.ticket.status'),
], function () {
return Status::get()->pluck('name', 'id')->toArray();
}, function ($value) { // if the filter is active
$this->crud->addClause('where', 'status_id', $value);
});
}
/**
@ -40,27 +52,29 @@ protected function setupListOperation()
{
$this->crud->addColumns([
[
'name' => 'title',
'name' => 'content',
'type' => 'text',
'label' => 'Title'
'label' => trans('app.ticket.content')
],
[
'name' => 'content',
'type' => 'textarea',
'label' => 'Content'
'name' => 'title',
'type' => 'text',
'label' => trans('app.ticket.ticket_title')
],
[
'name' => 'client_id',
'entity' => 'client',
'type' => 'select',
'label' => 'Client',
'attribute' => 'email',
'model' => 'App\Models\Client'
'type' => 'account_profile_name',
'label' => trans('app.ticket.account'),
],
[
'name' => 'status',
'type' => 'status',
'label' => 'Status'
'label' => trans('app.ticket.status'),
],
[
'name' => 'application_id',
'type' => 'text',
'label' => trans('app.ticket.application_id')
]
]);
@ -79,31 +93,48 @@ protected function setupCreateOperation()
$this->crud->addFields([
[
'name' => 'title',
'type' => 'text',
'name' => 'title',
'type' => 'text',
'label' => 'Title'
],
[
'name' => 'content',
'type' => 'textarea',
'name' => 'content',
'type' => 'textarea',
'label' => 'Content'
],
[
'name' => 'client_id',
'entity' => 'client',
'type' => 'select',
'label' => 'Client',
'attribute' => 'email',
'model' => 'App\Models\Client'
[ // SelectMultiple = n-n relationship (with pivot table)
'label' => "Account",
'type' => 'custom_select_account',
'name' => 'client_id', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'model' => "App\Models\Account", // foreign key model
'attribute_1' => 'name', // foreign key attribute that is shown to user
'attribute_2' => 'surname',
],
[
'name' => 'status_id',
'entity' => 'status',
'type' => 'select',
'label' => 'Status',
'name' => 'category_id',
'entity' => 'category',
'type' => 'select',
'label' => 'Category',
'attribute' => 'name',
'model' => 'App\Models\Status'
'model' => 'App\Models\Category'
],
[
'name' => 'status_id',
'entity' => 'status',
'type' => 'select',
'label' => 'Status',
'attribute' => 'name',
'model' => 'App\Models\Status'
],
[
'name' => 'last_sender',
'label' => 'Last sender',
'type' => 'select_from_array',
'options' => ['admin' => 'admin', 'client' => 'client'],
'allows_null' => false,
'default' => 'admin'
]
]);
}

View File

@ -6,6 +6,7 @@
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Auth;
class Controller extends BaseController
{

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers;
use App\Models\Account;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
use App\View\Composers\ProfileComposer;
use Laravel\Sanctum\PersonalAccessToken;
class ExportController extends Controller
{
public function exportAccount($hashedTooken){
$token = PersonalAccessToken::findToken($hashedTooken);
$user = $token->tokenable;
$account = $user->account()->with('profile')->first();
//dd(json_decode($account->bank));
$headers = array(
"Content-type"=>"text/html",
"Content-Disposition"=>"attachment;Filename=Sowalnama.doc"
);
$content = view('oprosniki.'.$account->type, ['account' => $account])->render();
return \Response::make($content,200, $headers);
}
public function export($id){
$account = Account::with('profile')->find($id);
//dd(json_decode($account->bank));
$headers = array(
"Content-type"=>"text/html",
"Content-Disposition"=>"attachment;Filename=Sowalnama.doc"
);
$content = view('oprosniki.'.$account->type, ['account' => $account])->render();
return \Response::make($content,200, $headers);
}
}

View File

@ -36,6 +36,7 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
'web_localization',
],
'api' => [
@ -66,6 +67,7 @@ class Kernel extends HttpKernel
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'auth.client' => \App\Http\Middleware\ClientUserProvider::class,
'localization' => \App\Http\Middleware\Localization::class,
'web_localization' => \App\Http\Middleware\WebLocalization::class
];
protected $middlewarePriority = [

View File

@ -15,7 +15,7 @@ class Authenticate extends Middleware
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
return response(['message' =>'Forbidden'],403);
}
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Session;
use Config;
use App;
class WebLocalization
{
/**
* 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)
{
$raw_locale = $request->session()->get('locale');
if (in_array($raw_locale, Config::get('app.locales'))) {
$locale = $raw_locale;
}
else $locale = Config::get('app.locale');
$request->session()->put('locale', $locale ?? 'en');
app()->setLocale($locale);
return $next($request);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class AddClientRequest 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<string, mixed>
*/
public function rules()
{
return [
'email' => 'required|email|unique:clients,email',
'password' => 'required|min:6',
'firstname' => 'required|string|max:255',
'lastname' => 'required|string|max:255',
];
}
}

View File

@ -4,7 +4,7 @@
use Illuminate\Foundation\Http\FormRequest;
class AccountRequest extends FormRequest
class BusinessProfileDocRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
@ -13,7 +13,7 @@ class AccountRequest extends FormRequest
*/
public function authorize()
{
return true;
return false;
}
/**

View File

@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class BusinessProfileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'name' => 'required|string|max:500',
'surname' => 'required|string|max:500',
'patronomic_name' => 'string|nullable|string|max:500',
'date_of_birth' => 'required|date_format:Y-m-d',
'birth_place' => 'required|string|max:500',
'citizenship_id' => 'required',
'registration_address' => 'required|string|max:500'
];
}
}

View File

@ -24,9 +24,10 @@ public function authorize()
public function rules()
{
return [
'firstname' => 'required',
'lastname' => 'required',
'password' => 'min:6'
'firstname' => 'required|string|max:500',
'lastname' => 'required|string|max:500',
'password' => 'min:6',
'old_password' => 'required_with:password'
];
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class CompanyProfileDocRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'fond_capital' => 'required',
'management_types' => 'required',
'signers' => 'required',
'share_holders' => 'required',
'organizational_form' => 'required',
'is_agent' => 'required'
];
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class CompanyProfileRequest 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<string, mixed>
*/
public function rules()
{
return [
'name' => 'required|string|max:500',
'short_name' => 'required|string|max:500',
'registration_number' => 'required|string|max:500',
'registration_date' => 'required|date_format:Y-m-d',
'state_registration_agency' => 'required|string|max:500',
'registration_place' => 'required|string|max:500',
'registration_address' => 'required|string|max:500',
];
}
}

View File

@ -26,7 +26,12 @@ public function rules()
return [
'address' => 'required',
'phone' => 'required',
<<<<<<< HEAD
'email' => 'required',
=======
'email' => 'required|email',
'fax' => 'nullable'
>>>>>>> e1b332b (account bank contact resources)
];
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class ContractRequest 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<string, mixed>
*/
public function rules()
{
return [
'number' => 'required|numeric',
];
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class DocumentUploadRequest 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<string, mixed>
*/
public function rules()
{
return [
'file' => 'required|file|mimes:jpg,pdf,png,zip',
];
}
// protected function prepareForValidation(): void
// {
// $this->merge(json_decode($this->payload, true, 512, JSON_THROW_ON_ERROR));
// }
}

View File

@ -3,6 +3,7 @@
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
use App\Rules\TicketRule;
class MessageRequest extends FormRequest
{
@ -13,7 +14,7 @@ class MessageRequest extends FormRequest
*/
public function authorize()
{
return false;
return true;
}
/**
@ -25,8 +26,7 @@ public function rules()
{
return [
'content' => 'required',
'ticket_id' => 'required',
'is_client' => 'required'
'ticket_id' => ['required', new TicketRule]
];
}
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
class ProfileRequest 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<string, mixed>
*/
public function rules()
{
$type = $this->get('account_type');
if ($type == "business") {
$rules = $this->businessRules();
}
else{
$rules = $this->companyRules();
}
return $rules;
}
private function businessRules(){
return [
'name' => 'required',
'surname' => 'required',
'patronomic_name' => 'required',
'date_of_birth' => 'required',
'birth_place' => 'required',
'citizenship_id' => 'required',
'registration_address' => 'required'
];
}
private function companyRules(){
return [
'name' => 'required',
'short_name' => 'required',
'registration_number' => 'required',
'registration_date' => 'required',
'state_registration_agency' => 'required',
'registration_place' => 'required',
'registration_address' => 'required',
'fond_capital' => 'required',
'management_types' => 'required',
'signers' => 'required',
'share_holders' => 'required',
'organizational_form' => 'required',
'is_agent' => 'required'
];
}
}

View File

@ -26,8 +26,8 @@ public function rules()
return [
'email' => 'required|email|unique:clients,email',
'password' => 'required|min:6',
'firstname' => 'required',
'lastname' => 'required',
'firstname' => 'required|string|max:255',
'lastname' => 'required|string|max:255',
'account_type' => 'required|in:company,business',
'country' => 'required|numeric|gt:0',
];

View File

@ -3,6 +3,7 @@
namespace App\Http\Requests\API;
use Illuminate\Foundation\Http\FormRequest;
use App\Rules\CategoryRule;
class TicketRequest extends FormRequest
{
@ -24,6 +25,7 @@ public function authorize()
public function rules()
{
return [
'category_id' => ['required', new CategoryRule],
'title' => 'required',
'content' => 'required',
];

View File

@ -0,0 +1,55 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ContractRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
// only allow updates if the user is logged in
return backpack_auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
// 'name' => 'required|min:5|max:255'
];
}
/**
* Get the validation attributes that apply to the request.
*
* @return array
*/
public function attributes()
{
return [
//
];
}
/**
* Get the validation messages that apply to the request.
*
* @return array
*/
public function messages()
{
return [
//
];
}
}

View File

@ -17,20 +17,39 @@ class AccountResource extends JsonResource
public function toArray($request)
{
return [
'id' => $this->id,
'bank_account' => $this->bank,
'contacts' => $this->contacts,
'account_type' => $this->type,
'profile' => $this->profile()
'bank_account' => $this->bank ? BankResource::make(json_decode($this->bank)):null,
'contacts' => $this->contacts ? ContactResource::make(json_decode($this->contacts)):null,
'account_type' => $this->type,
'country' => CountryResource::make($this->country),
'profile' => $this->getProfile(),
'legal_number' => $this->legalization_number,
'legal_expires_at' => !is_null($this->expires_at)?$this->expires_at->format('d.m.Y'):null,
'legal_can_apply' => $this->can_apply_legal_number,
'legal_can_extend' => $this->can_extend_legal_number,
'legal_app_status' => $this->application_status,
];
}
private function profile() : JsonResource
private function getProfile() : JsonResource
{
<<<<<<< HEAD
<<<<<<< HEAD
if($this->profile){
$type = config('account.'.$this->type.'.resource');
return $type::make($this->profile);
}
return new JsonResource([]);
=======
$type = config('account.'.$this->type.'.resource');
=======
$type = config('account.'.$this->type.'.resources');
>>>>>>> 4605c22 (account get fix)
<<<<<<< HEAD
return $type::make($this->profile);
>>>>>>> 3824a3c (Profile types with strategy)
=======
return new $type($this->profile);
>>>>>>> b5d92e2 (prof test)
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class ApplicationResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'application_id' => $this->id,
'state' => $this->state,
'questionnaire_path' => $this->questionnaire_path,
'receipt_path' => $this->receipt_path,
'attachments' => AttachmentResource::collection($this->attachments),
'ticket' => TicketResource::make($this->ticket)
];
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources;
use Illuminate\Support\Facades\Storage;
class AttachmentResource extends \Illuminate\Http\Resources\Json\JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'attachment_id' => $this->id,
'attachment_name' => $this->name,
'attachment_size' => $this->size,
'attachment_file_type' => $this->type,
'attachment_file_path' => is_null($this->file) ? null:Storage::url($this->file),
'document_name' => $this->document->name,
'document_description' => $this->document->description,
'document_max_size' => $this->document->max_size,
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class BankResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'account_number' => $this->account_number,
'account_date' => $this->account_date,
'currency' => $this->currency,
'iban' => $this->iban,
'bank_name' => $this->bank_name,
'country' => $this->country
];
}
}

View File

@ -15,9 +15,13 @@ class BusinessProfileResource extends JsonResource
public function toArray($request)
{
return [
'personal' => $this->personal,
'document' => $this->document,
'job' => $this->job
'name' => $this->name,
'surname' => $this->surname,
'patronomic_name' => $this->patronomic_name,
'date_of_birth' => $this->date_of_birth,
'birth_place' => $this->birth_place,
'citizenship' => CountryResource::make($this->citizenship),
'registration_address' => $this->registration_address,
];
}
}

View File

@ -15,10 +15,8 @@ class CategoryResource extends JsonResource
public function toArray($request)
{
return [
'id' => $this->id,
'name_en' => $this->name_en,
'name_ru' => $this->name_ru,
'name_tm' => $this->name_tm
'id' => $this->id,
'name' => $this->name
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class ContactResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'address' => $this->address,
'phone' => $this->phone,
'email' => $this->email,
'fax' => $this->fax
];
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class ContractResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'InputNumber' => $this->InputNumber,
'InputDate' => $this->InputDate,
'RegDate' => $this->RegDate,
'MarkerSpec' => $this->MarkerSpec,
'Workflow_ID' => $this->Workflow_ID,
// 'Note' => $this->Note,
'Remark' => $this->Remark,
];
}
}

View File

@ -15,11 +15,13 @@ class MessageResource extends JsonResource
public function toArray($request)
{
return [
'id' => $this->id,
'content' => $this->content,
'ticket_id' => $this->ticket_id,
'is_client' => $this->is_client,
'created_at' => $this->created_at
'id' => $this->id,
'content' => $this->content,
'ticket_id' => $this->ticket_id,
'is_client' => $this->is_client,
'created_at' => $this->created_at,
'admin' => $this->admin->name ?? null,
'client' => $this->client
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class QuestionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'question_text' => $this->question_text,
'options' => $this->options
];
}
}

View File

@ -16,10 +16,12 @@ public function toArray($request)
{
return [
'id' => $this->id,
'category_id' => $this->category_id,
'category' => CategoryResource::make($this->category),
'title' => $this->title,
'content' => $this->content,
'status' => $this->status->name
'status' => $this->status->name,
'last_sender' => $this->last_sender,
'created_at' => $this->created_at,
];
}
}

View File

@ -36,8 +36,7 @@ public function build()
$user['name'] = $this->name;
$user['token'] = $this->token;
return $this->from("milmedova96@gmail.com", "Password reset code")
->subject('Resetting your password')
return $this->subject('Resetting your password')
->view('emails.reset-password', ['user' => $user]);
}
}

View File

@ -3,7 +3,12 @@
namespace App\Models;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Facades\Config;
class Account extends Model
{
@ -18,22 +23,23 @@ class Account extends Model
protected $table = 'accounts';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
protected $guarded = [];
protected $fillable = [
'contacts', 'bank', 'vat', 'country_id', 'legalization_number', 'type',
'contacts', 'bank', 'vat', 'country_id', 'legalization_number', 'type', 'expires_at'
];
protected $casts = [
'contacts' => 'array',
'bank' => 'array'
];
// protected $hidden = [];
// protected $dates = [];
protected $dates = ['expires_at'];
/*
|--------------------------------------------------------------------------
| FUNCTIONS
|--------------------------------------------------------------------------
*/
<<<<<<< HEAD
public function getFillable(){
return $this->fillable;
}
@ -56,6 +62,23 @@ public function getBankFillables(){
'bank_name',
'country'
];
=======
public function preview(){
return '<a class="btn btn-sm btn-link" href="/admin/preview/'. $this->id .'" data-toggle="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
Preview</a>';
>>>>>>> 879eb8f (documents admin fixed, lang fixed)
}
public function export_account(){
return '<a class="btn btn-sm btn-link" href="/admin/export-account-admin/'. $this->id .'" data-toggle="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-filetype-docx" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641.861.861 0 0 0-.322-.387.862.862 0 0 0-.469-.129.868.868 0 0 0-.471.13.868.868 0 0 0-.32.386 1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387.883.883 0 0 0 .471.126.877.877 0 0 0 .469-.126.861.861 0 0 0 .322-.386 1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216 1.463 1.463 0 0 1-.589-.627 2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975.137-.274.333-.483.59-.627.257-.147.564-.22.92-.22.357 0 .662.073.916.22.256.146.452.356.59.63.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235.264.156.46.382.589.68.13.296.196.655.196 1.074 0 .422-.065.784-.196 1.084-.131.301-.33.53-.595.689-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964 1.44 1.44 0 0 0-.49-.272 1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223-.25.148-.44.359-.571.633-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976.13.271.321.48.571.627.25.144.555.216.914.216.293 0 .555-.054.785-.164.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364.699.699 0 0 1-.273.248.874.874 0 0 1-.401.088.845.845 0 0 1-.478-.131.834.834 0 0 1-.298-.393 1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006 1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"/>
</svg>
Export</a>';
}
/*
@ -63,26 +86,33 @@ public function getBankFillables(){
| RELATIONS
|--------------------------------------------------------------------------
*/
<<<<<<< HEAD
public function profile()
=======
public function profile():MorphTo
>>>>>>> 9b1576d (Document fix)
{
return $this->morphTo();
}
public function country(){
public function country():BelongsTo
{
return $this->belongsTo(Country::class, 'country_id');
}
public function account(){
public function clients():HasMany
{
return $this->hasMany(Client::class);
}
public function application(){
return $this->hasOne(Application::class);
public function applications():HasMany
{
return $this->hasMany(Application::class);
}
public function clients(){
return $this->hasMany(Client::class);
public function last_application(){
return $this->applications()->latest()->first();
}
/*
@ -96,6 +126,34 @@ public function clients(){
| ACCESSORS
|--------------------------------------------------------------------------
*/
public function getAccountTypeAttribute(){
return trans('app.account.filter.'.$this->type);
}
public function getCanApplyLegalNumberAttribute(){
return is_null($this->last_application());
}
public function getCanExtendLegalNumberAttribute() {
$application = $this->last_application();
$month = Config::get('settings.legalization_extend') ?? 1;
if($application && $application->state == 'approved'
&& $this->expires_at->lte(Carbon::now()->subMonth($month))){
return true;
}
return false;
}
public function getApplicationStatusAttribute(){
$application = $this->last_application();
return $application->state ?? null;
}
public function getCountryNameAttribute(){
return $this->country->name;
}
/*
|--------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@ class Answer extends Model
protected $table = 'answers';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'question_id', 'question_text', 'answer_text'
];

View File

@ -4,6 +4,7 @@
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
class Application extends Model
{
@ -18,9 +19,9 @@ class Application extends Model
protected $table = 'applications';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'account_id', 'status'
'account_id', 'status','state'
];
// protected $hidden = [];
// protected $dates = [];
@ -30,6 +31,14 @@ class Application extends Model
| FUNCTIONS
|--------------------------------------------------------------------------
*/
public function preview(){
return '<a class="btn btn-sm btn-link" href="/admin/preview-application/'. $this->id .'" data-toggle="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
Preview</a>';
}
/*
|--------------------------------------------------------------------------
@ -41,7 +50,14 @@ public function account(){
}
public function attachments(){
return $this->hasMany(Attachment::class);
return $this->hasMany(Attachment::class)
->leftJoin('documents','attachments.document_id','=','documents.id')
->select('attachments.*','order')
->orderBy('documents.order');
}
public function ticket():HasOne{
return $this->hasOne(Ticket::class);
}
/*

View File

@ -18,7 +18,7 @@ class Attachment extends Model
protected $table = 'attachments';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name', 'size', 'type', 'file', 'document_id', 'application_id'
];

View File

@ -18,17 +18,23 @@ class Business extends Model
protected $table = 'businesses';
// protected $primaryKey = 'id';
// public $timestamps = false;Akargider#2323!
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'personal', 'document', 'job'
'name' ,
'surname',
'patronomic_name',
'date_of_birth',
'birth_place',
'citizenship_id',
'registration_address',
];
// protected $hidden = [];
// protected $dates = [];
protected $casts = [
'personal' => 'array',
'document' => 'array',
'job' => 'array',
];
// protected $casts = [
// 'personal' => 'array',
// 'document' => 'array',
// 'job' => 'array',
// ];
/*
|--------------------------------------------------------------------------
@ -49,6 +55,10 @@ public function account()
return $this->morphOne(Account::class, 'profile');
}
public function citizenship(){
return $this->belongsTo(Country::class,'citizenship_id');
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -4,10 +4,12 @@
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class Category extends Model
{
use CrudTrait;
use HasTranslations;
/*
|--------------------------------------------------------------------------
@ -18,12 +20,15 @@ class Category extends Model
protected $table = 'categories';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name_en', 'name_tm', 'name_ru'
'name'
];
// protected $hidden = [];
// protected $dates = [];
protected $translatable = [
'name'
];
/*
|--------------------------------------------------------------------------

View File

@ -23,7 +23,7 @@ class Client extends Authenticatable
protected $table = 'clients';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'firstname', 'lastname', 'email', 'password', 'is_verified','verification_token', 'is_suspended', 'account_id'
];

View File

@ -18,7 +18,7 @@ class Company extends Model
protected $table = 'companies';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name',
'short_name',

64
app/Models/Contract.php Normal file
View File

@ -0,0 +1,64 @@
<?php
namespace App\Models;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Illuminate\Database\Eloquent\Model;
class Contract extends Model
{
use CrudTrait;
/*
|--------------------------------------------------------------------------
| GLOBAL VARIABLES
|--------------------------------------------------------------------------
*/
protected $table = 'contracts';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
protected $fillable = [
'foreign_ID',
'InputNumber',
'InputDate',
'RegDate',
'MarkerSpec',
'Workflow_ID',
'Note',
'Remark',
];
// protected $hidden = [];
// protected $dates = [];
/*
|--------------------------------------------------------------------------
| FUNCTIONS
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| RELATIONS
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| SCOPES
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| ACCESSORS
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| MUTATORS
|--------------------------------------------------------------------------
*/
}

View File

@ -5,6 +5,8 @@
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Country extends Model
{
@ -20,7 +22,7 @@ class Country extends Model
protected $table = 'countries';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name', 'code'
];
@ -39,10 +41,18 @@ class Country extends Model
| RELATIONS
|--------------------------------------------------------------------------
*/
public function accounts(){
public function accounts() : HasMany{
return $this->hasMany(Account::class);
}
public function document_groups():BelongsToMany{
return $this->belongsToMany(Documentgroup::class,'documentgroup_countries');
}
public function documents():BelongsToMany{
return $this->belongsToMany(Document::class,'document_countries');
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -5,6 +5,7 @@
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Document extends Model
@ -21,11 +22,15 @@ class Document extends Model
protected $table = 'documents';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name',
'description',
'max_size'
'max_size',
'business',
'company',
'all_country',
'order'
];
// protected $hidden = [];
// protected $dates = [];
@ -42,8 +47,16 @@ class Document extends Model
| RELATIONS
|--------------------------------------------------------------------------
*/
public function attachments(){
return $this->hasMany(Attachment::class);
public function attachments(): BelongsToMany{
return $this->belongsToMany(Attachment::class);
}
public function groups(): BelongsToMany{
return $this->belongsToMany(Documentgroup::class,'documentgroup_documents');
}
public function countries(): BelongsToMany{
return $this->belongsToMany(Country::class,'document_countries', 'document_id', 'country_id');
}
/*

View File

@ -5,6 +5,8 @@
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Builder;
class Documentgroup extends Model
{
@ -20,7 +22,7 @@ class Documentgroup extends Model
protected $table = 'documentgroups';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name',
'description',
@ -42,11 +44,26 @@ class Documentgroup extends Model
|--------------------------------------------------------------------------
*/
public function documents():BelongsToMany{
return $this->belongsToMany(Document::class,'documentgroup_documents', 'documentgroup_id', 'document_id');
}
public function countries():BelongsToMany{
return $this->belongsToMany(Country::class,'documentgroup_countries', 'documentgroup_id', 'country_id');
}
/*
|--------------------------------------------------------------------------
| SCOPES
|--------------------------------------------------------------------------
*/
public function scopeWithDocs($query,$type,$country){
return $query->where('type',$type)
->whereHas('countries',function(Builder $query) use ($country){
$query->where('countries.id',$country);
})
->with('documents');
}
/*
|--------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@ class DocumentgroupCountry extends Model
protected $table = 'documentgroup_countries';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
// protected $fillable = [];
// protected $hidden = [];
// protected $dates = [];

View File

@ -18,7 +18,7 @@ class DocumentgroupDocument extends Model
protected $table = 'documentgroup_documents';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
// protected $fillable = [];
// protected $hidden = [];
// protected $dates = [];

View File

@ -18,9 +18,9 @@ class Message extends Model
protected $table = 'messages';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'content', 'ticket_id', 'is_client'
'content', 'ticket_id', 'is_client', 'admin_id', 'client_id'
];
// protected $hidden = [];
// protected $dates = [];
@ -40,6 +40,14 @@ public function ticket(){
return $this->belongsTo(Ticket::class, 'ticket_id');
}
public function admin(){
return $this->belongsTo(User::class, 'admin_id');
}
public function client(){
return $this->belongsTo(Client::class, 'client_id');
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -3,11 +3,14 @@
namespace App\Models;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Database\Eloquent\Model;
class Question extends Model
{
use CrudTrait;
use HasTranslations;
/*
|--------------------------------------------------------------------------
@ -18,13 +21,14 @@ class Question extends Model
protected $table = 'questions';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'question_text',
'options'
];
// protected $hidden = [];
// protected $dates = [];
protected $translatable = ['question_text', 'options'];
/*
|--------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@ class Status extends Model
protected $table = 'statuses';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'name', 'color'
];

View File

@ -18,12 +18,15 @@ class Ticket extends Model
protected $table = 'tickets';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $guarded = ['id'];
protected $fillable = [
'client_id',
'status_id',
'title',
'content'
'content',
'category_id',
'last_sender',
'application_id'
];
// protected $hidden = [];
// protected $dates = [];
@ -34,7 +37,7 @@ class Ticket extends Model
|--------------------------------------------------------------------------
*/
public function messagesOfTicket(){
return '<a class="btn btn-sm btn-link" href="/chat?ticket_id='. $this->id .'" data-toggle="tooltip">
return '<a class="btn btn-sm btn-link" href="/admin/chat?ticket_id='. $this->id .'" data-toggle="tooltip">
<svg xmlns="http://www.w3.org/2000/svg" style="width:15px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg> Chat</a>';
@ -45,8 +48,8 @@ public function messagesOfTicket(){
| RELATIONS
|--------------------------------------------------------------------------
*/
public function client(){
return $this->belongsTo(Client::class, 'client_id');
public function account(){
return $this->belongsTo(Account::class, 'client_id');
}
public function category(){
@ -66,6 +69,19 @@ public function messages(){
| SCOPES
|--------------------------------------------------------------------------
*/
public function scopeOpen($query)
{
return $query->whereHas('status', function ($q) {
$q->where('name', 'Open');
});
}
public function scopeClosed($query)
{
return $query->whereHas('status', function ($q) {
$q->where('name', 'Closed');
});
}
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
<?php
namespace App\ProfileTypes;
use App\Http\Requests\API\BusinessProfileDocRequest;
use App\Http\Requests\API\BusinessProfileRequest;
use App\Http\Resources\BusinessProfileResource;
use App\Models\Business;
class BusinessProfile extends Profile
{
public $form = [
'profile' => BusinessProfileRequest::class,
'document' => BusinessProfileDocRequest::class,
'model' => Business::class,
'resource' => BusinessProfileResource::class
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\ProfileTypes;
use App\Http\Requests\API\CompanyProfileDocRequest;
use App\Http\Requests\API\CompanyProfileRequest;
use App\Http\Resources\CompanyProfileResource;
use App\Models\Company;
class CompanyProfile extends Profile
{
public $form = [
'profile' => CompanyProfileRequest::class,
'document' => CompanyProfileDocRequest::class,
'model' => Company::class,
'resource' => CompanyProfileResource::class
];
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\ProfileTypes;
use App\Http\Resources\BusinessProfileResource;
use App\Models\Business;
use Illuminate\Support\Facades\Auth;
abstract class Profile
{
protected $request;
protected $fileds = [
'profile' => [],
'document' => []
];// for fields that doesn need validation
protected $form;
public function validateRequest()
{
$validateConfig = request('_config')['request_type'];
$this->request = $this->form[$validateConfig]::createFrom(request());
$this->request->validate( $this->request->rules());
}
public function updateProfile($profile)
{
$config = request('_config')['request_type'];
$profileDataKeys = array_merge($this->fileds[$config],array_keys($this->request->rules()));
$profileData = request()->only($profileDataKeys);
if($profile != null)
{
$profile->fill($profileData)->save();
}
else
{
$profile = $this->createProfile($profileData);
$account = Auth::user()->account;
$account->profile()->associate($profile)->save();
}
return $this->resource($profile);
}
public function createProfile(array $data){
return $this->form['model']::create($data);
}
public function resource($profile){
return $this->form['resource']::make($profile);
}
}

View File

@ -6,16 +6,6 @@
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
@ -23,6 +13,29 @@ public function register()
*/
public function boot()
{
//
$this->overrideConfigValues();
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
protected function overrideConfigValues()
{
$config = [];
$config['mail.mailers.smtp.host'] = config('settings.smtp_host');
$config['mail.mailers.smtp.port'] = config('settings.smtp_port');
$config['mail.mailers.smtp.encryption'] = config('settings.smtp_encryption');
$config['mail.mailers.smtp.username'] = config('settings.smtp_username');
$config['mail.mailers.smtp.password'] = config('settings.smtp_password');
$config['mail.mailers.smtp.from.address'] = config('settings.smtp_username');
$config['mail.mailers.smtp.from.name'] = 'Birzha Legalizasia';
config($config);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Rules;
use App\Models\Category;
use Illuminate\Contracts\Validation\InvokableRule;
class CategoryRule implements InvokableRule
{
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
* @return void
*/
public function __invoke($attribute, $value, $fail)
{
$category = Category::find((int)$value);
if(!$category){
$fail('There is no :attribute with value: ' . $value);
}
}
}

25
app/Rules/TicketRule.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\InvokableRule;
use App\Models\Ticket;
class TicketRule implements InvokableRule
{
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
* @return void
*/
public function __invoke($attribute, $value, $fail)
{
$ticket = Ticket::find((int)$value);
if(!$ticket){
$fail('There is no :attribute with value: ' . $value);
}
}
}

View File

@ -4,5 +4,8 @@
"username": "root",
"password": "root"
}
},
"github-oauth": {
"github.com": "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"
}
}

View File

@ -17,6 +17,7 @@
"laravel/framework": "^9.11",
"laravel/sanctum": "^2.15",
"laravel/tinker": "^2.7",
"nesbot/carbon": "^2.61",
"spatie/laravel-translatable": "^6.0",
"zircote/swagger-php": "^4.4"
},

2
composer.lock generated
View File

@ -16,7 +16,7 @@
},
"dist": {
"type": "zip",
"url": "file:///C:/MAMP/htdocs/legalization/legalization/CRUD-5.zip",
"url": "file:///var/www/birzha-legalizasia/CRUD-5.zip",
"reference": "4539c787a2e052d2e2e2c00188c38432dc2a7ea9",
"shasum": ""
},

View File

@ -7,11 +7,11 @@
*/
return [
'business' => [
'class' => App\AccountTypes\BusinessAccount::class,
'resource' => App\Http\Resources\BusinessProfileResource::class
'class' => App\ProfileTypes\BusinessProfile::class,
'resources' => App\Http\Resources\BusinessProfileResource::class
],
'company' => [
'class' => App\AccountTypes\CompanyAccount::class,
'resource' => App\Http\Resources\CompanyProfileResource::class
'class' => App\ProfileTypes\CompanyProfile::class,
'resources' => App\Http\Resources\CompanyProfileResource::class
]
];

View File

@ -176,7 +176,7 @@
// "fr_SN" => "French (Senegal)",
// "fr_CH" => "French (Switzerland)",
// "fr_TG" => "French (Togo)",
'fr' => 'French',
//'fr' => 'French',
// "ff_SN" => "Fulah (Senegal)",
// "ff" => "Fulah",
// "gl_ES" => "Galician (Spain)",
@ -335,7 +335,7 @@
// "ru_MD" => "Russian (Moldova)",
// "ru_RU" => "Russian (Russia)",
// "ru_UA" => "Russian (Ukraine)",
// "ru" => "Russian",
"ru" => "Russian",
// "rwk_TZ" => "Rwa (Tanzania)",
// "rwk" => "Rwa",
// "saq_KE" => "Samburu (Kenya)",

View File

@ -10,7 +10,7 @@
| The dir where to store the images (relative from public).
|
*/
'dir' => ['uploads'],
'dir' => ['app/public'],
/*
|--------------------------------------------------------------------------
@ -26,7 +26,7 @@
| ]
*/
'disks' => [
// 'uploads',
'local',
],
/*

View File

@ -36,13 +36,13 @@
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.yandex.ru'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'host' => config('settings.smtp_host'),
'port' => config('settings.smtp_port'),
'encryption' => config('settings.smtp_encryption'),
'username' => config('settings.smtp_username'),
'password' => config('settings.smtp_password'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'birzha@digital-tps.tk'),
'address' => config('settings.smtp_username'),
'name' => env('MAIL_FROM_NAME', 'Birzha legalizasia'),
],
],

View File

@ -20,7 +20,7 @@ public function up()
$table->string('email')->unique()->nullable();
$table->string('password')->nullable();
$table->boolean('is_suspended')->default(0);
$table->bigInteger('account_id')->nullable();
$table->foreignId('account_id')->nullable();
$table->string('verification_token')->nullable();
$table->boolean('is_verified')->default(0);
$table->timestamps();

View File

@ -18,7 +18,7 @@ public function up()
$table->text('contacts')->nullable();
$table->text('bank')->nullable();
$table->string('vat')->nullable();
$table->integer('country_id')->nullable();
$table->foreignId('country_id')->nullable();
$table->string('legalization_number')->nullable();
$table->morphs('accountable');
$table->timestamps();

View File

@ -16,7 +16,7 @@ public function up()
Schema::create('applications', function (Blueprint $table) {
$table->id();
$table->boolean('status')->default(0);
$table->integer('account_id')->nullable();
$table->foreignId('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@ -19,8 +19,8 @@ public function up()
$table->string('size')->nullable();
$table->string('type')->nullable();
$table->string('file')->nullable();
$table->bigInteger('document_id')->nullable();
$table->bigInteger('application_id')->nullable();
$table->foreignId('document_id')->onDelete('cascade');
$table->foreignId('application_id')->references('id')->on('applications')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -15,7 +15,7 @@ public function up()
{
Schema::create('answers', function (Blueprint $table) {
$table->id();
$table->bigInteger('question_id')->nullable();
$table->foreignId('question_id')->onDelete('cascade');
$table->text('question_text')->nullable();
$table->text('answer_text')->nullable();
$table->timestamps();

View File

@ -15,8 +15,8 @@ public function up()
{
Schema::create('documentgroup_documents', function (Blueprint $table) {
$table->id();
$table->bigInteger('documentgroup_id');
$table->bigInteger('document_id');
$table->foreignId('documentgroup_id')->references('id')->on('documentgroups')->onDelete('cascade');
$table->foreignId('document_id')->references('id')->on('documents')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -15,8 +15,8 @@ public function up()
{
Schema::create('documentgroup_countries', function (Blueprint $table) {
$table->id();
$table->bigInteger('documentgroup_id');
$table->bigInteger('country_id');
$table->foreignId('documentgroup_id')->references('id')->on('documentgroups')->onDelete('cascade');
$table->foreignId('country_id')->references('id')->on('countries')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -17,9 +17,9 @@ public function up()
$table->id();
$table->string('title');
$table->string('content');
$table->foreignId('client_id');
$table->foreignId('status_id');
$table->foreignId('category_id');
$table->foreignId('client_id')->references('id')->on('clients')->onDelete('cascade');
$table->foreignId('status_id')->nullable();
$table->foreignId('category_id')->nullable();
$table->timestamps();
});
}

View File

@ -15,9 +15,7 @@ public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->string('name_en');
$table->string('name_ru');
$table->string('name_tm');
$table->text('name');
$table->timestamps();
});
}

View File

@ -15,9 +15,10 @@ public function up()
{
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->foreignId('ticket_id');
$table->foreignId('ticket_id')->references('id')->on('tickets')->onDelete('cascade')->onUpdate('cascade');
$table->boolean('is_client'); //if client diplay as client's message, else display as admin reply
$table->string('content');
$table->foreignId('admin_id')->nullable();;
$table->timestamps();
});
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tickets', function (Blueprint $table) {
$table->enum('last_sender', ['admin', 'client'])->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tickets', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('businesses', function (Blueprint $table) {
$table->dropColumn('personal');
$table->dropColumn('document');
$table->dropColumn('job');
$table->string('name')->nullable();
$table->string('surname')->nullable();
$table->string('patronomic_name')->nullable();
$table->string('birth_place')->nullable();
$table->text('registration_address')->nullable();
$table->date('date_of_birth')->nullable();
$table->foreignId('citizenship_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('businesses', function (Blueprint $table) {
$table->text('personal')->nullable();
$table->text('document')->nullable();
$table->text('job')->nullable();
$table->dropColumn('name');
$table->dropColumn('surname');
$table->dropColumn('patronomic_name');
$table->dropColumn('birth_place');
$table->dropColumn('registration_address');
$table->dropColumn('date_of_birth');
$table->dropColumn('citizenship_id');
});
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('applications', function (Blueprint $table) {
$table->string('state')->default('new');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('state');
});
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('document_countries', function (Blueprint $table) {
$table->id();
$table->foreignId('document_id')->references('id')->on('documents')->onDelete('cascade');
$table->foreignId('country_id')->references('id')->on('countries')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('document_countries');
}
};

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('documents', function (Blueprint $table) {
$table->boolean('business')->default(0);
$table->boolean('company')->default(0);
$table->boolean('all_country')->default(0);
$table->integer('order')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('documents', function (Blueprint $table) {
$table->dropColumn('business');
$table->dropColumn('company');
$table->dropColumn('all_country');
$table->dropColumn('order');
});
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exportformats', function (Blueprint $table) {
$table->id();
$table->enum('type',['company', 'business'])->default('business');
$table->longText('schema')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exportformats');
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tickets', function (Blueprint $table) {
$table->foreignId('application_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tickets', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('messages', function (Blueprint $table) {
$table->foreignId('client_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('messages', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contracts', function (Blueprint $table) {
$table->id();
// $table->unsignedBigInteger('entrance_number')->primary();
$table->text('hasaba_alysh')->nullable();
$table->string('hasaba_alysh_status')->nullable();
$table->text('baha_seljerish')->nullable();
$table->string('baha_seljerish_status')->nullable();
$table->text('tdh')->nullable();
$table->string('tdh_status')->nullable();
$table->text('hukuk')->nullable();
$table->string('hukuk_status')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contracts');
}
};

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