commit 515bdaf5cd435a4bad54802dc0c814462586275e Author: denisdulici Date: Thu Sep 14 22:21:00 2017 +0300 first commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..b7b834643 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,25 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text eol=lf + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.c text +*.h text + +# Declare files that will always have CRLF line endings on checkout. +*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary +*.otf binary +*.eot binary +*.svg binary +*.ttf binary +*.woff binary +*.woff2 binary + +*.css linguist-vendored +*.scss linguist-vendored +*.js linguist-vendored +CHANGELOG.md export-ignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..dc689103a --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +/node_modules +/public/hot +/public/storage +/storage/*.key +/vendor +/.idea +/.vagrant +Homestead.json +Homestead.yaml +npm-debug.log +.env +robots.txt +_ide_helper.php +.phpstorm.meta.php +composer.lock \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 000000000..903f6392c --- /dev/null +++ b/.htaccess @@ -0,0 +1,20 @@ + + + Options -MultiViews + + + RewriteEngine On + + # Redirect Trailing Slashes If Not A Folder... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)/$ /$1 [L,R=301] + + # Handle Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + + # Handle Authorization Header + RewriteCond %{HTTP:Authorization} . + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 000000000..9cecc1d46 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 000000000..e8ec55ae5 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# Akaunting™ + +[Latest Stable Version](https://img.shields.io/github/release/akaunting/akaunting.svg) [Total Downloads](https://img.shields.io/github/downloads/akaunting/akaunting/total.svg) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/akaunting/localized.png)](https://crowdin.com/project/akaunting) [License](https://img.shields.io/github/license/akaunting/akaunting.svg) + +Akaunting is a free, online and open source accounting software designed for small businesses and freelancers. It is built with modern technologies such as Laravel, Bootstrap, jQuery, RESTful API etc. Thanks to its modular structure, Akaunting provides an awesome App Store for users and developers. + +* [Home](https://akaunting.com) - The house of Akaunting +* [Blog](https://akaunting.com/blog) - Get the latest news +* [Forum](https://akaunting.com/forum) - Join the community +* [Documentation](https://akaunting.com/docs) - Learn more about Akaunting + +## Requirements + +* PHP 5.6.4 or higher +* Database (eg: MySQL, PostgreSQL, SQLite) +* Web Server (eg: Apache, Nginx, IIS) +* [Other libraries](https://akaunting.com/docs/requirements) + +## Framework + +Akaunting uses [Laravel](http://laravel.com), the best existing PHP framework, as the foundation framework and [Laravel Modules](https://nwidart.com/laravel-modules) package for Apps. + +## Installation + + * Install [Composer](https://getcomposer.org/download) + * Download the [repository](https://github.com/akaunting/akaunting/archive/master.zip) and unzip into your server + * Open and point your command line to the directory you unzipped Akaunting + * Run the following command: `composer install` + * Finally, go to the Akaunting folder via your browser + +## Contributing + +Fork the repository, make the code changes then submit a pull request. + +Please, be very clear on your commit messages and pull requests, empty pull request messages may be rejected without reason. + +When contributing code to Akaunting, you must follow the PSR coding standards. The golden rule is: Imitate the existing Akaunting code. + +Please note that this project is released with a [Contributor Code of Conduct](https://akaunting.com/code-of-conduct). By participating in this project you agree to abide by its terms. + +## Translation + +If you'd like to contribute translations, please check out our [Crowdin](https://crowdin.com/project/akaunting) project. + +## Changelog + +Please see [Releases](../../releases) for more information what has changed recently. + +## Security + +If you discover any security related issues, please email security[at]akaunting[dot]com instead of using the issue tracker. + +## Credits + +- [Denis Duliçi](https://github.com/denisdulici) +- [Cüneyt Şentürk](https://github.com/cuneytsenturk) +- [All Contributors](../../contributors) + +## License + +Akaunting is released under the [GPLv3 license](LICENSE.txt). diff --git a/app/Console/Commands/BillReminder.php b/app/Console/Commands/BillReminder.php new file mode 100644 index 000000000..7618c389f --- /dev/null +++ b/app/Console/Commands/BillReminder.php @@ -0,0 +1,80 @@ +setSettings(); + + //$days = explode(',', setting('general.schedule_bill_days', '1,3')); + $days = explode(',', $company->schedule_bill_days); + + foreach ($days as $day) { + $this->remind(trim($day), $company); + } + } + } + + protected function remind($day, $company) + { + // Get due date + $date = Date::today()->addDays($day)->toDateString(); + + // Get upcoming bills + $bills = Bill::companyId($company->id)->due($date)->with('vendor')->get(); + + foreach ($bills as $bill) { + // Notify all users assigned to this company + foreach ($company->users as $user) { + if (!$user->can('read-notifications')) { + continue; + } + + $user->notify(new Notification($bill)); + } + } + } + +} diff --git a/app/Console/Commands/CompanySeed.php b/app/Console/Commands/CompanySeed.php new file mode 100644 index 000000000..200ef4ef5 --- /dev/null +++ b/app/Console/Commands/CompanySeed.php @@ -0,0 +1,47 @@ +laravel->make('CompanySeeder'); + + $seeder = $class->setContainer($this->laravel)->setCommand($this); + + $seeder->__invoke(); + } + +} diff --git a/app/Console/Commands/InvoiceReminder.php b/app/Console/Commands/InvoiceReminder.php new file mode 100644 index 000000000..f1cc21098 --- /dev/null +++ b/app/Console/Commands/InvoiceReminder.php @@ -0,0 +1,83 @@ +setSettings(); + + //$days = explode(',', config('general.schedule_invoice_days', '1,3')); + $days = explode(',', $company->schedule_invoice_days); + + foreach ($days as $day) { + $this->remind(trim($day), $company); + } + } + } + + protected function remind($day, $company) + { + // Get due date + $date = Date::today()->subDays($day)->toDateString(); + + // Get upcoming bills + $invoices = Invoice::companyId($company->id)->due($date)->with('customer')->get(); + + foreach ($invoices as $invoice) { + // Notify the customer + $invoice->customer->notify(new Notification($invoice)); + + // Notify all users assigned to this company + foreach ($company->users as $user) { + if (!$user->can('read-notifications')) { + continue; + } + + $user->notify(new Notification($invoice)); + } + } + } + +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php new file mode 100644 index 000000000..618379594 --- /dev/null +++ b/app/Console/Kernel.php @@ -0,0 +1,47 @@ +command('reminder:invoice')->dailyAt(setting('general.schedule_time', '09:00')); + $schedule->command('reminder:bill')->dailyAt(setting('general.schedule_time', '09:00')); + } + + /** + * Register the Closure based commands for the application. + * + * @return void + */ + protected function commands() + { + require base_path('routes/console.php'); + } +} diff --git a/app/Console/Stubs/Modules/command.stub b/app/Console/Stubs/Modules/command.stub new file mode 100644 index 000000000..153760132 --- /dev/null +++ b/app/Console/Stubs/Modules/command.stub @@ -0,0 +1,68 @@ +view('view.name'); + } +} diff --git a/app/Console/Stubs/Modules/middleware.stub b/app/Console/Stubs/Modules/middleware.stub new file mode 100644 index 000000000..954583ed4 --- /dev/null +++ b/app/Console/Stubs/Modules/middleware.stub @@ -0,0 +1,21 @@ +increments('id'); +$FIELDS$ + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('$TABLE$'); + } +} diff --git a/app/Console/Stubs/Modules/migration/delete.stub b/app/Console/Stubs/Modules/migration/delete.stub new file mode 100644 index 000000000..53ec1b329 --- /dev/null +++ b/app/Console/Stubs/Modules/migration/delete.stub @@ -0,0 +1,32 @@ +increments('id'); +$FIELDS$ + $table->timestamps(); + }); + } +} diff --git a/app/Console/Stubs/Modules/migration/plain.stub b/app/Console/Stubs/Modules/migration/plain.stub new file mode 100644 index 000000000..cc014c60d --- /dev/null +++ b/app/Console/Stubs/Modules/migration/plain.stub @@ -0,0 +1,28 @@ +line('The introduction to the notification.') + ->action('Notification Action', 'https://laravel.com') + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/app/Console/Stubs/Modules/provider.stub b/app/Console/Stubs/Modules/provider.stub new file mode 100644 index 000000000..4fd17be8e --- /dev/null +++ b/app/Console/Stubs/Modules/provider.stub @@ -0,0 +1,35 @@ +routesAreCached()) { + // require __DIR__ . '/Http/routes.php'; + // } + } +} diff --git a/app/Console/Stubs/Modules/routes.stub b/app/Console/Stubs/Modules/routes.stub new file mode 100644 index 000000000..35865ba3f --- /dev/null +++ b/app/Console/Stubs/Modules/routes.stub @@ -0,0 +1,6 @@ + 'web', 'prefix' => '$LOWER_NAME$', 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers'], function() +{ + Route::get('/', '$STUDLY_NAME$Controller@index'); +}); diff --git a/app/Console/Stubs/Modules/scaffold/config.stub b/app/Console/Stubs/Modules/scaffold/config.stub new file mode 100644 index 000000000..0547f5553 --- /dev/null +++ b/app/Console/Stubs/Modules/scaffold/config.stub @@ -0,0 +1,7 @@ + '$STUDLY_NAME$', + +]; diff --git a/app/Console/Stubs/Modules/scaffold/provider.stub b/app/Console/Stubs/Modules/scaffold/provider.stub new file mode 100644 index 000000000..1ee8297d4 --- /dev/null +++ b/app/Console/Stubs/Modules/scaffold/provider.stub @@ -0,0 +1,111 @@ +registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->registerFactories(); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Register config. + * + * @return void + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + ], 'config'); + $this->mergeConfigFrom( + __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' + ); + } + + /** + * Register views. + * + * @return void + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/$LOWER_NAME$'); + + $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + + $this->publishes([ + $sourcePath => $viewPath + ]); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/$LOWER_NAME$'; + }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); + } + + /** + * Register translations. + * + * @return void + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/$LOWER_NAME$'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + } + } + + /** + * Register an additional directory of factories. + * @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66 + */ + public function registerFactories() + { + if (! app()->environment('production')) { + app(Factory::class)->load(__DIR__ . '/Database/factories'); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } +} diff --git a/app/Console/Stubs/Modules/seeder.stub b/app/Console/Stubs/Modules/seeder.stub new file mode 100644 index 000000000..dd4349080 --- /dev/null +++ b/app/Console/Stubs/Modules/seeder.stub @@ -0,0 +1,21 @@ +call("OthersTableSeeder"); + } +} diff --git a/app/Console/Stubs/Modules/start.stub b/app/Console/Stubs/Modules/start.stub new file mode 100644 index 000000000..140a1055c --- /dev/null +++ b/app/Console/Stubs/Modules/start.stub @@ -0,0 +1,17 @@ +routesAreCached()) { + require __DIR__ . '/Http/routes.php'; +} diff --git a/app/Console/Stubs/Modules/views/index.stub b/app/Console/Stubs/Modules/views/index.stub new file mode 100644 index 000000000..4a64852a4 --- /dev/null +++ b/app/Console/Stubs/Modules/views/index.stub @@ -0,0 +1,9 @@ +@extends('$LOWER_NAME$::layouts.master') + +@section('content') +

Hello World

+ +

+ This view is loaded from module: {!! config('$LOWER_NAME$.name') !!} +

+@stop diff --git a/app/Console/Stubs/Modules/views/master.stub b/app/Console/Stubs/Modules/views/master.stub new file mode 100644 index 000000000..14fd322d3 --- /dev/null +++ b/app/Console/Stubs/Modules/views/master.stub @@ -0,0 +1,12 @@ + + + + + + + Module $STUDLY_NAME$ + + + @yield('content') + + diff --git a/app/Events/AdminMenuCreated.php b/app/Events/AdminMenuCreated.php new file mode 100644 index 000000000..9883abb09 --- /dev/null +++ b/app/Events/AdminMenuCreated.php @@ -0,0 +1,18 @@ +menu = $menu; + } +} \ No newline at end of file diff --git a/app/Events/BillCreated.php b/app/Events/BillCreated.php new file mode 100644 index 000000000..fc4881a74 --- /dev/null +++ b/app/Events/BillCreated.php @@ -0,0 +1,18 @@ +bill = $bill; + } +} \ No newline at end of file diff --git a/app/Events/BillUpdated.php b/app/Events/BillUpdated.php new file mode 100644 index 000000000..21751e17a --- /dev/null +++ b/app/Events/BillUpdated.php @@ -0,0 +1,18 @@ +bill = $bill; + } +} \ No newline at end of file diff --git a/app/Events/CustomerMenuCreated.php b/app/Events/CustomerMenuCreated.php new file mode 100644 index 000000000..5766e1ba2 --- /dev/null +++ b/app/Events/CustomerMenuCreated.php @@ -0,0 +1,18 @@ +menu = $menu; + } +} \ No newline at end of file diff --git a/app/Events/InvoiceCreated.php b/app/Events/InvoiceCreated.php new file mode 100644 index 000000000..afa2e3c62 --- /dev/null +++ b/app/Events/InvoiceCreated.php @@ -0,0 +1,18 @@ +invoice = $invoice; + } +} \ No newline at end of file diff --git a/app/Events/InvoicePrinting.php b/app/Events/InvoicePrinting.php new file mode 100644 index 000000000..f775b69dc --- /dev/null +++ b/app/Events/InvoicePrinting.php @@ -0,0 +1,18 @@ +invoice = $invoice; + } +} \ No newline at end of file diff --git a/app/Events/InvoiceUpdated.php b/app/Events/InvoiceUpdated.php new file mode 100644 index 000000000..d9d6fc3ee --- /dev/null +++ b/app/Events/InvoiceUpdated.php @@ -0,0 +1,18 @@ +invoice = $invoice; + } +} \ No newline at end of file diff --git a/app/Events/PaymentGatewayListing.php b/app/Events/PaymentGatewayListing.php new file mode 100644 index 000000000..65f1ad82e --- /dev/null +++ b/app/Events/PaymentGatewayListing.php @@ -0,0 +1,18 @@ +gateways = $gateways; + } +} diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php new file mode 100644 index 000000000..a747e31b8 --- /dev/null +++ b/app/Exceptions/Handler.php @@ -0,0 +1,65 @@ +expectsJson()) { + return response()->json(['error' => 'Unauthenticated.'], 401); + } + + return redirect()->guest(route('login')); + } +} diff --git a/app/Filters/Auth/Permissions.php b/app/Filters/Auth/Permissions.php new file mode 100644 index 000000000..9ae73cf7c --- /dev/null +++ b/app/Filters/Auth/Permissions.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('display_name', $query); + } +} \ No newline at end of file diff --git a/app/Filters/Auth/Roles.php b/app/Filters/Auth/Roles.php new file mode 100644 index 000000000..8eb71d6db --- /dev/null +++ b/app/Filters/Auth/Roles.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('display_name', $query); + } +} \ No newline at end of file diff --git a/app/Filters/Auth/Users.php b/app/Filters/Auth/Users.php new file mode 100644 index 000000000..7af86c4e0 --- /dev/null +++ b/app/Filters/Auth/Users.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } + + public function role($roles) + { + return $this->where('user_roles.role_id', $roles); + } +} \ No newline at end of file diff --git a/app/Filters/Banking/Accounts.php b/app/Filters/Banking/Accounts.php new file mode 100644 index 000000000..df3ae03cc --- /dev/null +++ b/app/Filters/Banking/Accounts.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } +} \ No newline at end of file diff --git a/app/Filters/Banking/Transactions.php b/app/Filters/Banking/Transactions.php new file mode 100644 index 000000000..27ed093e4 --- /dev/null +++ b/app/Filters/Banking/Transactions.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('payment.name', $query)->whereLike('revenue.name', $query); + } +} \ No newline at end of file diff --git a/app/Filters/Banking/Transfers.php b/app/Filters/Banking/Transfers.php new file mode 100644 index 000000000..28c103a12 --- /dev/null +++ b/app/Filters/Banking/Transfers.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function fromAccount($account_id) + { + return $this->where('payments.account_id', $account_id); + } + + public function toAccount($account_id) + { + return $this->related('revenue', 'revenues.account_id', '=', $account_id); + } +} \ No newline at end of file diff --git a/app/Filters/Companies/Companies.php b/app/Filters/Companies/Companies.php new file mode 100644 index 000000000..7b7b2c7db --- /dev/null +++ b/app/Filters/Companies/Companies.php @@ -0,0 +1,22 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + $this->related('settings','settings.key', '=',"'company_name'"); + return $this->related('settings','settings.value', 'LIKE',"'%" . $query . "%'"); + } +} \ No newline at end of file diff --git a/app/Filters/Customers/Invoices.php b/app/Filters/Customers/Invoices.php new file mode 100644 index 000000000..3759c8213 --- /dev/null +++ b/app/Filters/Customers/Invoices.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('customer_name', $query); + } + + public function status($status) + { + return $this->where('invoice_status_code', $status); + } +} \ No newline at end of file diff --git a/app/Filters/Customers/Payments.php b/app/Filters/Customers/Payments.php new file mode 100644 index 000000000..4d0fbcf69 --- /dev/null +++ b/app/Filters/Customers/Payments.php @@ -0,0 +1,31 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('description', $query); + } + + public function category($category) + { + return $this->where('category_id', $category); + } + + public function paymentMethod($payment_method) + { + return $this->where('payment_method', $payment_method); + } +} diff --git a/app/Filters/Customers/Transactions.php b/app/Filters/Customers/Transactions.php new file mode 100644 index 000000000..fd6bc1a9c --- /dev/null +++ b/app/Filters/Customers/Transactions.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('payment.name', $query)->whereLike('revenue.name', $query); + } +} \ No newline at end of file diff --git a/app/Filters/Expenses/Bills.php b/app/Filters/Expenses/Bills.php new file mode 100644 index 000000000..7bbfcc422 --- /dev/null +++ b/app/Filters/Expenses/Bills.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('vendor_name', $query); + } + + public function status($status) + { + return $this->where('bill_status_code', $status); + } +} \ No newline at end of file diff --git a/app/Filters/Expenses/Payments.php b/app/Filters/Expenses/Payments.php new file mode 100644 index 000000000..e9ae561c8 --- /dev/null +++ b/app/Filters/Expenses/Payments.php @@ -0,0 +1,31 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('description', $query); + } + + public function category($category) + { + return $this->where('category_id', $category); + } + + public function account($account) + { + return $this->where('account_id', $account); + } +} \ No newline at end of file diff --git a/app/Filters/Expenses/Vendors.php b/app/Filters/Expenses/Vendors.php new file mode 100644 index 000000000..204b983ed --- /dev/null +++ b/app/Filters/Expenses/Vendors.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } +} \ No newline at end of file diff --git a/app/Filters/Incomes/Customers.php b/app/Filters/Incomes/Customers.php new file mode 100644 index 000000000..9480ab1de --- /dev/null +++ b/app/Filters/Incomes/Customers.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } +} diff --git a/app/Filters/Incomes/Invoices.php b/app/Filters/Incomes/Invoices.php new file mode 100644 index 000000000..c561765dd --- /dev/null +++ b/app/Filters/Incomes/Invoices.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('customer_name', $query); + } + + public function status($status) + { + return $this->where('invoice_status_code', $status); + } +} \ No newline at end of file diff --git a/app/Filters/Incomes/Revenues.php b/app/Filters/Incomes/Revenues.php new file mode 100644 index 000000000..b80881560 --- /dev/null +++ b/app/Filters/Incomes/Revenues.php @@ -0,0 +1,31 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function customer($customer) + { + return $this->where('customer_id', $customer); + } + + public function category($category) + { + return $this->where('category_id', $category); + } + + public function account($account) + { + return $this->where('account_id', $account); + } +} \ No newline at end of file diff --git a/app/Filters/Items/Items.php b/app/Filters/Items/Items.php new file mode 100644 index 000000000..abaf8e5e3 --- /dev/null +++ b/app/Filters/Items/Items.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } + + public function category($id) + { + return $this->where('category_id', $id); + } +} diff --git a/app/Filters/Settings/Categories.php b/app/Filters/Settings/Categories.php new file mode 100644 index 000000000..ebb50b667 --- /dev/null +++ b/app/Filters/Settings/Categories.php @@ -0,0 +1,26 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } + + public function type($type) + { + return $this->where('type', $type); + } +} diff --git a/app/Filters/Settings/Currencies.php b/app/Filters/Settings/Currencies.php new file mode 100644 index 000000000..ba0db14c7 --- /dev/null +++ b/app/Filters/Settings/Currencies.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } +} diff --git a/app/Filters/Settings/Taxes.php b/app/Filters/Settings/Taxes.php new file mode 100644 index 000000000..d2b56d878 --- /dev/null +++ b/app/Filters/Settings/Taxes.php @@ -0,0 +1,21 @@ + [input_key1, input_key2]]. + * + * @var array + */ + public $relations = []; + + public function search($query) + { + return $this->whereLike('name', $query); + } +} diff --git a/app/Http/Controllers/Api/Auth/Permissions.php b/app/Http/Controllers/Api/Auth/Permissions.php new file mode 100644 index 000000000..cda1194dd --- /dev/null +++ b/app/Http/Controllers/Api/Auth/Permissions.php @@ -0,0 +1,77 @@ +response->paginator($permissions, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Permission $permission + * @return \Dingo\Api\Http\Response + */ + public function show(Permission $permission) + { + return $this->response->item($permission, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $permission = Permission::create($request->all()); + + return $this->response->created(url('api/permissions/'.$permission->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $permission + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Permission $permission, Request $request) + { + $permission->update($request->all()); + + return $this->response->item($permission->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Permission $permission + * @return \Dingo\Api\Http\Response + */ + public function destroy(Permission $permission) + { + $permission->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Auth/Roles.php b/app/Http/Controllers/Api/Auth/Roles.php new file mode 100644 index 000000000..acafe95c4 --- /dev/null +++ b/app/Http/Controllers/Api/Auth/Roles.php @@ -0,0 +1,87 @@ +collect(); + + return $this->response->paginator($roles, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Dingo\Api\Http\Response + */ + public function show($id) + { + $role = Role::with('permissions')->findOrFail($id); + + return $this->response->item($role, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $role = Role::create($request->input()); + + if ($request->has('permissions')) { + $role->permissions()->attach($request->get('permissions')); + } + + return $this->response->created(url('api/roles/'.$role->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $role + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Role $role, Request $request) + { + $role->update($request->all()); + + if ($request->has('permissions')) { + $role->permissions()->attach($request->get('permissions')); + } + + return $this->response->item($role->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Role $role + * @return \Dingo\Api\Http\Response + */ + public function destroy(Role $role) + { + $role->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Auth/Users.php b/app/Http/Controllers/Api/Auth/Users.php new file mode 100644 index 000000000..be65ee2b3 --- /dev/null +++ b/app/Http/Controllers/Api/Auth/Users.php @@ -0,0 +1,96 @@ +collect(); + + return $this->response->paginator($users, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Dingo\Api\Http\Response + */ + public function show($id) + { + $user = User::with(['roles', 'permissions'])->findOrFail($id); + + return $this->response->item($user, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $user = User::create($request->input()); + + if ($request->has('roles')) { + $user->roles()->attach($request->get('roles')); + } + + if ($request->has('companies')) { + $user->companies()->attach($request->get('companies')); + } + + return $this->response->created(url('api/users/'.$user->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $user + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(User $user, Request $request) + { + // Except password as we don't want to let the users change a password from this endpoint + $user->update($request->except('password')); + + if ($request->has('roles')) { + $user->roles()->attach($request->get('roles')); + } + + if ($request->has('companies')) { + $user->companies()->attach($request->get('companies')); + } + + return $this->response->item($user->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param User $user + * @return \Dingo\Api\Http\Response + */ + public function destroy(User $user) + { + $user->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Banking/Accounts.php b/app/Http/Controllers/Api/Banking/Accounts.php new file mode 100644 index 000000000..ae19c28a9 --- /dev/null +++ b/app/Http/Controllers/Api/Banking/Accounts.php @@ -0,0 +1,77 @@ +response->paginator($accounts, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Account $account + * @return \Dingo\Api\Http\Response + */ + public function show(Account $account) + { + return $this->response->item($account, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $account = Account::create($request->all()); + + return $this->response->created(url('api/accounts/'.$account->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $account + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Account $account, Request $request) + { + $account->update($request->all()); + + return $this->response->item($account->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Account $account + * @return \Dingo\Api\Http\Response + */ + public function destroy(Account $account) + { + $account->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Banking/Transfers.php b/app/Http/Controllers/Api/Banking/Transfers.php new file mode 100644 index 000000000..ed413a1b8 --- /dev/null +++ b/app/Http/Controllers/Api/Banking/Transfers.php @@ -0,0 +1,84 @@ +collect('payment.paid_at'); + + return $this->response->paginator($transfers, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Transfer $transfer + * @return \Dingo\Api\Http\Response + */ + public function show(Transfer $transfer) + { + return $this->response->item($transfer, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $transfer = Transfer::create($request->all()); + + return $this->response->created(url('api/transfers/'.$transfer->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $transfer + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Transfer $transfer, Request $request) + { + $transfer->update($request->all()); + + return $this->response->item($transfer->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Transfer $transfer + * @return \Dingo\Api\Http\Response + */ + public function destroy(Transfer $transfer) + { + $payment = Payment::findOrFail($transfer['payment_id']); + $revenue = Revenue::findOrFail($transfer['revenue_id']); + + $transfer->delete(); + $payment->delete(); + $revenue->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Common/Ping.php b/app/Http/Controllers/Api/Common/Ping.php new file mode 100644 index 000000000..4f95f312e --- /dev/null +++ b/app/Http/Controllers/Api/Common/Ping.php @@ -0,0 +1,25 @@ +response->array([ + 'status' => 'ok', + 'timestamp' => Date::now(), + ]); + } +} diff --git a/app/Http/Controllers/Api/Companies/Companies.php b/app/Http/Controllers/Api/Companies/Companies.php new file mode 100644 index 000000000..e3b5b691a --- /dev/null +++ b/app/Http/Controllers/Api/Companies/Companies.php @@ -0,0 +1,92 @@ +user()->companies()->get()->sortBy('name'); + + foreach ($companies as $company) { + $company->setSettings(); + } + + return $this->response->paginator($companies, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Company $company + * @return \Dingo\Api\Http\Response + */ + public function show(Company $company) + { + $company->setSettings(); + + return $this->response->item($company, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $company = Company::create($request->all()); + + return $this->response->created(url('api/companies/'.$company->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $company + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Company $company, Request $request) + { + // Check if user can access company + $companies = app('Dingo\Api\Auth\Auth')->user()->companies()->pluck('id')->toArray(); + if (!in_array($company->id, $companies)) { + return $this->response->noContent(); + } + + return $this->response->item($company->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Company $company + * @return \Dingo\Api\Http\Response + */ + public function destroy(Company $company) + { + // Check if user can access company + $companies = app('Dingo\Api\Auth\Auth')->user()->companies()->pluck('id')->toArray(); + + if (in_array($company->id, $companies)) { + $company->delete(); + } + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Expenses/Bills.php b/app/Http/Controllers/Api/Expenses/Bills.php new file mode 100644 index 000000000..a2941e02c --- /dev/null +++ b/app/Http/Controllers/Api/Expenses/Bills.php @@ -0,0 +1,184 @@ +collect(); + + return $this->response->paginator($bills, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Bill $bill + * @return \Dingo\Api\Http\Response + */ + public function show(Bill $bill) + { + return $this->response->item($bill, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $bill = Bill::create($request->all()); + + $bill_item = array(); + $bill_item['company_id'] = $request['company_id']; + $bill_item['bill_id'] = $bill->id; + + if ($request['item']) { + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $bill_item['item_id'] = $item['item_id']; + $bill_item['name'] = $item['name']; + $bill_item['sku'] = $item_sku; + $bill_item['quantity'] = $item['quantity']; + $bill_item['price'] = $item['price']; + $bill_item['tax'] = (($item['price'] * $item['quantity']) / 100) * $tax_rate; + $bill_item['tax_id'] = $tax_id; + $bill_item['total'] = ($item['price'] + $bill_item['tax']) * $item['quantity']; + + $request['amount'] += $bill_item['total']; + + BillItem::create($bill_item); + } + } + + $bill->update($request->input()); + + $request['bill_id'] = $bill->id; + $request['status_code'] = 'draft'; + $request['notify'] = 0; + $request['description'] = trans('messages.success.added', ['type' => $request['bill_number']]); + + BillHistory::create($request->input()); + + // Fire the event to make it extendible + event(new BillCreated($bill)); + + return $this->response->created(url('api/bills/'.$bill->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $bill + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Bill $bill, Request $request) + { + $bill_item = array(); + $bill_item['company_id'] = $request['company_id']; + $bill_item['bill_id'] = $bill->id; + + if ($request['item']) { + BillItem::where('bill_id', $bill->id)->delete(); + + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $bill_item['item_id'] = $item['item_id']; + $bill_item['name'] = $item['name']; + $bill_item['sku'] = $item_sku; + $bill_item['quantity'] = $item['quantity']; + $bill_item['price'] = $item['price']; + $bill_item['tax'] = (($item['price'] * $item['quantity']) / 100 * $tax_rate); + $bill_item['tax_id'] = $tax_id; + $bill_item['total'] = ($item['price'] + $bill_item['tax']) * $item['quantity']; + + $request['amount'] += $bill_item['total']; + + BillItem::create($bill_item); + } + } + + $bill->update($request->input()); + + // Fire the event to make it extendible + event(new BillUpdated($bill)); + + return $this->response->item($bill->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Bill $bill + * @return \Dingo\Api\Http\Response + */ + public function destroy(Bill $bill) + { + $bill->delete(); + + BillItem::where('bill_id', $bill->id)->delete(); + BillPayment::where('bill_id', $bill->id)->delete(); + BillHistory::where('bill_id', $bill->id)->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Expenses/Payments.php b/app/Http/Controllers/Api/Expenses/Payments.php new file mode 100644 index 000000000..9993557df --- /dev/null +++ b/app/Http/Controllers/Api/Expenses/Payments.php @@ -0,0 +1,77 @@ +collect(); + + return $this->response->paginator($payments, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Payment $payment + * @return \Dingo\Api\Http\Response + */ + public function show(Payment $payment) + { + return $this->response->item($payment, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $payment = Payment::create($request->all()); + + return $this->response->created(url('api/payments/'.$payment->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $payment + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Payment $payment, Request $request) + { + $payment->update($request->all()); + + return $this->response->item($payment->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Payment $payment + * @return \Dingo\Api\Http\Response + */ + public function destroy(Payment $payment) + { + $payment->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Expenses/Vendors.php b/app/Http/Controllers/Api/Expenses/Vendors.php new file mode 100644 index 000000000..beb3bec92 --- /dev/null +++ b/app/Http/Controllers/Api/Expenses/Vendors.php @@ -0,0 +1,77 @@ +response->paginator($vendors, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Vendor $vendor + * @return \Dingo\Api\Http\Response + */ + public function show(Vendor $vendor) + { + return $this->response->item($vendor, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $vendor = Vendor::create($request->all()); + + return $this->response->created(url('api/vendors/'.$vendor->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $vendor + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Vendor $vendor, Request $request) + { + $vendor->update($request->all()); + + return $this->response->item($vendor->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Vendor $vendor + * @return \Dingo\Api\Http\Response + */ + public function destroy(Vendor $vendor) + { + $vendor->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Incomes/Customers.php b/app/Http/Controllers/Api/Incomes/Customers.php new file mode 100644 index 000000000..736b410dc --- /dev/null +++ b/app/Http/Controllers/Api/Incomes/Customers.php @@ -0,0 +1,77 @@ +response->paginator($customers, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Customer $customer + * @return \Dingo\Api\Http\Response + */ + public function show(Customer $customer) + { + return $this->response->item($customer, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $customer = Customer::create($request->all()); + + return $this->response->created(url('api/customers/'.$customer->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $customer + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Customer $customer, Request $request) + { + $customer->update($request->all()); + + return $this->response->item($customer->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Customer $customer + * @return \Dingo\Api\Http\Response + */ + public function destroy(Customer $customer) + { + $customer->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Incomes/Invoices.php b/app/Http/Controllers/Api/Incomes/Invoices.php new file mode 100644 index 000000000..bb8729276 --- /dev/null +++ b/app/Http/Controllers/Api/Incomes/Invoices.php @@ -0,0 +1,184 @@ +collect(); + + return $this->response->paginator($invoices, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Invoice $invoice + * @return \Dingo\Api\Http\Response + */ + public function show(Invoice $invoice) + { + return $this->response->item($invoice, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $invoice = Invoice::create($request->all()); + + $invoice_item = array(); + $invoice_item['company_id'] = $request['company_id']; + $invoice_item['invoice_id'] = $invoice->id; + + if ($request['item']) { + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $invoice_item['item_id'] = $item['item_id']; + $invoice_item['name'] = $item['name']; + $invoice_item['sku'] = $item_sku; + $invoice_item['quantity'] = $item['quantity']; + $invoice_item['price'] = $item['price']; + $invoice_item['tax'] = (($item['price'] * $item['quantity']) / 100) * $tax_rate; + $invoice_item['tax_id'] = $tax_id; + $invoice_item['total'] = ($item['price'] + $invoice_item['tax']) * $item['quantity']; + + $request['amount'] += $invoice_item['total']; + + InvoiceItem::create($invoice_item); + } + } + + $invoice->update($request->input()); + + $request['invoice_id'] = $invoice->id; + $request['status_code'] = 'draft'; + $request['notify'] = 0; + $request['description'] = trans('messages.success.added', ['type' => $request['invoice_number']]); + + InvoiceHistory::create($request->input()); + + // Fire the event to make it extendible + event(new InvoiceCreated($invoice)); + + return $this->response->created(url('api/invoices/'.$invoice->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $invoice + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Invoice $invoice, Request $request) + { + $invoice_item = array(); + $invoice_item['company_id'] = $request['company_id']; + $invoice_item['invoice_id'] = $invoice->id; + + if ($request['item']) { + InvoiceItem::where('invoice_id', $invoice->id)->delete(); + + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $invoice_item['item_id'] = $item['item_id']; + $invoice_item['name'] = $item['name']; + $invoice_item['sku'] = $item_sku; + $invoice_item['quantity'] = $item['quantity']; + $invoice_item['price'] = $item['price']; + $invoice_item['tax'] = (($item['price'] * $item['quantity']) / 100 * $tax_rate); + $invoice_item['tax_id'] = $tax_id; + $invoice_item['total'] = ($item['price'] + $invoice_item['tax']) * $item['quantity']; + + $request['amount'] += $invoice_item['total']; + + InvoiceItem::create($invoice_item); + } + } + + $invoice->update($request->input()); + + // Fire the event to make it extendible + event(new InvoiceUpdated($invoice)); + + return $this->response->item($invoice->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Invoice $invoice + * @return \Dingo\Api\Http\Response + */ + public function destroy(Invoice $invoice) + { + $invoice->delete(); + + InvoiceItem::where('invoice_id', $invoice->id)->delete(); + InvoicePayment::where('invoice_id', $invoice->id)->delete(); + InvoiceHistory::where('invoice_id', $invoice->id)->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Incomes/Revenues.php b/app/Http/Controllers/Api/Incomes/Revenues.php new file mode 100644 index 000000000..fb8aa7b67 --- /dev/null +++ b/app/Http/Controllers/Api/Incomes/Revenues.php @@ -0,0 +1,77 @@ +collect(); + + return $this->response->paginator($revenues, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Revenue $revenue + * @return \Dingo\Api\Http\Response + */ + public function show(Revenue $revenue) + { + return $this->response->item($revenue, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $revenue = Revenue::create($request->all()); + + return $this->response->created(url('api/revenues/'.$revenue->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $revenue + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Revenue $revenue, Request $request) + { + $revenue->update($request->all()); + + return $this->response->item($revenue->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Revenue $revenue + * @return \Dingo\Api\Http\Response + */ + public function destroy(Revenue $revenue) + { + $revenue->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Items/Items.php b/app/Http/Controllers/Api/Items/Items.php new file mode 100644 index 000000000..1699a4eb8 --- /dev/null +++ b/app/Http/Controllers/Api/Items/Items.php @@ -0,0 +1,77 @@ +collect(); + + return $this->response->paginator($items, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Item $item + * @return \Dingo\Api\Http\Response + */ + public function show(Item $item) + { + return $this->response->item($item, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $item = Item::create($request->all()); + + return $this->response->created(url('api/items/'.$item->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $item + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Item $item, Request $request) + { + $item->update($request->all()); + + return $this->response->item($item->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Item $item + * @return \Dingo\Api\Http\Response + */ + public function destroy(Item $item) + { + $item->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Settings/Categories.php b/app/Http/Controllers/Api/Settings/Categories.php new file mode 100644 index 000000000..c3614486e --- /dev/null +++ b/app/Http/Controllers/Api/Settings/Categories.php @@ -0,0 +1,77 @@ +response->paginator($categories, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Category $category + * @return \Dingo\Api\Http\Response + */ + public function show(Category $category) + { + return $this->response->item($category, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $category = Category::create($request->all()); + + return $this->response->created(url('api/categories/'.$category->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $category + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Category $category, Request $request) + { + $category->update($request->all()); + + return $this->response->item($category->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Category $category + * @return \Dingo\Api\Http\Response + */ + public function destroy(Category $category) + { + $category->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Settings/Currencies.php b/app/Http/Controllers/Api/Settings/Currencies.php new file mode 100644 index 000000000..b57c35d0f --- /dev/null +++ b/app/Http/Controllers/Api/Settings/Currencies.php @@ -0,0 +1,77 @@ +response->paginator($currencies, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Currency $currency + * @return \Dingo\Api\Http\Response + */ + public function show(Currency $currency) + { + return $this->response->item($currency, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $currency = Currency::create($request->all()); + + return $this->response->created(url('api/currencies/'.$currency->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $currency + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Currency $currency, Request $request) + { + $currency->update($request->all()); + + return $this->response->item($currency->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Currency $currency + * @return \Dingo\Api\Http\Response + */ + public function destroy(Currency $currency) + { + $currency->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/Api/Settings/Taxes.php b/app/Http/Controllers/Api/Settings/Taxes.php new file mode 100644 index 000000000..4bffeff6f --- /dev/null +++ b/app/Http/Controllers/Api/Settings/Taxes.php @@ -0,0 +1,77 @@ +response->paginator($taxes, new Transformer()); + } + + /** + * Display the specified resource. + * + * @param Tax $tax + * @return \Dingo\Api\Http\Response + */ + public function show(Tax $tax) + { + return $this->response->item($tax, new Transformer()); + } + + /** + * Store a newly created resource in storage. + * + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function store(Request $request) + { + $tax = Tax::create($request->all()); + + return $this->response->created(url('api/taxes/'.$tax->id)); + } + + /** + * Update the specified resource in storage. + * + * @param $tax + * @param $request + * @return \Dingo\Api\Http\Response + */ + public function update(Tax $tax, Request $request) + { + $tax->update($request->all()); + + return $this->response->item($tax->fresh(), new Transformer()); + } + + /** + * Remove the specified resource from storage. + * + * @param Tax $tax + * @return \Dingo\Api\Http\Response + */ + public function destroy(Tax $tax) + { + $tax->delete(); + + return $this->response->noContent(); + } +} diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php new file mode 100644 index 000000000..a1f75741c --- /dev/null +++ b/app/Http/Controllers/ApiController.php @@ -0,0 +1,25 @@ +expectsJson()) { + throw new ResourceException('Validation Error', $errors); + } + + return redirect()->to($this->getRedirectUrl())->withInput($request->input())->withErrors($errors, $this->errorBag()); + } +} diff --git a/app/Http/Controllers/Auth/Forgot.php b/app/Http/Controllers/Auth/Forgot.php new file mode 100644 index 000000000..ccc5b15ea --- /dev/null +++ b/app/Http/Controllers/Auth/Forgot.php @@ -0,0 +1,101 @@ +middleware('guest'); + } + + /** + * Display the form to request a password reset link. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + return view('auth.forgot.create'); + } + + /** + * Send a reset link to the given user. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\RedirectResponse + */ + public function store(Request $request) + { + $this->validateEmail($request); + + // We will send the password reset link to this user. Once we have attempted + // to send the link, we will examine the response then see the message we + // need to show to the user. Finally, we'll send out a proper response. + $response = $this->broker()->sendResetLink( + $request->only('email') + ); + + return $response == Password::RESET_LINK_SENT + ? $this->sendResetLinkResponse($response) + : $this->sendResetLinkFailedResponse($request, $response); + } + + /** + * Get the response for a successful password reset link. + * + * @param string $response + * @return \Illuminate\Http\RedirectResponse + */ + protected function sendResetLinkResponse($response) + { + flash(trans($response))->success(); + + return redirect($this->redirectTo); + } + + /** + * Get the response for a failed password reset link. + * + * @param \Illuminate\Http\Request + * @param string $response + * @return \Illuminate\Http\RedirectResponse + */ + protected function sendResetLinkFailedResponse(Request $request, $response) + { + return redirect($this->redirectTo)->withErrors( + ['email' => trans($response)] + ); + } +} diff --git a/app/Http/Controllers/Auth/Login.php b/app/Http/Controllers/Auth/Login.php new file mode 100644 index 000000000..774ece621 --- /dev/null +++ b/app/Http/Controllers/Auth/Login.php @@ -0,0 +1,71 @@ +middleware('guest')->except('logout'); + }*/ + public function __construct() + { + $this->middleware('guest', ['except' => 'destroy']); + } + + public function create() + { + return view('auth.login.create'); + } + + public function store() + { + if (!auth()->attempt(request(['email', 'password']))) { + flash('Please check your credentials and try again.')->error(); + + return back(); + } + + if (auth()->user()->customer) { + return redirect('/customers'); + } + + return redirect('/'); + } + + public function destroy() + { + auth()->logout(); + + return redirect('auth/login'); + } +} diff --git a/app/Http/Controllers/Auth/Permissions.php b/app/Http/Controllers/Auth/Permissions.php new file mode 100644 index 000000000..a51392acd --- /dev/null +++ b/app/Http/Controllers/Auth/Permissions.php @@ -0,0 +1,102 @@ +all()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.permissions', 1)]); + + flash($message)->success(); + + return redirect('auth/permissions'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Permission $permission + * + * @return Response + */ + public function edit(Permission $permission) + { + return view('auth.permissions.edit', compact('permission')); + } + + /** + * Update the specified resource in storage. + * + * @param Permission $permission + * @param Request $request + * + * @return Response + */ + public function update(Permission $permission, Request $request) + { + // Update permission + $permission->update($request->all()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.permissions', 1)]); + + flash($message)->success(); + + return redirect('auth/permissions'); + } + + /** + * Remove the specified resource from storage. + * + * @param Permission $permission + * + * @return Response + */ + public function destroy(Permission $permission) + { + $permission->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.permissions', 1)]); + + flash($message)->success(); + + return redirect('auth/permissions'); + } +} diff --git a/app/Http/Controllers/Auth/Reset.php b/app/Http/Controllers/Auth/Reset.php new file mode 100644 index 000000000..a4eb86e3a --- /dev/null +++ b/app/Http/Controllers/Auth/Reset.php @@ -0,0 +1,97 @@ +middleware('guest'); + } + + public function create(Request $request, $token = null) + { + return view('auth.reset.create')->with( + ['token' => $token, 'email' => $request->email] + ); + } + + public function store(Request $request) + { + $this->validate($request, $this->rules(), $this->validationErrorMessages()); + + // Here we will attempt to reset the user's password. If it is successful we + // will update the password on an actual user model and persist it to the + // database. Otherwise we will parse the error and return the response. + $response = $this->broker()->reset( + $this->credentials($request), function ($user, $password) { + $this->resetPassword($user, $password); + } + ); + + // If the password was successfully reset, we will redirect the user back to + // the application's home authenticated view. If there is an error we can + // redirect them back to where they came from with their error message. + return $response == Password::PASSWORD_RESET + ? $this->sendResetResponse($response) + : $this->sendResetFailedResponse($request, $response); + } + + /** + * Get the response for a successful password reset. + * + * @param string $response + * @return \Illuminate\Http\RedirectResponse + */ + protected function sendResetResponse($response) + { + flash(trans($response))->success(); + + return redirect($this->redirectTo); + } + + /** + * Get the response for a failed password reset. + * + * @param \Illuminate\Http\Request + * @param string $response + * @return \Illuminate\Http\RedirectResponse + */ + protected function sendResetFailedResponse(Request $request, $response) + { + return redirect()->back() + ->withInput($request->only('email')) + ->withErrors(['email' => trans($response)]); + } +} diff --git a/app/Http/Controllers/Auth/Roles.php b/app/Http/Controllers/Auth/Roles.php new file mode 100644 index 000000000..d371c2b83 --- /dev/null +++ b/app/Http/Controllers/Auth/Roles.php @@ -0,0 +1,116 @@ +all()); + + // Attach permissions + $role->permissions()->attach($request['permissions']); + + $message = trans('messages.success.added', ['type' => trans_choice('general.roles', 1)]); + + flash($message)->success(); + + return redirect('auth/roles'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Role $role + * + * @return Response + */ + public function edit(Role $role) + { + //$permissions = Permission::all()->sortBy('display_name'); + $permissions = Permission::all(); + + $rolePermissions = $role->permissions->pluck('id', 'id')->toArray(); + + return view('auth.roles.edit', compact('role', 'permissions', 'rolePermissions')); + } + + /** + * Update the specified resource in storage. + * + * @param Role $role + * @param Request $request + * + * @return Response + */ + public function update(Role $role, Request $request) + { + // Update role + $role->update($request->all()); + + // Sync permissions + $role->permissions()->sync($request['permissions']); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.roles', 1)]); + + flash($message)->success(); + + return redirect('auth/roles'); + } + + /** + * Remove the specified resource from storage. + * + * @param Role $role + * + * @return Response + */ + public function destroy(Role $role) + { + $role->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.roles', 1)]); + + flash($message)->success(); + + return redirect('auth/roles'); + } +} diff --git a/app/Http/Controllers/Auth/Users.php b/app/Http/Controllers/Auth/Users.php new file mode 100644 index 000000000..4442d16e9 --- /dev/null +++ b/app/Http/Controllers/Auth/Users.php @@ -0,0 +1,206 @@ +collect(); + + $roles = collect(Role::all()->pluck('display_name', 'id')) + ->prepend(trans('roles.all'), ''); + + return view('auth.users.index', compact('users', 'roles')); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $roles = Role::all(); + + $companies = Auth::user()->companies()->get()->sortBy('name'); + foreach ($companies as $company) { + $company->setSettings(); + } + + return view('auth.users.create', compact('roles', 'companies')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + // Upload picture + $picture = $request->file('picture'); + if ($picture && $picture->isValid()) { + $request['picture'] = $picture->store('uploads/users'); + } + + // Create user + $user = User::create($request->input()); + + // Attach roles + $user->roles()->attach($request['roles']); + + // Attach companies + $user->companies()->attach($request['companies']); + + $message = trans('messages.success.added', ['type' => trans_choice('general.users', 1)]); + + flash($message)->success(); + + return redirect('auth/users'); + } + + /** + * Show the form for editing the specified resource. + * + * @param User $user + * + * @return Response + */ + public function edit(User $user) + { + $roles = Role::all(); + + $companies = Auth::user()->companies()->get()->sortBy('name'); + foreach ($companies as $company) { + $company->setSettings(); + } + + return view('auth.users.edit', compact('user', 'companies', 'roles')); + } + + /** + * Update the specified resource in storage. + * + * @param User $user + * @param Request $request + * + * @return Response + */ + public function update(User $user, Request $request) + { + // Upload picture + $picture = $request->file('picture'); + if ($picture && $picture->isValid()) { + $request['picture'] = $picture->store('uploads/users'); + } + + // Do not reset password if not entered/changed + if (empty($request['password'])) { + unset($request['password']); + unset($request['password_confirmation']); + } + + // Update user + $user->update($request->input()); + + // Attach roles + $user->roles()->sync($request['roles']); + + // Sync companies + $user->companies()->sync($request['companies']); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.users', 1)]); + + flash($message)->success(); + + return redirect('auth/users'); + } + + /** + * Remove the specified resource from storage. + * + * @param User $user + * + * @return Response + */ + public function destroy(User $user) + { + // Can't delete yourself + if ($user->id == \Auth::user()->id) { + $message = trans('auth.error.self_delete'); + + flash($message)->error(); + + return redirect('auth/users'); + } + + $user->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.users', 1)]); + + flash($message)->success(); + + return redirect('auth/users'); + } + + /** + * Mark upcoming bills notifications are read and redirect to bills page. + * + * @param User $user + * + * @return Response + */ + public function readUpcomingBills(User $user) + { + // Mark bill notifications as read + foreach ($user->unreadNotifications as $notification) { + // Not a bill notification + if ($notification->getAttribute('type') != 'App\Notifications\Expense\Bill') { + continue; + } + + $notification->markAsRead(); + } + + // Redirect to bills + return redirect('expenses/bills'); + } + + /** + * Mark overdue invoices notifications are read and redirect to invoices page. + * + * @param User $user + * + * @return Response + */ + public function readOverdueInvoices(User $user) + { + // Mark invoice notifications as read + foreach ($user->unreadNotifications as $notification) { + // Not an invoice notification + if ($notification->getAttribute('type') != 'App\Notifications\Income\Invoice') { + continue; + } + + $notification->markAsRead(); + } + + // Redirect to invoices + return redirect('incomes/invoices'); + } +} diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php new file mode 100644 index 000000000..8058d4dec --- /dev/null +++ b/app/Http/Controllers/Banking/Accounts.php @@ -0,0 +1,145 @@ +pluck('name', 'code'); + + return view('banking.accounts.create', compact('currencies')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + $account = Account::create($request->all()); + + // Set default account + if ($request['default_account']) { + setting()->set('general.default_account', $account->id); + setting()->save(); + } + + $message = trans('messages.success.added', ['type' => trans_choice('general.accounts', 1)]); + + flash($message)->success(); + + return redirect('banking/accounts'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Account $account + * + * @return Response + */ + public function edit(Account $account) + { + $currencies = Currency::enabled()->pluck('name', 'code'); + + $account->default_account = ($account->id == setting('general.default_account')) ?: 1; + + return view('banking.accounts.edit', compact('account', 'currencies')); + } + + /** + * Update the specified resource in storage. + * + * @param Account $account + * @param Request $request + * + * @return Response + */ + public function update(Account $account, Request $request) + { + $account->update($request->all()); + + // Set default account + if ($request['default_account']) { + setting()->set('general.default_account', $account->id); + setting()->save(); + } + + $message = trans('messages.success.updated', ['type' => trans_choice('general.accounts', 1)]); + + flash($message)->success(); + + return redirect('banking/accounts'); + } + + /** + * Remove the specified resource from storage. + * + * @param Account $account + * + * @return Response + */ + public function destroy(Account $account) + { + $canDelete = $account->canDelete(); + + if ($canDelete === true) { + $account->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.accounts', 1)]); + + flash($message)->success(); + } else { + $text = array(); + + if (isset($canDelete['bills'])) { + $text[] = '' . $canDelete['bills'] . ' ' . trans_choice('general.bills', ($canDelete['bills'] > 1) ? 2 : 1); + } + + if (isset($canDelete['payments'])) { + $text[] = '' . $canDelete['payments'] . ' ' . trans_choice('general.payments', ($canDelete['payments'] > 1) ? 2 : 1); + } + + if (isset($canDelete['invoices'])) { + $text[] = '' . $canDelete['invoices'] . ' ' . trans_choice('general.invoices', ($canDelete['invoices'] > 1) ? 2 : 1); + } + + if (isset($canDelete['revenues'])) { + $text[] = '' . $canDelete['revenues'] . ' ' . trans_choice('general.revenues', ($canDelete['revenues'] > 1) ? 2 : 1); + } + + $message = trans('messages.warning.deleted', ['type' => trans_choice('general.accounts', 1), 'text' => implode(', ', $text)]); + + flash($message)->warning(); + } + + return redirect('banking/accounts'); + } +} diff --git a/app/Http/Controllers/Banking/Transactions.php b/app/Http/Controllers/Banking/Transactions.php new file mode 100644 index 000000000..cf332f8be --- /dev/null +++ b/app/Http/Controllers/Banking/Transactions.php @@ -0,0 +1,80 @@ + $payment->paid_at, + 'account_name' => $payment->account->name, + 'type' => trans_choice('general.expenses', 1), + 'category_name' => $payment->category->name, + 'description' => $payment->description, + 'amount' => $payment->amount, + 'currency_code' => $payment->currency_code, + ]; + } + + $revenues = Revenue::collect('paid_at'); + + foreach ($revenues as $revenue) { + $transactions[] = (object)[ + 'paid_at' => $revenue->paid_at, + 'account_name' => $revenue->account->name, + 'type' => trans_choice('general.incomes', 1), + 'category_name' => $revenue->category->name, + 'description' => $revenue->description, + 'amount' => $revenue->amount, + 'currency_code' => $revenue->currency_code, + ]; + } + + $special_key = array( + 'account.name' => 'account_name', + 'category.name' => 'category_name', + ); + + if (isset($request['sort']) && array_key_exists($request['sort'], $special_key)) { + $sort_order = array(); + + foreach ($transactions as $key => $value) { + $sort = $request['sort']; + + if (array_key_exists($request['sort'], $special_key)) { + $sort = $special_key[$request['sort']]; + } + + $sort_order[$key] = $value->{$sort}; + } + + $sort_type = (isset($request['order']) && $request['order'] == 'asc') ? SORT_ASC : SORT_DESC; + + array_multisort($sort_order, $sort_type, $transactions); + } + + $transactions = (object) $transactions; + + return view('banking.transactions.index', compact('transactions')); + } +} diff --git a/app/Http/Controllers/Banking/Transfers.php b/app/Http/Controllers/Banking/Transfers.php new file mode 100644 index 000000000..aaf366f20 --- /dev/null +++ b/app/Http/Controllers/Banking/Transfers.php @@ -0,0 +1,263 @@ +collect('payment.paid_at'); + + $accounts = collect(Account::enabled()->pluck('name', 'id')) + ->prepend(trans('accounts.all'), ''); + + $transfers = array(); + + foreach ($items as $item) { + $payment = $item->payment; + $revenue = $item->revenue; + + $transfers[] = (object)[ + 'from_account' => $payment->account->name, + 'to_account' => $revenue->account->name, + 'amount' => $payment->amount, + 'currency_code' => $payment->currency_code, + 'paid_at' => $payment->paid_at, + ]; + } + + $special_key = array( + 'payment.name' => 'from_account', + 'revenue.name' => 'to_account', + ); + + if (isset($request['sort']) && array_key_exists($request['sort'], $special_key)) { + $sort_order = array(); + + foreach ($transfers as $key => $value) { + $sort = $request['sort']; + + if (array_key_exists($request['sort'], $special_key)) { + $sort = $special_key[$request['sort']]; + } + + $sort_order[$key] = $value->{$sort}; + } + + $sort_type = (isset($request['order']) && $request['order'] == 'asc') ? SORT_ASC : SORT_DESC; + + array_multisort($sort_order, $sort_type, $transfers); + } + + return view('banking.transfers.index', compact('transfers', 'items', 'accounts')); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $accounts = Account::enabled()->pluck('name', 'id'); + + return view('banking.transfers.create', compact('accounts')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + $currencies = Currency::enabled()->pluck('rate', 'code')->toArray(); + + $payment_currency_code = Account::where('id', $request['from_account_id'])->pluck('currency_code')->first(); + $revenue_currency_code = Account::where('id', $request['to_account_id'])->pluck('currency_code')->first(); + + $request['account_id'] = $request['from_account_id']; + $request['paid_at'] = $request['transferred_at']; + // amount + $request['currency_code'] = $payment_currency_code; + $request['currency_rate'] = $currencies[$payment_currency_code]; + $request['vendor_id'] = '0'; + // description + $request['category_id'] = Category::enabled()->type('other')->pluck('id')->first(); // Transfer Category ID + // payment_method + // reference + $request['attachment'] = ''; + + $payment = Payment::create($request->all()); + + $transfer = new Transfer(); + + $transfer->default_currency_code = $payment_currency_code; + $transfer->amount = $request['amount']; + $transfer->currency_code = $revenue_currency_code; + $transfer->currency_rate = $currencies[$revenue_currency_code]; + + $amount = $transfer->getDynamicConvertedAmount(); + + $request['account_id'] = $request['to_account_id']; + // paid_at + $request['amount'] = $amount; + $request['currency_code'] = $revenue_currency_code; + $request['currency_rate'] = $currencies[$revenue_currency_code]; + $request['customer_id'] = '0'; + // description + // category_id + // payment_method + // reference + // attachment + + $revenue = Revenue::create($request->all()); + + $request['payment_id'] = $payment->id; + $request['revenue_id'] = $revenue->id; + + Transfer::create($request->all()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.transfers', 1)]); + + flash($message)->success(); + + return redirect('banking/transfers'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Request $request + * + * @return Response + */ + public function edit(Request $request) + { + $payment = Payment::findOrFail($request['payment_id']); + $revenue = Revenue::findOrFail($request['revenue_id']); + + $transfer['from_account_id'] = $payment->account_id; + $transfer['to_account_id'] = $revenue->account_id; + $transfer['transferred_at'] = $revenue->deposited_at; + $transfer['description'] = $revenue->description; + $transfer['amount'] = $revenue->amount; + $transfer['payment_method'] = $revenue->payment_method; + $transfer['reference'] = $revenue->reference; + + $accounts = Account::listArray(); + + return view('banking.transfers.edit', compact('transfer', 'accounts')); + } + + /** + * Update the specified resource in storage. + * + * @param Transfer $transfer + * @param Request $request + * + * @return Response + */ + public function update(Transfer $transfer, Request $request) + { + $currencies = Currency::enabled()->pluck('rate', 'code')->toArray(); + + $payment_currency_code = Account::where('id', $request['from_account_id'])->pluck('currency_code')->first(); + $revenue_currency_code = Account::where('id', $request['to_account_id'])->pluck('currency_code')->first(); + + $payment = Payment::findOrFail($transfer->payment_id); + + $request['account_id'] = $request['from_account_id']; + $request['paid_at'] = $request['transferred_at']; + // amount + $request['currency_code'] = $payment_currency_code; + $request['currency_rate'] = $currencies[$payment_currency_code]; + $request['vendor_id'] = '0'; + // description + $request['category_id'] = Category::enabled()->type('other')->pluck('id')->first(); // Transfer Category ID + // payment_method + // reference + $request['attachment'] = ''; + + $payment->update($request->all()); + + $revenue = Revenue::findOrFail($transfer->income_id); + + $transfer = new Transfer(); + + $transfer->default_currency_code = $payment_currency_code; + $transfer->amount = $request['amount']; + $transfer->currency_code = $revenue_currency_code; + $transfer->currency_rate = $currencies[$revenue_currency_code]; + + $amount = $transfer->getDynamicConvertedAmount(); + + $request['account_id'] = $request['to_account_id']; + // paid_at + $request['amount'] = $amount; + $request['currency_code'] = $revenue_currency_code; + $request['currency_rate'] = $currencies[$revenue_currency_code]; + $request['customer_id'] = '0'; + // description + // category_id + // payment_method + // reference + // attachment + + $revenue->update($request->all()); + + $request['payment_id'] = $payment->id; + $request['revenue_id'] = $revenue->id; + + $transfer->update($request->all()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.transfers', 1)]); + + flash($message)->success(); + + return redirect('banking/transfers'); + } + + /** + * Remove the specified resource from storage. + * + * @param Transfer $transfer + * + * @return Response + */ + public function destroy(Transfer $transfer) + { + $payment = Payment::findOrFail($transfer['payment_id']); + $revenue = Revenue::findOrFail($transfer['revenue_id']); + + $transfer->delete(); + $payment->delete(); + $revenue->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.transfers', 1)]); + + flash($message)->success(); + + return redirect('banking/transfers'); + } +} diff --git a/app/Http/Controllers/Companies/Companies.php b/app/Http/Controllers/Companies/Companies.php new file mode 100644 index 000000000..e5e14e01b --- /dev/null +++ b/app/Http/Controllers/Companies/Companies.php @@ -0,0 +1,228 @@ +companies()->get()->sortBy('name'); + + foreach ($companies as $company) { + $company->setSettings(); + } + + return view('companies.companies.index', compact('companies')); + } + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $currencies = Currency::enabled()->pluck('name', 'code'); + + return view('companies.companies.create', compact('currencies')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + Setting::forgetAll(); + + // Create company + $company = Company::create(['domain' => $request->get('domain')]); + + // Create settings + Setting::set('general.company_name', $request->get('company_name')); + Setting::set('general.company_email', $request->get('company_email')); + Setting::set('general.company_address', $request->get('company_address')); + + $logo_path = $this->getUploadedFilePath($request->file('company_logo'), 'settings', $company->id); + if ($logo_path) { + Setting::set('general.company_logo', $logo_path); + } + + Setting::set('general.default_currency', $request->get('default_currency')); + Setting::set('general.default_locale', session('locale')); + + Setting::setExtraColumns(['company_id' => $company->id]); + Setting::save(); + + // Redirect + $message = trans('messages.success.added', ['type' => trans_choice('general.companies', 1)]); + + flash($message)->success(); + + return redirect('companies/companies'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Company $company + * + * @return Response + */ + public function edit(Company $company) + { + // Check if user can edit company + $this->authorizeUserOrRedirect($company); + + $company->setSettings(); + + $currencies = Currency::enabled()->pluck('name', 'code'); + + return view('companies.companies.edit', compact('company', 'currencies')); + } + + /** + * Update the specified resource in storage. + * + * @param Company $company + * @param Request $request + * + * @return Response + */ + public function update(Company $company, Request $request) + { + // Check if user can update company + $this->authorizeUserOrRedirect($company); + + // Update company + $company->update(['domain' => $request->get('domain')]); + + // Get the company settings + Setting::forgetAll(); + Setting::setExtraColumns(['company_id' => $company->id]); + Setting::load(true); + + // Update settings + Setting::set('general.company_name', $request->get('company_name')); + Setting::set('general.company_email', $request->get('company_email')); + Setting::set('general.company_address', $request->get('company_address')); + + $logo_path = $this->getUploadedFilePath($request->file('company_logo'), 'settings', $company->id); + if ($logo_path) { + Setting::set('general.company_logo', $logo_path); + } + + Setting::set('general.default_payment_method', 'cash'); + Setting::set('general.default_currency', $request->get('default_currency')); + + Setting::save(); + + // Redirect + $message = trans('messages.success.updated', ['type' => trans_choice('general.companies', 1)]); + + flash($message)->success(); + + return redirect('companies/companies'); + } + + /** + * Remove the specified resource from storage. + * + * @param Company $company + * + * @return Response + */ + public function destroy(Company $company) + { + // Can't delete active company + if ($company->id == session('company_id')) { + $message = trans('companies.error.delete_active'); + + flash($message)->error(); + + return redirect('companies/companies'); + } + + $company->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.companies', 1)]); + + flash($message)->success(); + + return redirect('companies/companies'); + } + + /** + * Change the active company. + * + * @param Company $company + * + * @return Response + */ + public function set(Company $company) + { + // Check if user can manage company + if ($this->isUserCompany($company)) { + session(['company_id' => $company->id]); + } + + //return redirect('/'); + return redirect()->back(); + } + + /** + * Check user company assignment + * + * @param Company $company + * + * @return boolean + */ + public function isUserCompany(Company $company) + { + $companies = Auth::user()->companies()->pluck('id')->toArray(); + + if (in_array($company->id, $companies)) { + return true; + } + + return false; + } + + /** + * Check user company permission and redirect if not + * + * @param Company $company + * + * @return boolean + */ + public function authorizeUserOrRedirect(Company $company) + { + if ($this->isUserCompany($company)) { + return true; + } + + $message = trans('companies.error.not_user_company'); + + flash($message)->error(); + + Redirect::away(url('companies/companies'))->send(); + } +} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php new file mode 100644 index 000000000..b37ca25fd --- /dev/null +++ b/app/Http/Controllers/Controller.php @@ -0,0 +1,47 @@ +getAction()['uses'])[0])); + + $controller = ''; + + // Add folder + if ($arr[1] != 'controllers') { + $controller .= kebab_case($arr[1]) . '-'; + } + + // Add file + $controller .= kebab_case($arr[0]); + + // Skip ACL + $skip = ['dashboard-dashboard']; + if (in_array($controller, $skip)) { + return; + } + + // Add CRUD permission check + $this->middleware('permission:create-' . $controller)->only(['create', 'store']); + $this->middleware('permission:read-' . $controller)->only(['index', 'show', 'edit']); + $this->middleware('permission:update-' . $controller)->only(['update']); + $this->middleware('permission:delete-' . $controller)->only('destroy'); + } +} diff --git a/app/Http/Controllers/Customers/Dashboard.php b/app/Http/Controllers/Customers/Dashboard.php new file mode 100644 index 000000000..29f9276df --- /dev/null +++ b/app/Http/Controllers/Customers/Dashboard.php @@ -0,0 +1,23 @@ +customer; + + return view('customers.dashboard.index', compact('user')); + } +} diff --git a/app/Http/Controllers/Customers/Invoices.php b/app/Http/Controllers/Customers/Invoices.php new file mode 100644 index 000000000..dd68fe010 --- /dev/null +++ b/app/Http/Controllers/Customers/Invoices.php @@ -0,0 +1,215 @@ +where('customer_id', '=', Auth::user()->customer->id)->paginate(); + + foreach ($invoices as $invoice) { + $paid = 0; + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->amount = $invoice->amount - $paid; + } + + $status = collect(InvoiceStatus::all()->pluck('name', 'code')) + ->prepend(trans('general.all_statuses'), ''); + + return view('customers.invoices.index', compact('invoices', 'status')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param Invoice $invoice + * + * @return Response + */ + public function show(Invoice $invoice) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + foreach ($invoice->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->sub_total = $sub_total; + $invoice->tax_total = $tax_total; + $invoice->paid = $paid; + $invoice->grand_total = (($sub_total + $tax_total) - $paid); + + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first(); + + $customers = Customer::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('income')->pluck('name', 'id'); + + $payment_methods = Modules::getPaymentMethods(); + + return view('customers.invoices.show', compact('invoice', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param int $invoice_id + * + * @return Response + */ + public function printInvoice($invoice_id) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + $invoice = Invoice::where('id', $invoice_id)->first(); + + foreach ($invoice->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->sub_total = $sub_total; + $invoice->tax_total = $tax_total; + $invoice->paid = $paid; + $invoice->grand_total = (($sub_total + $tax_total) - $paid); + + return view('customers.invoices.invoice', compact('invoice')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param int $invoice_id + * + * @return Response + */ + public function pdfInvoice($invoice_id) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + $invoice = Invoice::where('id', $invoice_id)->first(); + + foreach ($invoice->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->sub_total = $sub_total; + $invoice->tax_total = $tax_total; + $invoice->paid = $paid; + $invoice->grand_total = (($sub_total + $tax_total) - $paid); + + $html = view('incomes.invoices.invoice', compact('invoice'))->render(); + + $pdf = \App::make('dompdf.wrapper'); + $pdf->loadHTML($html); + + $file_name = 'invoice_'.time().'.pdf'; + + return $pdf->download($file_name); + } + + /** + * Show the form for viewing the specified resource. + * + * @param PaymentRequest $request + * + * @return Response + */ + public function payment(PaymentRequest $request) + { + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'revenues'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $invoice = Invoice::find($request['invoice_id']); + + $invoice->invoice_status_code = 'partial'; + + $invoice->save(); + + $invoice_payment = InvoicePayment::create($request->input()); + + $request['status_code'] = 'partial'; + $request['notify'] = 0; + + $desc_date = Date::parse($request['paid_at'])->format($this->getCompanyDateFormat()); + $desc_amount = money((float) $request['amount'], $request['currency_code'], true)->format(); + $request['description'] = $desc_date . ' ' . $desc_amount; + + InvoiceHistory::create($request->input()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]); + + return response()->json($message); + } +} diff --git a/app/Http/Controllers/Customers/Payments.php b/app/Http/Controllers/Customers/Payments.php new file mode 100644 index 000000000..064dcac30 --- /dev/null +++ b/app/Http/Controllers/Customers/Payments.php @@ -0,0 +1,51 @@ +where('customer_id', '=', Auth::user()->customer->id)->paginate(); + + $payment_methods = Modules::getPaymentMethods(); + + $categories = collect(Category::enabled()->type('income')->pluck('name', 'id')) + ->prepend(trans('categories.all'), ''); + + $accounts = collect(Account::enabled()->pluck('name', 'id')) + ->prepend(trans('accounts.all'), ''); + + return view('customers.payments.index', compact('payments', 'payment_methods', 'categories', 'accounts')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param Payment $payment + * + * @return Response + */ + public function show(Payment $payment) + { + $payment_methods = Modules::getPaymentMethods(); + + return view('customers.payments.show', compact('payment', 'payment_methods')); + } +} diff --git a/app/Http/Controllers/Customers/Transactions.php b/app/Http/Controllers/Customers/Transactions.php new file mode 100644 index 000000000..f04d78add --- /dev/null +++ b/app/Http/Controllers/Customers/Transactions.php @@ -0,0 +1,24 @@ +customer->id, 'revenues'); + + return view('customers.transactions.index', compact('transactions')); + } +} diff --git a/app/Http/Controllers/Dashboard/Dashboard.php b/app/Http/Controllers/Dashboard/Dashboard.php new file mode 100644 index 000000000..7c8851f32 --- /dev/null +++ b/app/Http/Controllers/Dashboard/Dashboard.php @@ -0,0 +1,396 @@ + -1; $j--) { + $day[31 - $j] = date("d M", strtotime("-$j day")); + } + + $daily_income = $this->getCashFlow('income', 'daily'); + $daily_expense = $this->getCashFlow('expense', 'daily'); + + $daily_profit = $this->getProfit($daily_income, $daily_expense); + + // Monthly + $month = array(); + + for ($j = 12; $j >= 0; $j--) { + $month[12 - $j] = date("F-Y", strtotime(" -$j month")); + } + + $monthly_income = $this->getCashFlow('income', 'monthly'); + $monthly_expense = $this->getCashFlow('expense', 'monthly'); + + $monthly_profit = $this->getProfit($monthly_income, $monthly_expense); + + $cash_flow = [ + 'daily' => [ + 'date' => json_encode($day), + 'income' => json_encode(array_values($daily_income)), + 'expense' => json_encode(array_values($daily_expense)), + 'profit' => json_encode(array_values($daily_profit)) + ], + 'monthly' => [ + 'date' => json_encode($month), + 'income' => json_encode(array_values($monthly_income)), + 'expense' => json_encode(array_values($monthly_expense)), + 'profit' => json_encode(array_values($monthly_profit)) + ], + ]; + + /* + * Totals & Pie Charts + */ + + $incomes = $expenses = array(); + + $incomes_amount = $expenses_amount = 0; + $open_invoice = $overdue_invoice = 0; + $open_bill = $overdue_bill = 0; + $invoice_paid_amount = $bill_paid_amount = 0; + + $today = Date::today()->toDateString(); + + // Invoices + $invoices = Invoice::with('payments')->get(); + + foreach ($invoices as $invoice) { + $invoice_payments = 0; + + foreach ($invoice->payments as $payment) { + $invoice_payments += $payment->getConvertedAmount(); + } + + $invoice_paid_amount += $invoice_payments; + + // Check if it's open or overdue invoice + if ($invoice->due_at > $today) { + $open_invoice += $invoice->getConvertedAmount() - $invoice_payments; + } else { + $overdue_invoice += $invoice->getConvertedAmount() - $invoice_payments; + } + } + + $incomes_amount += $invoice_paid_amount; + + // Bills + $bills = Bill::with('payments')->get(); + + foreach ($bills as $bill) { + $bill_payments = 0; + + foreach ($bill->payments as $payment) { + $bill_payments += $payment->getConvertedAmount(); + } + + $bill_paid_amount += $bill_payments; + + // Check if it's open or overdue bill + if ($bill->due_at > $today) { + $open_bill += $bill->getConvertedAmount() - $bill_payments; + } else { + $overdue_bill += $bill->getConvertedAmount() - $bill_payments; + } + } + + $expenses_amount += $bill_paid_amount; + + // Add to Incomes By Category + $incomes[] = array( + 'amount' => money($invoice_paid_amount, setting('general.default_currency'), true)->format(), + 'value' => (int) $invoice_paid_amount, + 'color' => '#00c0ef', + 'highlight' => '#00c0ef', + 'label' => trans_choice('general.invoices', 2) + ); + + // Add to Expenses By Category + $expenses[] = array( + 'amount' => money($bill_paid_amount, setting('general.default_currency'), true)->format(), + 'value' => (int) $bill_paid_amount, + 'color' => '#dd4b39', + 'highlight' => '#dd4b39', + 'label' => trans_choice('general.bills', 2) + ); + + // Revenues & Payments + $categories = Category::orWhere('type', 'income')->orWhere('type', 'expense')->enabled()->get(); + + foreach ($categories as $category) { + switch ($category->type) { + case 'income': + $revenues = $category->revenues; + + $amount = 0; + + if ($revenues) { + foreach ($revenues as $revenue) { + $amount += $revenue->getConvertedAmount(); + } + + $incomes[] = array( + 'amount' => money($amount, setting('general.default_currency'), true)->format(), + 'value' => (int) $amount, + 'color' => $category->color, + 'highlight' => $category->color, + 'label' => $category->name + ); + } else { + $incomes[] = array( + 'amount' => money(0, setting('general.default_currency'), true)->format(), + 'value' => (int) 0, + 'color' => $category->color, + 'highlight' => $category->color, + 'label' => $category->name + ); + } + + $incomes_amount += $amount; + break; + case 'expense': + $payments = $category->payments; + + $amount = 0; + + if ($payments) { + foreach ($payments as $payment) { + $amount += $payment->getConvertedAmount(); + } + + $expenses[] = array( + 'amount' => money($amount, setting('general.default_currency'), true)->format(), + 'value' => (int) $amount, + 'color' => $category->color, + 'highlight' => $category->color, + 'label' => $category->name + ); + } else { + $expenses[] = array( + 'amount' => money(0, setting('general.default_currency'), true)->format(), + 'value' => (int) 0, + 'color' => $category->color, + 'highlight' => $category->color, + 'label' => $category->name + ); + } + + $expenses_amount += $amount; + break; + } + } + + if (empty($incomes_amount)) { + foreach ($incomes as $key => $income) { + $incomes[$key]['amount'] = money(0, setting('general.default_currency'), true)->format(); + $incomes[$key]['value'] = (int) 100 / count($incomes); + } + } + + // Incomes Pie Chart + $income_graph = json_encode($incomes); + + if (empty($expenses_amount)) { + foreach ($expenses as $key => $expense) { + $expenses[$key]['amount'] = money(0, setting('general.default_currency'), true)->format(); + $expenses[$key]['value'] = (int) 100 / count($expenses); + } + } + + // Expenses Pie Chart + $expense_graph = json_encode($expenses); + + $incomes_progress = 100; + + if (!empty($open_invoice) && !empty($overdue_invoice)) { + $incomes_progress = (int) 100 - (100 * ($open_invoice / $overdue_invoice)); + } + + // Totals + $total_incomes = array( + 'total' => $incomes_amount, + 'open_invoice' => money($open_invoice, setting('general.default_currency'), true), + 'overdue_invoice' => money($overdue_invoice, setting('general.default_currency'), true), + 'progress' => $incomes_progress + ); + + $expenses_progress = 100; + + if (!empty($open_bill) && !empty($overdue_bill)) { + $expenses_progress = (int) 100 - (100 * ($open_bill / $overdue_bill)); + } + + $total_expenses = array( + 'total' => $expenses_amount, + 'open_bill' => money($open_bill, setting('general.default_currency'), true), + 'overdue_bill' => money($overdue_bill, setting('general.default_currency'), true), + 'progress' => $expenses_progress + ); + + $amount_profit = $incomes_amount - $expenses_amount; + $open_profit = $open_invoice - $open_bill; + $overdue_profit = $overdue_invoice - $overdue_bill; + + $total_progress = 100; + + if (!empty($open_profit) && !empty($overdue_profit)) { + $total_progress = (int) 100 - (100 * ($open_profit / $overdue_profit)); + } + + $total_profit = array( + 'total' => $amount_profit, + 'open' => money($open_profit, setting('general.default_currency'), true), + 'overdue' => money($overdue_profit, setting('general.default_currency'), true), + 'progress' => $total_progress + ); + + /* + * Accounts + */ + + $accounts = Account::enabled()->get(); + + /* + * Latest Incomes + */ + + $latest_incomes = collect(InvoicePayment::latest()->take(5)->get()); + $latest_incomes = $latest_incomes->merge(Revenue::latest()->take(5)->get())->sortByDesc('paid_at'); + + /* + * Latest Expenses + */ + + $latest_expenses = collect(BillPayment::latest()->take(5)->get()); + $latest_expenses = $latest_expenses->merge(Payment::latest()->take(5)->get())->sortByDesc('paid_at'); + + return view('dashboard.dashboard.index', compact( + 'total_incomes', + 'total_expenses', + 'total_profit', + 'cash_flow', + 'incomes', + 'incomes_amount', + 'income_graph', + 'expenses', + 'expenses_amount', + 'expense_graph', + 'accounts', + 'latest_incomes', + 'latest_expenses' + )); + } + + private function getCashFlow($type, $period) + { + $totals = array(); + + if ($type == 'income') { + $m1 = '\App\Models\Income\Revenue'; + $m2 = '\App\Models\Income\InvoicePayment'; + } else { + $m1 = '\App\Models\Expense\Payment'; + $m2 = '\App\Models\Expense\BillPayment'; + } + + switch ($period) { + case 'yearly': + $f1 = 'subYear'; + $f2 = 'addYear'; + + $date_format = 'Y'; + break; + case 'monthly': + $f1 = 'subYear'; + $f2 = 'addMonth'; + + $date_format = 'Y-m'; + break; + default: + case 'daily': + $f1 = 'subMonth'; + $f2 = 'addDay'; + + $date_format = 'Y-m-d'; + break; + } + + $now = Date::now(); + $sub = Date::now()->$f1(); + + $start_date = $sub->format($date_format); + $end_date = $now->format($date_format); + $next_date = $start_date; + + $totals[$start_date] = 0; + + do { + $next_date = Date::parse($next_date)->$f2()->format($date_format); + + $totals[$next_date] = 0; + } while ($next_date < $end_date); + + $items_1 = $m1::whereBetween('paid_at', [$sub, $now])->get(); + + $this->setTotals($totals, $items_1, $date_format); + + $items_2 = $m2::whereBetween('paid_at', [$sub, $now])->get(); + + $this->setTotals($totals, $items_2, $date_format); + + return $totals; + } + + private function setTotals(&$totals, $items, $date_format) + { + foreach ($items as $item) { + $i = Date::parse($item->paid_at)->format($date_format); + + $totals[$i] += $item->getConvertedAmount(); + } + } + + private function getProfit($incomes, $expenses) + { + $profit = []; + + foreach ($incomes as $key => $income) { + if ($income > 0 && $income > $expenses[$key]) { + $profit[$key] = $income - $expenses[$key]; + } else { + $profit[$key] = 0; + } + } + + return $profit; + } +} diff --git a/app/Http/Controllers/Expenses/Bills.php b/app/Http/Controllers/Expenses/Bills.php new file mode 100644 index 000000000..9acba181b --- /dev/null +++ b/app/Http/Controllers/Expenses/Bills.php @@ -0,0 +1,503 @@ +collect(); + + $status = collect(BillStatus::all()->pluck('name', 'code')) + ->prepend(trans('general.all_statuses'), ''); + + return view('expenses.bills.index', compact('bills', 'status')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param Bill $bill + * + * @return Response + */ + public function show(Bill $bill) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + foreach ($bill->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($bill->payments as $item) { + $item->default_currency_code = $bill->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $bill->sub_total = $sub_total; + $bill->tax_total = $tax_total; + $bill->paid = $paid; + $bill->grand_total = (($sub_total + $tax_total) - $paid); + + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first(); + + $vendors = Vendor::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('income')->pluck('name', 'id'); + + $payment_methods = Modules::getPaymentMethods(); + + return view('expenses.bills.show', compact('bill', 'accounts', 'currencies', 'account_currency_code', 'vendors', 'categories', 'payment_methods')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param int $bill_id + * + * @return Response + */ + public function printBill($bill_id) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + $bill = Bill::where('id', $bill_id)->first(); + + foreach ($bill->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($bill->payments as $item) { + $item->default_currency_code = $bill->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $bill->sub_total = $sub_total; + $bill->tax_total = $tax_total; + $bill->paid = $paid; + $bill->grand_total = (($sub_total + $tax_total) - $paid); + + return view('expenses.bills.bill', compact('bill')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param int $bill_id + * + * @return Response + */ + public function pdfBill($bill_id) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + $bill = Bill::where('id', $bill_id)->first(); + + foreach ($bill->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($bill->payments as $item) { + $item->default_currency_code = $bill->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $bill->sub_total = $sub_total; + $bill->tax_total = $tax_total; + $bill->paid = $paid; + $bill->grand_total = (($sub_total + $tax_total) - $paid); + + $html = view('expenses.bills.bill', compact('bill'))->render(); + + $pdf = \App::make('dompdf.wrapper'); + $pdf->loadHTML($html); + + $file_name = 'bill_'.time().'.pdf'; + + return $pdf->download($file_name); + } + + /** + * Show the form for viewing the specified resource. + * + * @param PaymentRequest $request + * + * @return Response + */ + public function payment(PaymentRequest $request) + { + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'revenues'); + + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $bill = Bill::find($request['bill_id']); + + if ($request['currency_code'] == $bill->currency_code) { + if ($request['amount'] > $bill->amount) { + $message = trans('messages.error.added', ['type' => trans_choice('general.payment', 1)]); + + return response()->json($message); + } elseif ($request['amount'] == $bill->amount) { + $bill->bill_status_code = 'paid'; + } else { + $bill->bill_status_code = 'partial'; + } + } else { + $request_bill = new Bill(); + + $request_bill->amount = (float) $request['amount']; + $request_bill->currency_code = $currency->code; + $request_bill->currency_rate = $currency->rate; + + $amount = $request_bill->getConvertedAmount(); + + if ($amount > $bill->amount) { + $message = trans('messages.error.added', ['type' => trans_choice('general.payment', 1)]); + + return response()->json($message); + } elseif ($amount == $bill->amount) { + $bill->bill_status_code = 'paid'; + } else { + $bill->bill_status_code = 'partial'; + } + } + + $bill->save(); + + $bill_payment = BillPayment::create($request->input()); + + $request['status_code'] = $bill->bill_status_code; + $request['notify'] = 0; + + $desc_date = Date::parse($request['paid_at'])->format($this->getCompanyDateFormat()); + $desc_amount = money((float) $request['amount'], $request['currency_code'], true)->format(); + $request['description'] = $desc_date . ' ' . $desc_amount; + + BillHistory::create($request->input()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]); + + return response()->json($message); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $vendors = Vendor::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code'); + + $items = Item::enabled()->pluck('name', 'id'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + return view('expenses.bills.create', compact('vendors', 'currencies', 'items', 'taxes')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + // Get vendor object + $vendor = Vendor::findOrFail($request['vendor_id']); + + $request['vendor_name'] = $vendor->name; + $request['vendor_email'] = $vendor->email; + $request['vendor_tax_number'] = $vendor->tax_number; + $request['vendor_phone'] = $vendor->phone; + $request['vendor_address'] = $vendor->address; + + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + $request['bill_status_code'] = 'new'; + + $request['amount'] = 0; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'bills'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $bill = Bill::create($request->input()); + + $bill_item = array(); + $bill_item['company_id'] = $request['company_id']; + $bill_item['bill_id'] = $bill->id; + + if ($request['item']) { + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $bill_item['item_id'] = $item['item_id']; + $bill_item['name'] = $item['name']; + $bill_item['sku'] = $item_sku; + $bill_item['quantity'] = $item['quantity']; + $bill_item['price'] = $item['price']; + $bill_item['tax'] = (($item['price'] * $item['quantity']) / 100) * $tax_rate; + $bill_item['tax_id'] = $tax_id; + $bill_item['total'] = ($item['price'] + $bill_item['tax']) * $item['quantity']; + + $request['amount'] += $bill_item['total']; + + BillItem::create($bill_item); + } + } + + $bill->update($request->input()); + + $request['bill_id'] = $bill->id; + $request['status_code'] = 'new'; + $request['notify'] = 0; + $request['description'] = trans('messages.success.added', ['type' => $request['bill_number']]); + + BillHistory::create($request->input()); + + // Fire the event to make it extendible + event(new BillCreated($bill)); + + $message = trans('messages.success.added', ['type' => trans_choice('general.bills', 1)]); + + flash($message)->success(); + + return redirect('expenses/bills/' . $bill->id); + } + + /** + * Show the form for editing the specified resource. + * + * @param Bill $bill + * + * @return Response + */ + public function edit(Bill $bill) + { + $vendors = Vendor::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code'); + + $items = Item::enabled()->pluck('name', 'id'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + return view('expenses.bills.edit', compact('bill', 'vendors', 'currencies', 'items', 'taxes')); + } + + /** + * Update the specified resource in storage. + * + * @param Bill $bill + * @param Request $request + * + * @return Response + */ + public function update(Bill $bill, Request $request) + { + // Get vendor object + $vendor = Vendor::findOrFail($request['vendor_id']); + + $request['vendor_name'] = $vendor->name; + $request['vendor_email'] = $vendor->email; + $request['vendor_tax_number'] = $vendor->tax_number; + $request['vendor_phone'] = $vendor->phone; + $request['vendor_address'] = $vendor->address; + + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + $request['bill_status_code'] = 'updated'; + + $request['amount'] = 0; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'bills'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $bill_item = array(); + $bill_item['company_id'] = $request['company_id']; + $bill_item['bill_id'] = $bill->id; + + if ($request['item']) { + BillItem::where('bill_id', $bill->id)->delete(); + + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $bill_item['item_id'] = $item['item_id']; + $bill_item['name'] = $item['name']; + $bill_item['sku'] = $item_sku; + $bill_item['quantity'] = $item['quantity']; + $bill_item['price'] = $item['price']; + $bill_item['tax'] = (($item['price'] * $item['quantity']) / 100) * $tax_rate; + $bill_item['tax_id'] = $tax_id; + $bill_item['total'] = ($item['price'] + $bill_item['tax']) * $item['quantity']; + + $request['amount'] += $bill_item['total']; + + BillItem::create($bill_item); + } + } + + $bill->update($request->input()); + + // Fire the event to make it extendible + event(new BillUpdated($bill)); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.bills', 1)]); + + flash($message)->success(); + + return redirect('expenses/bills/' . $bill->id); + } + + /** + * Remove the specified resource from storage. + * + * @param Bill $bill + * + * @return Response + */ + public function destroy(Bill $bill) + { + $bill->delete(); + + /* + $bill->items->delete(); + $bill->payments->delete(); + $bill->histories->delete(); + */ + + BillItem::where('bill_id', $bill->id)->delete(); + BillPayment::where('bill_id', $bill->id)->delete(); + BillHistory::where('bill_id', $bill->id)->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.bills', 1)]); + + flash($message)->success(); + + return redirect('expenses/bills'); + } + + /** + * Remove the specified resource from storage. + * + * @param BillPayment $payment + * + * @return Response + */ + public function paymentDestroy(BillPayment $payment) + { + $payment->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.bills', 1)]); + + flash($message)->success(); + + return redirect('expenses/bills'); + } +} diff --git a/app/Http/Controllers/Expenses/Payments.php b/app/Http/Controllers/Expenses/Payments.php new file mode 100644 index 000000000..69f90cd19 --- /dev/null +++ b/app/Http/Controllers/Expenses/Payments.php @@ -0,0 +1,156 @@ +collect(); + + $categories = collect(Category::enabled()->type('expense')->pluck('name', 'id')) + ->prepend(trans('categories.all'), ''); + + $accounts = collect(Account::enabled()->pluck('name', 'id')) + ->prepend(trans('accounts.all'), ''); + + return view('expenses.payments.index', compact('payments', 'categories', 'accounts')); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first(); + + $vendors = Vendor::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('expense')->pluck('name', 'id'); + + return view('expenses.payments.create', compact('accounts', 'currencies', 'account_currency_code', 'vendors', 'categories')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'payments'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + Payment::create($request->input()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]); + + flash($message)->success(); + + return redirect('expenses/payments'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Payment $payment + * + * @return Response + */ + public function edit(Payment $payment) + { + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', $payment->account_id)->pluck('currency_code')->first(); + + $vendors = Vendor::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('expense')->pluck('name', 'id'); + + return view('expenses.payments.edit', compact('payment', 'accounts', 'currencies', 'account_currency_code', 'vendors', 'categories')); + } + + /** + * Update the specified resource in storage. + * + * @param Payment $payment + * @param Request $request + * + * @return Response + */ + public function update(Payment $payment, Request $request) + { + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'payments'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $payment->update($request->input()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.payments', 1)]); + + flash($message)->success(); + + return redirect('expenses/payments'); + } + + /** + * Remove the specified resource from storage. + * + * @param Payment $payment + * + * @return Response + */ + public function destroy(Payment $payment) + { + $payment->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.payments', 1)]); + + flash($message)->success(); + + return redirect('expenses/payments'); + } +} diff --git a/app/Http/Controllers/Expenses/Vendors.php b/app/Http/Controllers/Expenses/Vendors.php new file mode 100644 index 000000000..9ba8e99bd --- /dev/null +++ b/app/Http/Controllers/Expenses/Vendors.php @@ -0,0 +1,132 @@ +pluck('name', 'code'); + + return view('expenses.vendors.create', compact('currencies')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + Vendor::create($request->all()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.vendors', 1)]); + + flash($message)->success(); + + return redirect('expenses/vendors'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Vendor $vendor + * + * @return Response + */ + public function edit(Vendor $vendor) + { + $currencies = Currency::enabled()->pluck('name', 'code'); + + return view('expenses.vendors.edit', compact('vendor', 'currencies')); + } + + /** + * Update the specified resource in storage. + * + * @param Vendor $vendor + * @param Request $request + * + * @return Response + */ + public function update(Vendor $vendor, Request $request) + { + $vendor->update($request->all()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.vendors', 1)]); + + flash($message)->success(); + + return redirect('expenses/vendors'); + } + + /** + * Remove the specified resource from storage. + * + * @param Vendor $vendor + * + * @return Response + */ + public function destroy(Vendor $vendor) + { + $canDelete = $vendor->canDelete(); + + if ($canDelete === true) { + $vendor->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.vendors', 1)]); + + flash($message)->success(); + } else { + $text = array(); + + if (isset($canDelete['bills'])) { + $text[] = '' . $canDelete['bills'] . ' ' . trans_choice('general.bills', ($canDelete['bills'] > 1) ? 2 : 1); + } + + if (isset($canDelete['payments'])) { + $text[] = '' . $canDelete['payments'] . ' ' . trans_choice('general.payments', ($canDelete['payments'] > 1) ? 2 : 1); + } + + $message = trans('messages.warning.deleted', ['type' => trans_choice('general.vendors', 1), 'text' => implode(', ', $text)]); + + flash($message)->warning(); + } + + return redirect('expenses/vendors'); + } + + public function currency() + { + $vendor_id = request('vendor_id'); + + $vendor = Vendor::find($vendor_id); + + return response()->json($vendor); + } +} diff --git a/app/Http/Controllers/Incomes/Customers.php b/app/Http/Controllers/Incomes/Customers.php new file mode 100644 index 000000000..ac8fa1051 --- /dev/null +++ b/app/Http/Controllers/Incomes/Customers.php @@ -0,0 +1,165 @@ +pluck('name', 'code'); + + return view('incomes.customers.create', compact('currencies')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + $customer = Customer::create($request->all()); + + if (!empty($request->input('create_user'))) { + $user = User::create($request->input()); + + $request['user_id'] = $user->id; + $request['roles'] = array('3'); + $request['companies'] = array(session('company_id')); + + // Attach roles + $user->roles()->attach($request['roles']); + + // Attach companies + $user->companies()->attach($request['companies']); + + $customer->update($request->all()); + } + + $message = trans('messages.success.added', ['type' => trans_choice('general.customers', 1)]); + + flash($message)->success(); + + return redirect('incomes/customers'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Customer $customer + * + * @return Response + */ + public function edit(Customer $customer) + { + $currencies = Currency::enabled()->pluck('name', 'code'); + + return view('incomes.customers.edit', compact('customer', 'currencies')); + } + + /** + * Update the specified resource in storage. + * + * @param Customer $customer + * @param Request $request + * + * @return Response + */ + public function update(Customer $customer, Request $request) + { + $customer->update($request->all()); + + if (!empty($request->input('create_user'))) { + $user = User::create($request->input()); + + $request['user_id'] = $user->id; + $request['roles'] = array('3'); + $request['companies'] = array(session('company_id')); + + // Attach roles + $user->roles()->attach($request['roles']); + + // Attach companies + $user->companies()->attach($request['companies']); + + $customer->update($request->all()); + } + + $message = trans('messages.success.updated', ['type' => trans_choice('general.customers', 1)]); + + flash($message)->success(); + + return redirect('incomes/customers'); + } + + /** + * Remove the specified resource from storage. + * + * @param Customer $customer + * + * @return Response + */ + public function destroy(Customer $customer) + { + $canDelete = $customer->canDelete(); + + if ($canDelete === true) { + $customer->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.customers', 1)]); + + flash($message)->success(); + } else { + $text = array(); + + if (isset($canDelete['invoices'])) { + $text[] = '' . $canDelete['invoices'] . ' ' . trans_choice('general.invoices', ($canDelete['invoices'] > 1) ? 2 : 1); + } + + if (isset($canDelete['revenues'])) { + $text[] = '' . $canDelete['revenues'] . ' ' . trans_choice('general.revenues', ($canDelete['revenues'] > 1) ? 2 : 1); + } + + $message = trans('messages.warning.deleted', ['type' => trans_choice('general.customers', 1), 'text' => implode(', ', $text)]); + + flash($message)->warning(); + } + + return redirect('incomes/customers'); + } + + public function currency() + { + $customer_id = request('customer_id'); + + $customer = Customer::find($customer_id); + + return response()->json($customer); + } +} diff --git a/app/Http/Controllers/Incomes/Invoices.php b/app/Http/Controllers/Incomes/Invoices.php new file mode 100644 index 000000000..0d0fe389e --- /dev/null +++ b/app/Http/Controllers/Incomes/Invoices.php @@ -0,0 +1,513 @@ +collect(); + + $status = collect(InvoiceStatus::all()->pluck('name', 'code')) + ->prepend(trans('general.all_statuses'), ''); + + return view('incomes.invoices.index', compact('invoices', 'status')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param Invoice $invoice + * + * @return Response + */ + public function show(Invoice $invoice) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + foreach ($invoice->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->sub_total = $sub_total; + $invoice->tax_total = $tax_total; + $invoice->paid = $paid; + $invoice->grand_total = (($sub_total + $tax_total) - $paid); + + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first(); + + $customers = Customer::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('income')->pluck('name', 'id'); + + $payment_methods = Modules::getPaymentMethods(); + + return view('incomes.invoices.show', compact('invoice', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param int $invoice_id + * + * @return Response + */ + public function printInvoice($invoice_id) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + $invoice = Invoice::where('id', $invoice_id)->first(); + + foreach ($invoice->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->sub_total = $sub_total; + $invoice->tax_total = $tax_total; + $invoice->paid = $paid; + $invoice->grand_total = (($sub_total + $tax_total) - $paid); + + $invoice->template_path = 'incomes.invoices.invoice'; + + event(new InvoicePrinting($invoice)); + + return view($invoice->template_path, compact('invoice')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param int $invoice_id + * + * @return Response + */ + public function pdfInvoice($invoice_id) + { + $sub_total = 0; + $tax_total = 0; + $paid = 0; + + $invoice = Invoice::where('id', $invoice_id)->first(); + + foreach ($invoice->items as $item) { + $sub_total += ($item->price * $item->quantity); + $tax_total += ($item->tax * $item->quantity); + } + + foreach ($invoice->payments as $item) { + $item->default_currency_code = $invoice->currency_code; + + $paid += $item->getDynamicConvertedAmount(); + } + + $invoice->sub_total = $sub_total; + $invoice->tax_total = $tax_total; + $invoice->paid = $paid; + $invoice->grand_total = (($sub_total + $tax_total) - $paid); + + $invoice->template_path = 'incomes.invoices.invoice'; + + event(new InvoicePrinting($invoice)); + + $html = view($invoice->template_path, compact('invoice'))->render(); + + $pdf = \App::make('dompdf.wrapper'); + $pdf->loadHTML($html); + + $file_name = 'invoice_'.time().'.pdf'; + + return $pdf->download($file_name); + } + + /** + * Show the form for viewing the specified resource. + * + * @param PaymentRequest $request + * + * @return Response + */ + public function payment(PaymentRequest $request) + { + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'revenues'); + + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $invoice = Invoice::find($request['invoice_id']); + + if ($request['currency_code'] == $invoice->currency_code) { + if ($request['amount'] > $invoice->amount) { + $message = trans('messages.error.added', ['type' => trans_choice('general.payment', 1)]); + + return response()->json($message); + } elseif ($request['amount'] == $invoice->amount) { + $invoice->invoice_status_code = 'paid'; + } else { + $invoice->invoice_status_code = 'partial'; + } + } else { + $request_invoice = new Invoice(); + + $request_invoice->amount = (float) $request['amount']; + $request_invoice->currency_code = $currency->code; + $request_invoice->currency_rate = $currency->rate; + + $amount = $request_invoice->getConvertedAmount(); + + if ($amount > $invoice->amount) { + $message = trans('messages.error.added', ['type' => trans_choice('general.payment', 1)]); + + return response()->json($message); + } elseif ($amount == $invoice->amount) { + $invoice->invoice_status_code = 'paid'; + } else { + $invoice->invoice_status_code = 'partial'; + } + } + + $invoice->save(); + + $invoice_payment = InvoicePayment::create($request->input()); + + $request['status_code'] = $invoice->invoice_status_code; + $request['notify'] = 0; + + $desc_date = Date::parse($request['paid_at'])->format($this->getCompanyDateFormat()); + $desc_amount = money((float) $request['amount'], $request['currency_code'], true)->format(); + $request['description'] = $desc_date . ' ' . $desc_amount; + + InvoiceHistory::create($request->input()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]); + + return response()->json($message); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $customers = Customer::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code'); + + $items = Item::enabled()->pluck('name', 'id'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + return view('incomes.invoices.create', compact('customers', 'currencies', 'items', 'taxes')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + // Get customer object + $customer = Customer::findOrFail($request['customer_id']); + + $request['customer_name'] = $customer->name; + $request['customer_email'] = $customer->email; + $request['customer_tax_number'] = $customer->tax_number; + $request['customer_phone'] = $customer->phone; + $request['customer_address'] = $customer->address; + + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + $request['invoice_status_code'] = 'draft'; + + $request['amount'] = 0; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'invoices'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $invoice = Invoice::create($request->input()); + + $invoice_item = array(); + $invoice_item['company_id'] = $request['company_id']; + $invoice_item['invoice_id'] = $invoice->id; + + if ($request['item']) { + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $invoice_item['item_id'] = $item['item_id']; + $invoice_item['name'] = $item['name']; + $invoice_item['sku'] = $item_sku; + $invoice_item['quantity'] = $item['quantity']; + $invoice_item['price'] = $item['price']; + $invoice_item['tax'] = (($item['price'] * $item['quantity']) / 100) * $tax_rate; + $invoice_item['tax_id'] = $tax_id; + $invoice_item['total'] = ($item['price'] + $invoice_item['tax']) * $item['quantity']; + + $request['amount'] += $invoice_item['total']; + + InvoiceItem::create($invoice_item); + } + } + + $invoice->update($request->input()); + + $request['invoice_id'] = $invoice->id; + $request['status_code'] = 'draft'; + $request['notify'] = 0; + $request['description'] = trans('messages.success.added', ['type' => $request['invoice_number']]); + + InvoiceHistory::create($request->all()); + + // Fire the event to make it extendible + event(new InvoiceCreated($invoice)); + + $message = trans('messages.success.added', ['type' => trans_choice('general.invoices', 1)]); + + flash($message)->success(); + + return redirect('incomes/invoices/' . $invoice->id); + } + + /** + * Show the form for editing the specified resource. + * + * @param Invoice $invoice + * + * @return Response + */ + public function edit(Invoice $invoice) + { + $customers = Customer::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code'); + + $items = Item::enabled()->pluck('name', 'id'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + return view('incomes.invoices.edit', compact('invoice', 'customers', 'currencies', 'items', 'taxes')); + } + + /** + * Update the specified resource in storage. + * + * @param Invoice $invoice + * @param Request $request + * + * @return Response + */ + public function update(Invoice $invoice, Request $request) + { + // Get customer object + $customer = Customer::findOrFail($request['customer_id']); + + $request['customer_name'] = $customer->name; + $request['customer_email'] = $customer->email; + $request['customer_tax_number'] = $customer->tax_number; + $request['customer_phone'] = $customer->phone; + $request['customer_address'] = $customer->address; + + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + $request['invoice_status_code'] = 'draft'; + + $request['amount'] = 0; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'invoices'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $invoice_item = array(); + $invoice_item['company_id'] = $request['company_id']; + $invoice_item['invoice_id'] = $invoice->id; + + if ($request['item']) { + InvoiceItem::where('invoice_id', $invoice->id)->delete(); + + foreach ($request['item'] as $item) { + $item_sku = ''; + + if (!empty($item['item_id'])) { + $data = Item::where('id', $item['item_id'])->first(); + + $item_sku = $data['sku']; + } + + $tax_id = 0; + $tax_rate = 0; + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $tax_rate = $tax->rate; + $tax_id = $item['tax']; + } + + $invoice_item['item_id'] = $item['item_id']; + $invoice_item['name'] = $item['name']; + $invoice_item['sku'] = $item_sku; + $invoice_item['quantity'] = $item['quantity']; + $invoice_item['price'] = $item['price']; + $invoice_item['tax'] = (($item['price'] * $item['quantity']) / 100 * $tax_rate); + $invoice_item['tax_id'] = $tax_id; + $invoice_item['total'] = ($item['price'] + $invoice_item['tax']) * $item['quantity']; + + $request['amount'] += $invoice_item['total']; + + InvoiceItem::create($invoice_item); + } + } + + $invoice->update($request->input()); + + // Fire the event to make it extendible + event(new InvoiceUpdated($invoice)); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.invoices', 1)]); + + flash($message)->success(); + + return redirect('incomes/invoices/' . $invoice->id); + } + + /** + * Remove the specified resource from storage. + * + * @param Invoice $invoice + * + * @return Response + */ + public function destroy(Invoice $invoice) + { + $invoice->delete(); + + /* + $invoice->items->delete(); + $invoice->payments->delete(); + $invoice->histories->delete(); + */ + + InvoiceItem::where('invoice_id', $invoice->id)->delete(); + InvoicePayment::where('invoice_id', $invoice->id)->delete(); + InvoiceHistory::where('invoice_id', $invoice->id)->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.invoices', 1)]); + + flash($message)->success(); + + return redirect('incomes/invoices'); + } + + /** + * Remove the specified resource from storage. + * + * @param InvoicePayment $payment + * + * @return Response + */ + public function paymentDestroy(InvoicePayment $payment) + { + $payment->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.invoices', 1)]); + + flash($message)->success(); + + return redirect('incomes/invoices'); + } +} diff --git a/app/Http/Controllers/Incomes/Revenues.php b/app/Http/Controllers/Incomes/Revenues.php new file mode 100644 index 000000000..b27ad123a --- /dev/null +++ b/app/Http/Controllers/Incomes/Revenues.php @@ -0,0 +1,166 @@ +collect(); + + $customers = collect(Customer::enabled()->pluck('name', 'id')) + ->prepend(trans('customer.all'), ''); + + $categories = collect(Category::enabled()->type('income')->pluck('name', 'id')) + ->prepend(trans('categories.all'), ''); + + $accounts = collect(Account::enabled()->pluck('name', 'id')) + ->prepend(trans('accounts.all'), ''); + + return view('incomes.revenues.index', compact('revenues', 'customers', 'categories', 'accounts')); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first(); + + $customers = Customer::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('income')->pluck('name', 'id'); + + $payment_methods = Modules::getPaymentMethods(); + + return view('incomes.revenues.create', compact('accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + // Get currency object + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'revenues'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + Revenue::create($request->input()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]); + + flash($message)->success(); + + return redirect('incomes/revenues'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Revenue $revenue + * + * @return Response + */ + public function edit(Revenue $revenue) + { + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $account_currency_code = Account::where('id', $revenue->account_id)->pluck('currency_code')->first(); + + $customers = Customer::enabled()->pluck('name', 'id'); + + $categories = Category::enabled()->type('income')->pluck('name', 'id'); + + $payment_methods = Modules::getPaymentMethods(); + + return view('incomes.revenues.edit', compact('revenue', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods')); + } + + /** + * Update the specified resource in storage. + * + * @param Revenue $revenue + * @param Request $request + * + * @return Response + */ + public function update(Revenue $revenue, Request $request) + { + // Get currency + $currency = Currency::where('code', $request['currency_code'])->first(); + + $request['currency_code'] = $currency->code; + $request['currency_rate'] = $currency->rate; + + // Upload attachment + $attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'revenues'); + if ($attachment_path) { + $request['attachment'] = $attachment_path; + } + + $revenue->update($request->input()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.revenues', 1)]); + + flash($message)->success(); + + return redirect('incomes/revenues'); + } + + /** + * Remove the specified resource from storage. + * + * @param Revenue $revenue + * + * @return Response + */ + public function destroy(Revenue $revenue) + { + $revenue->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.revenues', 1)]); + + flash($message)->success(); + + return redirect('incomes/revenues'); + } +} diff --git a/app/Http/Controllers/Install/Database.php b/app/Http/Controllers/Install/Database.php new file mode 100644 index 000000000..e5657dd02 --- /dev/null +++ b/app/Http/Controllers/Install/Database.php @@ -0,0 +1,122 @@ +canConnect($request)) { + $message = trans('install.error.connection'); + + flash($message)->error()->important(); + + return redirect('install/database')->withInput(); + } + + // Set database details + $this->saveVariables($request); + + // Try to increase the maximum execution time + set_time_limit(300); // 5 minutes + + // Create tables + Artisan::call('migrate', ['--force' => true]); + + // Create Roles + Artisan::call('db:seed', ['--class' => 'Database\Seeds\Roles', '--force' => true]); + + return redirect('install/settings'); + } + + private function canConnect($request) + { + Config::set('database.connections.install_test', [ + 'host' => $request['hostname'], + 'database' => $request['database'], + 'username' => $request['username'], + 'password' => $request['password'], + 'driver' => 'mysql', + 'port' => env('DB_PORT', '3306'), + ]); + + try { + DB::connection('install_test')->getPdo(); + } catch (\Exception $e) { + return false; + } + + // Purge test connection + DB::purge('install_test'); + + return true; + } + + private function saveVariables($request) + { + $prefix = strtolower(str_random(3) . '_'); + + // Save to file + DotenvEditor::setKeys([ + [ + 'key' => 'DB_HOST', + 'value' => $request['hostname'], + ], + [ + 'key' => 'DB_DATABASE', + 'value' => $request['database'], + ], + [ + 'key' => 'DB_USERNAME', + 'value' => $request['username'], + ], + [ + 'key' => 'DB_PASSWORD', + 'value' => $request['password'], + ], + [ + 'key' => 'DB_PREFIX', + 'value' => $prefix, + ], + ])->save(); + + // Change current connection + $mysql = Config::get('database.connections.mysql'); + + $mysql['host'] = $request['hostname']; + $mysql['database'] = $request['database']; + $mysql['username'] = $request['username']; + $mysql['password'] = $request['password']; + $mysql['prefix'] = $prefix; + + Config::set('database.connections.mysql', $mysql); + + DB::purge('mysql'); + DB::reconnect('mysql'); + } +} diff --git a/app/Http/Controllers/Install/Language.php b/app/Http/Controllers/Install/Language.php new file mode 100644 index 000000000..dc21d2ca2 --- /dev/null +++ b/app/Http/Controllers/Install/Language.php @@ -0,0 +1,35 @@ +check(); + + if (empty($requirements)) { + // Create the .env file + $this->createEnvFile(); + + redirect('install/language')->send(); + } else { + foreach ($requirements as $requirement) { + flash($requirement)->error()->important(); + } + + return view('install.requirements.show'); + } + } + + /** + * Check the requirements. + * + * @return array + */ + private function check() + { + $requirements = array(); + + if (version_compare(PHP_VERSION, '5.6.4', '<')) { + $requirements[] = trans('install.requirements.php_version'); + } + + if (ini_get('safe_mode')) { + $requirements[] = trans('install.requirements.disabled', ['feature' => 'Safe Mode']); + } + + if (ini_get('register_globals')) { + $requirements[] = trans('install.requirements.disabled', ['feature' => 'Register Globals']); + } + + if (ini_get('magic_quotes_gpc')) { + $requirements[] = trans('install.requirements.disabled', ['feature' => 'Magic Quotes']); + } + + if (!ini_get('file_uploads')) { + $requirements[] = trans('install.requirements.enabled', ['feature' => 'File Uploads']); + } + + if (!class_exists('PDO')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'MySQL PDO']); + } + + if (!extension_loaded('openssl')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'OpenSSL']); + } + + if (!extension_loaded('mcrypt')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'mCrypt']); + } + + if (!extension_loaded('tokenizer')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'Tokenizer']); + } + + if (!extension_loaded('mbstring')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'mbstring']); + } + + if (!extension_loaded('curl')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'cURL']); + } + + if (!extension_loaded('zip')) { + $requirements[] = trans('install.requirements.extension', ['extension' => 'ZIP']); + } + + if (!is_writable(base_path('storage/app'))) { + $requirements[] = trans('install.requirements.directory', ['directory' => 'storage/app']); + } + + if (!is_writable(base_path('storage/app/uploads'))) { + $requirements[] = trans('install.requirements.directory', ['directory' => 'storage/app/uploads']); + } + + if (!is_writable(base_path('storage/framework'))) { + $requirements[] = trans('install.requirements.directory', ['directory' => 'storage/framework']); + } + + if (!is_writable(base_path('storage/logs'))) { + $requirements[] = trans('install.requirements.directory', ['directory' => 'storage/logs']); + } + + return $requirements; + } + + /** + * Create the .env file. + * + * @return void + */ + private function createEnvFile() + { + // App + DotenvEditor::setKeys([ + [ + 'key' => 'APP_NAME', + 'value' => 'Akaunting', + ], + [ + 'key' => 'APP_ENV', + 'value' => 'production', + ], + [ + 'key' => 'APP_KEY', + 'value' => 'base64:'.base64_encode(random_bytes(32)), + ], + [ + 'key' => 'APP_DEBUG', + 'value' => 'false', + ], + [ + 'key' => 'APP_LOG_LEVEL', + 'value' => 'debug', + ], + [ + 'key' => 'APP_URL', + 'value' => url('/'), + ], + ]); + + DotenvEditor::addEmpty(); + + // Database + DotenvEditor::setKeys([ + [ + 'key' => 'DB_CONNECTION', + 'value' => 'mysql', + ], + [ + 'key' => 'DB_HOST', + 'value' => 'localhost', + ], + [ + 'key' => 'DB_PORT', + 'value' => '3306', + ], + [ + 'key' => 'DB_DATABASE', + 'value' => '', + ], + [ + 'key' => 'DB_USERNAME', + 'value' => '', + ], + [ + 'key' => 'DB_PASSWORD', + 'value' => '', + ], + [ + 'key' => 'DB_PREFIX', + 'value' => '', + ], + ]); + + DotenvEditor::addEmpty(); + + // Drivers + DotenvEditor::setKeys([ + [ + 'key' => 'BROADCAST_DRIVER', + 'value' => 'log', + ], + [ + 'key' => 'CACHE_DRIVER', + 'value' => 'file', + ], + [ + 'key' => 'SESSION_DRIVER', + 'value' => 'file', + ], + [ + 'key' => 'QUEUE_DRIVER', + 'value' => 'database', + ], + ]); + + DotenvEditor::addEmpty(); + + // Mail + DotenvEditor::setKeys([ + [ + 'key' => 'MAIL_DRIVER', + 'value' => 'mail', + ], + [ + 'key' => 'MAIL_HOST', + 'value' => 'localhost', + ], + [ + 'key' => 'MAIL_PORT', + 'value' => '2525', + ], + [ + 'key' => 'MAIL_USERNAME', + 'value' => 'null', + ], + [ + 'key' => 'MAIL_PASSWORD', + 'value' => 'null', + ], + [ + 'key' => 'MAIL_ENCRYPTION', + 'value' => 'null', + ], + ]); + + DotenvEditor::save(); + } +} diff --git a/app/Http/Controllers/Install/Settings.php b/app/Http/Controllers/Install/Settings.php new file mode 100644 index 000000000..e8720ec1c --- /dev/null +++ b/app/Http/Controllers/Install/Settings.php @@ -0,0 +1,95 @@ +createCompany($request); + + // Create user + $this->createUser($request); + + // Make the final touches + $this->finalTouches(); + + // Redirect to dashboard + return redirect('auth/login'); + } + + private function createCompany($request) + { + // Create company + $company = Company::create([ + 'domain' => '', + ]); + + // Set settings + Setting::set([ + 'general.company_name' => $request['company_name'], + 'general.company_email' => $request['company_email'], + 'general.default_currency' => 'USD', + 'general.default_locale' => session('locale'), + ]); + Setting::setExtraColumns(['company_id' => $company->id]); + Setting::save(); + } + + private function createUser($request) + { + // Create the user + $user = User::create([ + 'name' => $request[''], + 'email' => $request['user_email'], + 'password' => $request['user_password'], + 'locale' => session('locale'), + ]); + + // Attach admin role + $user->roles()->attach('1'); + + // Attach company + $user->companies()->attach('1'); + } + + private function finalTouches() + { + // Caching the config and route + //Artisan::call('config:cache'); + //Artisan::call('route:cache'); + + // Rename the robots.txt file + try { + File::move(base_path('robots.txt.dist'), base_path('robots.txt')); + } catch (\Exception $e) { + // nothing to do + } + } +} diff --git a/app/Http/Controllers/Install/Updates.php b/app/Http/Controllers/Install/Updates.php new file mode 100644 index 000000000..5ef9a4bfb --- /dev/null +++ b/app/Http/Controllers/Install/Updates.php @@ -0,0 +1,63 @@ +get('alias'); + + if (!isset($updates[$alias])) { + continue; + } + + $m = new \stdClass(); + $m->name = $row->get('name'); + $m->alias = $row->get('alias'); + $m->category = $row->get('category'); + $m->installed = $row->get('version'); + $m->latest = $updates[$alias]; + + $modules[] = $m; + } + + return view('install.updates.index', compact('core', 'modules')); + } + + public function changelog() + { + return Versions::changelog(); + } + + public function update($alias, $version) + { + set_time_limit(600); // 10 minutes + + $status = Updater::update($alias, $version); + + // Clear cache in order to check for updates again + Updater::clear(); + + return redirect()->back(); + } +} diff --git a/app/Http/Controllers/Items/Items.php b/app/Http/Controllers/Items/Items.php new file mode 100644 index 000000000..be67b94bd --- /dev/null +++ b/app/Http/Controllers/Items/Items.php @@ -0,0 +1,257 @@ +collect(); + + $categories = Category::enabled()->type('item')->pluck('name', 'id')->prepend(trans('categories.all'), ''); + + return view('items.items.index', compact('items', 'categories')); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + $categories = Category::enabled()->type('item')->pluck('name', 'id'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + return view('items.items.create', compact('categories', 'taxes')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + // Upload picture + $picture_path = $this->getUploadedFilePath($request->file('picture'), 'items'); + if ($picture_path) { + $request['picture'] = $picture_path; + } + + Item::create($request->input()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.items', 1)]); + + flash($message)->success(); + + return redirect('items/items'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Item $item + * + * @return Response + */ + public function edit(Item $item) + { + $categories = Category::enabled()->type('item')->pluck('name', 'id'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + return view('items.items.edit', compact('item', 'categories', 'taxes')); + } + + /** + * Update the specified resource in storage. + * + * @param Item $item + * @param Request $request + * + * @return Response + */ + public function update(Item $item, Request $request) + { + // Upload picture + $picture_path = $this->getUploadedFilePath($request->file('picture'), 'items'); + if ($picture_path) { + $request['picture'] = $picture_path; + } + + $item->update($request->input()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.items', 1)]); + + flash($message)->success(); + + return redirect('items/items'); + } + + /** + * Remove the specified resource from storage. + * + * @param Item $item + * + * @return Response + */ + public function destroy(Item $item) + { + $canDelete = $item->canDelete(); + + if ($canDelete === true) { + $item->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.items', 1)]); + + flash($message)->success(); + } else { + $text = array(); + + if (isset($canDelete['bills'])) { + $text[] = '' . $canDelete['bills'] . ' ' . trans_choice('general.bills', ($canDelete['bills'] > 1) ? 2 : 1); + } + + if (isset($canDelete['invoices'])) { + $text[] = '' . $canDelete['invoices'] . ' ' . trans_choice('general.items', ($canDelete['invoices'] > 1) ? 2 : 1); + } + + $message = trans('messages.warning.deleted', ['type' => trans_choice('general.items', 1), 'text' => implode(', ', $text)]); + + flash($message)->warning(); + } + + return redirect('items/items'); + } + + public function autocomplete() + { + $type = request('type'); + $query = request('query'); + $currency_code = request('currency_code'); + + if (empty($currency_code) || (strtolower($currency_code) == 'null')) { + $currency_code = setting('general.default_currency'); + } + + $currency = Currency::where('code', $currency_code)->first(); + + $filter_data = array( + 'name' => $query + ); + + $items = Item::getItems($filter_data); + + if ($items) { + foreach ($items as $item) { + $tax = Tax::where('id', $item->tax_id)->first(); + + $item_tax_price = 0; + + if (!empty($tax)) { + $item_tax_price = ($item->sale_price / 100) * $tax->rate; + } + + $item->sale_price = $this->convertPrice($item->sale_price, $currency_code, $currency->rate); + $item->purchase_price = $this->convertPrice($item->purchase_price, $currency_code, $currency->rate); + + switch ($type) { + case 'bill': + $total = $item->purchase_price + $item_tax_price; + break; + case 'invoice': + default: + $total = $item->sale_price + $item_tax_price; + break; + } + + $item->total = money($total, $currency_code, true)->format(); + } + } + + return response()->json($items); + } + + public function totalItem() + { + $input_items = request('item'); + $currency_code = request('currency_code'); + + if (empty($currency_code)) { + $currency_code = setting('general.default_currency'); + } + + $json = new \stdClass; + + $sub_total = 0; + $tax_total = 0; + + $items = array(); + + if ($input_items) { + foreach ($input_items as $key => $item) { + $item_tax_total= 0; + $item_sub_total = ($item['price'] * $item['quantity']); + + if (!empty($item['tax'])) { + $tax = Tax::where('id', $item['tax'])->first(); + + $item_tax_total = (($item['price'] * $item['quantity']) / 100) * $tax->rate; + } + + $sub_total += $item_sub_total; + $tax_total += $item_tax_total; + + $total = $item_sub_total + $item_tax_total; + + $items[$key] = money($total, $currency_code, true)->format(); + } + } + + $json->items = $items; + + $json->sub_total = money($sub_total, $currency_code, true)->format(); + + $json->tax_total = money($tax_total, $currency_code, true)->format(); + + $grand_total = $sub_total + $tax_total; + + $json->grand_total = money($grand_total, $currency_code, true)->format(); + + return response()->json($json); + } + + protected function convertPrice($amount, $currency_code, $currency_rate, $format = false, $reverse = false) + { + $item = new Item(); + + $item->amount = $amount; + $item->currency_code = $currency_code; + $item->currency_rate = $currency_rate; + + if ($reverse) { + return $item->getReverseConvertedAmount($format); + } + + return $item->getConvertedAmount($format); + } +} diff --git a/app/Http/Controllers/Modules/Home.php b/app/Http/Controllers/Modules/Home.php new file mode 100644 index 000000000..fb569f97f --- /dev/null +++ b/app/Http/Controllers/Modules/Home.php @@ -0,0 +1,40 @@ +send(); + } + + parent::__construct($route); + } + + /** + * Display a listing of the resource. + * + * @return Response + */ + public function index() + { + $paid = $this->getPaidModules(); + $new = $this->getNewModules(); + $free = $this->getFreeModules(); + + return view('modules.home.index', compact('paid', 'new', 'free')); + } +} diff --git a/app/Http/Controllers/Modules/Item.php b/app/Http/Controllers/Modules/Item.php new file mode 100644 index 000000000..13b83f4e6 --- /dev/null +++ b/app/Http/Controllers/Modules/Item.php @@ -0,0 +1,272 @@ +send(); + } + + parent::__construct($route); + } + + /** + * Show the form for viewing the specified resource. + * + * @param $alias + * + * @return Response + */ + public function show($alias) + { + $installed = false; + $enable = false; + + $module = $this->getModule($alias); + + $check = Module::where('alias', $alias)->first(); + + if ($check) { + $installed = true; + + if ($check->status) { + $enable = true; + } + } + + return view('modules.item.show', compact('module', 'about', 'installed', 'enable')); + } + + /** + * Show the form for viewing the specified resource. + * + * @param $path + * + * @return Response + */ + public function steps(Request $request) + { + $json = array(); + $json['step'] = array(); + + $name = $request['name']; + $version = $request['version']; + + // Download + $json['step'][] = array( + 'text' => trans('modules.installation.download', ['module' => $name]), + 'url' => url('modules/item/download') + ); + + // Unzip + $json['step'][] = array( + 'text' => trans('modules.installation.unzip', ['module' => $name]), + 'url' => url('modules/item/unzip') + ); + + // Download + $json['step'][] = array( + 'text' => trans('modules.installation.install', ['module' => $name]), + 'url' => url('modules/item/install') + ); + + return response()->json($json); + } + + /** + * Show the form for viewing the specified resource. + * + * @param $path + * + * @return Response + */ + public function download(Request $request) + { + $path = $request['path']; + + $version = $request['version']; + + $path .= '/' . $version . '/' . version('short') . '/' . setting('general.api_token'); + + $json = $this->downloadModule($path); + + return response()->json($json); + } + + /** + * Show the form for viewing the specified resource. + * + * @param $path + * + * @return Response + */ + public function unzip(Request $request) + { + $path = $request['path']; + + $json = $this->unzipModule($path); + + return response()->json($json); + } + + /** + * Show the form for viewing the specified resource. + * + * @param $path + * + * @return Response + */ + public function install(Request $request) + { + $path = $request['path']; + + $json = $this->installModule($path); + + if ($json['success']) { + $request['company_id'] = session('company_id'); + $request['alias'] = 'paypal'; + + $module = Module::create($request->all()); + + $mmodule = MModule::findByAlias($module->alias); + + $data = array( + 'company_id' => session('company_id'), + 'module_id' => $module->id, + 'category' => $mmodule->get('category'), + 'version' => $mmodule->get('version'), + 'description' => trans('modules.history.installed', ['module' => $mmodule->get('name')]), + ); + + ModuleHistory::create($data); + + $message = trans('messages.success.added', ['type' => trans('modules.installed', ['module' => $json['data']['name']])]); + + flash($message)->success(); + } + + return response()->json($json); + } + + public function uninstall($alias) + { + $json = $this->uninstallModule($alias); + + $module = Module::where('alias', $alias)->first(); + + $data = array( + 'company_id' => session('company_id'), + 'module_id' => $module->id, + 'category' => $json['data']['category'], + 'version' => $json['data']['version'], + 'description' => trans('modules.history.uninstalled', ['module' => $json['data']['name']]), + ); + + ModuleHistory::create($data); + + $module->delete(); + + $message = trans('messages.success.added', ['type' => trans('modules.uninstalled', ['module' => $json['data']['name']])]); + + flash($message)->success(); + + return redirect('modules/item/' . $alias)->send(); + } + + public function update($alias) + { + $json = $this->updateModule($alias); + + $module = Module::where('alias', $alias)->first(); + + $data = array( + 'company_id' => session('company_id'), + 'module_id' => $module->id, + 'category' => $json['data']['category'], + 'version' => $json['data']['version'], + 'description' => trans_choice('modules.history.updated', $json['data']['name']), + ); + + ModuleHistory::create($data); + + $message = trans('messages.success.added', ['type' => trans('modules.updated', ['module' => $json['data']['name']])]); + + flash($message)->success(); + + return redirect('modules/item/' . $alias)->send(); + } + + public function enabled($alias) + { + $json = $this->enabledModule($alias); + + $module = Module::where('alias', $alias)->first(); + + $data = array( + 'company_id' => session('company_id'), + 'module_id' => $module->id, + 'category' => $json['data']['category'], + 'version' => $json['data']['version'], + 'description' => trans('modules.history.enabled', ['module' => $json['data']['name']]), + ); + + $module->status = 1; + + $module->save(); + + ModuleHistory::create($data); + + $message = trans('messages.success.added', ['type' => trans('modules.enabled', ['module' => $json['data']['name']])]); + + flash($message)->success(); + + return redirect('modules/item/' . $alias)->send(); + } + + public function disabled($alias) + { + $json = $this->disabledModule($alias); + + $module = Module::where('alias', $alias)->first(); + + $data = array( + 'company_id' => session('company_id'), + 'module_id' => $module->id, + 'category' => $json['data']['category'], + 'version' => $json['data']['version'], + 'description' => trans('modules.history.disabled', ['module' => $json['data']['name']]), + ); + + $module->status = 0; + + $module->save(); + + ModuleHistory::create($data); + + $message = trans('messages.success.added', ['type' => trans('modules.disabled', ['module' => $json['data']['name']])]); + + flash($message)->success(); + + return redirect('modules/item/' . $alias)->send(); + } +} diff --git a/app/Http/Controllers/Modules/Tiles.php b/app/Http/Controllers/Modules/Tiles.php new file mode 100644 index 000000000..839cc66b3 --- /dev/null +++ b/app/Http/Controllers/Modules/Tiles.php @@ -0,0 +1,82 @@ +send(); + } + + parent::__construct($route); + } + + /** + * Show the form for viewing the specified resource. + * + * @param $alias + * + * @return Response + */ + public function category($alias) + { + $data = $this->getModulesByCategory($alias); + + $title = $data->category->name; + $modules = $data->modules; + + return view('modules.tiles.index', compact('title', 'modules')); + } + + /** + * Show the form for viewing the specified resource. + * + * @return Response + */ + public function paid() + { + $title = trans('modules.top_paid'); + $modules = $this->getPaidModules(); + + return view('modules.tiles.index', compact('title', 'modules')); + } + + /** + * Show the form for viewing the specified resource. + * + * @return Response + */ + public function new() + { + $title = trans('modules.new'); + $modules = $this->getNewModules(); + + return view('modules.tiles.index', compact('title', 'modules')); + } + + /** + * Show the form for viewing the specified resource. + * + * @return Response + */ + public function free() + { + $title = trans('modules.top_free'); + $modules = $this->getFreeModules(); + + return view('modules.tiles.index', compact('title', 'modules')); + } +} diff --git a/app/Http/Controllers/Modules/Token.php b/app/Http/Controllers/Modules/Token.php new file mode 100644 index 000000000..8a19a3a03 --- /dev/null +++ b/app/Http/Controllers/Modules/Token.php @@ -0,0 +1,37 @@ +set('general.api_token', $request['api_token']); + + setting()->save(); + + return redirect('modules/home'); + } +} diff --git a/app/Http/Controllers/Reports/ExpenseSummary.php b/app/Http/Controllers/Reports/ExpenseSummary.php new file mode 100644 index 000000000..4a94ea857 --- /dev/null +++ b/app/Http/Controllers/Reports/ExpenseSummary.php @@ -0,0 +1,132 @@ +type('expense')->pluck('name', 'id')->toArray(); + //} + + // Add Bill in Categories + $categories[0] = trans_choice('general.bills', 2); + + // Get year + $year = request('year'); + if (empty($year)) { + $year = Date::now()->year; + } + + // Dates + for ($j = 1; $j <= 12; $j++) { + $dates[$j] = Date::parse($year . '-' . $j)->format('F'); + + $expenses_graph[Date::parse($year . '-' . $j)->format('F-Y')] = 0; + + // Totals + $totals[$dates[$j]] = array( + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + // Bill + $expenses[0][$dates[$j]] = array( + 'category_id' => 0, + 'name' => trans_choice('general.bills', 1), + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + foreach ($categories as $category_id => $category_name) { + $expenses[$category_id][$dates[$j]] = array( + 'category_id' => $category_id, + 'name' => $category_name, + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + } + } + + // Bills + switch ($status) { + case 'all': + $bills = Bill::getMonthsOfYear('billed_at'); + $this->setAmount($expenses_graph, $totals, $expenses, $bills, 'bill', 'billed_at'); + break; + case 'upcoming': + $bills = Bill::getMonthsOfYear('due_at'); + $this->setAmount($expenses_graph, $totals, $expenses, $bills, 'bill', 'due_at'); + break; + default: + $bills = BillPayment::getMonthsOfYear('paid_at'); + $this->setAmount($expenses_graph, $totals, $expenses, $bills, 'bill', 'paid_at'); + break; + } + + // Payments + if ($status != 'upcoming') { + $payments = Payment::getMonthsOfYear('paid_at'); + $this->setAmount($expenses_graph, $totals, $expenses, $payments, 'payment', 'paid_at'); + } + + // Expenses Graph + $expenses_graph = json_encode($expenses_graph); + + return view('reports.expense_summary.index', compact('dates', 'categories', 'expenses', 'expenses_graph', 'totals')); + } + + private function setAmount(&$graph, &$totals, &$expenses, $items, $type, $date_field) + { + foreach ($items as $item) { + $date = Date::parse($item->$date_field)->format('F'); + + if ($type == 'bill') { + $category_id = 0; + } else { + $category_id = $item->category_id; + } + + if (!isset($expenses[$category_id])) { + continue; + } + + $amount = $item->getConvertedAmount(); + + // Forecasting + if (($type == 'bill') && ($date_field == 'due_at')) { + foreach ($item->payments as $payment) { + $amount -= $payment->getConvertedAmount(); + } + } + + $expenses[$category_id][$date]['amount'] += $amount; + $expenses[$category_id][$date]['currency_code'] = $item->currency_code; + $expenses[$category_id][$date]['currency_rate'] = $item->currency_rate; + + $graph[Date::parse($item->$date_field)->format('F-Y')] += $amount; + + $totals[$date]['amount'] += $amount; + } + } +} diff --git a/app/Http/Controllers/Reports/IncomeExpenseSummary.php b/app/Http/Controllers/Reports/IncomeExpenseSummary.php new file mode 100644 index 000000000..83ed62eb4 --- /dev/null +++ b/app/Http/Controllers/Reports/IncomeExpenseSummary.php @@ -0,0 +1,190 @@ +type('income')->pluck('name', 'id')->toArray(); + //} + + // Add Invoice in Categories + $income_categories[0] = trans_choice('general.invoices', 2); + + //if ($filter != 'upcoming') { + $expense_categories = Category::enabled()->type('expense')->pluck('name', 'id')->toArray(); + //} + + // Add Bill in Categories + $expense_categories[0] = trans_choice('general.bills', 2); + + // Get year + $year = request('year'); + if (empty($year)) { + $year = Date::now()->year; + } + + // Dates + for ($j = 1; $j <= 12; $j++) { + $dates[$j] = Date::parse($year . '-' . $j)->format('F'); + + $compares_graph[Date::parse($year . '-' . $j)->format('F-Y')] = 0; + + // Totals + $totals[$dates[$j]] = array( + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + // Compares + $compares['income'][0][$dates[$j]] = array( + 'category_id' => 0, + 'name' => trans_choice('general.invoices', 1), + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + foreach ($income_categories as $category_id => $category_name) { + $compares['income'][$category_id][$dates[$j]] = array( + 'category_id' => $category_id, + 'name' => $category_name, + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + } + + $compares['expense'][0][$dates[$j]] = array( + 'category_id' => 0, + 'name' => trans_choice('general.invoices', 1), + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + foreach ($expense_categories as $category_id => $category_name) { + $compares['expense'][$category_id][$dates[$j]] = array( + 'category_id' => $category_id, + 'name' => $category_name, + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + } + } + + // Invoices + switch ($status) { + case 'all': + $invoices = Invoice::getMonthsOfYear('invoiced_at'); + $this->setAmount($compares_graph, $totals, $compares, $invoices, 'invoice', 'invoiced_at'); + break; + case 'upcoming': + $invoices = Invoice::getMonthsOfYear('due_at'); + $this->setAmount($compares_graph, $totals, $compares, $invoices, 'invoice', 'due_at'); + break; + default: + $invoices = InvoicePayment::getMonthsOfYear('paid_at'); + $this->setAmount($compares_graph, $totals, $compares, $invoices, 'invoice', 'paid_at'); + break; + } + + // Revenues + if ($status != 'upcoming') { + $revenues = Revenue::getMonthsOfYear('paid_at'); + $this->setAmount($compares_graph, $totals, $compares, $revenues, 'revenue', 'paid_at'); + } + + // Bills + switch ($status) { + case 'all': + $bills = Bill::getMonthsOfYear('billed_at'); + $this->setAmount($compares_graph, $totals, $compares, $bills, 'bill', 'billed_at'); + break; + case 'upcoming': + $bills = Bill::getMonthsOfYear('due_at'); + $this->setAmount($compares_graph, $totals, $compares, $bills, 'bill', 'due_at'); + break; + default: + $bills = BillPayment::getMonthsOfYear('paid_at'); + $this->setAmount($compares_graph, $totals, $compares, $bills, 'bill', 'paid_at'); + break; + } + + // Payments + if ($status != 'upcoming') { + $payments = Payment::getMonthsOfYear('paid_at'); + $this->setAmount($compares_graph, $totals, $compares, $payments, 'payment', 'paid_at'); + } + + // Incomes Graph + $compares_graph = json_encode($compares_graph); + + return view('reports.income_expense_summary.index', compact('dates', 'income_categories', 'expense_categories', 'compares', 'compares_graph', 'totals')); + } + + private function setAmount(&$graph, &$totals, &$compares, $items, $type, $date_field) + { + foreach ($items as $item) { + $date = Date::parse($item->$date_field)->format('F'); + + if (($type == 'invoice') || ($type == 'bill')) { + $category_id = 0; + } else { + $category_id = $item->category_id; + } + + $group = (($type == 'invoice') || ($type == 'revenue')) ? 'income' : 'expense'; + + if (!isset($compares[$group][$category_id])) { + continue; + } + + $amount = $item->getConvertedAmount(); + + // Forecasting + if ((($type == 'invoice') || ($type == 'bill')) && ($date_field == 'due_at')) { + foreach ($item->payments as $payment) { + $amount -= $payment->getConvertedAmount(); + } + } + + $compares[$group][$category_id][$date]['amount'] += $amount; + $compares[$group][$category_id][$date]['currency_code'] = $item->currency_code; + $compares[$group][$category_id][$date]['currency_rate'] = $item->currency_rate; + + if ($group == 'income') { + $graph[Date::parse($item->$date_field)->format('F-Y')] += $amount; + + $totals[$date]['amount'] += $amount; + } else { + $graph[Date::parse($item->$date_field)->format('F-Y')] -= $amount; + + $totals[$date]['amount'] -= $amount; + } + } + } +} diff --git a/app/Http/Controllers/Reports/IncomeSummary.php b/app/Http/Controllers/Reports/IncomeSummary.php new file mode 100644 index 000000000..d46377c96 --- /dev/null +++ b/app/Http/Controllers/Reports/IncomeSummary.php @@ -0,0 +1,132 @@ +type('income')->pluck('name', 'id')->toArray(); + //} + + // Add Invoice in Categories + $categories[0] = trans_choice('general.invoices', 2); + + // Get year + $year = request('year'); + if (empty($year)) { + $year = Date::now()->year; + } + + // Dates + for ($j = 1; $j <= 12; $j++) { + $dates[$j] = Date::parse($year . '-' . $j)->format('F'); + + $incomes_graph[Date::parse($year . '-' . $j)->format('F-Y')] = 0; + + // Totals + $totals[$dates[$j]] = array( + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + // Invoice + $incomes[0][$dates[$j]] = array( + 'category_id' => 0, + 'name' => trans_choice('general.invoices', 1), + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + + foreach ($categories as $category_id => $category_name) { + $incomes[$category_id][$dates[$j]] = array( + 'category_id' => $category_id, + 'name' => $category_name, + 'amount' => 0, + 'currency_code' => setting('general.default_currency'), + 'currency_rate' => 1 + ); + } + } + + // Invoices + switch ($status) { + case 'all': + $invoices = Invoice::getMonthsOfYear('invoiced_at'); + $this->setAmount($incomes_graph, $totals, $incomes, $invoices, 'invoice', 'invoiced_at'); + break; + case 'upcoming': + $invoices = Invoice::getMonthsOfYear('due_at'); + $this->setAmount($incomes_graph, $totals, $incomes, $invoices, 'invoice', 'due_at'); + break; + default: + $invoices = InvoicePayment::getMonthsOfYear('paid_at'); + $this->setAmount($incomes_graph, $totals, $incomes, $invoices, 'invoice', 'paid_at'); + break; + } + + // Revenues + if ($status != 'upcoming') { + $revenues = Revenue::getMonthsOfYear('paid_at'); + $this->setAmount($incomes_graph, $totals, $incomes, $revenues, 'revenue', 'paid_at'); + } + + // Incomes Graph + $incomes_graph = json_encode($incomes_graph); + + return view('reports.income_summary.index', compact('dates', 'categories', 'incomes', 'incomes_graph', 'totals')); + } + + private function setAmount(&$graph, &$totals, &$incomes, $items, $type, $date_field) + { + foreach ($items as $item) { + $date = Date::parse($item->$date_field)->format('F'); + + if ($type == 'invoice') { + $category_id = 0; + } else { + $category_id = $item->category_id; + } + + if (!isset($incomes[$category_id])) { + continue; + } + + $amount = $item->getConvertedAmount(); + + // Forecasting + if (($type == 'invoice') && ($date_field == 'due_at')) { + foreach ($item->payments as $payment) { + $amount -= $payment->getConvertedAmount(); + } + } + + $incomes[$category_id][$date]['amount'] += $amount; + $incomes[$category_id][$date]['currency_code'] = $item->currency_code; + $incomes[$category_id][$date]['currency_rate'] = $item->currency_rate; + + $graph[Date::parse($item->$date_field)->format('F-Y')] += $amount; + + $totals[$date]['amount'] += $amount; + } + } +} diff --git a/app/Http/Controllers/Search/Search.php b/app/Http/Controllers/Search/Search.php new file mode 100644 index 000000000..d7dfd13f6 --- /dev/null +++ b/app/Http/Controllers/Search/Search.php @@ -0,0 +1,130 @@ +with('category')->get()->sortBy('name'); + + return view('items.items.index', compact('items')); + } + + /** + * Display a listing of the resource. + * + * @return Response + */ + public function search() + { + $results = array(); + + $keyword = request('keyword'); + + $accounts = Account::enabled()->search($keyword)->get(); + + if ($accounts->count()) { + foreach ($accounts as $account) { + $results[] = (object)[ + 'id' => $account->id, + 'name' => $account->name, + 'type' => trans_choice('general.accounts', 1), + 'color' => '#337ab7', + 'href' => url('banking/accounts/' . $account->id . '/edit'), + ]; + } + } + + $items = Item::enabled()->search($keyword)->get(); + + if ($items->count()) { + foreach ($items as $item) { + $results[] = (object)[ + 'id' => $item->id, + 'name' => $item->name, + 'type' => trans_choice('general.items', 1), + 'color' => '#f5bd65', + 'href' => url('items/items/' . $item->id . '/edit'), + ]; + } + } + + $invoices = Invoice::search($keyword)->get(); + + if ($invoices->count()) { + foreach ($invoices as $invoice) { + $results[] = (object)[ + 'id' => $invoice->id, + 'name' => $invoice->invoice_number . ' - ' . $invoice->customer_name, + 'type' => trans_choice('general.invoices', 1), + 'color' => '#00c0ef', + 'href' => url('incomes/invoices/' . $invoice->id), + ]; + } + } + + //$revenues = Revenue::search($keyword)->get(); + + $customers = Customer::enabled()->search($keyword)->get(); + + if ($customers->count()) { + foreach ($customers as $customer) { + $results[] = (object)[ + 'id' => $customer->id, + 'name' => $customer->name, + 'type' => trans_choice('general.customers', 1), + 'color' => '#03d876', + 'href' => url('incomes/customers/' . $customer->id . '/edit'), + ]; + } + } + + $bills = Bill::search($keyword)->get(); + + if ($bills->count()) { + foreach ($bills as $bill) { + $results[] = (object)[ + 'id' => $bill->id, + 'name' => $bill->bill_number . ' - ' . $bill->vendor_name, + 'type' => trans_choice('general.bills', 1), + 'color' => '#dd4b39', + 'href' => url('expenses/bills/' . $bill->id), + ]; + } + } + + //$payments = Payment::search($keyword)->get(); + + $vendors = Vendor::enabled()->search($keyword)->get(); + + if ($vendors->count()) { + foreach ($vendors as $vendor) { + $results[] = (object)[ + 'id' => $vendor->id, + 'name' => $vendor->name, + 'type' => trans_choice('general.vendors', 1), + 'color' => '#ff8373', + 'href' => url('expenses/vendors/' . $vendor->id . '/edit'), + ]; + } + } + + return response()->json((object) $results); + } +} diff --git a/app/Http/Controllers/Settings/Categories.php b/app/Http/Controllers/Settings/Categories.php new file mode 100644 index 000000000..904256763 --- /dev/null +++ b/app/Http/Controllers/Settings/Categories.php @@ -0,0 +1,125 @@ + 'Expense', 'income' => 'Income', 'item' => 'Item', 'other' => 'Other']) + ->prepend(trans('categories.all_types'), ''); + + return view('settings.categories.index', compact('categories', 'types')); + } + + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + return view('settings.categories.create'); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + Category::create($request->all()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.categories', 1)]); + + flash($message)->success(); + + return redirect('settings/categories'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Category $category + * + * @return Response + */ + public function edit(Category $category) + { + return view('settings.categories.edit', compact('category')); + } + + /** + * Update the specified resource in storage. + * + * @param Category $category + * @param Request $request + * + * @return Response + */ + public function update(Category $category, Request $request) + { + $category->update($request->all()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.categories', 1)]); + + flash($message)->success(); + + return redirect('settings/categories'); + } + + /** + * Remove the specified resource from storage. + * + * @param Category $category + * + * @return Response + */ + public function destroy(Category $category) + { + $canDelete = $category->canDelete(); + + if ($canDelete === true) { + $category->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.categories', 1)]); + + flash($message)->success(); + } else { + $text = array(); + + if (isset($canDelete['items'])) { + $text[] = '' . $canDelete['items'] . ' ' . trans_choice('general.items', ($canDelete['items'] > 1) ? 2 : 1); + } + + if (isset($canDelete['payments'])) { + $text[] = '' . $canDelete['payments'] . ' ' . trans_choice('general.payments', ($canDelete['payments'] > 1) ? 2 : 1); + } + + if (isset($canDelete['revenues'])) { + $text[] = '' . $canDelete['revenues'] . ' ' . trans_choice('general.items', ($canDelete['revenues'] > 1) ? 2 : 1); + } + + $message = trans('messages.warning.deleted', ['type' => trans_choice('general.categories', 1), 'text' => implode(', ', $text)]); + + flash($message)->warning(); + } + + return redirect('settings/categories'); + } +} diff --git a/app/Http/Controllers/Settings/Currencies.php b/app/Http/Controllers/Settings/Currencies.php new file mode 100644 index 000000000..d0936c2a3 --- /dev/null +++ b/app/Http/Controllers/Settings/Currencies.php @@ -0,0 +1,146 @@ + $item) { + $codes[$key] = $key; + } + + return view('settings.currencies.create', compact('codes')); + } + + /** + * Store a newly created resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function store(Request $request) + { + Currency::create($request->all()); + + // Update default currency setting + if ($request['default_currency']) { + setting()->set('general.default_currency', $request['code']); + setting()->save(); + } + + $message = trans('messages.success.added', ['type' => trans_choice('general.currencies', 1)]); + + flash($message)->success(); + + return redirect('settings/currencies'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Currency $currency + * + * @return Response + */ + public function edit(Currency $currency) + { + // Prepare codes + $codes = array(); + $currencies = MoneyCurrency::getCurrencies(); + foreach ($currencies as $key => $item) { + $codes[$key] = $key; + } + + // Set default currency + $currency->default_currency = ($currency->code == setting('general.default_currency')) ? 1 : 0; + + return view('settings.currencies.edit', compact('currency', 'codes')); + } + + /** + * Update the specified resource in storage. + * + * @param Currency $currency + * @param Request $request + * + * @return Response + */ + public function update(Currency $currency, Request $request) + { + $currency->update($request->all()); + + // Update default currency setting + if ($request['default_currency']) { + setting()->set('general.default_currency', $request['code']); + setting()->save(); + } + + $message = trans('messages.success.updated', ['type' => trans_choice('general.currencies', 1)]); + + flash($message)->success(); + + return redirect('settings/currencies'); + } + + /** + * Remove the specified resource from storage. + * + * @param Currency $currency + * + * @return Response + */ + public function destroy(Currency $currency) + { + $currency->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.currencies', 1)]); + + flash($message)->success(); + + return redirect('settings/currencies'); + } + + public function currency() + { + $json = new \stdClass(); + + $account_id = request('account_id'); + + if ($account_id) { + $currencies = Currency::enabled()->pluck('name', 'code')->toArray(); + + $json->currency_code = Account::where('id', $account_id)->pluck('currency_code')->first(); + $json->currency_name = $currencies[$json->currency_code]; + } + + return response()->json($json); + } +} diff --git a/app/Http/Controllers/Settings/Modules.php b/app/Http/Controllers/Settings/Modules.php new file mode 100644 index 000000000..a453ffe47 --- /dev/null +++ b/app/Http/Controllers/Settings/Modules.php @@ -0,0 +1,62 @@ +pluck('value', 'key');*/ + $setting = Setting::all($alias)->map(function($s) use($alias) { + $s->key = str_replace($alias . '.', '', $s->key); + return $s; + })->pluck('value', 'key'); + + $module = Module::get($alias); + + return view('settings.modules.edit', compact('setting', 'module')); + } + + /** + * Update the specified resource in storage. + * + * @param $alias + * + * @return Response + */ + public function update($alias) + { + $fields = request()->all(); + + $skip_keys = ['company_id', '_method', '_token']; + + foreach ($fields as $key => $value) { + // Don't process unwanted keys + if (in_array($key, $skip_keys)) { + continue; + } + + setting()->set($alias . '.' . $key, $value); + } + + // Save all settings + setting()->save(); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.settings', 2)]); + + flash($message)->success(); + + return redirect('settings/modules/' . $alias); + } + +} diff --git a/app/Http/Controllers/Settings/Settings.php b/app/Http/Controllers/Settings/Settings.php new file mode 100644 index 000000000..1d40a030b --- /dev/null +++ b/app/Http/Controllers/Settings/Settings.php @@ -0,0 +1,118 @@ +pluck('value', 'key');*/ + $setting = Setting::all()->map(function($s) { + $s->key = str_replace('general.', '', $s->key); + return $s; + })->pluck('value', 'key'); + + $timezones = $this->getTimezones(); + + $accounts = Account::enabled()->pluck('name', 'id'); + + $currencies = Currency::enabled()->pluck('name', 'code'); + + $taxes = Tax::enabled()->pluck('name', 'id'); + + $date_formats = [ + 'd M Y' => '31 Dec 2017', + 'd F Y' => '31 December 2017', + 'd m Y' => '31 12 2017', + 'm d Y' => '12 31 2017', + 'Y m d' => '2017 12 31' + ]; + + $date_separators = [ + 'dash' => trans('settings.localisation.date.dash'), + 'slash' => trans('settings.localisation.date.slash'), + 'dot' => trans('settings.localisation.date.dot'), + 'comma' => trans('settings.localisation.date.comma'), + 'space' => trans('settings.localisation.date.space'), + ]; + + $email_protocols = [ + 'mail' => trans('settings.email.php'), + 'smtp' => trans('settings.email.smtp.name'), + 'sendmail' => trans('settings.email.sendmail'), + 'log' => trans('settings.email.log') + ]; + + return view('settings.settings.edit', compact( + 'setting', + 'timezones', + 'accounts', + 'currencies', + 'taxes', + 'date_formats', + 'date_separators', + 'email_protocols' + )); + } + + /** + * Update the specified resource in storage. + * + * @param Request $request + * + * @return Response + */ + public function update(Request $request) + { + $fields = $request->all(); + $company_id = $request->get('company_id'); + + $skip_keys = ['company_id', '_method', '_token']; + $file_keys = ['company_logo', 'invoice_logo']; + + foreach ($fields as $key => $value) { + // Don't process unwanted keys + if (in_array($key, $skip_keys)) { + continue; + } + + // Process file uploads + if (in_array($key, $file_keys)) { + $value = $this->getUploadedFilePath($request->file($key), 'settings'); + + // Prevent reset + if (empty($value)) { + continue; + } + } + + setting()->set('general.' . $key, $value); + } + + // Save all settings + setting()->save(); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.settings', 2)]); + + flash($message)->success(); + + return redirect('settings/settings'); + } + +} diff --git a/app/Http/Controllers/Settings/Taxes.php b/app/Http/Controllers/Settings/Taxes.php new file mode 100644 index 000000000..586ac70e5 --- /dev/null +++ b/app/Http/Controllers/Settings/Taxes.php @@ -0,0 +1,122 @@ +all()); + + $message = trans('messages.success.added', ['type' => trans_choice('general.tax_rates', 1)]); + + flash($message)->success(); + + return redirect('settings/taxes'); + } + + /** + * Show the form for editing the specified resource. + * + * @param Tax $tax + * + * @return Response + */ + public function edit(Tax $tax) + { + return view('settings.taxes.edit', compact('tax')); + } + + /** + * Update the specified resource in storage. + * + * @param Tax $tax + * @param Request $request + * + * @return Response + */ + public function update(Tax $tax, Request $request) + { + $tax->update($request->all()); + + $message = trans('messages.success.updated', ['type' => trans_choice('general.tax_rates', 1)]); + + flash($message)->success(); + + return redirect('settings/taxes'); + } + + /** + * Remove the specified resource from storage. + * + * @param Tax $tax + * + * @return Response + */ + public function destroy(Tax $tax) + { + $canDelete = $tax->canDelete(); + + if ($canDelete === true) { + $tax->delete(); + + $message = trans('messages.success.deleted', ['type' => trans_choice('general.taxes', 1)]); + + flash($message)->success(); + } else { + $text = array(); + + if (isset($canDelete['items'])) { + $text[] = '' . $canDelete['items'] . ' ' . trans_choice('general.items', ($canDelete['items'] > 1) ? 2 : 1); + } + + if (isset($canDelete['bills'])) { + $text[] = '' . $canDelete['bills'] . ' ' . trans_choice('general.bills', ($canDelete['bills'] > 1) ? 2 : 1); + } + + if (isset($canDelete['invoices'])) { + $text[] = '' . $canDelete['invoices'] . ' ' . trans_choice('general.items', ($canDelete['invoices'] > 1) ? 2 : 1); + } + + $message = trans('messages.warning.deleted', ['type' => trans_choice('general.taxes', 1), 'text' => implode(', ', $text)]); + + flash($message)->warning(); + } + + return redirect('settings/taxes'); + } +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php new file mode 100644 index 000000000..4f1078885 --- /dev/null +++ b/app/Http/Kernel.php @@ -0,0 +1,69 @@ + [ + \App\Http\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + // \Illuminate\Session\Middleware\AuthenticateSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + \App\Http\Middleware\VerifyCsrfToken::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + \App\Http\Middleware\CheckIfInstalled::class, + \App\Http\Middleware\LoadSettings::class, + ], + + 'api' => [ + 'throttle:60,1', + 'bindings', + 'api.company', + ], + ]; + + /** + * The application's route middleware. + * + * These middleware may be assigned to groups or used individually. + * + * @var array + */ + protected $routeMiddleware = [ + 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'adminmenu' => \App\Http\Middleware\AdminMenu::class, + 'customermenu' => \App\Http\Middleware\CustomerMenu::class, + 'role' => \Laratrust\Middleware\LaratrustRole::class, + 'permission' => \Laratrust\Middleware\LaratrustPermission::class, + 'ability' => \Laratrust\Middleware\LaratrustAbility::class, + 'api.company' => \App\Http\Middleware\ApiCompany::class, + ]; +} diff --git a/app/Http/Middleware/AdminMenu.php b/app/Http/Middleware/AdminMenu.php new file mode 100644 index 000000000..31928b076 --- /dev/null +++ b/app/Http/Middleware/AdminMenu.php @@ -0,0 +1,186 @@ +style('adminlte'); + + $user = Auth::user(); + $attr = ['icon' => 'fa fa-angle-double-right']; + + // Dashboard + $menu->add([ + 'url' => '/', + 'title' => trans('general.dashboard'), + 'icon' => 'fa fa-dashboard', + 'order' => 1, + ]); + + // Items + if ($user->can('read-items-items')) { + $menu->add([ + 'url' => 'items/items', + 'title' => trans_choice('general.items', 2), + 'icon' => 'fa fa-cubes', + 'order' => 2, + ]); + } + + // Incomes + if ($user->can(['read-incomes-invoices', 'read-incomes-revenues', 'read-incomes-customers'])) { + $menu->dropdown(trans_choice('general.incomes', 2), function ($sub) use($user, $attr) { + if ($user->can('read-incomes-invoices')) { + $sub->url('incomes/invoices', trans_choice('general.invoices', 2), 1, $attr); + } + + if ($user->can('read-incomes-revenues')) { + $sub->url('incomes/revenues', trans_choice('general.revenues', 2), 2, $attr); + } + + if ($user->can('read-incomes-customers')) { + $sub->url('incomes/customers', trans_choice('general.customers', 2), 3, $attr); + } + }, 3, [ + 'title' => trans_choice('general.incomes', 2), + 'icon' => 'fa fa-money', + ]); + } + + // Expences + if ($user->can(['read-expenses-bills', 'read-expenses-payments', 'read-expenses-vendors'])) { + $menu->dropdown(trans_choice('general.expenses', 2), function ($sub) use($user, $attr) { + if ($user->can('read-expenses-bills')) { + $sub->url('expenses/bills', trans_choice('general.bills', 2), 1, $attr); + } + + if ($user->can('read-expenses-payments')) { + $sub->url('expenses/payments', trans_choice('general.payments', 2), 2, $attr); + } + + if ($user->can('read-expenses-vendors')) { + $sub->url('expenses/vendors', trans_choice('general.vendors', 2), 3, $attr); + } + }, 4, [ + 'title' => trans_choice('general.expenses', 2), + 'icon' => 'fa fa-shopping-cart', + ]); + } + + // Banking + if ($user->can(['read-banking-accounts', 'read-banking-transfers', 'read-banking-transactions'])) { + $menu->dropdown(trans('general.banking'), function ($sub) use($user, $attr) { + if ($user->can('read-banking-accounts')) { + $sub->url('banking/accounts', trans_choice('general.accounts', 2), 1, $attr); + } + + if ($user->can('read-banking-transfers')) { + $sub->url('banking/transfers', trans_choice('general.transfers', 2), 2, $attr); + } + + if ($user->can('read-banking-transactions')) { + $sub->url('banking/transactions', trans_choice('general.transactions', 2), 3, $attr); + } + }, 5, [ + 'title' => trans('general.banking'), + 'icon' => 'fa fa-university', + ]); + } + + // Reports + if ($user->can(['read-reports-income-summary', 'read-reports-expense-summary', 'read-reports-income-expense-summary'])) { + $menu->dropdown(trans_choice('general.reports', 2), function ($sub) use($user, $attr) { + if ($user->can('read-reports-income-summary')) { + $sub->url('reports/income-summary', trans('reports.summary.income'), 1, $attr); + } + + if ($user->can('read-reports-expense-summary')) { + $sub->url('reports/expense-summary', trans('reports.summary.expense'), 2, $attr); + } + + if ($user->can('read-reports-income-expense-summary')) { + $sub->url('reports/income-expense-summary', trans('reports.summary.income_expense'), 3, $attr); + } + }, 6, [ + 'title' => trans_choice('general.reports', 2), + 'icon' => 'fa fa-bar-chart', + ]); + } + + // Settings + if ($user->can(['read-settings-settings', 'read-settings-categories', 'read-settings-currencies', 'read-settings-taxes'])) { + $menu->dropdown(trans_choice('general.settings', 2), function ($sub) use($user, $attr) { + if ($user->can('read-settings-settings')) { + $sub->url('settings/settings', trans('general.general'), 1, $attr); + } + + if ($user->can('read-settings-categories')) { + $sub->url('settings/categories', trans_choice('general.categories', 2), 2, $attr); + } + + if ($user->can('read-settings-currencies')) { + $sub->url('settings/currencies', trans_choice('general.currencies', 2), 3, $attr); + } + + if ($user->can('read-settings-taxes')) { + $sub->url('settings/taxes', trans_choice('general.tax_rates', 2), 4, $attr); + } + + // Modules + $modules = Module::all(); + $position = 5; + foreach ($modules as $module) { + // Check if the module has settings + if (empty($module->get('settings'))) { + continue; + } + + $sub->url('settings/modules/' . $module->getAlias(), $module->getName(), $position, $attr); + + $position++; + } + }, 7, [ + 'title' => trans_choice('general.settings', 2), + 'icon' => 'fa fa-gears', + ]); + } + + // Apps + if ($user->can('read-modules-home')) { + $menu->add([ + 'url' => 'modules/home', + 'title' => trans_choice('general.modules', 2), + 'icon' => 'fa fa-rocket', + 'order' => 8, + ]); + } + + // Fire the event to extend the menu + event(new AdminMenuCreated($menu)); + }); + + return $next($request); + } +} diff --git a/app/Http/Middleware/ApiCompany.php b/app/Http/Middleware/ApiCompany.php new file mode 100644 index 000000000..8dabe9562 --- /dev/null +++ b/app/Http/Middleware/ApiCompany.php @@ -0,0 +1,36 @@ +get('company_id'); + + if (empty($company_id)) { + return $next($request); + } + + // Check if user can access company + $companies = app('Dingo\Api\Auth\Auth')->user()->companies()->pluck('id')->toArray(); + if (!in_array($company_id, $companies)) { + return $next($request); + } + + // Set company id + session(['company_id' => $company_id]); + + return $next($request); + } + +} \ No newline at end of file diff --git a/app/Http/Middleware/CheckIfInstalled.php b/app/Http/Middleware/CheckIfInstalled.php new file mode 100644 index 000000000..970eb3c7a --- /dev/null +++ b/app/Http/Middleware/CheckIfInstalled.php @@ -0,0 +1,31 @@ +getPathInfo(), '/install')) { + return $next($request); + } + + // Not installed, redirect to installation wizard + redirect('install/requirements')->send(); + } +} diff --git a/app/Http/Middleware/CustomerMenu.php b/app/Http/Middleware/CustomerMenu.php new file mode 100644 index 000000000..fdf842a49 --- /dev/null +++ b/app/Http/Middleware/CustomerMenu.php @@ -0,0 +1,69 @@ +style('adminlte'); + + $user = Auth::user(); + + // Dashboard + $menu->add([ + 'url' => 'customers/', + 'title' => trans('general.dashboard'), + 'icon' => 'fa fa-dashboard', + 'order' => 1, + ]); + + // Invoices + $menu->add([ + 'url' => 'customers/invoices', + 'title' => trans_choice('general.invoices', 2), + 'icon' => 'fa fa-wpforms', + 'order' => 2, + ]); + + // Payments + $menu->add([ + 'url' => 'customers/payments', + 'title' => trans_choice('general.payments', 2), + 'icon' => 'fa fa-money', + 'order' => 3, + ]); + + // Payments + $menu->add([ + 'url' => 'customers/transactions', + 'title' => trans_choice('general.transactions', 2), + 'icon' => 'fa fa-list', + 'order' => 4, + ]); + + // Fire the event to extend the menu + event(new CustomerMenuCreated($menu)); + }); + + return $next($request); + } +} diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php new file mode 100644 index 000000000..3aa15f8dd --- /dev/null +++ b/app/Http/Middleware/EncryptCookies.php @@ -0,0 +1,17 @@ +setExtraColumns(['company_id' => $company_id]); + + // Timezone + config(['app.timezone' => setting('general.timezone', 'UTC')]); + + // Email + $email_protocol = setting('general.email_protocol', 'mail'); + config(['mail.driver' => $email_protocol]); + config(['mail.from.name' => setting('general.company_name')]); + config(['mail.from.address' => setting('general.company_email')]); + + if ($email_protocol == 'sendmail') { + config(['mail.sendmail' => setting('general.email_sendmail_path')]); + } elseif ($email_protocol == 'smtp') { + config(['mail.host' => setting('general.email_smtp_host')]); + config(['mail.port' => setting('general.email_smtp_port')]); + config(['mail.username' => setting('general.email_smtp_username')]); + config(['mail.password' => setting('general.email_smtp_password')]); + config(['mail.encryption' => setting('general.email_smtp_encryption')]); + } + + // Session + config(['session.driver' => setting('general.session_handler', 'file')]); + config(['session.lifetime' => setting('general.session_lifetime', '30')]); + + // Locale + if (session('locale') == '') { + //App::setLocale(setting('general.default_language')); + //Session::put('locale', setting('general.default_language')); + config(['app.locale' => setting('general.default_locale')]); + } + + return $next($request); + } + +} \ No newline at end of file diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php new file mode 100644 index 000000000..95d4172d9 --- /dev/null +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -0,0 +1,30 @@ +check()) { + if (Auth::user()->customer) { + return redirect('/customers'); + } + + return redirect('/'); + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php new file mode 100644 index 000000000..943e9a4da --- /dev/null +++ b/app/Http/Middleware/TrimStrings.php @@ -0,0 +1,18 @@ + 'required|string', + 'display_name' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/Auth/Role.php b/app/Http/Requests/Auth/Role.php new file mode 100644 index 000000000..2a966c293 --- /dev/null +++ b/app/Http/Requests/Auth/Role.php @@ -0,0 +1,32 @@ + 'required|string', + 'display_name' => 'required|string', + 'permissions' => 'required' + ]; + } +} diff --git a/app/Http/Requests/Auth/User.php b/app/Http/Requests/Auth/User.php new file mode 100644 index 000000000..38a6a52f1 --- /dev/null +++ b/app/Http/Requests/Auth/User.php @@ -0,0 +1,43 @@ +getMethod() == 'PATCH') { + $id = $this->user->getAttribute('id'); + $required = ''; + } else { + $id = null; + $required = 'required|'; + } + + return [ + 'name' => 'required|string', + 'email' => 'required|email|unique:users,email,' . $id . ',id,deleted_at,NULL', + 'password' => $required . 'confirmed', + 'roles' => 'required', + 'picture' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + ]; + } +} diff --git a/app/Http/Requests/Banking/Account.php b/app/Http/Requests/Banking/Account.php new file mode 100644 index 000000000..e2e9c176f --- /dev/null +++ b/app/Http/Requests/Banking/Account.php @@ -0,0 +1,33 @@ + 'required|string', + 'number' => 'required|string', + 'currency_code' => 'required|string', + 'opening_balance' => 'required', + ]; + } +} diff --git a/app/Http/Requests/Banking/Transfer.php b/app/Http/Requests/Banking/Transfer.php new file mode 100644 index 000000000..b6b36f079 --- /dev/null +++ b/app/Http/Requests/Banking/Transfer.php @@ -0,0 +1,34 @@ + 'required|integer', + 'to_account_id' => 'required|integer', + 'amount' => 'required', + 'transferred_at' => 'required|date', + 'payment_method' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/Company/Company.php b/app/Http/Requests/Company/Company.php new file mode 100644 index 000000000..afd381416 --- /dev/null +++ b/app/Http/Requests/Company/Company.php @@ -0,0 +1,34 @@ + 'required|string', + 'company_name' => 'required|string', + 'company_email' => 'required|email', + 'company_logo' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + 'default_currency' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/Expense/Bill.php b/app/Http/Requests/Expense/Bill.php new file mode 100644 index 000000000..ffdcef1b1 --- /dev/null +++ b/app/Http/Requests/Expense/Bill.php @@ -0,0 +1,45 @@ +getMethod() == 'PATCH') { + $id = $this->bill->getAttribute('id'); + } else { + $id = null; + } + + // Get company id + $company_id = $this->request->get('company_id'); + + return [ + 'vendor_id' => 'required|integer', + 'bill_number' => 'required|string|unique:bills,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', + 'billed_at' => 'required|date', + 'due_at' => 'required|date', + 'currency_code' => 'required|string', + 'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + ]; + } +} diff --git a/app/Http/Requests/Expense/BillPayment.php b/app/Http/Requests/Expense/BillPayment.php new file mode 100644 index 000000000..23d1b4cb9 --- /dev/null +++ b/app/Http/Requests/Expense/BillPayment.php @@ -0,0 +1,35 @@ + 'required|integer', + 'paid_at' => 'required|date', + 'amount' => 'required', + 'currency_code' => 'required|string', + 'payment_method' => 'required|string', + 'attachment' => 'mimes:' . setting('general.file_types', 'pdf,jpeg,jpg,png'), + ]; + } +} diff --git a/app/Http/Requests/Expense/Payment.php b/app/Http/Requests/Expense/Payment.php new file mode 100644 index 000000000..17106bef3 --- /dev/null +++ b/app/Http/Requests/Expense/Payment.php @@ -0,0 +1,36 @@ + 'required|integer', + 'paid_at' => 'required|date', + 'amount' => 'required', + 'currency_code' => 'required|string', + 'category_id' => 'required|integer', + 'payment_method' => 'required|string', + 'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + ]; + } +} diff --git a/app/Http/Requests/Expense/Vendor.php b/app/Http/Requests/Expense/Vendor.php new file mode 100644 index 000000000..b40613165 --- /dev/null +++ b/app/Http/Requests/Expense/Vendor.php @@ -0,0 +1,42 @@ +getMethod() == 'PATCH') { + $id = $this->vendor->getAttribute('id'); + } else { + $id = null; + } + + // Get company id + $company_id = $this->request->get('company_id'); + + return [ + 'name' => 'required|string', + 'email' => 'required|email|unique:vendors,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', + 'currency_code' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/Income/Customer.php b/app/Http/Requests/Income/Customer.php new file mode 100644 index 000000000..015277b15 --- /dev/null +++ b/app/Http/Requests/Income/Customer.php @@ -0,0 +1,49 @@ +getMethod() == 'PATCH') { + $id = $this->customer->getAttribute('id'); + } else { + $id = null; + } + + if (!empty($this->request->get('create_user'))) { + $required = 'required|'; + } + + // Get company id + $company_id = $this->request->get('company_id'); + + return [ + 'name' => 'required|string', + 'email' => 'required|email|unique:customers,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', + 'currency_code' => 'required|string', + 'password' => $required . 'confirmed', + ]; + } +} diff --git a/app/Http/Requests/Income/Invoice.php b/app/Http/Requests/Income/Invoice.php new file mode 100644 index 000000000..a0ddcdb24 --- /dev/null +++ b/app/Http/Requests/Income/Invoice.php @@ -0,0 +1,45 @@ +getMethod() == 'PATCH') { + $id = $this->invoice->getAttribute('id'); + } else { + $id = null; + } + + // Get company id + $company_id = $this->request->get('company_id'); + + return [ + 'customer_id' => 'required|integer', + 'invoice_number' => 'required|string|unique:invoices,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', + 'invoiced_at' => 'required|date', + 'due_at' => 'required|date', + 'currency_code' => 'required|string', + 'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + ]; + } +} diff --git a/app/Http/Requests/Income/InvoicePayment.php b/app/Http/Requests/Income/InvoicePayment.php new file mode 100644 index 000000000..397cc99ee --- /dev/null +++ b/app/Http/Requests/Income/InvoicePayment.php @@ -0,0 +1,35 @@ + 'required|integer', + 'paid_at' => 'required|date', + 'amount' => 'required', + 'currency_code' => 'required|string', + 'payment_method' => 'required|string', + 'attachment' => 'mimes:jpeg,jpg,png,pdf', + ]; + } +} diff --git a/app/Http/Requests/Income/Revenue.php b/app/Http/Requests/Income/Revenue.php new file mode 100644 index 000000000..061a5cfce --- /dev/null +++ b/app/Http/Requests/Income/Revenue.php @@ -0,0 +1,36 @@ + 'required|integer', + 'paid_at' => 'required|date', + 'amount' => 'required', + 'currency_code' => 'required|string', + 'category_id' => 'required|integer', + 'payment_method' => 'required|string', + 'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + ]; + } +} diff --git a/app/Http/Requests/Install/Database.php b/app/Http/Requests/Install/Database.php new file mode 100644 index 000000000..9564fcaec --- /dev/null +++ b/app/Http/Requests/Install/Database.php @@ -0,0 +1,32 @@ + 'required', + 'username' => 'required', + 'database' => 'required' + ]; + } +} diff --git a/app/Http/Requests/Install/Setting.php b/app/Http/Requests/Install/Setting.php new file mode 100644 index 000000000..30d1842a5 --- /dev/null +++ b/app/Http/Requests/Install/Setting.php @@ -0,0 +1,33 @@ + 'required', + 'company_email' => 'required', + 'user_email' => 'required', + 'user_password' => 'required' + ]; + } +} diff --git a/app/Http/Requests/Item/Item.php b/app/Http/Requests/Item/Item.php new file mode 100644 index 000000000..2a0b8fcf7 --- /dev/null +++ b/app/Http/Requests/Item/Item.php @@ -0,0 +1,45 @@ +getMethod() == 'PATCH') { + $id = $this->item->getAttribute('id'); + } else { + $id = null; + } + + // Get company id + $company_id = $this->request->get('company_id'); + + return [ + 'name' => 'required|string', + 'sku' => 'required|string|unique:items,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', + 'sale_price' => 'required', + 'purchase_price' => 'required', + 'quantity' => 'required|integer', + 'picture' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024, + ]; + } +} diff --git a/app/Http/Requests/Module/Module.php b/app/Http/Requests/Module/Module.php new file mode 100644 index 000000000..436ce99f3 --- /dev/null +++ b/app/Http/Requests/Module/Module.php @@ -0,0 +1,30 @@ + 'required|string', + ]; + } +} diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php new file mode 100644 index 000000000..65f4ad8fa --- /dev/null +++ b/app/Http/Requests/Request.php @@ -0,0 +1,28 @@ +all(); + + // Add active company id + $data['company_id'] = session('company_id'); + + // Reset the request data + $this->getInputSource()->replace($data); + + return parent::getValidatorInstance(); + } +} diff --git a/app/Http/Requests/Setting/Category.php b/app/Http/Requests/Setting/Category.php new file mode 100644 index 000000000..8ba8f6715 --- /dev/null +++ b/app/Http/Requests/Setting/Category.php @@ -0,0 +1,32 @@ + 'required|string', + 'type' => 'required|string', + 'color' => 'required|string', + ]; + } +} diff --git a/app/Http/Requests/Setting/Currency.php b/app/Http/Requests/Setting/Currency.php new file mode 100644 index 000000000..28bb37f35 --- /dev/null +++ b/app/Http/Requests/Setting/Currency.php @@ -0,0 +1,44 @@ +getMethod() == 'PATCH') { + $id = $this->currency->getAttribute('id'); + } else { + $id = null; + } + + // Get company id + $company_id = $this->request->get('company_id'); + + return [ + 'name' => 'required|string', + 'code' => 'required|string|unique:currencies,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', + 'rate' => 'required', + 'enabled' => 'boolean', + 'default_currency' => 'boolean', + ]; + } +} diff --git a/app/Http/Requests/Setting/Setting.php b/app/Http/Requests/Setting/Setting.php new file mode 100644 index 000000000..9f438fed9 --- /dev/null +++ b/app/Http/Requests/Setting/Setting.php @@ -0,0 +1,32 @@ + 'required|string', + 'company_email' => 'required|email', + 'company_logo' => 'mimes:' . setting('general.file_types', 'pdf,jpeg,jpg,png'), + ]; + } +} diff --git a/app/Http/Requests/Setting/Tax.php b/app/Http/Requests/Setting/Tax.php new file mode 100644 index 000000000..157936d4b --- /dev/null +++ b/app/Http/Requests/Setting/Tax.php @@ -0,0 +1,31 @@ + 'required|string', + 'rate' => 'required', + ]; + } +} diff --git a/app/Http/Transformers/Auth/Permission.php b/app/Http/Transformers/Auth/Permission.php new file mode 100644 index 000000000..e60c78cd3 --- /dev/null +++ b/app/Http/Transformers/Auth/Permission.php @@ -0,0 +1,24 @@ + $model->id, + 'name' => $model->display_name, + 'code' => $model->name, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Auth/Role.php b/app/Http/Transformers/Auth/Role.php new file mode 100644 index 000000000..9c9b1efe2 --- /dev/null +++ b/app/Http/Transformers/Auth/Role.php @@ -0,0 +1,38 @@ + $model->id, + 'name' => $model->display_name, + 'code' => $model->name, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includePermissions(Model $model) + { + return $this->collection($model->permissions, new Permission()); + } +} diff --git a/app/Http/Transformers/Auth/User.php b/app/Http/Transformers/Auth/User.php new file mode 100644 index 000000000..09961cc3c --- /dev/null +++ b/app/Http/Transformers/Auth/User.php @@ -0,0 +1,38 @@ + $model->id, + 'name' => $model->name, + 'email' => $model->email, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includeRoles(Model $model) + { + return $this->collection($model->roles, new Role()); + } +} diff --git a/app/Http/Transformers/Banking/Account.php b/app/Http/Transformers/Banking/Account.php new file mode 100644 index 000000000..1bf6668bc --- /dev/null +++ b/app/Http/Transformers/Banking/Account.php @@ -0,0 +1,32 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'number' => $model->number, + 'currency_code' => $model->currency_code, + 'opening_balance' => $model->opening_balance, + 'current_balance' => $model->balance, + 'bank_name' => $model->bank_name, + 'bank_phone' => $model->bank_phone, + 'bank_address' => $model->bank_address, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Banking/Transfer.php b/app/Http/Transformers/Banking/Transfer.php new file mode 100644 index 000000000..bb9d0c96c --- /dev/null +++ b/app/Http/Transformers/Banking/Transfer.php @@ -0,0 +1,50 @@ + $model->id, + 'company_id' => $model->company_id, + 'payment_id' => $model->payment_id, + 'revenue_id' => $model->revenue_id, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includePayment(Model $model) + { + return $this->item($model->payment, new Payment()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeRevenue(Model $model) + { + return $this->item($model->revenue, new Revenue()); + } +} diff --git a/app/Http/Transformers/Company/Company.php b/app/Http/Transformers/Company/Company.php new file mode 100644 index 000000000..6db4d45d3 --- /dev/null +++ b/app/Http/Transformers/Company/Company.php @@ -0,0 +1,24 @@ + $model->id, + 'domain' => $model->domain, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Expense/Bill.php b/app/Http/Transformers/Expense/Bill.php new file mode 100644 index 000000000..09ccd60f2 --- /dev/null +++ b/app/Http/Transformers/Expense/Bill.php @@ -0,0 +1,94 @@ + $model->id, + 'company_id' => $model->company_id, + 'bill_number' => $model->bill_number, + 'order_number' => $model->order_number, + 'bill_status_code' => $model->invoice_status_code, + 'billed_at' => $model->billed_at->toIso8601String(), + 'due_at' => $model->due_at->toIso8601String(), + 'amount' => $model->amount, + 'currency_code' => $model->currency_code, + 'currency_rate' => $model->currency_rate, + 'vendor_id' => $model->vendor_id, + 'vendor_name' => $model->vendor_name, + 'vendor_email' => $model->vendor_email, + 'vendor_tax_number' => $model->vendor_tax_number, + 'vendor_phone' => $model->vendor_phone, + 'vendor_address' => $model->vendor_address, + 'notes' => $model->notes, + 'attachment' => $model->attachment, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeVendor(Model $model) + { + return $this->item($model->vendor, new Vendor()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeStatus(Model $model) + { + return $this->item($model->status, new BillStatus()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includeItems(Model $model) + { + return $this->collection($model->items, new BillItems()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includeHistories(Model $model) + { + return $this->collection($model->histories, new BillHistories()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includePayments(Model $model) + { + return $this->collection($model->payments, new BillPayments()); + } +} diff --git a/app/Http/Transformers/Expense/BillHistories.php b/app/Http/Transformers/Expense/BillHistories.php new file mode 100644 index 000000000..63a274dab --- /dev/null +++ b/app/Http/Transformers/Expense/BillHistories.php @@ -0,0 +1,27 @@ + $model->id, + 'company_id' => $model->company_id, + 'bill_id' => $model->bill_id, + 'status_code' => $model->status_code, + 'notify' => $model->notify, + 'description' => $model->description, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Expense/BillItems.php b/app/Http/Transformers/Expense/BillItems.php new file mode 100644 index 000000000..d446f7342 --- /dev/null +++ b/app/Http/Transformers/Expense/BillItems.php @@ -0,0 +1,32 @@ + $model->id, + 'company_id' => $model->company_id, + 'bill_id' => $model->bill_id, + 'item_id' => $model->item_id, + 'name' => $model->name, + 'sku' => $model->sku, + 'quantity' => $model->quantity, + 'price' => $model->price, + 'total' => $model->total, + 'tax' => $model->tax, + 'tax_id' => $model->tax_id, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Expense/BillPayments.php b/app/Http/Transformers/Expense/BillPayments.php new file mode 100644 index 000000000..564933e4a --- /dev/null +++ b/app/Http/Transformers/Expense/BillPayments.php @@ -0,0 +1,48 @@ + $model->id, + 'company_id' => $model->company_id, + 'bill_id' => $model->bill_id, + 'account_id' => $model->account_id, + 'paid_at' => $model->paid_at->toIso8601String(), + 'amount' => $model->amount, + 'currency_code' => $model->currency_code, + 'currency_rate' => $model->currency_rate, + 'description' => $model->description, + 'payment_method' => $model->payment_method, + 'reference' => $model->reference, + 'attachment' => $model->attachment, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeAccount(Model $model) + { + return $this->item($model->account, new Account()); + } +} diff --git a/app/Http/Transformers/Expense/BillStatus.php b/app/Http/Transformers/Expense/BillStatus.php new file mode 100644 index 000000000..71c0a424d --- /dev/null +++ b/app/Http/Transformers/Expense/BillStatus.php @@ -0,0 +1,25 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'code' => $model->code, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Expense/Payment.php b/app/Http/Transformers/Expense/Payment.php new file mode 100644 index 000000000..20e95fc0f --- /dev/null +++ b/app/Http/Transformers/Expense/Payment.php @@ -0,0 +1,69 @@ + $model->id, + 'company_id' => $model->company_id, + 'account_id' => $model->account_id, + 'paid_at' => $model->paid_at->toIso8601String(), + 'amount' => $model->amount, + 'currency_code' => $model->currency_code, + 'currency_rate' => $model->currency_rate, + 'vendor_id' => $model->vendor_id, + 'description' => $model->description, + 'category_id' => $model->category_id, + 'payment_method' => $model->payment_method, + 'reference' => $model->reference, + 'attachment' => $model->attachment, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeAccount(Model $model) + { + return $this->item($model->account, new Account()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeVendor(Model $model) + { + return $this->item($model->vendor, new Vendor()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeCategory(Model $model) + { + return $this->item($model->category, new Category()); + } +} diff --git a/app/Http/Transformers/Expense/Vendor.php b/app/Http/Transformers/Expense/Vendor.php new file mode 100644 index 000000000..215474eed --- /dev/null +++ b/app/Http/Transformers/Expense/Vendor.php @@ -0,0 +1,32 @@ + $model->id, + 'company_id' => $model->company_id, + 'user_id' => $model->user_id, + 'name' => $model->name, + 'email' => $model->email, + 'tax_number' => $model->tax_number, + 'phone' => $model->phone, + 'address' => $model->address, + 'website' => $model->website, + 'currency_code' => $model->currency_code, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Income/Customer.php b/app/Http/Transformers/Income/Customer.php new file mode 100644 index 000000000..f0e3712d0 --- /dev/null +++ b/app/Http/Transformers/Income/Customer.php @@ -0,0 +1,32 @@ + $model->id, + 'company_id' => $model->company_id, + 'user_id' => $model->user_id, + 'name' => $model->name, + 'email' => $model->email, + 'tax_number' => $model->tax_number, + 'phone' => $model->phone, + 'address' => $model->address, + 'website' => $model->website, + 'currency_code' => $model->currency_code, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Income/Invoice.php b/app/Http/Transformers/Income/Invoice.php new file mode 100644 index 000000000..e226cb433 --- /dev/null +++ b/app/Http/Transformers/Income/Invoice.php @@ -0,0 +1,94 @@ + $model->id, + 'company_id' => $model->company_id, + 'invoice_number' => $model->invoice_number, + 'order_number' => $model->order_number, + 'invoice_status_code' => $model->invoice_status_code, + 'invoiced_at' => $model->invoiced_at->toIso8601String(), + 'due_at' => $model->due_at->toIso8601String(), + 'amount' => $model->amount, + 'currency_code' => $model->currency_code, + 'currency_rate' => $model->currency_rate, + 'customer_id' => $model->customer_id, + 'customer_name' => $model->customer_name, + 'customer_email' => $model->customer_email, + 'customer_tax_number' => $model->customer_tax_number, + 'customer_phone' => $model->customer_phone, + 'customer_address' => $model->customer_address, + 'notes' => $model->notes, + 'attachment' => $model->attachment, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeCustomer(Model $model) + { + return $this->item($model->customer, new Customer()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeStatus(Model $model) + { + return $this->item($model->status, new InvoiceStatus()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includeItems(Model $model) + { + return $this->collection($model->items, new InvoiceItems()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includeHistories(Model $model) + { + return $this->collection($model->histories, new InvoiceHistories()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Collection + */ + public function includePayments(Model $model) + { + return $this->collection($model->payments, new InvoicePayments()); + } +} diff --git a/app/Http/Transformers/Income/InvoiceHistories.php b/app/Http/Transformers/Income/InvoiceHistories.php new file mode 100644 index 000000000..991a8f77b --- /dev/null +++ b/app/Http/Transformers/Income/InvoiceHistories.php @@ -0,0 +1,27 @@ + $model->id, + 'company_id' => $model->company_id, + 'invoice_id' => $model->invoice_id, + 'status_code' => $model->status_code, + 'notify' => $model->notify, + 'description' => $model->description, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Income/InvoiceItems.php b/app/Http/Transformers/Income/InvoiceItems.php new file mode 100644 index 000000000..cf2b2c64a --- /dev/null +++ b/app/Http/Transformers/Income/InvoiceItems.php @@ -0,0 +1,32 @@ + $model->id, + 'company_id' => $model->company_id, + 'invoice_id' => $model->invoice_id, + 'item_id' => $model->item_id, + 'name' => $model->name, + 'sku' => $model->sku, + 'quantity' => $model->quantity, + 'price' => $model->price, + 'total' => $model->total, + 'tax' => $model->tax, + 'tax_id' => $model->tax_id, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Income/InvoicePayments.php b/app/Http/Transformers/Income/InvoicePayments.php new file mode 100644 index 000000000..d58b199e3 --- /dev/null +++ b/app/Http/Transformers/Income/InvoicePayments.php @@ -0,0 +1,48 @@ + $model->id, + 'company_id' => $model->company_id, + 'invoice_id' => $model->invoice_id, + 'account_id' => $model->account_id, + 'paid_at' => $model->paid_at->toIso8601String(), + 'amount' => $model->amount, + 'currency_code' => $model->currency_code, + 'currency_rate' => $model->currency_rate, + 'description' => $model->description, + 'payment_method' => $model->payment_method, + 'reference' => $model->reference, + 'attachment' => $model->attachment, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeAccount(Model $model) + { + return $this->item($model->account, new Account()); + } +} diff --git a/app/Http/Transformers/Income/InvoiceStatus.php b/app/Http/Transformers/Income/InvoiceStatus.php new file mode 100644 index 000000000..9ce92a572 --- /dev/null +++ b/app/Http/Transformers/Income/InvoiceStatus.php @@ -0,0 +1,25 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'code' => $model->code, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Income/Revenue.php b/app/Http/Transformers/Income/Revenue.php new file mode 100644 index 000000000..c55f82935 --- /dev/null +++ b/app/Http/Transformers/Income/Revenue.php @@ -0,0 +1,69 @@ + $model->id, + 'company_id' => $model->company_id, + 'account_id' => $model->account_id, + 'paid_at' => $model->paid_at->toIso8601String(), + 'amount' => $model->amount, + 'currency_code' => $model->currency_code, + 'currency_rate' => $model->currency_rate, + 'customer_id' => $model->customer_id, + 'description' => $model->description, + 'category_id' => $model->category_id, + 'payment_method' => $model->payment_method, + 'reference' => $model->reference, + 'attachment' => $model->attachment, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeAccount(Model $model) + { + return $this->item($model->account, new Account()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeCustomer(Model $model) + { + return $this->item($model->customer, new Customer()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeCategory(Model $model) + { + return $this->item($model->category, new Category()); + } +} diff --git a/app/Http/Transformers/Item/Item.php b/app/Http/Transformers/Item/Item.php new file mode 100644 index 000000000..219960d78 --- /dev/null +++ b/app/Http/Transformers/Item/Item.php @@ -0,0 +1,58 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'sku' => $model->sku, + 'description' => $model->description, + 'sale_price' => $model->sale_price, + 'purchase_price' => $model->purchase_price, + 'quantity' => $model->quantity, + 'category_id' => $model->category_id, + 'tax_id' => $model->tax_id, + 'picture' => $model->picture, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeTax(Model $model) + { + return $this->item($model->tax, new Tax()); + } + + /** + * @param Model $model + * @return \League\Fractal\Resource\Item + */ + public function includeCategory(Model $model) + { + return $this->item($model->category, new Category()); + } +} diff --git a/app/Http/Transformers/Setting/Category.php b/app/Http/Transformers/Setting/Category.php new file mode 100644 index 000000000..97528a9bb --- /dev/null +++ b/app/Http/Transformers/Setting/Category.php @@ -0,0 +1,27 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'type' => $model->type, + 'color' => $model->color, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Setting/Currency.php b/app/Http/Transformers/Setting/Currency.php new file mode 100644 index 000000000..7c098e531 --- /dev/null +++ b/app/Http/Transformers/Setting/Currency.php @@ -0,0 +1,27 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'code' => $model->code, + 'rate' => $model->rate, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/Transformers/Setting/Tax.php b/app/Http/Transformers/Setting/Tax.php new file mode 100644 index 000000000..f83c97a5e --- /dev/null +++ b/app/Http/Transformers/Setting/Tax.php @@ -0,0 +1,26 @@ + $model->id, + 'company_id' => $model->company_id, + 'name' => $model->name, + 'rate' => $model->rate, + 'enabled' => $model->enabled, + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), + ]; + } +} diff --git a/app/Http/ViewComposers/All.php b/app/Http/ViewComposers/All.php new file mode 100644 index 000000000..80845ddec --- /dev/null +++ b/app/Http/ViewComposers/All.php @@ -0,0 +1,26 @@ +with(['date_format' => $this->getCompanyDateFormat()]); + } + } +} diff --git a/app/Http/ViewComposers/Header.php b/app/Http/ViewComposers/Header.php new file mode 100644 index 000000000..81d19afc3 --- /dev/null +++ b/app/Http/ViewComposers/Header.php @@ -0,0 +1,64 @@ +customer()) { + $company = (object)[ + 'company_name' => setting('general.company_name'), + 'company_email' => setting('general.company_email'), + 'company_address' => setting('general.company_address'), + 'company_logo' => setting('general.company_logo'), + ]; + } + + $undereads = $user->unreadNotifications; + + foreach ($undereads as $underead) { + $data = $underead->getAttribute('data'); + + switch ($underead->getAttribute('type')) { + case 'App\Notifications\Expense\Bill': + $bills[$data['bill_id']] = $data['amount']; + $notifications++; + break; + case 'App\Notifications\Income\Invoice': + $invoices[$data['invoice_id']] = $data['amount']; + $notifications++; + break; + } + } + + $updates = count(Updater::all()); + + $view->with([ + 'user' => $user, + 'notifications' => $notifications, + 'bills' => $bills, + 'invoices' => $invoices, + 'company' => $company, + 'updates' => $updates, + ]); + } +} diff --git a/app/Http/ViewComposers/Index.php b/app/Http/ViewComposers/Index.php new file mode 100644 index 000000000..9d231adfa --- /dev/null +++ b/app/Http/ViewComposers/Index.php @@ -0,0 +1,23 @@ + '10', '25' => '25', '50' => '50', '100' => '100']; + + $years = ['2017' => '2017', '2016' => '2016', '2015' => '2015', '2014' => '2014']; + + $view->with(['limits' => $limits, 'years' => $years]); + } +} diff --git a/app/Http/ViewComposers/Menu.php b/app/Http/ViewComposers/Menu.php new file mode 100644 index 000000000..d962c8019 --- /dev/null +++ b/app/Http/ViewComposers/Menu.php @@ -0,0 +1,35 @@ +companies()->get()->sortBy('name'); + foreach ($companies as $com) { + $com->setSettings(); + } + + // Get customer + if (Auth::user()->customer) { + $customer = Auth::user(); + } + + $view->with(['companies' => $companies, 'customer' => $customer]); + } +} diff --git a/app/Http/ViewComposers/Modules.php b/app/Http/ViewComposers/Modules.php new file mode 100644 index 000000000..cb68c5f25 --- /dev/null +++ b/app/Http/ViewComposers/Modules.php @@ -0,0 +1,32 @@ +addHour(6), function () { + return collect($this->getCategories())->pluck('name', 'slug') + ->prepend(trans('categories.all'), ''); + }); + + $view->with(['categories' => $categories]); + } + } +} diff --git a/app/Listeners/Auth/Login.php b/app/Listeners/Auth/Login.php new file mode 100644 index 000000000..86f32dab6 --- /dev/null +++ b/app/Listeners/Auth/Login.php @@ -0,0 +1,33 @@ +companies()->first(); + + session(['company_id' => $company->id]); + } +} diff --git a/app/Listeners/Auth/Logout.php b/app/Listeners/Auth/Logout.php new file mode 100644 index 000000000..6220ea8ef --- /dev/null +++ b/app/Listeners/Auth/Logout.php @@ -0,0 +1,38 @@ +user)) { + return; + } + + $event->user->last_logged_in_at = Date::now(); + + $event->user->save(); + + session()->forget('company_id'); + } +} \ No newline at end of file diff --git a/app/Models/Auth/Permission.php b/app/Models/Auth/Permission.php new file mode 100644 index 000000000..5303bf74b --- /dev/null +++ b/app/Models/Auth/Permission.php @@ -0,0 +1,70 @@ +currentRouteAction())[0])); + $folder = $arr[1]; + $file = $arr[0]; + } else { + list($folder, $file) = explode('/', Route::current()->uri()); + } + + if (empty($folder) || empty($file)) { + return $this->provideFilter(); + } + + $class = '\App\Filters\\' . ucfirst($folder) .'\\' . ucfirst($file); + + return $this->provideFilter($class); + } + + /** + * Scope to get all rows filtered, sorted and paginated. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $sort + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCollect($query, $sort = 'display_name') + { + $request = request(); + + $input = $request->input(); + $limit = $request->get('limit', setting('general.list_limit', '25')); + + return $this->filter($input)->sortable($sort)->paginate($limit); + } +} diff --git a/app/Models/Auth/Role.php b/app/Models/Auth/Role.php new file mode 100644 index 000000000..f45c9de01 --- /dev/null +++ b/app/Models/Auth/Role.php @@ -0,0 +1,69 @@ +currentRouteAction())[0])); + $folder = $arr[1]; + $file = $arr[0]; + } else { + list($folder, $file) = explode('/', Route::current()->uri()); + } + + if (empty($folder) || empty($file)) { + return $this->provideFilter(); + } + + $class = '\App\Filters\\' . ucfirst($folder) .'\\' . ucfirst($file); + + return $this->provideFilter($class); + } + + /** + * Scope to get all rows filtered, sorted and paginated. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $sort + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCollect($query, $sort = 'display_name') + { + $request = request(); + + $input = $request->input(); + $limit = $request->get('limit', setting('general.list_limit', '25')); + + return $this->filter($input)->sortable($sort)->paginate($limit); + } +} diff --git a/app/Models/Auth/User.php b/app/Models/Auth/User.php new file mode 100644 index 000000000..75be3bc84 --- /dev/null +++ b/app/Models/Auth/User.php @@ -0,0 +1,184 @@ +morphToMany('App\Models\Company\Company', 'user', 'user_companies', 'user_id', 'company_id'); + } + + public function customer() + { + return $this->hasOne('App\Models\Income\Customer', 'user_id', 'id'); + } + + public function invoices() + { + return $this->hasMany('App\Models\Income\Invoice', 'customer_id', 'id'); + } + + public function revenues() + { + return $this->hasMany('App\Models\Income\Revenue', 'customer_id', 'id'); + } + + /** + * Always capitalize the name when we retrieve it + */ + public function getNameAttribute($value) + { + return ucfirst($value); + } + + /** + * Always return a valid picture when we retrieve it + */ + public function getPictureAttribute($value) + { + $pic = ''; + + if (is_file(base_path($value))) { + $pic = $value; + } elseif (setting('general.use_gravatar', '0') == '1') { + // Check for gravatar + $url = 'https://www.gravatar.com/avatar/' . md5(strtolower($this->getAttribute('email'))).'?size=90&d=404'; + + $client = new \GuzzleHttp\Client(['verify' => false]); + + try { + $pic = $client->request('GET', $url)->getBody()->getContents(); + } catch (RequestException $e) { + // 404 Not Found + } + } + + return $pic; + } + + /** + * Always return a valid picture when we retrieve it + */ + public function getLastLoggedInAtAttribute($value) + { + // Date::setLocale('tr'); + + if (!empty($value)) { + return Date::parse($value)->diffForHumans(); + } else { + return trans('auth.never'); + } + } + + /** + * Send reset link to user via email + */ + public function sendPasswordResetNotification($token) + { + $this->notify(new Reset($token)); + } + + /** + * Always capitalize the name when we save it to the database + */ + public function setNameAttribute($value) + { + $this->attributes['name'] = ucfirst($value); + } + + /** + * Always hash the password when we save it to the database + */ + public function setPasswordAttribute($value) + { + $this->attributes['password'] = Hash::make($value); + } + + /** + * Define the filter provider globally. + * + * @return ModelFilter + */ + public function modelFilter() + { + // Check if is api or web + if (Request::is('api/*')) { + $arr = array_reverse(explode('\\', explode('@', app()['api.router']->currentRouteAction())[0])); + $folder = $arr[1]; + $file = $arr[0]; + } else { + list($folder, $file) = explode('/', Route::current()->uri()); + } + + if (empty($folder) || empty($file)) { + return $this->provideFilter(); + } + + //$class = '\App\Filters\Auth\Users'; + + $class = '\App\Filters\\' . ucfirst($folder) . '\\' . ucfirst($file); + + return $this->provideFilter($class); + } + + /** + * Scope to get all rows filtered, sorted and paginated. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $sort + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCollect($query, $sort = 'name') + { + $request = request(); + + $input = $request->input(); + $limit = $request->get('limit', setting('general.list_limit', '25')); + + return $this->filter($input)->sortable($sort)->paginate($limit); + } +} diff --git a/app/Models/Banking/Account.php b/app/Models/Banking/Account.php new file mode 100644 index 000000000..587906615 --- /dev/null +++ b/app/Models/Banking/Account.php @@ -0,0 +1,136 @@ + 10, + 'number' => 10, + 'bank_name' => 10, + 'bank_phone' => 5, + 'bank_address' => 2, + ]; + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function invoice_payments() + { + return $this->hasMany('App\Models\Income\InvoicePayment'); + } + + public function revenues() + { + return $this->hasMany('App\Models\Income\Revenue'); + } + + public function bill_payments() + { + return $this->hasMany('App\Models\Expense\BillPayment'); + } + + public function payments() + { + return $this->hasMany('App\Models\Expense\Payment'); + } + + public function canDelete() + { + $error = false; + + $bill_payments = $this->bill_payments(); + if ($bill_payments->count()) { + $error['bills'] = $bill_payments->count(); + } + + $payments = $this->payments(); + if ($payments->count()) { + $error['payments'] = $payments->count(); + } + + $invoice_payments = $this->invoice_payments(); + if ($invoice_payments->count()) { + $error['invoices'] = $invoice_payments->count(); + } + + $revenues = $this->revenues(); + if ($revenues->count()) { + $error['revenues'] = $revenues->count(); + } + + if ($error) { + return $error; + } + + return true; + } + + /** + * Get the current balance. + * + * @return string + */ + public function getBalanceAttribute() + { + // Opening Balance + $total = $this->opening_balance; + + // Sum invoices + foreach ($this->invoice_payments as $item) { + $total += $item->amount; + } + + // Sum revenues + foreach ($this->revenues as $item) { + $total += $item->amount; + } + + // Subtract bills + foreach ($this->bill_payments as $item) { + $total -= $item->amount; + } + + // Subtract payments + foreach ($this->payments as $item) { + $total -= $item->amount; + } + + return $total; + } +} diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php new file mode 100644 index 000000000..75465d7f4 --- /dev/null +++ b/app/Models/Banking/Transaction.php @@ -0,0 +1,92 @@ +get(); + + foreach ($bills as $bill) { + $bill_payments = $bill->payments; + + if ($bill_payments) { + foreach ($bill_payments as $bill_payment) { + $transactions[] = (object) [ + 'date' => $bill_payment->paid_at, + 'account' => $bill_payment->account->name, + 'type' => trans('invoices.status.partial'), + 'category' => trans_choice('general.invoices', 1), + 'description' => $bill_payment->description, + 'amount' => $bill_payment->amount, + 'currency_code' => $bill_payment->currency_code, + ]; + } + } + } + + $payments = Payment::where('vendor_id', $user_id)->get(); + + foreach ($payments as $payment) { + $transactions[] = (object) [ + 'date' => $payment->paid_at, + 'account' => $payment->account->name, + 'type' => 'Expense', + 'category' => $payment->category->name, + 'description' => $payment->description, + 'amount' => $payment->amount, + 'currency_code' => $payment->currency_code, + ]; + } + break; + case 'revenues': + $invoices = Invoice::where('customer_id', $user_id)->get(); + + foreach ($invoices as $invoice) { + $invoice_payments = $invoice->payments; + + if ($invoice_payments) { + foreach ($invoice_payments as $invoice_payment) { + $transactions[] = (object) [ + 'date' => $invoice_payment->paid_at, + 'account' => $invoice_payment->account->name, + 'type' => trans('invoices.status.partial'), + 'category' => trans_choice('general.invoices', 1), + 'description' => $invoice_payment->description, + 'amount' => $invoice_payment->amount, + 'currency_code' => $invoice_payment->currency_code, + ]; + } + } + } + + $revenues = Revenue::where('customer_id', $user_id)->get(); + + foreach ($revenues as $revenue) { + $transactions[] = (object) [ + 'date' => $revenue->paid_at, + 'account' => $revenue->account->name, + 'type' => trans_choice('general.payments', 1), + 'category' => $revenue->category->name, + 'description' => $revenue->description, + 'amount' => $revenue->amount, + 'currency_code' => $revenue->currency_code, + ]; + } + break; + } + + return $transactions; + } +} diff --git a/app/Models/Banking/Transfer.php b/app/Models/Banking/Transfer.php new file mode 100644 index 000000000..e3f3125b9 --- /dev/null +++ b/app/Models/Banking/Transfer.php @@ -0,0 +1,52 @@ +belongsTo('App\Models\Expense\Payment'); + } + + public function paymentAccount() + { + return $this->belongsTo('App\Models\Banking\Account', 'payment.account_id', 'id'); + } + + public function revenue() + { + return $this->belongsTo('App\Models\Income\Revenue'); + } + + public function revenueAccount() + { + return $this->belongsTo('App\Models\Banking\Account', 'revenue.account_id', 'id'); + } + + public function getDynamicConvertedAmount($format = false) + { + return $this->dynamicConvert($this->default_currency_code, $this->amount, $this->currency_code, $this->currency_rate, $format); + } +} diff --git a/app/Models/Company/Company.php b/app/Models/Company/Company.php new file mode 100644 index 000000000..de9fb2354 --- /dev/null +++ b/app/Models/Company/Company.php @@ -0,0 +1,199 @@ +hasMany('App\Models\Banking\Account'); + } + + public function bill_histories() + { + return $this->hasMany('App\Models\Expense\BillHistory'); + } + + public function bill_items() + { + return $this->hasMany('App\Models\Expense\BillItem'); + } + + public function bill_payments() + { + return $this->hasMany('App\Models\Expense\BillPayment'); + } + + public function bill_statuses() + { + return $this->hasMany('App\Models\Expense\BillStatus'); + } + + public function bills() + { + return $this->hasMany('App\Models\Expense\Bill'); + } + + public function categories() + { + return $this->hasMany('App\Models\Setting\Category'); + } + + public function currencies() + { + return $this->hasMany('App\Models\Setting\Currency'); + } + + public function customers() + { + return $this->hasMany('App\Models\Income\Customer'); + } + + public function invoice_histories() + { + return $this->hasMany('App\Models\Income\InvoiceHistory'); + } + + public function invoice_items() + { + return $this->hasMany('App\Models\Income\InvoiceItem'); + } + + public function invoice_payments() + { + return $this->hasMany('App\Models\Income\InvoicePayment'); + } + + public function invoice_statuses() + { + return $this->hasMany('App\Models\Income\InvoiceStatus'); + } + + public function invoices() + { + return $this->hasMany('App\Models\Income\Invoice'); + } + + public function items() + { + return $this->hasMany('App\Models\Item\Item'); + } + + public function payments() + { + return $this->hasMany('App\Models\Expense\Payment'); + } + + public function revenues() + { + return $this->hasMany('App\Models\Income\Revenue'); + } + + public function settings() + { + return $this->hasMany('App\Models\Setting\Setting'); + } + + public function taxes() + { + return $this->hasMany('App\Models\Setting\Tax'); + } + + public function transfers() + { + return $this->hasMany('App\Models\Banking\Transfer'); + } + + public function users() + { + return $this->morphedByMany('App\Models\Auth\User', 'user', 'user_companies', 'company_id', 'user_id'); + } + + public function vendors() + { + return $this->hasMany('App\Models\Expense\Vendor'); + } + + public function setSettings() + { + $settings = $this->settings; + + foreach ($settings as $setting) { + list($group, $key) = explode('.', $setting->getAttribute('key')); + + // Load only general settings + if ($group != 'general') { + continue; + } + + $value = $setting->getAttribute('value'); + + if (($key == 'company_logo') && empty($value)) { + $value = 'public/img/company.png'; + } + + $this->setAttribute($key, $value); + } + + // Set default default company logo if empty + if ($this->getAttribute('company_logo') == '') { + $this->setAttribute('company_logo', 'public/img/company.png'); + } + } + + /** + * Define the filter provider globally. + * + * @return ModelFilter + */ + public function modelFilter() + { + list($folder, $file) = explode('/', \Route::current()->uri()); + + if (empty($folder) || empty($file)) { + return $this->provideFilter(); + } + + $class = '\App\Filters\\' . ucfirst($folder) .'\\' . ucfirst($file); + + return $this->provideFilter($class); + } + + /** + * Scope to get all rows filtered, sorted and paginated. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $sort + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCollect($query, $sort = 'name') + { + $request = request(); + + $input = $request->input(); + $limit = $request->get('limit', setting('general.list_limit', '25')); + + return $this->filter($input)->sortable($sort)->paginate($limit); + } +} diff --git a/app/Models/Expense/Bill.php b/app/Models/Expense/Bill.php new file mode 100644 index 000000000..15ce9bb09 --- /dev/null +++ b/app/Models/Expense/Bill.php @@ -0,0 +1,91 @@ + 10, + 'order_number' => 10, + 'vendor_name' => 10, + 'vendor_email' => 5, + 'vendor_phone' => 2, + 'vendor_address' => 1, + 'notes' => 2, + ]; + + public function vendor() + { + return $this->belongsTo('App\Models\Expense\Vendor'); + } + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function status() + { + return $this->belongsTo('App\Models\Expense\BillStatus', 'bill_status_code', 'code'); + } + + public function item() + { + return $this->belongsTo('App\Models\Expense\BillItem', 'id', 'bill_id'); + } + + public function items() + { + return $this->hasMany('App\Models\Expense\BillItem'); + } + + public function payment() + { + return $this->belongsTo('App\Models\Expense\BillPayment', 'id', 'bill_id'); + } + + public function payments() + { + return $this->hasMany('App\Models\Expense\BillPayment'); + } + + public function histories() + { + return $this->hasMany('App\Models\Expense\BillHistory'); + } + + public function scopeDue($query, $date) + { + return $query->where('due_at', '=', $date); + } +} diff --git a/app/Models/Expense/BillHistory.php b/app/Models/Expense/BillHistory.php new file mode 100644 index 000000000..b8f4fd0bd --- /dev/null +++ b/app/Models/Expense/BillHistory.php @@ -0,0 +1,51 @@ +belongsTo('App\Models\Expense\Bill'); + } + + public function item() + { + return $this->belongsTo('App\Models\Item\Item'); + } + + public function tax() + { + return $this->belongsTo('App\Models\Setting\Tax'); + } + + public function payment() + { + return $this->belongsTo('App\Models\Setting\Payment'); + } + + public function status() + { + return $this->belongsTo('App\Models\Expense\BillStatus', 'status_code', 'code'); + } + + public function getConvertedAmount($format = false) + { + return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format); + } +} diff --git a/app/Models/Expense/BillItem.php b/app/Models/Expense/BillItem.php new file mode 100644 index 000000000..ce3f105d6 --- /dev/null +++ b/app/Models/Expense/BillItem.php @@ -0,0 +1,36 @@ +belongsTo('App\Models\Expense\Bill'); + } + + public function item() + { + return $this->belongsTo('App\Models\Item\Item'); + } + + public function tax() + { + return $this->belongsTo('App\Models\Setting\Tax'); + } +} diff --git a/app/Models/Expense/BillPayment.php b/app/Models/Expense/BillPayment.php new file mode 100644 index 000000000..e7b1c116c --- /dev/null +++ b/app/Models/Expense/BillPayment.php @@ -0,0 +1,48 @@ +belongsTo('App\Models\Banking\Account'); + } + + public function bill() + { + return $this->belongsTo('App\Models\Expense\Bill'); + } + + public function item() + { + return $this->belongsTo('App\Models\Item\Item'); + } + + public function tax() + { + return $this->belongsTo('App\Models\Setting\Tax'); + } + + public function scopeLatest($query) + { + return $query->orderBy('paid_at', 'desc'); + } +} diff --git a/app/Models/Expense/BillStatus.php b/app/Models/Expense/BillStatus.php new file mode 100644 index 000000000..57349a93b --- /dev/null +++ b/app/Models/Expense/BillStatus.php @@ -0,0 +1,18 @@ +belongsTo('App\Models\Banking\Account'); + } + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function category() + { + return $this->belongsTo('App\Models\Setting\Category'); + } + + public function vendor() + { + return $this->belongsTo('App\Models\Expense\Vendor'); + } + + public function transfers() + { + return $this->hasMany('App\Models\Banking\Transfer'); + } + + public static function scopeLatest($query) + { + return $query->orderBy('paid_at', 'desc'); + } +} diff --git a/app/Models/Expense/Vendor.php b/app/Models/Expense/Vendor.php new file mode 100644 index 000000000..94c6a74e6 --- /dev/null +++ b/app/Models/Expense/Vendor.php @@ -0,0 +1,76 @@ + 10, + 'email' => 5, + 'phone' => 2, + 'website' => 2, + 'address' => 1, + ]; + + public function bills() + { + return $this->hasMany('App\Models\Expense\Bill'); + } + + public function payments() + { + return $this->hasMany('App\Models\Expense\Payments'); + } + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function canDelete() + { + $error = false; + + $bills = $this->bills(); + if ($bills->count()) { + $error['bills'] = $bills->count(); + } + + $payments = $this->payments(); + if ($payments->count()) { + $error['payments'] = $payments->count(); + } + + if ($error) { + return $error; + } + + return true; + } +} diff --git a/app/Models/Income/Customer.php b/app/Models/Income/Customer.php new file mode 100644 index 000000000..d6471540c --- /dev/null +++ b/app/Models/Income/Customer.php @@ -0,0 +1,83 @@ + 10, + 'email' => 5, + 'phone' => 2, + 'website' => 2, + 'address' => 1, + ]; + + public function invoices() + { + return $this->hasMany('App\Models\Income\Invoice'); + } + + public function revenues() + { + return $this->hasMany('App\Models\Income\Revenue'); + } + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function user() + { + return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id'); + } + + public function canDelete() + { + $error = false; + + $invoices = $this->invoices(); + if ($invoices->count()) { + $error['invoices'] = $invoices->count(); + } + + $revenues = $this->revenues(); + if ($revenues->count()) { + $error['revenues'] = $revenues->count(); + } + + if ($error) { + return $error; + } + + return true; + } +} diff --git a/app/Models/Income/Invoice.php b/app/Models/Income/Invoice.php new file mode 100644 index 000000000..cbf4c4996 --- /dev/null +++ b/app/Models/Income/Invoice.php @@ -0,0 +1,96 @@ + 10, + 'order_number' => 10, + 'customer_name' => 10, + 'customer_email' => 5, + 'customer_phone' => 2, + 'customer_address' => 1, + 'notes' => 2, + ]; + + public function user() + { + return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id'); + } + + public function customer() + { + return $this->belongsTo('App\Models\Income\Customer'); + } + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function status() + { + return $this->belongsTo('App\Models\Income\InvoiceStatus', 'invoice_status_code', 'code'); + } + + public function item() + { + return $this->belongsTo('App\Models\Income\InvoiceItem', 'id', 'invoice_id'); + } + + public function payment() + { + return $this->belongsTo('App\Models\Income\InvoicePayment', 'id', 'invoice_id'); + } + + public function items() + { + return $this->hasMany('App\Models\Income\InvoiceItem'); + } + + public function payments() + { + return $this->hasMany('App\Models\Income\InvoicePayment'); + } + + public function histories() + { + return $this->hasMany('App\Models\Income\InvoiceHistory'); + } + + public function scopeDue($query, $date) + { + return $query->where('due_at', '=', $date); + } +} diff --git a/app/Models/Income/InvoiceHistory.php b/app/Models/Income/InvoiceHistory.php new file mode 100644 index 000000000..64bcd1663 --- /dev/null +++ b/app/Models/Income/InvoiceHistory.php @@ -0,0 +1,51 @@ +belongsTo('App\Models\Income\Invoice'); + } + + public function item() + { + return $this->belongsTo('App\Models\Item\Item'); + } + + public function tax() + { + return $this->belongsTo('App\Models\Setting\Tax'); + } + + public function payment() + { + return $this->belongsTo('App\Models\Setting\Payment'); + } + + public function status() + { + return $this->belongsTo('App\Models\Income\InvoiceStatus', 'status_code', 'code'); + } + + public function getConvertedAmount($format = false) + { + return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format); + } +} diff --git a/app/Models/Income/InvoiceItem.php b/app/Models/Income/InvoiceItem.php new file mode 100644 index 000000000..55e92dc9b --- /dev/null +++ b/app/Models/Income/InvoiceItem.php @@ -0,0 +1,36 @@ +belongsTo('App\Models\Income\Invoice'); + } + + public function item() + { + return $this->belongsTo('App\Models\Item\Item'); + } + + public function tax() + { + return $this->belongsTo('App\Models\Setting\Tax'); + } +} diff --git a/app/Models/Income/InvoicePayment.php b/app/Models/Income/InvoicePayment.php new file mode 100644 index 000000000..295fe8f7a --- /dev/null +++ b/app/Models/Income/InvoicePayment.php @@ -0,0 +1,48 @@ +belongsTo('App\Models\Banking\Account'); + } + + public function invoice() + { + return $this->belongsTo('App\Models\Income\Invoice'); + } + + public function item() + { + return $this->belongsTo('App\Models\Item\Item'); + } + + public function tax() + { + return $this->belongsTo('App\Models\Setting\Tax'); + } + + public function scopeLatest($query) + { + return $query->orderBy('paid_at', 'desc'); + } +} diff --git a/app/Models/Income/InvoiceStatus.php b/app/Models/Income/InvoiceStatus.php new file mode 100644 index 000000000..e11365453 --- /dev/null +++ b/app/Models/Income/InvoiceStatus.php @@ -0,0 +1,18 @@ + 10, + 'order_number' => 10, + 'customer_name' => 10, + 'customer_email' => 5, + 'notes' => 2, + ]; + + public function user() + { + return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id'); + } + + public function account() + { + return $this->belongsTo('App\Models\Banking\Account'); + } + + public function currency() + { + return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); + } + + public function category() + { + return $this->belongsTo('App\Models\Setting\Category'); + } + + public function customer() + { + return $this->belongsTo('App\Models\Income\Customer'); + } + + public function transfers() + { + return $this->hasMany('App\Models\Banking\Transfer'); + } + + public function scopeLatest($query) + { + return $query->orderBy('paid_at', 'desc'); + } +} diff --git a/app/Models/Item/Item.php b/app/Models/Item/Item.php new file mode 100644 index 000000000..a7cc21dd9 --- /dev/null +++ b/app/Models/Item/Item.php @@ -0,0 +1,121 @@ + 10, + 'sku' => 5, + 'description' => 2, + ]; + + public function category() + { + return $this->belongsTo('App\Models\Setting\Category'); + } + + public function taxes() + { + return $this->hasMany('App\Models\Setting\Tax'); + } + + public function bills() + { + return $this->hasMany('App\Models\Expense\Bill'); + } + + public function invoices() + { + return $this->hasMany('App\Models\Income\Invoice'); + } + + public function getConvertedAmount($format = false) + { + return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format); + } + + public function getReverseConvertedAmount($format = false) + { + return $this->reverseConvert($this->amount, $this->currency_code, $this->currency_rate, $format); + } + + /** + * Always return a valid picture when we retrieve it + */ + public function getPictureAttribute($value) + { + if (!empty($value)) { + return $value; + } else { + return 'public/img/akaunting-logo-green.png'; + } + } + + public function canDelete() + { + $error = false; + + $bills = $this->bills(); + if ($bills->count()) { + $error['bills'] = $bills->count(); + } + + $invoices = $this->invoices(); + if ($invoices->count()) { + $error['invoices'] = $invoices->count(); + } + + if ($error) { + return $error; + } + + return true; + } + + public static function getItems($filter_data = array()) + { + if (empty($filter_data)) { + return Item::all(); + } + + $query = Item::select('id as item_id', 'name', 'sale_price', 'purchase_price', 'tax_id'); + + $query->where('quantity', '>', '0'); + + foreach ($filter_data as $key => $value) { + $query->where($key, 'LIKE', "%" . $value . "%"); + } + + return $query->get(); + } +} diff --git a/app/Models/Model.php b/app/Models/Model.php new file mode 100644 index 000000000..47efe52c5 --- /dev/null +++ b/app/Models/Model.php @@ -0,0 +1,107 @@ +belongsTo('App\Models\Company\Company'); + } + + /** + * Define the filter provider globally. + * + * @return ModelFilter + */ + public function modelFilter() + { + // Check if is api or web + if (Request::is('api/*')) { + $arr = array_reverse(explode('\\', explode('@', app()['api.router']->currentRouteAction())[0])); + $folder = $arr[1]; + $file = $arr[0]; + } else { + list($folder, $file) = explode('/', Route::current()->uri()); + } + + if (empty($folder) || empty($file)) { + return $this->provideFilter(); + } + + $class = '\App\Filters\\' . ucfirst($folder) . '\\' . ucfirst($file); + + return $this->provideFilter($class); + } + + /** + * Scope to only include company data. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $company_id + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCompanyId($query, $company_id) + { + return $query->where($this->table . '.company_id', '=', $company_id); + } + + /** + * Scope to get all rows filtered, sorted and paginated. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $sort + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCollect($query, $sort = 'name') + { + $request = request(); + + $input = $request->input(); + $limit = $request->get('limit', setting('general.list_limit', '25')); + + return $this->filter($input)->sortable($sort)->paginate($limit); + } + + /** + * Scope to only include active currencies. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeEnabled($query) + { + return $query->where('enabled', 1); + } +} diff --git a/app/Models/Module/Module.php b/app/Models/Module/Module.php new file mode 100644 index 000000000..9347d0e48 --- /dev/null +++ b/app/Models/Module/Module.php @@ -0,0 +1,20 @@ +hasMany('App\Models\Income\Revenue'); + } + + public function payments() + { + return $this->hasMany('App\Models\Expense\Payment'); + } + + public function items() + { + return $this->hasMany('App\Models\Item\Item'); + } + + public function canDelete() + { + $error = false; + + $items = $this->items(); + if ($items->count()) { + $error['items'] = $items->count(); + } + + $payments = $this->payments(); + if ($payments->count()) { + $error['payments'] = $payments->count(); + } + + $revenues = $this->revenues(); + if ($revenues->count()) { + $error['revenues'] = $revenues->count(); + } + + if ($error) { + return $error; + } + + return true; + } + + /** + * Scope to only include categories of a given type. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param mixed $type + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeType($query, $type) + { + return $query->where('type', $type); + } +} diff --git a/app/Models/Setting/Currency.php b/app/Models/Setting/Currency.php new file mode 100644 index 000000000..b21348a89 --- /dev/null +++ b/app/Models/Setting/Currency.php @@ -0,0 +1,55 @@ +hasMany('App\Models\Banking\Account'); + } + + public function customers() + { + return $this->hasMany('App\Models\Income\Customer'); + } + + public function invoices() + { + return $this->hasMany('App\Models\Income\Invoice', 'code', 'currency_code'); + } + + public function revenues() + { + return $this->hasMany('App\Models\Income\Revenue', 'code', 'currency_code'); + } + + public function bills() + { + return $this->hasMany('App\Models\Expense\Bill', 'code', 'currency_code'); + } + + public function payments() + { + return $this->hasMany('App\Models\Expense\Payment', 'code', 'currency_code'); + } +} diff --git a/app/Models/Setting/Setting.php b/app/Models/Setting/Setting.php new file mode 100644 index 000000000..9844f7cee --- /dev/null +++ b/app/Models/Setting/Setting.php @@ -0,0 +1,59 @@ +get(); + } + + /** + * Global company relation. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function company() + { + return $this->belongsTo('App\Models\Company\Company'); + } + + /** + * Scope to only include company data. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $company_id + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCompanyId($query, $company_id) + { + return $query->where($this->table . '.company_id', '=', $company_id); + } +} diff --git a/app/Models/Setting/Tax.php b/app/Models/Setting/Tax.php new file mode 100644 index 000000000..8dd5fb33e --- /dev/null +++ b/app/Models/Setting/Tax.php @@ -0,0 +1,69 @@ +hasMany('App\Models\Item\Item'); + } + + public function bills() + { + return $this->hasMany('App\Models\Expense\Bill'); + } + + public function invoices() + { + return $this->hasMany('App\Models\Income\Invoice'); + } + + public function canDelete() + { + $error = false; + + $items = $this->items(); + if ($items->count()) { + $error['items'] = $items->count(); + } + + $bills = $this->bills(); + if ($bills->count()) { + $error['bills'] = $bills->count(); + } + + $invoices = $this->invoices(); + if ($invoices->count()) { + $error['invoices'] = $invoices->count(); + } + + if ($error) { + return $error; + } + + return true; + } +} diff --git a/app/Notifications/Auth/Reset.php b/app/Notifications/Auth/Reset.php new file mode 100644 index 000000000..b7587c108 --- /dev/null +++ b/app/Notifications/Auth/Reset.php @@ -0,0 +1,52 @@ +token = $token; + } + + /** + * Get the notification's channels. + * + * @param mixed $notifiable + * @return array|string + */ + public function via($notifiable) + { + return ['mail']; + } + + /** + * Build the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + return (new MailMessage) + ->line('You are receiving this email because we received a password reset request for your account.') + ->action('Reset Password', url('auth/reset', $this->token, true)) + ->line('If you did not request a password reset, no further action is required.'); + } +} diff --git a/app/Notifications/Expense/Bill.php b/app/Notifications/Expense/Bill.php new file mode 100644 index 000000000..0d7df9d83 --- /dev/null +++ b/app/Notifications/Expense/Bill.php @@ -0,0 +1,67 @@ +queue = 'high'; + $this->delay = config('queue.connections.database.delay'); + + $this->bill = $bill; + } + + /** + * Get the notification's channels. + * + * @param mixed $notifiable + * @return array|string + */ + public function via($notifiable) + { + return ['mail', 'database']; + } + + /** + * Build the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + return (new MailMessage) + ->line('You are receiving this email because you have an upcoming ' . money($this->bill->amount, $this->bill->currency_code, true) . ' bill to ' . $this->bill->vendor->name . ' vendor.') + ->action('Add Payment', url('expenses/bills', $this->bill->id, true)); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + 'bill_id' => $this->bill->id, + 'amount' => $this->bill->amount, + ]; + } +} diff --git a/app/Notifications/Income/Invoice.php b/app/Notifications/Income/Invoice.php new file mode 100644 index 000000000..2ca68b092 --- /dev/null +++ b/app/Notifications/Income/Invoice.php @@ -0,0 +1,67 @@ +queue = 'high'; + $this->delay = config('queue.connections.database.delay'); + + $this->invoice = $invoice; + } + + /** + * Get the notification's channels. + * + * @param mixed $notifiable + * @return array|string + */ + public function via($notifiable) + { + return ['mail', 'database']; + } + + /** + * Build the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + return (new MailMessage) + ->line('You are receiving this email because you have an upcoming ' . money($this->invoice->amount, $this->invoice->currency_code, true) . ' invoice to ' . $this->invoice->customer->name . ' customer.') + ->action('Pay Now', url('customers/invoices', $this->invoice->id, true)); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + 'invoice_id' => $this->invoice->id, + 'amount' => $this->invoice->amount, + ]; + } +} diff --git a/app/Observers/Company.php b/app/Observers/Company.php new file mode 100644 index 000000000..00a682483 --- /dev/null +++ b/app/Observers/Company.php @@ -0,0 +1,65 @@ + $company->id + ]); + + // Check if user is logged in + if (!Auth::check()) { + return; + } + + // Attach company to user + Auth::user()->companies()->attach($company->id); + } + + /** + * Listen to the deleted event. + * + * @param Model $company + * @return void + */ + public function deleted(Model $company) + { + $tables = [ + 'accounts', 'bill_histories', 'bill_items', 'bill_payments', 'bill_statuses', 'bills', 'categories', + 'currencies', 'customers', 'invoice_histories', 'invoice_items', 'invoice_payments', 'invoice_statuses', + 'invoices', 'items', 'payments', 'revenues', 'settings', 'taxes', 'transfers', 'vendors', + ]; + + foreach ($tables as $table) { + $this->deleteItems($company, $table); + } + } + + /** + * Delete items in batch. + * + * @param Model $company + * @param $table + * @return void + */ + protected function deleteItems($company, $table) + { + foreach ($company->$table as $item) { + $item->delete(); + } + } +} \ No newline at end of file diff --git a/app/Overrides/Illuminate/MessageSelector.php b/app/Overrides/Illuminate/MessageSelector.php new file mode 100644 index 000000000..d6a91c463 --- /dev/null +++ b/app/Overrides/Illuminate/MessageSelector.php @@ -0,0 +1,241 @@ +extract($segments, $number)) !== null) { + return trim($value); + } + + $segments = $this->stripConditions($segments); + + $pluralIndex = $this->getPluralIndex($locale, $number); + + if (count($segments) == 1 || ! isset($segments[$pluralIndex])) { + return $segments[0]; + } + + return $segments[$pluralIndex]; + } + + /** + * Extract a translation string using inline conditions. + * + * @param array $segments + * @param int $number + * @return mixed + */ + private function extract($segments, $number) + { + foreach ($segments as $part) { + if (! is_null($line = $this->extractFromString($part, $number))) { + return $line; + } + } + } + + /** + * Get the translation string if the condition matches. + * + * @param string $part + * @param int $number + * @return mixed + */ + private function extractFromString($part, $number) + { + preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches); + + if (count($matches) != 3) { + return; + } + + $condition = $matches[1]; + + $value = $matches[2]; + + if (Str::contains($condition, ',')) { + list($from, $to) = explode(',', $condition, 2); + + if ($to == '*' && $number >= $from) { + return $value; + } elseif ($from == '*' && $number <= $to) { + return $value; + } elseif ($number >= $from && $number <= $to) { + return $value; + } + } + + return $condition == $number ? $value : null; + } + + /** + * Strip the inline conditions from each segment, just leaving the text. + * + * @param array $segments + * @return array + */ + private function stripConditions($segments) + { + return collect($segments)->map(function ($part) { + return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part); + })->all(); + } + + /** + * Get the index to use for pluralization. + * + * The plural rules are derived from code of the Zend Framework (2010-09-25), which + * is subject to the new BSD license (http://framework.zend.com/license/new-bsd) + * Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com) + * + * @param string $locale + * @param int $number + * @return int + */ + public function getPluralIndex($locale, $number) + { + $allowed_langs = config('localizer.allowed_langs'); + + switch ($locale) { + case 'az': + case 'bo': + case 'dz': + case 'id': + case 'ja': + case 'jv': + case 'ka': + case 'km': + case 'kn': + case 'ko': + case 'ms': + case 'th': + case 'tr': + case 'vi': + case 'zh': + return 0; + break; + case 'af': + case 'bn': + case 'bg': + case 'ca': + case 'da': + case 'de': + case 'de-DE': + case 'el': + case 'el-GR': + case 'en': + case 'en-AU': + case 'en-GB': + case 'en-US': + case 'eo': + case 'es': + case 'es-ES': + case 'et': + case 'eu': + case 'fa': + case 'fi': + case 'fo': + case 'fur': + case 'fy': + case 'gl': + case 'gu': + case 'ha': + case 'he': + case 'hu': + case 'is': + case 'it': + case 'it-IT': + case 'ku': + case 'lb': + case 'ml': + case 'mn': + case 'mr': + case 'nah': + case 'nb': + case 'ne': + case 'nl': + case 'nn': + case 'no': + case 'om': + case 'or': + case 'pa': + case 'pap': + case 'ps': + case 'pt': + case 'so': + case 'sq': + case 'sv': + case 'sw': + case 'ta': + case 'te': + case 'tk': + case 'tr-TR': + case 'ur': + case 'zu': + return ($number == 1) ? 0 : 1; + case 'am': + case 'bh': + case 'fil': + case 'fr': + case 'fr-FR': + case 'gun': + case 'hi': + case 'hy': + case 'ln': + case 'mg': + case 'nso': + case 'pt-BR': + case 'xbr': + case 'ti': + case 'wa': + return (($number == 0) || ($number == 1)) ? 0 : 1; + case 'be': + case 'bs': + case 'hr': + case 'ru': + case 'sr': + case 'uk': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + case 'cs': + case 'sk': + return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); + case 'ga': + return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); + case 'lt': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + case 'sl': + return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); + case 'mk': + return ($number % 10 == 1) ? 0 : 1; + case 'mt': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); + case 'lv': + return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); + case 'pl': + return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); + case 'cy': + return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); + case 'ro': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); + case 'ar': + return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); + default: + return 0; + } + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php new file mode 100644 index 000000000..5c3cebb3d --- /dev/null +++ b/app/Providers/AppServiceProvider.php @@ -0,0 +1,42 @@ +"; + }); + } + + /** + * Register any application services. + * + * @return void + */ + public function register() + { + if (env('APP_DEBUG')) { + $this->app->register(\Barryvdh\Debugbar\ServiceProvider::class); + } + + if (env('APP_ENV') !== 'production') { + $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); + } + } +} diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php new file mode 100644 index 000000000..9784b1a30 --- /dev/null +++ b/app/Providers/AuthServiceProvider.php @@ -0,0 +1,30 @@ + 'App\Policies\ModelPolicy', + ]; + + /** + * Register any authentication / authorization services. + * + * @return void + */ + public function boot() + { + $this->registerPolicies(); + + // + } +} diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php new file mode 100644 index 000000000..352cce44a --- /dev/null +++ b/app/Providers/BroadcastServiceProvider.php @@ -0,0 +1,21 @@ + [ + 'App\Listeners\EventListener', + ], + 'Illuminate\Auth\Events\Login' => [ + 'App\Listeners\Auth\Login', + ], + 'Illuminate\Auth\Events\Logout' => [ + 'App\Listeners\Auth\Logout', + ], + ]; + + /** + * Register any events for your application. + * + * @return void + */ + public function boot() + { + parent::boot(); + + // + } +} diff --git a/app/Providers/FormServiceProvider.php b/app/Providers/FormServiceProvider.php new file mode 100644 index 000000000..e9c634b85 --- /dev/null +++ b/app/Providers/FormServiceProvider.php @@ -0,0 +1,68 @@ + ['required' => 'required'], 'value' => null, 'col' => 'col-md-6', + ]); + + Form::component('emailGroup', 'partials.form.email_group', [ + 'name', 'text', 'icon', 'attributes' => ['required' => 'required'], 'value' => null, 'col' => 'col-md-6', + ]); + + Form::component('passwordGroup', 'partials.form.password_group', [ + 'name', 'text', 'icon', 'attributes' => ['required' => 'required'], 'value' => null, 'col' => 'col-md-6', + ]); + + Form::component('selectGroup', 'partials.form.select_group', [ + 'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required'], 'col' => 'col-md-6', + ]); + + Form::component('textareaGroup', 'partials.form.textarea_group', [ + 'name', 'text', 'value' => null, 'attributes' => ['rows' => '3'], 'col' => 'col-md-12', + ]); + + Form::component('radioGroup', 'partials.form.radio_group', [ + 'name', 'text', 'enable' => trans('general.yes'), 'disable' => trans('general.no'), 'attributes' => [], 'col' => 'col-md-6', + ]); + + Form::component('checkboxGroup', 'partials.form.checkbox_group', [ + 'name', 'text', 'items' => [], 'value' => 'name', 'id' => 'id', 'attributes' => ['required' => 'required'], 'col' => 'col-md-12', + ]); + + Form::component('fileGroup', 'partials.form.file_group', [ + 'name', 'text', 'attributes' => [], 'col' => 'col-md-6', + ]); + + Form::component('deleteButton', 'partials.form.delete_button', [ + 'item', 'url', 'text' => '', 'value' => 'name', 'id' => 'id', + ]); + + Form::component('saveButtons', 'partials.form.save_buttons', [ + 'cancel', 'col' => 'col-md-12', + ]); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } +} \ No newline at end of file diff --git a/app/Providers/ObserverServiceProvider.php b/app/Providers/ObserverServiceProvider.php new file mode 100644 index 000000000..edb3ad306 --- /dev/null +++ b/app/Providers/ObserverServiceProvider.php @@ -0,0 +1,31 @@ +mapApiRoutes(); + + $this->mapWebRoutes(); + + // + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + * + * @return void + */ + protected function mapWebRoutes() + { + Route::middleware('web') + ->namespace($this->namespace) + ->group(base_path('routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ + protected function mapApiRoutes() + { + Route::prefix('api') + ->middleware('api') + ->namespace($this->namespace) + ->group(base_path('routes/api.php')); + } +} diff --git a/app/Providers/ViewComposerServiceProvider.php b/app/Providers/ViewComposerServiceProvider.php new file mode 100644 index 000000000..fc9574a5e --- /dev/null +++ b/app/Providers/ViewComposerServiceProvider.php @@ -0,0 +1,52 @@ +getTable(); + + // Skip for specific tables + $skip_tables = ['companies', 'jobs', 'migrations', 'notifications', 'permissions', 'role_user', 'roles', 'sessions', 'users']; + if (in_array($table, $skip_tables)) { + return; + } + + // Skip if already exists + if ($this->exists($builder, 'company_id')) { + return; + } + + // Apply company scope + $company_id = session('company_id'); + + $builder->where($table . '.company_id', '=', $company_id); + } + + /** + * Check if scope exists. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @param $column + * @return boolean + */ + protected function exists($builder, $column) + { + $query = $builder->getQuery(); + + foreach ((array) $query->wheres as $key => $where) { + if (empty($where) || empty($where['column'])) { + continue; + } + + if (strstr($where['column'], '.')) { + $whr = explode('.', $where['column']); + + $where['column'] = $whr[1]; + } + + if ($where['column'] != $column) { + continue; + } + + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/app/Traits/Currencies.php b/app/Traits/Currencies.php new file mode 100644 index 000000000..2ddfced25 --- /dev/null +++ b/app/Traits/Currencies.php @@ -0,0 +1,61 @@ +convert($default, $rate)->format(); + } else { + $money = Money::$code($amount)->convert($default, $rate)->getAmount(); + } + + return $money; + } + + public function reverseConvert($amount, $code, $rate, $format = false) + { + $default = setting('general.default_currency', 'USD'); + + $code = new Currency($code); + + if ($format) { + $money = Money::$default($amount, true)->convert($code, $rate)->format(); + } else { + $money = Money::$default($amount)->convert($code, $rate)->getAmount(); + } + + return $money; + } + + public function dynamicConvert($default, $amount, $code, $rate, $format = false) + { + $code = new Currency($code); + + if ($format) { + $money = Money::$default($amount, true)->convert($code, $rate)->format(); + } else { + $money = Money::$default($amount)->convert($code, $rate)->getAmount(); + } + + return $money; + } + + public function getConvertedAmount($format = false) + { + return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format); + } + + public function getDynamicConvertedAmount($format = false) + { + return $this->dynamicConvert($this->default_currency_code, $this->amount, $this->currency_code, $this->currency_rate, $format); + } +} \ No newline at end of file diff --git a/app/Traits/DateTime.php b/app/Traits/DateTime.php new file mode 100644 index 000000000..a22716b5c --- /dev/null +++ b/app/Traits/DateTime.php @@ -0,0 +1,78 @@ + '-', 'slash' => '/', 'dot' => '.', 'comma' => ',', 'space' => ' ']; + + $date_format = setting('general.date_format', 'd F Y'); + $date_separator = $chars[setting('general.date_separator', 'space')]; + + return str_replace(' ', $date_separator, $date_format); + } + + public static function getMonthsOfYear($field) + { + $year = request('year'); + + // Get current year if not set + if (empty($year)) { + $year = Date::now()->year; + } + + $start = Date::parse($year . '-01-01')->format('Y-m-d'); + $end = Date::parse($year . '-12-31')->format('Y-m-d'); + + return static::whereBetween($field, [$start, $end])->get(); + } + + public function getTimezones() + { + // The list of available timezone groups to use. + $use_zones = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'); + + // Get the list of time zones from the server. + $zones = \DateTimeZone::listIdentifiers(); + + // Build the group lists. + foreach ($zones as $zone) { + // Time zones not in a group we will ignore. + if (strpos($zone, '/') === false) { + continue; + } + + // Get the group/locale from the timezone. + list ($group, $locale) = explode('/', $zone, 2); + + // Only use known groups. + if (in_array($group, $use_zones)) { + // Initialize the group if necessary. + if (!isset($groups[$group])) { + $groups[$group] = array(); + } + + // Only add options where a locale exists. + if (!empty($locale)) { + $groups[$group][$zone] = str_replace('_', ' ', $locale); + } + } + } + + // Sort the group lists. + ksort($groups); + + return $groups; + } +} \ No newline at end of file diff --git a/app/Traits/Modules.php b/app/Traits/Modules.php new file mode 100644 index 000000000..b0aa5bb7d --- /dev/null +++ b/app/Traits/Modules.php @@ -0,0 +1,298 @@ +getRemote('modules/items'); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getModule($alias) + { + $response = $this->getRemote('modules/items/' . $alias); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getCategories() + { + $response = $this->getRemote('modules/categories'); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getModulesByCategory($alias) + { + $response = $this->getRemote('modules/categories/' . $alias); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getPaidModules() + { + $response = $this->getRemote('modules/paid'); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getNewModules() + { + $response = $this->getRemote('modules/new'); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getFreeModules() + { + $response = $this->getRemote('modules/free'); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody())->data; + } + + return array(); + } + + public function getCoreVersion() + { + $data['query'] = Info::all(); + + $response = $this->getRemote('core/version', 'GET', $data); + + if ($response->getStatusCode() == 200) { + return $response->json(); + } + + return array(); + } + + public function downloadModule($path) + { + $response = $this->getRemote($path); + + if ($response->getStatusCode() == 200) { + $file = $response->getBody()->getContents(); + + $path = 'temp-' . md5(mt_rand()); + $temp_path = storage_path('app/temp') . '/' . $path; + + $file_path = $temp_path . '/upload.zip'; + + // Create tmp directory + if (!File::isDirectory($temp_path)) { + File::makeDirectory($temp_path); + } + + // Add content to the Zip file + $uploaded = is_int(file_put_contents($file_path, $file)) ? true : false; + + if (!$uploaded) { + return false; + } + + $data = array( + 'path' => $path + ); + + return array( + 'success' => true, + 'errors' => false, + 'data' => $data, + ); + } + + return array( + 'success' => false, + 'errors' => true, + 'data' => null, + ); + } + + public function unzipModule($path) + { + $temp_path = storage_path('app/temp') . '/' . $path; + + $file = $temp_path . '/upload.zip'; + + // Unzip the file + try { + Zipper::make($file)->extractTo($temp_path); + } catch (\RuntimeException $e) { + return array( + 'success' => false, + 'errors' => true, + 'data' => null, + ); + } + + // Remove Zip + Zipper::delete(); + + $data = array( + 'path' => $path + ); + + return array( + 'success' => true, + 'errors' => false, + 'data' => $data, + ); + } + + public function installModule($path) + { + $temp_path = storage_path('app/temp') . '/' . $path; + + $modules_path = base_path() . '/modules'; + + // Create modules directory + if (!File::isDirectory($modules_path)) { + File::makeDirectory($modules_path); + } + + $module = json_decode(file_get_contents($temp_path . '/module.json')); + + $module_path = $modules_path . '/' . $module->name; + + // Create module directory + if (!File::isDirectory($module_path)) { + File::makeDirectory($module_path); + } + + // Move all files/folders from temp path then delete it + File::copyDirectory($temp_path, $module_path); + File::deleteDirectory($temp_path); + + // Update database + Artisan::call('migrate', ['--force' => true]); + + $data = array( + 'path' => $path + ); + + return array( + 'success' => true, + 'installed' => true, + 'errors' => false, + 'data' => $data, + ); + } + + public function uninstallModule($alias) + { + $module = Module::findByAlias($alias); + + $data = array( + 'name' => $module->get('name'), + 'category' => $module->get('category'), + 'version' => $module->get('version'), + ); + + $module->delete(); + + Artisan::call('cache:clear'); + + return array( + 'success' => true, + 'errors' => false, + 'data' => $data + ); + } + + public function enabledModule($alias) + { + $module = Module::findByAlias($alias); + + $data = array( + 'name' => $module->get('name'), + 'category' => $module->get('category'), + 'version' => $module->get('version'), + ); + + $module->enable(); + + Artisan::call('cache:clear'); + + return array( + 'success' => true, + 'errors' => false, + 'data' => $data + ); + } + + public function disabledModule($alias) + { + $module = Module::findByAlias($alias); + + $data = array( + 'name' => $module->get('name'), + 'category' => $module->get('category'), + 'version' => $module->get('version'), + ); + + $module->disable(); + + Artisan::call('cache:clear'); + + return array( + 'success' => true, + 'errors' => false, + 'data' => $data + ); + } + + protected function getRemote($path, $method = 'GET', $data = array()) + { + $base = 'https://akaunting.com/api/'; + + $client = new Client(['verify' => false, 'base_uri' => $base]); + + $headers['headers'] = array( + 'Authorization' => 'Bearer ' . setting('general.api_token'), + 'Accept' => 'application/json', + ); + + $data = array_merge($data, $headers); + + $result = $client->request($method, $path, $data); + + return $result; + } +} diff --git a/app/Traits/SiteApi.php b/app/Traits/SiteApi.php new file mode 100644 index 000000000..9fa60a6b2 --- /dev/null +++ b/app/Traits/SiteApi.php @@ -0,0 +1,27 @@ + false, 'base_uri' => $base]); + + $headers['headers'] = array( + 'Authorization' => 'Bearer ' . setting('general.api_token'), + 'Accept' => 'application/json', + ); + + $data = array_merge($data, $headers); + + $result = $client->get($url, $data); + + return $result; + } +} \ No newline at end of file diff --git a/app/Traits/Uploads.php b/app/Traits/Uploads.php new file mode 100644 index 000000000..66bef03a5 --- /dev/null +++ b/app/Traits/Uploads.php @@ -0,0 +1,26 @@ +isValid()) { + return $path; + } + + if (!$company_id) { + $company_id = session('company_id'); + } + + $file_name = $file->getClientOriginalName(); + + $path = 'storage/app/' . $file->storeAs('uploads/' . $company_id . '/' . $folder, $file_name); + + return $path; + } +} \ No newline at end of file diff --git a/app/Utilities/Info.php b/app/Utilities/Info.php new file mode 100644 index 000000000..72298c544 --- /dev/null +++ b/app/Utilities/Info.php @@ -0,0 +1,44 @@ +count(); + + return $data; + } + + public static function phpVersion() + { + return phpversion(); + } + + public static function mysqlVersion() + { + return DB::selectOne('select version() as mversion')->mversion; + } +} \ No newline at end of file diff --git a/app/Utilities/Modules.php b/app/Utilities/Modules.php new file mode 100644 index 000000000..3f2f6acfd --- /dev/null +++ b/app/Utilities/Modules.php @@ -0,0 +1,49 @@ + $value) { + $sort_order[$key] = $value['order']; + } + + array_multisort($sort_order, SORT_ASC, $methods); + + foreach ($methods as $method) { + $payment_methods[$method['code']] = $method['name']; + } + + Cache::put('payment_methods', $payment_methods, Date::now()->addHour(6)); + + return $payment_methods; + } +} diff --git a/app/Utilities/Updater.php b/app/Utilities/Updater.php new file mode 100644 index 000000000..b2be69b1d --- /dev/null +++ b/app/Utilities/Updater.php @@ -0,0 +1,158 @@ +extractTo($temp_path); + } catch (\RuntimeException $e) { + return false; + } + + // Remove Zip + Zipper::delete(); + + if ($alias == 'core') { + // Move all files/folders from temp path then delete it + File::copyDirectory($temp_path, base_path()); + File::deleteDirectory($temp_path); + + // Update database + Artisan::call('migrate', ['--force' => true]); + + // Check if the file mirror was successful + if (version('short') != $version) { + return false; + } + } else { + $module = Module::get($alias); + $model = Model::where('alias', $alias)->first(); + + // Move all files/folders from temp path then delete it + File::copyDirectory($temp_path, module_path($module->get('name'))); + File::deleteDirectory($temp_path); + + // Update database + Artisan::call('migrate', ['--force' => true]); + + // Add history + ModelHistory::create([ + 'company_id' => session('company_id'), + 'module_id' => $model->id, + 'category' => $module->get('category'), + 'version' => $version, + 'description' => trans('modules.history.updated', ['module' => $module->get('name')]), + ]); + } + + return true; + } + + public static function download($alias, $version) + { + $file = null; + + // Check core first + $info = Info::all(); + + if ($alias == 'core') { + $url = 'core/download/' . $version . '/' . $info['php'] . '/' . $info['mysql']; + } else { + $url = 'modules/items/' . $alias . '/download/' . $version . '/' . $info['akaunting'] . '/' . $info['token']; + } + + $response = static::getRemote($url, ['timeout' => 30, 'referer' => true, 'track_redirects' => true]); + + if ($response->getStatusCode() == 200) { + $file = $response->getBody()->getContents(); + } + + return $file; + } + + public static function all() + { + // Get data from cache + $data = Cache::get('updates'); + + if (!empty($data) || !setting('general.api_token')) { + return $data; + } + + // No data in cache, grab them from remote + $data = array(); + + $modules = Module::all(); + + $versions = Versions::latest($modules); + + foreach ($versions as $alias => $version) { + // Modules come as array + if ($alias == 'core') { + if (version_compare(version('short'), $version) != 0) { + $data['core'] = $version; + } + } else { + $module = Module::get($alias); + + // Up-to-date + if (version_compare($module->get('version'), $version) == 0) { + continue; + } + + $data[$alias] = $version; + } + } + + Cache::put('updates', $data, Date::now()->addHour(6)); + + return $data; + } +} \ No newline at end of file diff --git a/app/Utilities/Versions.php b/app/Utilities/Versions.php new file mode 100644 index 000000000..28820fc8d --- /dev/null +++ b/app/Utilities/Versions.php @@ -0,0 +1,110 @@ + false]); + + $json = $http->get($url, ['timeout' => 30])->getBody()->getContents(); + + if (empty($json)) { + return $output; + } + + $github = new \cebe\markdown\GithubMarkdown(); + + $releases = json_decode($json); + + foreach ($releases as $release) { + if ($release->tag_name <= version('short')) { + continue; + } + + if ($release->prerelease == true) { + continue; + } + + if (empty($release->body)) { + continue; + } + + $output .= '

'.$release->tag_name.'

'; + + // Parse markdown output + $markdown = str_replace('## Changelog', '', $release->body); + + $output .= $github->parse($markdown); + + $output .= '
'; + } + + return $output; + } + + public static function latest($modules = array()) + { + // Get data from cache + $data = Cache::get('versions'); + + if (!empty($data) || !setting('general.api_token')) { + return $data; + } + + $info = Info::all(); + + // No data in cache, grab them from remote + $data = array(); + + // Check core first + $url = 'core/version/' . $info['akaunting'] . '/' . $info['php'] . '/' . $info['mysql'] . '/' . $info['companies']; + + $data['core'] = static::getLatestVersion($url); + + // Then modules + foreach ($modules as $module) { + $alias = $module->get('alias'); + $version = $module->get('version'); + + $url = 'modules/items/' . $alias . '/version/' . $version . '/' . $info['akaunting']; + + $data[$alias] = static::getLatestVersion($url); + } + + Cache::put('versions', $data, Date::now()->addHour(6)); + + return $data; + } + + public static function getLatestVersion($url) + { + $response = static::getRemote($url, ['timeout' => 30, 'referer' => true]); + + if ($response->getStatusCode() == 200) { + $version = json_decode($response->getBody())->data; + + if (is_object($version)) { + $latest = $version->latest; + } else { + $latest = '0.0.0'; + } + } else { + $latest = '0.0.0'; + } + + return $latest; + } +} \ No newline at end of file diff --git a/artisan b/artisan new file mode 100644 index 000000000..df630d0d6 --- /dev/null +++ b/artisan @@ -0,0 +1,51 @@ +#!/usr/bin/env php +make(Illuminate\Contracts\Console\Kernel::class); + +$status = $kernel->handle( + $input = new Symfony\Component\Console\Input\ArgvInput, + new Symfony\Component\Console\Output\ConsoleOutput +); + +/* +|-------------------------------------------------------------------------- +| Shutdown The Application +|-------------------------------------------------------------------------- +| +| Once Artisan has finished running. We will fire off the shutdown events +| so that any final work may be done by the application before we shut +| down the process. This is the last thing to happen to the request. +| +*/ + +$kernel->terminate($input, $status); + +exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php new file mode 100644 index 000000000..f2801adf6 --- /dev/null +++ b/bootstrap/app.php @@ -0,0 +1,55 @@ +singleton( + Illuminate\Contracts\Http\Kernel::class, + App\Http\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); + +/* +|-------------------------------------------------------------------------- +| Return The Application +|-------------------------------------------------------------------------- +| +| This script returns the application instance. The instance is given to +| the calling script so we can separate the building of the instances +| from the actual running of the application and sending responses. +| +*/ + +return $app; diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php new file mode 100644 index 000000000..94adc9977 --- /dev/null +++ b/bootstrap/autoload.php @@ -0,0 +1,17 @@ +=5.6.4", + "akaunting/language": "1.0.*", + "akaunting/setting": "1.0.*", + "akaunting/version": "1.0.*", + "almasaeed2010/adminlte": "2.3.*", + "barryvdh/laravel-debugbar": "2.3.*", + "barryvdh/laravel-dompdf": "0.*", + "barryvdh/laravel-ide-helper": "2.3.*", + "cebe/markdown": "1.1.*", + "chumper/zipper": "v1.0.*", + "cknow/laravel-money": "1.0.*", + "dingo/api": "1.0.0-beta8", + "fzaninotto/faker": "1.6.*", + "guzzlehttp/guzzle": "6.3.*", + "intervention/image": "2.3.*", + "jackiedo/dotenv-editor": "1.*", + "jenssegers/date": "3.2.*", + "laracasts/flash": "3.0.*", + "laravel/framework": "5.4.*", + "laravel/tinker": "~1.0", + "LaravelCollective/html": "5.4.*", + "kyslik/column-sortable": "5.4.*", + "nwidart/laravel-menus": "0.5.*", + "nwidart/laravel-modules": "1.*", + "santigarcor/laratrust": "4.0.*", + "sofa/eloquence": "5.4.*", + "tucker-eric/eloquentfilter": "1.1.*" + }, + "autoload": { + "classmap": [ + "database", + "app/Overrides" + ], + "psr-4": { + "App\\": "app/", + "Modules\\": "modules/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "scripts": { + "post-install-cmd": [ + "composer dump-autoload", + "Illuminate\\Foundation\\ComposerScripts::postInstall", + "php artisan ide-helper:generate", + "php artisan ide-helper:meta", + "php artisan clear-compiled", + "php artisan optimize" + ], + "post-update-cmd": [ + "Illuminate\\Foundation\\ComposerScripts::postUpdate", + "php artisan ide-helper:generate", + "php artisan ide-helper:meta", + "php artisan clear-compiled", + "php artisan optimize" + ], + "post-create-project-cmd": [ + "composer dump-autoload", + "Illuminate\\Foundation\\ComposerScripts::postInstall", + "php artisan ide-helper:generate", + "php artisan ide-helper:meta", + "php artisan clear-compiled", + "php artisan optimize" + ] + }, + "config": { + "preferred-install": "dist" + } +} \ No newline at end of file diff --git a/config/api.php b/config/api.php new file mode 100644 index 000000000..dc23802ce --- /dev/null +++ b/config/api.php @@ -0,0 +1,223 @@ + env('API_STANDARDS_TREE', 'vnd'), + + /* + |-------------------------------------------------------------------------- + | API Subtype + |-------------------------------------------------------------------------- + | + | Your subtype will follow the standards tree you use when used in the + | "Accept" header to negotiate the content type and version. + | + | For example: Accept: application/x.SUBTYPE.v1+json + | + */ + + 'subtype' => env('API_SUBTYPE', 'api'), + + /* + |-------------------------------------------------------------------------- + | Default API Version + |-------------------------------------------------------------------------- + | + | This is the default version when strict mode is disabled and your API + | is accessed via a web browser. It's also used as the default version + | when generating your APIs documentation. + | + */ + + 'version' => env('API_VERSION', 'v1'), + + /* + |-------------------------------------------------------------------------- + | Default API Prefix + |-------------------------------------------------------------------------- + | + | A default prefix to use for your API routes so you don't have to + | specify it for each group. + | + */ + + 'prefix' => env('API_PREFIX', 'api'), + + /* + |-------------------------------------------------------------------------- + | Default API Domain + |-------------------------------------------------------------------------- + | + | A default domain to use for your API routes so you don't have to + | specify it for each group. + | + */ + + 'domain' => env('API_DOMAIN', null), + + /* + |-------------------------------------------------------------------------- + | Name + |-------------------------------------------------------------------------- + | + | When documenting your API using the API Blueprint syntax you can + | configure a default name to avoid having to manually specify + | one when using the command. + | + */ + + 'name' => env('API_NAME', 'Akaunting'), + + /* + |-------------------------------------------------------------------------- + | Conditional Requests + |-------------------------------------------------------------------------- + | + | Globally enable conditional requests so that an ETag header is added to + | any successful response. Subsequent requests will perform a check and + | will return a 304 Not Modified. This can also be enabled or disabled + | on certain groups or routes. + | + */ + + 'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true), + + /* + |-------------------------------------------------------------------------- + | Strict Mode + |-------------------------------------------------------------------------- + | + | Enabling strict mode will require clients to send a valid Accept header + | with every request. This also voids the default API version, meaning + | your API will not be browsable via a web browser. + | + */ + + 'strict' => env('API_STRICT', false), + + /* + |-------------------------------------------------------------------------- + | Debug Mode + |-------------------------------------------------------------------------- + | + | Enabling debug mode will result in error responses caused by thrown + | exceptions to have a "debug" key that will be populated with + | more detailed information on the exception. + | + */ + + 'debug' => env('API_DEBUG', true), + + /* + |-------------------------------------------------------------------------- + | Generic Error Format + |-------------------------------------------------------------------------- + | + | When some HTTP exceptions are not caught and dealt with the API will + | generate a generic error response in the format provided. Any + | keys that aren't replaced with corresponding values will be + | removed from the final response. + | + */ + + 'errorFormat' => [ + 'message' => ':message', + 'errors' => ':errors', + 'code' => ':code', + 'status_code' => ':status_code', + 'debug' => ':debug', + ], + + /* + |-------------------------------------------------------------------------- + | API Middleware + |-------------------------------------------------------------------------- + | + | Middleware that will be applied globally to all API requests. + | + */ + + 'middleware' => [ + + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Providers + |-------------------------------------------------------------------------- + | + | The authentication providers that should be used when attempting to + | authenticate an incoming API request. + | + */ + + 'auth' => [ + 'basic' => 'Dingo\Api\Auth\Provider\Basic', + ], + + /* + |-------------------------------------------------------------------------- + | Throttling / Rate Limiting + |-------------------------------------------------------------------------- + | + | Consumers of your API can be limited to the amount of requests they can + | make. You can create your own throttles or simply change the default + | throttles. + | + */ + + 'throttling' => [ + + ], + + /* + |-------------------------------------------------------------------------- + | Response Transformer + |-------------------------------------------------------------------------- + | + | Responses can be transformed so that they are easier to format. By + | default a Fractal transformer will be used to transform any + | responses prior to formatting. You can easily replace + | this with your own transformer. + | + */ + + 'transformer' => env('API_TRANSFORMER', Dingo\Api\Transformer\Adapter\Fractal::class), + + /* + |-------------------------------------------------------------------------- + | Response Formats + |-------------------------------------------------------------------------- + | + | Responses can be returned in multiple formats by registering different + | response formatters. You can also customize an existing response + | formatter. + | + */ + + 'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'), + + 'formats' => [ + + 'json' => Dingo\Api\Http\Response\Format\Json::class, + + ], + +]; diff --git a/config/app.php b/config/app.php new file mode 100644 index 000000000..1f4658a6e --- /dev/null +++ b/config/app.php @@ -0,0 +1,275 @@ + env('APP_NAME', 'Akaunting'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services your application utilizes. Set this in your ".env" file. + | + */ + + 'env' => env('APP_ENV', 'local'), + + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ + + 'debug' => env('APP_DEBUG', true), + + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ + + 'url' => env('APP_URL', 'http://localhost'), + + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. + | + */ + + 'timezone' => 'UTC', + + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. + | + */ + + 'locale' => 'en-GB', + + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ + + 'fallback_locale' => 'en-GB', + + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encrypter service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ + + 'key' => env('APP_KEY', 'JustAKeyForAkauntingInstallation'), + + 'cipher' => env('APP_CIPHER', 'AES-256-CBC'), + + /* + |-------------------------------------------------------------------------- + | Logging Configuration + |-------------------------------------------------------------------------- + | + | Here you may configure the log settings for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Settings: "single", "daily", "syslog", "errorlog" + | + */ + + 'log' => env('APP_LOG', 'single'), + + 'log_level' => env('APP_LOG_LEVEL', 'debug'), + + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ + + 'providers' => [ + + /* + * Laravel Framework Service Providers... + */ + Illuminate\Auth\AuthServiceProvider::class, + Illuminate\Broadcasting\BroadcastServiceProvider::class, + Illuminate\Bus\BusServiceProvider::class, + Illuminate\Cache\CacheServiceProvider::class, + Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, + Illuminate\Cookie\CookieServiceProvider::class, + Illuminate\Database\DatabaseServiceProvider::class, + Illuminate\Encryption\EncryptionServiceProvider::class, + Illuminate\Filesystem\FilesystemServiceProvider::class, + Illuminate\Foundation\Providers\FoundationServiceProvider::class, + Illuminate\Hashing\HashServiceProvider::class, + Illuminate\Mail\MailServiceProvider::class, + Illuminate\Notifications\NotificationServiceProvider::class, + Illuminate\Pagination\PaginationServiceProvider::class, + Illuminate\Pipeline\PipelineServiceProvider::class, + Illuminate\Queue\QueueServiceProvider::class, + Illuminate\Redis\RedisServiceProvider::class, + Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, + Illuminate\Session\SessionServiceProvider::class, + Illuminate\Translation\TranslationServiceProvider::class, + Illuminate\Validation\ValidationServiceProvider::class, + Illuminate\View\ViewServiceProvider::class, + + /* + * Package Service Providers... + */ + Laravel\Tinker\TinkerServiceProvider::class, + + /* + * Application Service Providers... + */ + App\Providers\AppServiceProvider::class, + App\Providers\AuthServiceProvider::class, + // App\Providers\BroadcastServiceProvider::class, + App\Providers\EventServiceProvider::class, + App\Providers\FormServiceProvider::class, + App\Providers\ObserverServiceProvider::class, + App\Providers\RouteServiceProvider::class, + App\Providers\ViewComposerServiceProvider::class, + + /* + * Vendor Service Providers... + */ + Akaunting\Language\Provider::class, + Akaunting\Setting\Provider::class, + Akaunting\Version\Provider::class, + Barryvdh\DomPDF\ServiceProvider::class, + Chumper\Zipper\ZipperServiceProvider::class, + ClickNow\Money\MoneyServiceProvider::class, + Collective\Html\HtmlServiceProvider::class, + Dingo\Api\Provider\LaravelServiceProvider::class, + EloquentFilter\ServiceProvider::class, + Intervention\Image\ImageServiceProvider::class, + Jackiedo\DotenvEditor\DotenvEditorServiceProvider::class, + Jenssegers\Date\DateServiceProvider::class, + Kyslik\ColumnSortable\ColumnSortableServiceProvider::class, + Laracasts\Flash\FlashServiceProvider::class, + Laratrust\LaratrustServiceProvider::class, + Nwidart\Menus\MenusServiceProvider::class, + Nwidart\Modules\LaravelModulesServiceProvider::class, + Sofa\Eloquence\ServiceProvider::class, + + ], + + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ + + 'aliases' => [ + + 'App' => Illuminate\Support\Facades\App::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Notification' => Illuminate\Support\Facades\Notification::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, + + /* + * Vendor Aliases... + */ + //'Api' => Dingo\Api\Facade\API, + 'Debugbar' => Barryvdh\Debugbar\Facade::class, + 'Date' => Jenssegers\Date\Date::class, + 'DotenvEditor' => Jackiedo\DotenvEditor\Facades\DotenvEditor::class, + 'Form' => Collective\Html\FormFacade::class, + 'Html' => Collective\Html\HtmlFacade::class, + 'Image' => Intervention\Image\Facades\Image::class, + 'Language' => Akaunting\Language\Facade::class, + 'Laratrust' => Laratrust\LaratrustFacade::class, + 'Menu' => Nwidart\Menus\Facades\Menu::class, + 'Module' => Nwidart\Modules\Facades\Module::class, + 'PDF' => Barryvdh\DomPDF\Facade::class, + 'Setting' => Akaunting\Setting\Facade::class, + 'Version' => Akaunting\Version\Facade::class, + 'Zipper' => Chumper\Zipper\Zipper::class, + + ], + +]; diff --git a/config/auth.php b/config/auth.php new file mode 100644 index 000000000..4ca9439bb --- /dev/null +++ b/config/auth.php @@ -0,0 +1,102 @@ + [ + 'guard' => 'web', + 'passwords' => 'users', + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | here which uses session storage and the Eloquent user provider. + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | Supported: "session", "token" + | + */ + + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'users', + ], + + 'api' => [ + 'driver' => 'token', + 'provider' => 'users', + ], + ], + + /* + |-------------------------------------------------------------------------- + | User Providers + |-------------------------------------------------------------------------- + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | If you have multiple user tables or models you may configure multiple + | sources which represent each model / table. These sources may then + | be assigned to any extra authentication guards you have defined. + | + | Supported: "database", "eloquent" + | + */ + + 'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => App\Models\Auth\User::class, + ], + + // 'users' => [ + // 'driver' => 'database', + // 'table' => 'users', + // ], + ], + + /* + |-------------------------------------------------------------------------- + | Resetting Passwords + |-------------------------------------------------------------------------- + | + | You may specify multiple password reset configurations if you have more + | than one user table or model in the application and you want to have + | separate password reset settings based on the specific user types. + | + | The expire time is the number of minutes that the reset token should be + | considered valid. This security feature keeps tokens short-lived so + | they have less time to be guessed. You may change this as needed. + | + */ + + 'passwords' => [ + 'users' => [ + 'provider' => 'users', + 'table' => 'password_resets', + 'expire' => 60, + ], + ], + +]; diff --git a/config/broadcasting.php b/config/broadcasting.php new file mode 100644 index 000000000..5eecd2b26 --- /dev/null +++ b/config/broadcasting.php @@ -0,0 +1,58 @@ + env('BROADCAST_DRIVER', 'null'), + + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over websockets. Samples of + | each available type of connection are provided inside this array. + | + */ + + 'connections' => [ + + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + // + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], + + 'log' => [ + 'driver' => 'log', + ], + + 'null' => [ + 'driver' => 'null', + ], + + ], + +]; diff --git a/config/cache.php b/config/cache.php new file mode 100644 index 000000000..e87f0320f --- /dev/null +++ b/config/cache.php @@ -0,0 +1,91 @@ + env('CACHE_DRIVER', 'file'), + + /* + |-------------------------------------------------------------------------- + | Cache Stores + |-------------------------------------------------------------------------- + | + | Here you may define all of the cache "stores" for your application as + | well as their drivers. You may even define multiple stores for the + | same cache driver to group types of items stored in your caches. + | + */ + + 'stores' => [ + + 'apc' => [ + 'driver' => 'apc', + ], + + 'array' => [ + 'driver' => 'array', + ], + + 'database' => [ + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, + ], + + 'file' => [ + 'driver' => 'file', + 'path' => storage_path('framework/cache/data'), + ], + + 'memcached' => [ + 'driver' => 'memcached', + 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), + 'sasl' => [ + env('MEMCACHED_USERNAME'), + env('MEMCACHED_PASSWORD'), + ], + 'options' => [ + // Memcached::OPT_CONNECT_TIMEOUT => 2000, + ], + 'servers' => [ + [ + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), + 'weight' => 100, + ], + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Cache Key Prefix + |-------------------------------------------------------------------------- + | + | When utilizing a RAM based store such as APC or Memcached, there might + | be other applications utilizing the same cache. So, we'll specify a + | value to get prefixed to all our keys so we can avoid collisions. + | + */ + + 'prefix' => 'laravel', + +]; diff --git a/config/clicknow.money.php b/config/clicknow.money.php new file mode 100644 index 000000000..2bbfda884 --- /dev/null +++ b/config/clicknow.money.php @@ -0,0 +1,1808 @@ + [ + 'name' => 'UAE Dirham', + 'code' => 784, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'د.إ', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'AFN' => [ + 'name' => 'Afghani', + 'code' => 971, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '؋', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ALL' => [ + 'name' => 'Lek', + 'code' => 8, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'L', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'AMD' => [ + 'name' => 'Armenian Dram', + 'code' => 51, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'դր.', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ANG' => [ + 'name' => 'Netherlands Antillean Guilder', + 'code' => 532, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ƒ', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'AOA' => [ + 'name' => 'Kwanza', + 'code' => 973, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Kz', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ARS' => [ + 'name' => 'Argentine Peso', + 'code' => 32, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'AUD' => [ + 'name' => 'Australian Dollar', + 'code' => 36, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'AWG' => [ + 'name' => 'Aruban Florin', + 'code' => 533, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ƒ', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'AZN' => [ + 'name' => 'Azerbaijanian Manat', + 'code' => 944, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₼', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BAM' => [ + 'name' => 'Convertible Mark', + 'code' => 977, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'КМ', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BBD' => [ + 'name' => 'Barbados Dollar', + 'code' => 52, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BDT' => [ + 'name' => 'Taka', + 'code' => 50, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '৳', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BGN' => [ + 'name' => 'Bulgarian Lev', + 'code' => 975, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'лв', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BHD' => [ + 'name' => 'Bahraini Dinar', + 'code' => 48, + 'precision' => 3, + 'subunit' => 1000, + 'symbol' => 'ب.د', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BIF' => [ + 'name' => 'Burundi Franc', + 'code' => 108, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BMD' => [ + 'name' => 'Bermudian Dollar', + 'code' => 60, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BND' => [ + 'name' => 'Brunei Dollar', + 'code' => 96, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BOB' => [ + 'name' => 'Boliviano', + 'code' => 68, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Bs.', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BOV' => [ + 'name' => 'Mvdol', + 'code' => 984, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Bs.', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BRL' => [ + 'name' => 'Brazilian Real', + 'code' => 986, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'R$', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'BSD' => [ + 'name' => 'Bahamian Dollar', + 'code' => 44, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BTN' => [ + 'name' => 'Ngultrum', + 'code' => 64, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Nu.', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BWP' => [ + 'name' => 'Pula', + 'code' => 72, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'P', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'BYR' => [ + 'name' => 'Belarussian Ruble', + 'code' => 974, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Br', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => ' ', + ], + + 'BZD' => [ + 'name' => 'Belize Dollar', + 'code' => 84, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CAD' => [ + 'name' => 'Canadian Dollar', + 'code' => 124, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CDF' => [ + 'name' => 'Congolese Franc', + 'code' => 976, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CHF' => [ + 'name' => 'Swiss Franc', + 'code' => 756, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'CHF', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CLF' => [ + 'name' => 'Unidades de fomento', + 'code' => 990, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'UF', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'CLP' => [ + 'name' => 'Chilean Peso', + 'code' => 152, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'CNY' => [ + 'name' => 'Yuan Renminbi', + 'code' => 156, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '¥', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'COP' => [ + 'name' => 'Colombian Peso', + 'code' => 170, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'CRC' => [ + 'name' => 'Costa Rican Colon', + 'code' => 188, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₡', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'CUC' => [ + 'name' => 'Peso Convertible', + 'code' => 931, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CUP' => [ + 'name' => 'Cuban Peso', + 'code' => 192, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CVE' => [ + 'name' => 'Cape Verde Escudo', + 'code' => 132, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'CZK' => [ + 'name' => 'Czech Koruna', + 'code' => 203, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Kč', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'DJF' => [ + 'name' => 'Djibouti Franc', + 'code' => 262, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fdj', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'DKK' => [ + 'name' => 'Danish Krone', + 'code' => 208, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'kr', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'DOP' => [ + 'name' => 'Dominican Peso', + 'code' => 214, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'DZD' => [ + 'name' => 'Algerian Dinar', + 'code' => 12, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'د.ج', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'EGP' => [ + 'name' => 'Egyptian Pound', + 'code' => 818, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ج.م', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ERN' => [ + 'name' => 'Nakfa', + 'code' => 232, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Nfk', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ETB' => [ + 'name' => 'Ethiopian Birr', + 'code' => 230, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Br', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'EUR' => [ + 'name' => 'Euro', + 'code' => 978, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '€', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'FJD' => [ + 'name' => 'Fiji Dollar', + 'code' => 242, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'FKP' => [ + 'name' => 'Falkland Islands Pound', + 'code' => 238, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GBP' => [ + 'name' => 'Pound Sterling', + 'code' => 826, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GEL' => [ + 'name' => 'Lari', + 'code' => 981, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ლ', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GHS' => [ + 'name' => 'Ghana Cedi', + 'code' => 936, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₵', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GIP' => [ + 'name' => 'Gibraltar Pound', + 'code' => 292, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GMD' => [ + 'name' => 'Dalasi', + 'code' => 270, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'D', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GNF' => [ + 'name' => 'Guinea Franc', + 'code' => 324, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GTQ' => [ + 'name' => 'Quetzal', + 'code' => 320, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Q', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'GYD' => [ + 'name' => 'Guyana Dollar', + 'code' => 328, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'HKD' => [ + 'name' => 'Hong Kong Dollar', + 'code' => 344, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'HNL' => [ + 'name' => 'Lempira', + 'code' => 340, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'L', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'HRK' => [ + 'name' => 'Croatian Kuna', + 'code' => 191, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'kn', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'HTG' => [ + 'name' => 'Gourde', + 'code' => 332, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'G', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'HUF' => [ + 'name' => 'Forint', + 'code' => 348, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Ft', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'IDR' => [ + 'name' => 'Rupiah', + 'code' => 360, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Rp', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'ILS' => [ + 'name' => 'New Israeli Sheqel', + 'code' => 376, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₪', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'INR' => [ + 'name' => 'Indian Rupee', + 'code' => 356, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₹', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'IQD' => [ + 'name' => 'Iraqi Dinar', + 'code' => 368, + 'precision' => 3, + 'subunit' => 1000, + 'symbol' => 'ع.د', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'IRR' => [ + 'name' => 'Iranian Rial', + 'code' => 364, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '﷼', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ISK' => [ + 'name' => 'Iceland Krona', + 'code' => 352, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'kr', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'JMD' => [ + 'name' => 'Jamaican Dollar', + 'code' => 388, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'JOD' => [ + 'name' => 'Jordanian Dinar', + 'code' => 400, + 'precision' => 3, + 'subunit' => 100, + 'symbol' => 'د.ا', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'JPY' => [ + 'name' => 'Yen', + 'code' => 392, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => '¥', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KES' => [ + 'name' => 'Kenyan Shilling', + 'code' => 404, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'KSh', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KGS' => [ + 'name' => 'Som', + 'code' => 417, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'som', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KHR' => [ + 'name' => 'Riel', + 'code' => 116, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '៛', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KMF' => [ + 'name' => 'Comoro Franc', + 'code' => 174, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KPW' => [ + 'name' => 'North Korean Won', + 'code' => 408, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₩', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KRW' => [ + 'name' => 'Won', + 'code' => 410, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => '₩', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KWD' => [ + 'name' => 'Kuwaiti Dinar', + 'code' => 414, + 'precision' => 3, + 'subunit' => 1000, + 'symbol' => 'د.ك', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KYD' => [ + 'name' => 'Cayman Islands Dollar', + 'code' => 136, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'KZT' => [ + 'name' => 'Tenge', + 'code' => 398, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '〒', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LAK' => [ + 'name' => 'Kip', + 'code' => 418, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₭', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LBP' => [ + 'name' => 'Lebanese Pound', + 'code' => 422, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ل.ل', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LKR' => [ + 'name' => 'Sri Lanka Rupee', + 'code' => 144, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₨', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LRD' => [ + 'name' => 'Liberian Dollar', + 'code' => 430, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LSL' => [ + 'name' => 'Loti', + 'code' => 426, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'L', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LTL' => [ + 'name' => 'Lithuanian Litas', + 'code' => 440, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Lt', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LVL' => [ + 'name' => 'Latvian Lats', + 'code' => 428, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Ls', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'LYD' => [ + 'name' => 'Libyan Dinar', + 'code' => 434, + 'precision' => 3, + 'subunit' => 1000, + 'symbol' => 'ل.د', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MAD' => [ + 'name' => 'Moroccan Dirham', + 'code' => 504, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'د.م.', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MDL' => [ + 'name' => 'Moldovan Leu', + 'code' => 498, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'L', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MGA' => [ + 'name' => 'Malagasy Ariary', + 'code' => 969, + 'precision' => 2, + 'subunit' => 5, + 'symbol' => 'Ar', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MKD' => [ + 'name' => 'Denar', + 'code' => 807, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ден', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MMK' => [ + 'name' => 'Kyat', + 'code' => 104, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'K', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MNT' => [ + 'name' => 'Tugrik', + 'code' => 496, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₮', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MOP' => [ + 'name' => 'Pataca', + 'code' => 446, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'P', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MRO' => [ + 'name' => 'Ouguiya', + 'code' => 478, + 'precision' => 2, + 'subunit' => 5, + 'symbol' => 'UM', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MUR' => [ + 'name' => 'Mauritius Rupee', + 'code' => 480, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₨', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MVR' => [ + 'name' => 'Rufiyaa', + 'code' => 462, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'MVR', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MWK' => [ + 'name' => 'Kwacha', + 'code' => 454, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'MK', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MXN' => [ + 'name' => 'Mexican Peso', + 'code' => 484, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MYR' => [ + 'name' => 'Malaysian Ringgit', + 'code' => 458, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'RM', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'MZN' => [ + 'name' => 'Mozambique Metical', + 'code' => 943, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'MTn', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'NAD' => [ + 'name' => 'Namibia Dollar', + 'code' => 516, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'NGN' => [ + 'name' => 'Naira', + 'code' => 566, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₦', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'NIO' => [ + 'name' => 'Cordoba Oro', + 'code' => 558, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'C$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'NOK' => [ + 'name' => 'Norwegian Krone', + 'code' => 578, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'kr', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'NPR' => [ + 'name' => 'Nepalese Rupee', + 'code' => 524, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₨', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'NZD' => [ + 'name' => 'New Zealand Dollar', + 'code' => 554, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'OMR' => [ + 'name' => 'Rial Omani', + 'code' => 512, + 'precision' => 3, + 'subunit' => 1000, + 'symbol' => 'ر.ع.', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'PAB' => [ + 'name' => 'Balboa', + 'code' => 590, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'B/.', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'PEN' => [ + 'name' => 'Nuevo Sol', + 'code' => 604, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'S/.', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'PGK' => [ + 'name' => 'Kina', + 'code' => 598, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'K', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'PHP' => [ + 'name' => 'Philippine Peso', + 'code' => 608, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₱', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'PKR' => [ + 'name' => 'Pakistan Rupee', + 'code' => 586, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₨', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'PLN' => [ + 'name' => 'Zloty', + 'code' => 985, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'zł', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => ' ', + ], + + 'PYG' => [ + 'name' => 'Guarani', + 'code' => 600, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => '₲', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'QAR' => [ + 'name' => 'Qatari Rial', + 'code' => 634, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ر.ق', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'RON' => [ + 'name' => 'New Romanian Leu', + 'code' => 946, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Lei', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'RSD' => [ + 'name' => 'Serbian Dinar', + 'code' => 941, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'РСД', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'RUB' => [ + 'name' => 'Russian Ruble', + 'code' => 643, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₽', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'RWF' => [ + 'name' => 'Rwanda Franc', + 'code' => 646, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'FRw', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SAR' => [ + 'name' => 'Saudi Riyal', + 'code' => 682, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ر.س', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SBD' => [ + 'name' => 'Solomon Islands Dollar', + 'code' => 90, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SCR' => [ + 'name' => 'Seychelles Rupee', + 'code' => 690, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₨', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SDG' => [ + 'name' => 'Sudanese Pound', + 'code' => 938, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SEK' => [ + 'name' => 'Swedish Krona', + 'code' => 752, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'kr', + 'symbol_first' => false, + 'decimal_mark' => ',', + 'thousands_separator' => ' ', + ], + + 'SGD' => [ + 'name' => 'Singapore Dollar', + 'code' => 702, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SHP' => [ + 'name' => 'Saint Helena Pound', + 'code' => 654, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SLL' => [ + 'name' => 'Leone', + 'code' => 694, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Le', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SOS' => [ + 'name' => 'Somali Shilling', + 'code' => 706, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Sh', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SRD' => [ + 'name' => 'Surinam Dollar', + 'code' => 968, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SSP' => [ + 'name' => 'South Sudanese Pound', + 'code' => 728, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'STD' => [ + 'name' => 'Dobra', + 'code' => 678, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Db', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SVC' => [ + 'name' => 'El Salvador Colon', + 'code' => 222, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₡', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SYP' => [ + 'name' => 'Syrian Pound', + 'code' => 760, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '£S', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'SZL' => [ + 'name' => 'Lilangeni', + 'code' => 748, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'E', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'THB' => [ + 'name' => 'Baht', + 'code' => 764, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '฿', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TJS' => [ + 'name' => 'Somoni', + 'code' => 972, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ЅМ', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TMT' => [ + 'name' => 'Turkmenistan New Manat', + 'code' => 934, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'T', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TND' => [ + 'name' => 'Tunisian Dinar', + 'code' => 788, + 'precision' => 3, + 'subunit' => 1000, + 'symbol' => 'د.ت', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TOP' => [ + 'name' => 'Pa’anga', + 'code' => 776, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'T$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TRY' => [ + 'name' => 'Turkish Lira', + 'code' => 949, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₺', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'TTD' => [ + 'name' => 'Trinidad and Tobago Dollar', + 'code' => 780, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TWD' => [ + 'name' => 'New Taiwan Dollar', + 'code' => 901, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'TZS' => [ + 'name' => 'Tanzanian Shilling', + 'code' => 834, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Sh', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'UAH' => [ + 'name' => 'Hryvnia', + 'code' => 980, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '₴', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'UGX' => [ + 'name' => 'Uganda Shilling', + 'code' => 800, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'USh', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'USD' => [ + 'name' => 'US Dollar', + 'code' => 840, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'UYU' => [ + 'name' => 'Peso Uruguayo', + 'code' => 858, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'UZS' => [ + 'name' => 'Uzbekistan Sum', + 'code' => 860, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => null, + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'VEF' => [ + 'name' => 'Bolivar', + 'code' => 937, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'Bs F', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'VND' => [ + 'name' => 'Dong', + 'code' => 704, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => '₫', + 'symbol_first' => true, + 'decimal_mark' => ',', + 'thousands_separator' => '.', + ], + + 'VUV' => [ + 'name' => 'Vatu', + 'code' => 548, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Vt', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'WST' => [ + 'name' => 'Tala', + 'code' => 882, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'T', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XAF' => [ + 'name' => 'CFA Franc BEAC', + 'code' => 950, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XAG' => [ + 'name' => 'Silver', + 'code' => 961, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'oz t', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XAU' => [ + 'name' => 'Gold', + 'code' => 959, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'oz t', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XCD' => [ + 'name' => 'East Caribbean Dollar', + 'code' => 951, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XDR' => [ + 'name' => 'SDR (Special Drawing Right)', + 'code' => 960, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'SDR', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XOF' => [ + 'name' => 'CFA Franc BCEAO', + 'code' => 952, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'XPF' => [ + 'name' => 'CFP Franc', + 'code' => 953, + 'precision' => 0, + 'subunit' => 1, + 'symbol' => 'Fr', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'YER' => [ + 'name' => 'Yemeni Rial', + 'code' => 886, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '﷼', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ZAR' => [ + 'name' => 'Rand', + 'code' => 710, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'R', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ZMW' => [ + 'name' => 'Zambian Kwacha', + 'code' => 967, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => 'ZK', + 'symbol_first' => false, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], + + 'ZWL' => [ + 'name' => 'Zimbabwe Dollar', + 'code' => 932, + 'precision' => 2, + 'subunit' => 100, + 'symbol' => '$', + 'symbol_first' => true, + 'decimal_mark' => '.', + 'thousands_separator' => ',', + ], +]; diff --git a/config/columnsortable.php b/config/columnsortable.php new file mode 100644 index 000000000..6df10d541 --- /dev/null +++ b/config/columnsortable.php @@ -0,0 +1,89 @@ + [ + 'alpha' => [ + 'rows' => ['name', 'customer_name', 'vendor_name', 'display_name', 'company_name', 'domain', 'email', 'description', 'code', 'type', 'status', 'vendor', 'account'], + 'class' => 'fa fa-sort-alpha', + ], + 'amount' => [ + 'rows' => ['amount', 'price', 'sale_price', 'purchase_price', 'total_price', 'current_balance', 'total_price', 'opening_balance'], + 'class' => 'fa fa-sort-amount' + ], + 'numeric' => [ + 'rows' => ['created_at', 'updated_at', 'paid_at', 'invoiced_at', 'due_at', 'id', 'quantity', 'rate', 'number', 'invoice_number', 'bill_number'], + 'class' => 'fa fa-sort-numeric' + ], + ], + + /* + defines icon set to use when sorted data is none above (alpha nor amount nor numeric) + */ + 'default_icon_set' => 'fa fa-long-arrow-down sort-icon', + + /* + icon that shows when generating sortable link while column is not sorted + */ + 'sortable_icon' => 'fa fa-long-arrow-down sort-icon', + + /* + generated icon is clickable non-clickable (default) + */ + 'clickable_icon' => false, + + /* + icon and text separator (any string) + in case of 'clickable_icon' => true; separator creates possibility to style icon and anchor-text properly + */ + 'icon_text_separator' => '  ', + + /* + suffix class that is appended when ascending order is applied + */ + 'asc_suffix' => '-asc', + + /* + suffix class that is appended when descending order is applied + */ + 'desc_suffix' => '-desc', + + /* + default anchor class, if value is null none is added + */ + 'anchor_class' => null, + + /* + relation - column separator ex: detail.phone_number means relation "detail" and column "phone_number" + */ + 'uri_relation_column_separator' => '.', + + /* + formatting function applied to name of column, use null to turn formatting off + */ + 'formatting_function' => 'ucfirst', + + /* + inject title parameter in query strings, use null to turn injection off + example: 'inject_title' => 't' will result in ..user/?t="formatted title of sorted column" + */ + 'inject_title_as' => null, + + /* + allow request modification, when default sorting is set but is not in URI (first load) + */ + 'allow_request_modification' => true, + + /* + default order for: $user->sortable('id') usage + */ + 'default_direction' => 'asc', + + /* + default order for non-sorted columns + */ + 'default_direction_unsorted' => 'asc' +]; diff --git a/config/database.php b/config/database.php new file mode 100644 index 000000000..de9839e3f --- /dev/null +++ b/config/database.php @@ -0,0 +1,118 @@ + env('DB_CONNECTION', 'mysql'), + + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ + + 'connections' => [ + + 'sqlite' => [ + 'driver' => 'sqlite', + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => env('DB_PREFIX', 'ak_'), + ], + + 'mysql' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => env('DB_PREFIX', 'ak_'), + 'strict' => true, + 'engine' => null, + 'modes' => [ + //'ONLY_FULL_GROUP_BY', // conflicts with eloquence + 'STRICT_TRANS_TABLES', + 'NO_ZERO_IN_DATE', + 'NO_ZERO_DATE', + 'ERROR_FOR_DIVISION_BY_ZERO', + 'NO_AUTO_CREATE_USER', + 'NO_ENGINE_SUBSTITUTION', + ], + ], + + 'pgsql' => [ + 'driver' => 'pgsql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => env('DB_PREFIX', 'ak_'), + 'schema' => 'public', + 'sslmode' => 'prefer', + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ + + 'migrations' => 'migrations', + + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer set of commands than a typical key-value systems + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ + + 'redis' => [ + + 'client' => 'predis', + + 'default' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => 0, + ], + + ], + +]; diff --git a/config/debugbar.php b/config/debugbar.php new file mode 100644 index 000000000..b343d32a4 --- /dev/null +++ b/config/debugbar.php @@ -0,0 +1,170 @@ + true, + + /* + |-------------------------------------------------------------------------- + | Storage settings + |-------------------------------------------------------------------------- + | + | DebugBar stores data for session/ajax requests. + | You can disable this, so the debugbar stores data in headers/session, + | but this can cause problems with large data collectors. + | By default, file storage (in the storage folder) is used. Redis and PDO + | can also be used. For PDO, run the package migrations first. + | + */ + 'storage' => [ + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo, custom + 'path' => storage_path('debugbar'), // For file driver + 'connection' => null, // Leave null for default connection (Redis/PDO) + 'provider' => '' // Instance of StorageInterface for custom driver + ], + + /* + |-------------------------------------------------------------------------- + | Vendors + |-------------------------------------------------------------------------- + | + | Vendor files are included by default, but can be set to false. + | This can also be set to 'js' or 'css', to only include javascript or css vendor files. + | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) + | and for js: jquery and and highlight.js + | So if you want syntax highlighting, set it to true. + | jQuery is set to not conflict with existing jQuery scripts. + | + */ + + 'include_vendors' => true, + + /* + |-------------------------------------------------------------------------- + | Capture Ajax Requests + |-------------------------------------------------------------------------- + | + | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), + | you can use this option to disable sending the data through the headers. + | + */ + + 'capture_ajax' => true, + + /* + |-------------------------------------------------------------------------- + | Clockwork integration + |-------------------------------------------------------------------------- + | + | The Debugbar can emulate the Clockwork headers, so you can use the Chrome + | Extension, without the server-side code. It uses Debugbar collectors instead. + | + */ + 'clockwork' => false, + + /* + |-------------------------------------------------------------------------- + | DataCollectors + |-------------------------------------------------------------------------- + | + | Enable/disable DataCollectors + | + */ + + 'collectors' => [ + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired + 'default_request' => false, // Regular or special Symfony request logger + 'symfony_request' => true, // Only one can be enabled.. + 'mail' => true, // Catch mail messages + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'auth' => false, // Display Laravel authentication status + 'gate' => false, // Display Laravel Gate checks + 'session' => true, // Display session data + ], + + /* + |-------------------------------------------------------------------------- + | Extra options + |-------------------------------------------------------------------------- + | + | Configure some DataCollectors + | + */ + + 'options' => [ + 'auth' => [ + 'show_name' => false, // Also show the users name/email in the debugbar + ], + 'db' => [ + 'with_params' => true, // Render SQL with the parameters substituted + 'timeline' => false, // Add the queries to the timeline + 'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files. + 'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries + 'enabled' => false, + 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+ + ], + 'hints' => true, // Show hints for common mistakes + ], + 'mail' => [ + 'full_log' => false + ], + 'views' => [ + 'data' => false, //Note: Can slow down the application, because the data can be quite large.. + ], + 'route' => [ + 'label' => true // show complete route on bar + ], + 'logs' => [ + 'file' => null + ], + ], + + /* + |-------------------------------------------------------------------------- + | Inject Debugbar in Response + |-------------------------------------------------------------------------- + | + | Usually, the debugbar is added just before , by listening to the + | Response after the App is done. If you disable this, you have to add them + | in your template yourself. See http://phpdebugbar.com/docs/rendering.html + | + */ + + 'inject' => true, + + /* + |-------------------------------------------------------------------------- + | DebugBar route prefix + |-------------------------------------------------------------------------- + | + | Sometimes you want to set route prefix to be used by DebugBar to load + | its resources from. Usually the need comes from misconfigured web server or + | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97 + | + */ + 'route_prefix' => '_debugbar', + +]; diff --git a/config/dotenv-editor.php b/config/dotenv-editor.php new file mode 100644 index 000000000..c631842f8 --- /dev/null +++ b/config/dotenv-editor.php @@ -0,0 +1,27 @@ + false, + + /* + |---------------------------------------------------------------------- + | Backup location + |---------------------------------------------------------------------- + | + | This value is used when you backup your file. This value is the sub + | path from root folder of project application. + */ + + 'backupPath' => base_path('storage/dotenv-editor/backups/') + +); diff --git a/config/eloquentfilter.php b/config/eloquentfilter.php new file mode 100644 index 000000000..030277d5f --- /dev/null +++ b/config/eloquentfilter.php @@ -0,0 +1,16 @@ + 'App\\Filters\\', + +]; diff --git a/config/filesystems.php b/config/filesystems.php new file mode 100644 index 000000000..f59cf9e99 --- /dev/null +++ b/config/filesystems.php @@ -0,0 +1,68 @@ + 'local', + + /* + |-------------------------------------------------------------------------- + | Default Cloud Filesystem Disk + |-------------------------------------------------------------------------- + | + | Many applications store files both locally and in the cloud. For this + | reason, you may specify a default "cloud" driver here. This driver + | will be bound as the Cloud disk implementation in the container. + | + */ + + 'cloud' => 's3', + + /* + |-------------------------------------------------------------------------- + | Filesystem Disks + |-------------------------------------------------------------------------- + | + | Here you may configure as many filesystem "disks" as you wish, and you + | may even configure multiple disks of the same driver. Defaults have + | been setup for each driver as an example of the required options. + | + | Supported Drivers: "local", "ftp", "s3", "rackspace" + | + */ + + 'disks' => [ + + 'local' => [ + 'driver' => 'local', + 'root' => storage_path('app'), + ], + + 'public' => [ + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', + 'visibility' => 'public', + ], + + 's3' => [ + 'driver' => 's3', + 'key' => env('AWS_KEY'), + 'secret' => env('AWS_SECRET'), + 'region' => env('AWS_REGION'), + 'bucket' => env('AWS_BUCKET'), + ], + + ], + +]; diff --git a/config/ide-helper.php b/config/ide-helper.php new file mode 100644 index 000000000..5350f3af0 --- /dev/null +++ b/config/ide-helper.php @@ -0,0 +1,168 @@ + '_ide_helper', + 'format' => 'php', + + /* + |-------------------------------------------------------------------------- + | Fluent helpers + |-------------------------------------------------------------------------- + | + | Set to true to generate commonly used Fluent methods + | + */ + + 'include_fluent' => false, + + /* + |-------------------------------------------------------------------------- + | Helper files to include + |-------------------------------------------------------------------------- + | + | Include helper files. By default not included, but can be toggled with the + | -- helpers (-H) option. Extra helper files can be included. + | + */ + + 'include_helpers' => false, + + 'helper_files' => array( + base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php', + ), + + /* + |-------------------------------------------------------------------------- + | Model locations to include + |-------------------------------------------------------------------------- + | + | Define in which directories the ide-helper:models command should look + | for models. + | + */ + + 'model_locations' => array( + 'app', + ), + + + /* + |-------------------------------------------------------------------------- + | Extra classes + |-------------------------------------------------------------------------- + | + | These implementations are not really extended, but called with magic functions + | + */ + + 'extra' => array( + 'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'), + 'Session' => array('Illuminate\Session\Store'), + ), + + 'magic' => array( + 'Log' => array( + 'debug' => 'Monolog\Logger::addDebug', + 'info' => 'Monolog\Logger::addInfo', + 'notice' => 'Monolog\Logger::addNotice', + 'warning' => 'Monolog\Logger::addWarning', + 'error' => 'Monolog\Logger::addError', + 'critical' => 'Monolog\Logger::addCritical', + 'alert' => 'Monolog\Logger::addAlert', + 'emergency' => 'Monolog\Logger::addEmergency', + ) + ), + + /* + |-------------------------------------------------------------------------- + | Interface implementations + |-------------------------------------------------------------------------- + | + | These interfaces will be replaced with the implementing class. Some interfaces + | are detected by the helpers, others can be listed below. + | + */ + + 'interfaces' => array( + + ), + + /* + |-------------------------------------------------------------------------- + | Support for custom DB types + |-------------------------------------------------------------------------- + | + | This setting allow you to map any custom database type (that you may have + | created using CREATE TYPE statement or imported using database plugin + | / extension to a Doctrine type. + | + | Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are: + | 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql' + | + | This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant + | + | The value of the array is an array of type mappings. Key is the name of the custom type, + | (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in + | our case it is 'json_array'. Doctrine types are listed here: + | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html + | + | So to support jsonb in your models when working with Postgres, just add the following entry to the array below: + | + | "postgresql" => array( + | "jsonb" => "json_array", + | ), + | + */ + 'custom_db_types' => array( + + ), + + /* + |-------------------------------------------------------------------------- + | Support for camel cased models + |-------------------------------------------------------------------------- + | + | There are some Laravel packages (such as Eloquence) that allow for accessing + | Eloquent model properties via camel case, instead of snake case. + | + | Enabling this option will support these packages by saving all model + | properties as camel case, instead of snake case. + | + | For example, normally you would see this: + | + | * @property \Carbon\Carbon $created_at + | * @property \Carbon\Carbon $updated_at + | + | With this enabled, the properties will be this: + | + | * @property \Carbon\Carbon $createdAt + | * @property \Carbon\Carbon $updatedAt + | + | Note, it is currently an all-or-nothing option. + | + */ + 'model_camel_case_properties' => false, + + /* + |-------------------------------------------------------------------------- + | Property Casts + |-------------------------------------------------------------------------- + | + | Cast the given "real type" to the given "type". + | + */ + 'type_overrides' => array( + 'integer' => 'int', + 'boolean' => 'bool', + ), +); diff --git a/config/image.php b/config/image.php new file mode 100644 index 000000000..b106809e2 --- /dev/null +++ b/config/image.php @@ -0,0 +1,20 @@ + 'gd' + +); diff --git a/config/language.php b/config/language.php new file mode 100644 index 000000000..d9483b8c9 --- /dev/null +++ b/config/language.php @@ -0,0 +1,175 @@ + true, + + /* + |-------------------------------------------------------------------------- + | Enable Language Home Route + |-------------------------------------------------------------------------- + | + | This option enable language route to set language and return + | to url('/') + | + */ + 'home' => true, + + /* + |-------------------------------------------------------------------------- + | Carbon Language + |-------------------------------------------------------------------------- + | + | This option the language of carbon library. + | + */ + 'carbon' => true, + + /* + |-------------------------------------------------------------------------- + | Date Language + |-------------------------------------------------------------------------- + | + | This option the language of jenssegers/date library. + | + */ + 'date' => true, + + /* + |-------------------------------------------------------------------------- + | Auto Change Language + |-------------------------------------------------------------------------- + | + | This option allows to change website language to user's + | browser language. + | + */ + 'auto' => true, + + /* + |-------------------------------------------------------------------------- + | Routes Prefix + |-------------------------------------------------------------------------- + | + | This option indicates the prefix for language routes. + | + */ + 'prefix' => 'languages', + + /* + |-------------------------------------------------------------------------- + | Middleware + |-------------------------------------------------------------------------- + | + | This option indicates the middleware to change language. + | + */ + 'middleware' => 'Akaunting\Language\Middleware\SetLocale', + + /* + |-------------------------------------------------------------------------- + | Controller + |-------------------------------------------------------------------------- + | + | This option indicates the controller to be used. + | + */ + 'controller' => 'Akaunting\Language\Controllers\Language', + + /* + |-------------------------------------------------------------------------- + | Flags + |-------------------------------------------------------------------------- + | + | This option indicates the flags features. + | + */ + + 'flags' => ['width' => '22px', 'ul_class' => 'menu', 'li_class' => '', 'img_class' => ''], + + /* + |-------------------------------------------------------------------------- + | Language code mode + |-------------------------------------------------------------------------- + | + | This option indicates the language code to be used, short or long + | + */ + + 'mode' => ['code' => 'long', 'name' => 'native'], + + /* + |-------------------------------------------------------------------------- + | Allowed languages + |-------------------------------------------------------------------------- + | + | This options indicates the allowed languages. + | + */ + + 'allowed' => ['en-GB', 'tr-TR'], + + /* + |-------------------------------------------------------------------------- + | All languages + |-------------------------------------------------------------------------- + | + | This option indicates the language codes and names. + | + */ + + 'all' => [ + ['short' => 'ar', 'long' => 'ar-SA', 'english' => 'Arabic', 'native' => 'العربية'], + ['short' => 'bg', 'long' => 'bg-BG', 'english' => 'Bulgarian', 'native' => 'български'], + ['short' => 'bn', 'long' => 'bn-BD', 'english' => 'Bengali', 'native' => 'বাংলা'], + ['short' => 'cn', 'long' => 'zh-CN', 'english' => 'Chinese (S)', 'native' => '简体中文'], + ['short' => 'cs', 'long' => 'cs-CZ', 'english' => 'Czech', 'native' => 'Čeština'], + ['short' => 'da', 'long' => 'da-DK', 'english' => 'Danish', 'native' => 'Dansk'], + ['short' => 'de', 'long' => 'de-DE', 'english' => 'German', 'native' => 'Deutsch'], + ['short' => 'de', 'long' => 'de-AT', 'english' => 'Austrian', 'native' => 'Österreichisches Deutsch'], + ['short' => 'fi', 'long' => 'fi-FI', 'english' => 'Finnish', 'native' => 'Suomi'], + ['short' => 'fr', 'long' => 'fr-FR', 'english' => 'French', 'native' => 'Français'], + ['short' => 'el', 'long' => 'el-GR', 'english' => 'Greek', 'native' => 'Ελληνικά'], + ['short' => 'en', 'long' => 'en-AU', 'english' => 'English (AU)', 'native' => 'English (AU)'], + ['short' => 'en', 'long' => 'en-CA', 'english' => 'English (CA)', 'native' => 'English (CA)'], + ['short' => 'en', 'long' => 'en-GB', 'english' => 'English (GB)', 'native' => 'English (GB)'], + ['short' => 'en', 'long' => 'en-US', 'english' => 'English (US)', 'native' => 'English (US)'], + ['short' => 'es', 'long' => 'es-ES', 'english' => 'Spanish', 'native' => 'Español'], + ['short' => 'et', 'long' => 'et-EE', 'english' => 'Estonian', 'native' => 'Eesti'], + ['short' => 'he', 'long' => 'he-IL', 'english' => 'Hebrew', 'native' => 'עִבְרִית'], + ['short' => 'hi', 'long' => 'hi-IN', 'english' => 'Hindi', 'native' => 'हिन्दी'], + ['short' => 'hr', 'long' => 'hr-HR', 'english' => 'Croatian', 'native' => 'Hrvatski'], + ['short' => 'hu', 'long' => 'hu-HU', 'english' => 'Hungarian', 'native' => 'Magyar'], + ['short' => 'hy', 'long' => 'hy-AM', 'english' => 'Armenian', 'native' => 'Հայերեն'], + ['short' => 'id', 'long' => 'id-ID', 'english' => 'Indonesian', 'native' => 'Bahasa Indonesia'], + ['short' => 'it', 'long' => 'it-IT', 'english' => 'Italian', 'native' => 'Italiano'], + ['short' => 'ir', 'long' => 'fa-IR', 'english' => 'Persian', 'native' => 'فارسی'], + ['short' => 'lt', 'long' => 'lt-LT', 'english' => 'Lithuanian', 'native' => 'Lietuvių'], + ['short' => 'jp', 'long' => 'ja-JP', 'english' => 'Japanese', 'native' => '日本語'], + ['short' => 'ko', 'long' => 'ko-KR', 'english' => 'Korean', 'native' => '한국어'], + ['short' => 'ms', 'long' => 'ms-MY', 'english' => 'Malay', 'native' => 'Bahasa Melayu'], + ['short' => 'mx', 'long' => 'es-MX', 'english' => 'Mexico', 'native' => 'Español de México'], + ['short' => 'nb', 'long' => 'nb-NO', 'english' => 'Norwegian', 'native' => 'Norsk Bokmål'], + ['short' => 'nl', 'long' => 'nl-NL', 'english' => 'Dutch', 'native' => 'Nederlands'], + ['short' => 'pl', 'long' => 'pl-PL', 'english' => 'Polish', 'native' => 'Polski'], + ['short' => 'pt-BR', 'long' => 'pt-BR', 'english' => 'Brazilian', 'native' => 'Português do Brasil'], + ['short' => 'pt', 'long' => 'pt-PT', 'english' => 'Portuguese', 'native' => 'Português'], + ['short' => 'ro', 'long' => 'ro-RO', 'english' => 'Romanian', 'native' => 'Română'], + ['short' => 'ru', 'long' => 'ru-RU', 'english' => 'Russian', 'native' => 'Русский'], + ['short' => 'sq', 'long' => 'sq-AL', 'english' => 'Albanian', 'native' => 'Shqip'], + ['short' => 'sv', 'long' => 'sv-SE', 'english' => 'Swedish', 'native' => 'Svenska'], + ['short' => 'th', 'long' => 'th-TH', 'english' => 'Thai', 'native' => 'ไทย'], + ['short' => 'tr', 'long' => 'tr-TR', 'english' => 'Turkish', 'native' => 'Türkçe'], + ['short' => 'tw', 'long' => 'zh-TW', 'english' => 'Chinese (T)', 'native' => '繁體中文'], + ['short' => 'uk', 'long' => 'uk-UA', 'english' => 'Ukrainian', 'native' => 'Українська'], + ['short' => 'vn', 'long' => 'vi-VN', 'english' => 'Vietnamese', 'native' => 'Tiếng Việt'], + ], +]; diff --git a/config/laratrust.php b/config/laratrust.php new file mode 100644 index 000000000..f6c322f55 --- /dev/null +++ b/config/laratrust.php @@ -0,0 +1,182 @@ + true, + + /* + |-------------------------------------------------------------------------- + | Use teams feature in the package + |-------------------------------------------------------------------------- + | + | Defines if Laratrust will use the teams feature. + | Please check the docs to see what you need to do in case you have the package already configured. + | + */ + 'use_teams' => false, + + /* + |-------------------------------------------------------------------------- + | Laratrust User Models + |-------------------------------------------------------------------------- + | + | This is the array that contains the information of the user models. + | This information is used in the add-trait command, and for the roles and + | permissions relationships with the possible user models. + | + | The key in the array is the name of the relationship inside the roles and permissions. + | + */ + 'user_models' => [ + 'users' => 'App\Models\Auth\User', + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Models + |-------------------------------------------------------------------------- + | + | These are the models used by Laratrust to define the roles, permissions and teams. + | If you want the Laratrust models to be in a different namespace or + | to have a different name, you can do it here. + | + */ + 'models' => [ + /** + * Role model + */ + 'role' => 'App\Models\Auth\Role', + + /** + * Permission model + */ + 'permission' => 'App\Models\Auth\Permission', + + /** + * Team model + */ + 'team' => 'App\Models\Auth\Team', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Tables + |-------------------------------------------------------------------------- + | + | These are the tables used by Laratrust to store all the authorization data. + | + */ + 'tables' => [ + /** + * Roles table. + */ + 'roles' => 'roles', + + /** + * Permissions table. + */ + 'permissions' => 'permissions', + + /** + * Teams table. + */ + 'teams' => 'teams', + + /** + * Role - User intermediate table. + */ + 'role_user' => 'user_roles', + + /** + * Permission - User intermediate table. + */ + 'permission_user' => 'user_permissions', + + /** + * Permission - Role intermediate table. + */ + 'permission_role' => 'role_permissions', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Foreign Keys + |-------------------------------------------------------------------------- + | + | These are the foreign keys used by laratrust in the intermediate tables. + | + */ + 'foreign_keys' => [ + /** + * User foreign key on Laratrust's role_user and permission_user tables. + */ + 'user' => 'user_id', + + /** + * Role foreign key on Laratrust's role_user and permission_role tables. + */ + 'role' => 'role_id', + + /** + * Role foreign key on Laratrust's permission_user and permission_role tables. + */ + 'permission' => 'permission_id', + + /** + * Role foreign key on Laratrust's role_user and permission_user tables. + */ + 'team' => 'team_id', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Middleware + |-------------------------------------------------------------------------- + | + | This configuration helps to customize the Laratrust middlewares behavior. + | + */ + 'middleware' => [ + /** + * Method to be called in the middleware return case. + * Available: abort|redirect + */ + 'handling' => 'redirect', + + /** + * Parameter passed to the middleware_handling method + */ + 'params' => 'auth/login', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Magic 'can' Method + |-------------------------------------------------------------------------- + | + | Supported cases for the magic can method (Refer to the docs). + | Available: camel_case|snake_case|kebab_case + | + */ + 'magic_can_method_case' => 'kebab_case', +]; diff --git a/config/mail.php b/config/mail.php new file mode 100644 index 000000000..81b215a88 --- /dev/null +++ b/config/mail.php @@ -0,0 +1,123 @@ + env('MAIL_DRIVER', 'mail'), + + /* + |-------------------------------------------------------------------------- + | SMTP Host Address + |-------------------------------------------------------------------------- + | + | Here you may provide the host address of the SMTP server used by your + | applications. A default option is provided that is compatible with + | the Mailgun mail service which will provide reliable deliveries. + | + */ + + 'host' => env('MAIL_HOST', 'localhost'), + + /* + |-------------------------------------------------------------------------- + | SMTP Host Port + |-------------------------------------------------------------------------- + | + | This is the SMTP port used by your application to deliver e-mails to + | users of the application. Like the host we have set this value to + | stay compatible with the Mailgun e-mail application by default. + | + */ + + 'port' => env('MAIL_PORT', 587), + + /* + |-------------------------------------------------------------------------- + | Global "From" Address + |-------------------------------------------------------------------------- + | + | You may wish for all e-mails sent by your application to be sent from + | the same address. Here, you may specify a name and address that is + | used globally for all e-mails that are sent by your application. + | + */ + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), + ], + + /* + |-------------------------------------------------------------------------- + | E-Mail Encryption Protocol + |-------------------------------------------------------------------------- + | + | Here you may specify the encryption protocol that should be used when + | the application send e-mail messages. A sensible default using the + | transport layer security protocol should provide great security. + | + */ + + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + + /* + |-------------------------------------------------------------------------- + | SMTP Server Username + |-------------------------------------------------------------------------- + | + | If your SMTP server requires a username for authentication, you should + | set it here. This will get used to authenticate with your server on + | connection. You may also set the "password" value below this one. + | + */ + + 'username' => env('MAIL_USERNAME'), + + 'password' => env('MAIL_PASSWORD'), + + /* + |-------------------------------------------------------------------------- + | Sendmail System Path + |-------------------------------------------------------------------------- + | + | When using the "sendmail" driver to send e-mails, we will need to know + | the path to where Sendmail lives on this server. A default path has + | been provided here, which will work well on most of your systems. + | + */ + + 'sendmail' => '/usr/sbin/sendmail -bs', + + /* + |-------------------------------------------------------------------------- + | Markdown Mail Settings + |-------------------------------------------------------------------------- + | + | If you are using Markdown based email rendering, you may configure your + | theme and component paths here, allowing you to customize the design + | of the emails. Or, you may simply stick with the Laravel defaults! + | + */ + + 'markdown' => [ + 'theme' => 'default', + + 'paths' => [ + resource_path('views/vendor/mail'), + ], + ], + +]; diff --git a/config/menus.php b/config/menus.php new file mode 100644 index 000000000..51632e4ed --- /dev/null +++ b/config/menus.php @@ -0,0 +1,18 @@ + [ + 'navbar' => \Nwidart\Menus\Presenters\Bootstrap\NavbarPresenter::class, + 'navbar-right' => \Nwidart\Menus\Presenters\Bootstrap\NavbarRightPresenter::class, + 'nav-pills' => \Nwidart\Menus\Presenters\Bootstrap\NavPillsPresenter::class, + 'nav-tab' => \Nwidart\Menus\Presenters\Bootstrap\NavTabPresenter::class, + 'sidebar' => \Nwidart\Menus\Presenters\Bootstrap\SidebarMenuPresenter::class, + 'navmenu' => \Nwidart\Menus\Presenters\Bootstrap\NavMenuPresenter::class, + 'adminlte' => \Nwidart\Menus\Presenters\Admin\AdminltePresenter::class, + 'zurbmenu' => \Nwidart\Menus\Presenters\Foundation\ZurbMenuPresenter::class, + ], + + 'ordering' => true, + +]; diff --git a/config/modules.php b/config/modules.php new file mode 100644 index 000000000..8d3e0ddb3 --- /dev/null +++ b/config/modules.php @@ -0,0 +1,169 @@ + 'Modules', + + /* + |-------------------------------------------------------------------------- + | Module Stubs + |-------------------------------------------------------------------------- + | + | Default module stubs. + | + */ + 'stubs' => [ + 'enabled' => true, + 'path' => base_path() . '/app/Console/Stubs/Modules', + 'files' => [ + 'start' => 'start.php', + 'routes' => 'Http/routes.php', + 'views/index' => 'Resources/views/index.blade.php', + 'views/master' => 'Resources/views/layouts/master.blade.php', + 'scaffold/config' => 'Config/config.php', + 'composer' => 'composer.json', + ], + 'replacements' => [ + 'start' => ['LOWER_NAME'], + 'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'views/index' => ['LOWER_NAME'], + 'views/master' => ['STUDLY_NAME'], + 'scaffold/config' => ['STUDLY_NAME'], + 'composer' => [ + 'LOWER_NAME', + 'STUDLY_NAME', + 'VENDOR', + 'AUTHOR_NAME', + 'AUTHOR_EMAIL', + 'MODULE_NAMESPACE', + ], + ], + ], + 'paths' => [ + /* + |-------------------------------------------------------------------------- + | Modules path + |-------------------------------------------------------------------------- + | + | This path used for save the generated module. This path also will added + | automatically to list of scanned folders. + | + */ + 'modules' => base_path('modules'), + + /* + |-------------------------------------------------------------------------- + | Modules assets path + |-------------------------------------------------------------------------- + | + | Here you may update the modules assets path. + | + */ + 'assets' => public_path('public/modules'), + + /* + |-------------------------------------------------------------------------- + | The migrations path + |-------------------------------------------------------------------------- + | + | Where you run 'module:publish-migration' command, where do you publish the + | the migration files? + | + */ + 'migration' => base_path('database/migrations'), + + /* + |-------------------------------------------------------------------------- + | Generator path + |-------------------------------------------------------------------------- + | + | Here you may update the modules generator path. + | + */ + 'generator' => [ + 'assets' => 'Assets', + 'config' => 'Config', + 'command' => 'Console', + 'event' => 'Events', + 'listener' => 'Events/Handlers', + 'migration' => 'Database/Migrations', + 'model' => 'Entities', + 'repository' => 'Repositories', + 'seeder' => 'Database/Seeders', + 'controller' => 'Http/Controllers', + 'filter' => 'Http/Middleware', + 'request' => 'Http/Requests', + 'provider' => 'Providers', + 'lang' => 'Resources/lang', + 'views' => 'Resources/views', + 'test' => 'Tests', + 'jobs' => 'Jobs', + 'emails' => 'Mail', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Scan Path + |-------------------------------------------------------------------------- + | + | Here you define which folder will be scanned. By default will scan vendor + | directory. This is useful if you host the package in packagist website. + | + */ + 'scan' => [ + 'enabled' => false, + 'paths' => [ + base_path('vendor/*/*'), + ], + ], + + /* + |-------------------------------------------------------------------------- + | Composer File Template + |-------------------------------------------------------------------------- + | + | Here is the config for composer.json file, generated by this package + | + */ + 'composer' => [ + 'vendor' => 'akaunting', + 'author' => [ + 'name' => 'Akaunting', + 'email' => 'info@akaunting.com', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Caching + |-------------------------------------------------------------------------- + | + | Here is the config for setting up caching feature. + | + */ + 'cache' => [ + 'enabled' => true, + 'key' => 'modules', + 'lifetime' => 60, + ], + + /* + |-------------------------------------------------------------------------- + | Choose what laravel-modules will register as custom namespaces. + | Setting one to false will require to register that part + | in your own Service Provider class. + |-------------------------------------------------------------------------- + */ + 'register' => [ + 'translations' => true, + ], +]; diff --git a/config/queue.php b/config/queue.php new file mode 100644 index 000000000..a7c024de3 --- /dev/null +++ b/config/queue.php @@ -0,0 +1,86 @@ + env('QUEUE_DRIVER', 'database'), + + /* + |-------------------------------------------------------------------------- + | Queue Connections + |-------------------------------------------------------------------------- + | + | Here you may configure the connection information for each server that + | is used by your application. A default configuration has been added + | for each back-end shipped with Laravel. You are free to add more. + | + */ + + 'connections' => [ + + 'sync' => [ + 'driver' => 'sync', + ], + + 'database' => [ + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', + 'delay' => 2, + 'retry_after' => 90, + ], + + 'beanstalkd' => [ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, + ], + + 'sqs' => [ + 'driver' => 'sqs', + 'key' => 'your-public-key', + 'secret' => 'your-secret-key', + 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', + 'queue' => 'your-queue-name', + 'region' => 'us-east-1', + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'default', + 'retry_after' => 90, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Failed Queue Jobs + |-------------------------------------------------------------------------- + | + | These options configure the behavior of failed queue job logging so you + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. + | + */ + + 'failed' => [ + 'database' => env('DB_CONNECTION', 'mysql'), + 'table' => 'failed_jobs', + ], + +]; diff --git a/config/services.php b/config/services.php new file mode 100644 index 000000000..4460f0ec2 --- /dev/null +++ b/config/services.php @@ -0,0 +1,38 @@ + [ + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), + ], + + 'ses' => [ + 'key' => env('SES_KEY'), + 'secret' => env('SES_SECRET'), + 'region' => 'us-east-1', + ], + + 'sparkpost' => [ + 'secret' => env('SPARKPOST_SECRET'), + ], + + 'stripe' => [ + 'model' => App\User::class, + 'key' => env('STRIPE_KEY'), + 'secret' => env('STRIPE_SECRET'), + ], + +]; diff --git a/config/session.php b/config/session.php new file mode 100644 index 000000000..cc076ee40 --- /dev/null +++ b/config/session.php @@ -0,0 +1,179 @@ + env('SESSION_DRIVER', 'file'), + + /* + |-------------------------------------------------------------------------- + | Session Lifetime + |-------------------------------------------------------------------------- + | + | Here you may specify the number of minutes that you wish the session + | to be allowed to remain idle before it expires. If you want them + | to immediately expire on the browser closing, set that option. + | + */ + + 'lifetime' => 30, + + 'expire_on_close' => false, + + /* + |-------------------------------------------------------------------------- + | Session Encryption + |-------------------------------------------------------------------------- + | + | This option allows you to easily specify that all of your session data + | should be encrypted before it is stored. All encryption will be run + | automatically by Laravel and you can use the Session like normal. + | + */ + + 'encrypt' => false, + + /* + |-------------------------------------------------------------------------- + | Session File Location + |-------------------------------------------------------------------------- + | + | When using the native session driver, we need a location where session + | files may be stored. A default has been set for you but a different + | location may be specified. This is only needed for file sessions. + | + */ + + 'files' => storage_path('framework/sessions'), + + /* + |-------------------------------------------------------------------------- + | Session Database Connection + |-------------------------------------------------------------------------- + | + | When using the "database" or "redis" session drivers, you may specify a + | connection that should be used to manage these sessions. This should + | correspond to a connection in your database configuration options. + | + */ + + 'connection' => null, + + /* + |-------------------------------------------------------------------------- + | Session Database Table + |-------------------------------------------------------------------------- + | + | When using the "database" session driver, you may specify the table we + | should use to manage the sessions. Of course, a sensible default is + | provided for you; however, you are free to change this as needed. + | + */ + + 'table' => 'sessions', + + /* + |-------------------------------------------------------------------------- + | Session Cache Store + |-------------------------------------------------------------------------- + | + | When using the "apc" or "memcached" session drivers, you may specify a + | cache store that should be used for these sessions. This value must + | correspond with one of the application's configured cache stores. + | + */ + + 'store' => null, + + /* + |-------------------------------------------------------------------------- + | Session Sweeping Lottery + |-------------------------------------------------------------------------- + | + | Some session drivers must manually sweep their storage location to get + | rid of old sessions from storage. Here are the chances that it will + | happen on a given request. By default, the odds are 2 out of 100. + | + */ + + 'lottery' => [2, 100], + + /* + |-------------------------------------------------------------------------- + | Session Cookie Name + |-------------------------------------------------------------------------- + | + | Here you may change the name of the cookie used to identify a session + | instance by ID. The name specified here will get used every time a + | new session cookie is created by the framework for every driver. + | + */ + + 'cookie' => 'laravel_session', + + /* + |-------------------------------------------------------------------------- + | Session Cookie Path + |-------------------------------------------------------------------------- + | + | The session cookie path determines the path for which the cookie will + | be regarded as available. Typically, this will be the root path of + | your application but you are free to change this when necessary. + | + */ + + 'path' => '/', + + /* + |-------------------------------------------------------------------------- + | Session Cookie Domain + |-------------------------------------------------------------------------- + | + | Here you may change the domain of the cookie used to identify a session + | in your application. This will determine which domains the cookie is + | available to in your application. A sensible default has been set. + | + */ + + 'domain' => env('SESSION_DOMAIN', null), + + /* + |-------------------------------------------------------------------------- + | HTTPS Only Cookies + |-------------------------------------------------------------------------- + | + | By setting this option to true, session cookies will only be sent back + | to the server if the browser has a HTTPS connection. This will keep + | the cookie from being sent to you if it can not be done securely. + | + */ + + 'secure' => env('SESSION_SECURE_COOKIE', false), + + /* + |-------------------------------------------------------------------------- + | HTTP Access Only + |-------------------------------------------------------------------------- + | + | Setting this value to true will prevent JavaScript from accessing the + | value of the cookie and the cookie will only be accessible through + | the HTTP protocol. You are free to modify this option if needed. + | + */ + + 'http_only' => true, + +]; diff --git a/config/setting.php b/config/setting.php new file mode 100644 index 000000000..49f18bec9 --- /dev/null +++ b/config/setting.php @@ -0,0 +1,70 @@ + false, + + /* + |-------------------------------------------------------------------------- + | Setting driver + |-------------------------------------------------------------------------- + | + | Select where to store the settings. + | + | Supported: "database", "json" + | + */ + 'driver' => 'database', + + /* + |-------------------------------------------------------------------------- + | Database driver + |-------------------------------------------------------------------------- + | + | Options for database driver. Enter which connection to use, null means + | the default connection. Set the table and column names. + | + */ + 'database' => [ + 'connection' => null, + 'table' => 'settings', + 'key' => 'key', + 'value' => 'value', + ], + + /* + |-------------------------------------------------------------------------- + | JSON driver + |-------------------------------------------------------------------------- + | + | Options for json driver. Enter the full path to the .json file. + | + */ + 'json' => [ + 'path' => storage_path().'/settings.json', + ], + + /* + |-------------------------------------------------------------------------- + | Override application config values + |-------------------------------------------------------------------------- + | + | If defined, settings package will override these config values. + | + | Sample: + | "app.fallback_locale", + | "app.locale" => "settings.locale", + | + */ + 'override' => [ + + ], +]; diff --git a/config/version.php b/config/version.php new file mode 100644 index 000000000..d6a5742a2 --- /dev/null +++ b/config/version.php @@ -0,0 +1,25 @@ + 'Akaunting', + + 'code' => 'Besmele', + + 'major' => '1', + + 'minor' => '0', + + 'patch' => '0', + + 'build' => '', + + 'status' => 'Stable', + + 'date' => '14-September-2017', + + 'time' => '18:00', + + 'zone' => 'GMT +3', + +]; diff --git a/config/view.php b/config/view.php new file mode 100644 index 000000000..2acfd9cc9 --- /dev/null +++ b/config/view.php @@ -0,0 +1,33 @@ + [ + resource_path('views'), + ], + + /* + |-------------------------------------------------------------------------- + | Compiled View Path + |-------------------------------------------------------------------------- + | + | This option determines where all the compiled Blade templates will be + | stored for your application. Typically, this is within the storage + | directory. However, as usual, you are free to change this value. + | + */ + + 'compiled' => realpath(storage_path('framework/views')), + +]; diff --git a/database/.gitignore b/database/.gitignore new file mode 100644 index 000000000..9b1dffd90 --- /dev/null +++ b/database/.gitignore @@ -0,0 +1 @@ +*.sqlite diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php new file mode 100644 index 000000000..7926c7946 --- /dev/null +++ b/database/factories/ModelFactory.php @@ -0,0 +1,24 @@ +define(App\User::class, function (Faker\Generator $faker) { + static $password; + + return [ + 'name' => $faker->name, + 'email' => $faker->unique()->safeEmail, + 'password' => $password ?: $password = bcrypt('secret'), + 'remember_token' => str_random(10), + ]; +}); diff --git a/database/migrations/2017_09_01_000000_create_accounts_table.php b/database/migrations/2017_09_01_000000_create_accounts_table.php new file mode 100644 index 000000000..d6cb5addc --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_accounts_table.php @@ -0,0 +1,42 @@ +increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->string('number'); + $table->string('currency_code'); + $table->decimal('opening_balance')->default('0'); + $table->string('bank_name')->nullable(); + $table->string('bank_phone')->nullable(); + $table->text('bank_address')->nullable(); + $table->boolean('enabled'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('accounts'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_bills_table.php b/database/migrations/2017_09_01_000000_create_bills_table.php new file mode 100644 index 000000000..b2cef1bf4 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_bills_table.php @@ -0,0 +1,116 @@ +increments('id'); + $table->integer('company_id'); + $table->string('bill_number'); + $table->string('order_number')->nullable(); + $table->string('bill_status_code'); + $table->date('billed_at'); + $table->date('due_at'); + $table->float('amount', 15, 4); + $table->string('currency_code'); + $table->float('currency_rate', 15, 8); + $table->integer('vendor_id'); + $table->string('vendor_name'); + $table->string('vendor_email'); + $table->string('vendor_tax_number')->nullable(); + $table->string('vendor_phone')->nullable(); + $table->text('vendor_address')->nullable(); + $table->text('notes')->nullable(); + $table->string('attachment')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'bill_number', 'deleted_at']); + }); + + Schema::create('bill_items', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('bill_id'); + $table->integer('item_id')->nullable(); + $table->string('name'); + $table->string('sku')->nullable(); + $table->integer('quantity'); + $table->float('price', 15, 4); + $table->float('total', 15, 4); + $table->float('tax', 15, 4)->default('0.0000'); + $table->integer('tax_id'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + + Schema::create('bill_statuses', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->string('code'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + + Schema::create('bill_payments', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('bill_id'); + $table->integer('account_id'); + $table->date('paid_at'); + $table->float('amount', 15, 4); + $table->string('currency_code'); + $table->float('currency_rate', 15, 8); + $table->text('description')->nullable(); + $table->string('payment_method'); + $table->string('reference')->nullable(); + $table->string('attachment')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + + Schema::create('bill_histories', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('bill_id'); + $table->string('status_code'); + $table->boolean('notify'); + $table->text('description')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('bills'); + Schema::drop('bill_items'); + Schema::drop('bill_statuses'); + Schema::drop('bill_payments'); + Schema::drop('bill_histories'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_categories_table.php b/database/migrations/2017_09_01_000000_create_categories_table.php new file mode 100644 index 000000000..82a1a2ccf --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_categories_table.php @@ -0,0 +1,38 @@ +increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->string('type'); + $table->string('color'); + $table->boolean('enabled'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('categories'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_companies_table.php b/database/migrations/2017_09_01_000000_create_companies_table.php new file mode 100644 index 000000000..950011a5e --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_companies_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->string('domain'); + $table->boolean('enabled')->default(0); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('companies'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_currencies_table.php b/database/migrations/2017_09_01_000000_create_currencies_table.php new file mode 100644 index 000000000..74ca20705 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_currencies_table.php @@ -0,0 +1,39 @@ +increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->string('code'); + $table->float('rate', 15, 8); + $table->tinyInteger('enabled')->default(0); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'code', 'deleted_at']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('currencies'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_customers_table.php b/database/migrations/2017_09_01_000000_create_customers_table.php new file mode 100644 index 000000000..0a65a5174 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_customers_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->integer('company_id'); + $table->integer('user_id')->nullable(); + $table->string('name'); + $table->string('email'); + $table->string('tax_number')->nullable(); + $table->string('phone')->nullable(); + $table->text('address')->nullable(); + $table->string('website')->nullable(); + $table->string('currency_code'); + $table->boolean('enabled'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'email', 'deleted_at']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('customers'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_invoices_table.php b/database/migrations/2017_09_01_000000_create_invoices_table.php new file mode 100644 index 000000000..94fff7818 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_invoices_table.php @@ -0,0 +1,116 @@ +increments('id'); + $table->integer('company_id'); + $table->string('invoice_number'); + $table->string('order_number')->nullable(); + $table->string('invoice_status_code'); + $table->date('invoiced_at'); + $table->date('due_at'); + $table->float('amount', 15, 4); + $table->string('currency_code'); + $table->float('currency_rate', 15, 8); + $table->integer('customer_id'); + $table->string('customer_name'); + $table->string('customer_email'); + $table->string('customer_tax_number')->nullable(); + $table->string('customer_phone')->nullable(); + $table->text('customer_address')->nullable(); + $table->text('notes')->nullable(); + $table->string('attachment')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'invoice_number', 'deleted_at']); + }); + + Schema::create('invoice_items', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('invoice_id'); + $table->integer('item_id')->nullable(); + $table->string('name'); + $table->string('sku')->nullable(); + $table->integer('quantity'); + $table->float('price', 15, 4); + $table->float('total', 15, 4); + $table->float('tax', 15, 4)->default('0.0000'); + $table->integer('tax_id'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + + Schema::create('invoice_statuses', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->string('code'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + + Schema::create('invoice_payments', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('invoice_id'); + $table->integer('account_id'); + $table->date('paid_at'); + $table->float('amount', 15, 4); + $table->string('currency_code'); + $table->float('currency_rate', 15, 8); + $table->text('description')->nullable(); + $table->string('payment_method'); + $table->string('reference')->nullable(); + $table->string('attachment')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + + Schema::create('invoice_histories', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('invoice_id'); + $table->string('status_code'); + $table->boolean('notify'); + $table->text('description')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('invoices'); + Schema::drop('invoice_items'); + Schema::drop('invoice_statuses'); + Schema::drop('invoice_payments'); + Schema::drop('invoice_histories'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_items_table.php b/database/migrations/2017_09_01_000000_create_items_table.php new file mode 100644 index 000000000..260504d18 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_items_table.php @@ -0,0 +1,45 @@ +increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->string('sku'); + $table->text('description')->nullable(); + $table->float('sale_price', 15, 4); + $table->float('purchase_price', 15, 4); + $table->integer('quantity'); + $table->integer('category_id')->nullable(); + $table->integer('tax_id')->nullable(); + $table->string('picture')->nullable(); + $table->boolean('enabled'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'sku', 'deleted_at']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('items'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_jobs_table.php b/database/migrations/2017_09_01_000000_create_jobs_table.php new file mode 100644 index 000000000..ae05432ad --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_jobs_table.php @@ -0,0 +1,38 @@ +bigIncrements('id'); + $table->string('queue'); + $table->longText('payload'); + $table->tinyInteger('attempts')->unsigned(); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + + $table->index(['queue', 'reserved_at']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_modules_table.php b/database/migrations/2017_09_01_000000_create_modules_table.php new file mode 100644 index 000000000..1d8f450aa --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_modules_table.php @@ -0,0 +1,51 @@ +increments('id'); + $table->integer('company_id'); + $table->string('alias'); + $table->integer('status'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'alias', 'deleted_at']); + }); + + Schema::create('module_histories', function (Blueprint $table) { + $table->increments('id'); + $table->integer('company_id'); + $table->integer('module_id'); + $table->string('category'); + $table->string('version'); + $table->text('description')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index(['company_id', 'module_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('modules'); + Schema::drop('module_histories'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_notifications_table.php b/database/migrations/2017_09_01_000000_create_notifications_table.php new file mode 100644 index 000000000..fb16d5bcc --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_notifications_table.php @@ -0,0 +1,35 @@ +uuid('id')->primary(); + $table->string('type'); + $table->morphs('notifiable'); + $table->text('data'); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('notifications'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_password_resets_table.php b/database/migrations/2017_09_01_000000_create_password_resets_table.php new file mode 100644 index 000000000..68e6142e4 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_password_resets_table.php @@ -0,0 +1,34 @@ +string('email'); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + + $table->index('email'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('password_resets'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_payments_table.php b/database/migrations/2017_09_01_000000_create_payments_table.php new file mode 100644 index 000000000..54860a20f --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_payments_table.php @@ -0,0 +1,45 @@ +increments('id'); + $table->integer('company_id'); + $table->integer('account_id'); + $table->date('paid_at'); + $table->float('amount', 15, 4); + $table->string('currency_code'); + $table->float('currency_rate', 15, 8); + $table->integer('vendor_id')->nullable(); + $table->text('description')->nullable(); + $table->integer('category_id'); + $table->string('payment_method'); + $table->string('reference')->nullable(); + $table->string('attachment')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('payments'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_revenues_table.php b/database/migrations/2017_09_01_000000_create_revenues_table.php new file mode 100644 index 000000000..d4290dca5 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_revenues_table.php @@ -0,0 +1,45 @@ +increments('id'); + $table->integer('company_id'); + $table->integer('account_id'); + $table->date('paid_at'); + $table->float('amount', 15, 4); + $table->string('currency_code'); + $table->float('currency_rate', 15, 8); + $table->integer('customer_id')->nullable(); + $table->text('description')->nullable(); + $table->integer('category_id'); + $table->string('payment_method'); + $table->string('reference')->nullable(); + $table->string('attachment')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('revenues'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_roles_table.php b/database/migrations/2017_09_01_000000_create_roles_table.php new file mode 100644 index 000000000..71b970215 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_roles_table.php @@ -0,0 +1,89 @@ +increments('id'); + $table->string('name'); + $table->string('display_name'); + $table->string('description')->nullable(); + $table->timestamps(); + + $table->unique('name'); + }); + + // Create table for associating roles to users (Many To Many Polymorphic) + Schema::create('user_roles', function (Blueprint $table) { + $table->integer('user_id')->unsigned(); + $table->integer('role_id')->unsigned(); + $table->string('user_type'); + + $table->foreign('role_id')->references('id')->on('roles') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->primary(['user_id', 'role_id', 'user_type']); + }); + + // Create table for storing permissions + Schema::create('permissions', function (Blueprint $table) { + $table->increments('id'); + $table->string('name'); + $table->string('display_name'); + $table->string('description')->nullable(); + $table->timestamps(); + + $table->unique('name'); + }); + + // Create table for associating permissions to roles (Many-to-Many) + Schema::create('role_permissions', function (Blueprint $table) { + $table->integer('role_id')->unsigned(); + $table->integer('permission_id')->unsigned(); + + $table->foreign('role_id')->references('id')->on('roles') + ->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('permission_id')->references('id')->on('permissions') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->primary(['role_id', 'permission_id']); + }); + + // Create table for associating permissions to users (Many To Many Polymorphic) + Schema::create('user_permissions', function (Blueprint $table) { + $table->integer('user_id')->unsigned(); + $table->integer('permission_id')->unsigned(); + $table->string('user_type'); + + $table->foreign('permission_id')->references('id')->on('permissions') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->primary(['user_id', 'permission_id', 'user_type']); + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // Cascade table first + Schema::dropIfExists('user_permissions'); + Schema::dropIfExists('role_permissions'); + Schema::dropIfExists('permissions'); + Schema::dropIfExists('user_roles'); + Schema::dropIfExists('roles'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_sessions_table.php b/database/migrations/2017_09_01_000000_create_sessions_table.php new file mode 100644 index 000000000..c213297d1 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_sessions_table.php @@ -0,0 +1,35 @@ +string('id')->unique(); + $table->unsignedInteger('user_id')->nullable(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->text('payload'); + $table->integer('last_activity'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('sessions'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_settings_table.php b/database/migrations/2017_09_01_000000_create_settings_table.php new file mode 100644 index 000000000..422920f0b --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_settings_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->integer('company_id'); + $table->string('key'); + $table->text('value')->nullable(); + + $table->index('company_id'); + $table->unique(['company_id', 'key']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('settings'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_taxes_table.php b/database/migrations/2017_09_01_000000_create_taxes_table.php new file mode 100644 index 000000000..bf3454fb8 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_taxes_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->integer('company_id'); + $table->string('name'); + $table->integer('rate'); + $table->boolean('enabled'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('taxes'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_transfers_table.php b/database/migrations/2017_09_01_000000_create_transfers_table.php new file mode 100644 index 000000000..f7b35a5ff --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_transfers_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->integer('company_id'); + $table->integer('payment_id'); + $table->integer('revenue_id'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transfers'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_users_table.php b/database/migrations/2017_09_01_000000_create_users_table.php new file mode 100644 index 000000000..1a97f418f --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_users_table.php @@ -0,0 +1,52 @@ +increments('id'); + $table->string('name'); + $table->string('email'); + $table->string('password'); + $table->rememberToken(); + $table->string('picture')->nullable(); + $table->timestamp('last_logged_in_at')->nullable(); + $table->boolean('enabled')->default(1); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['email', 'deleted_at']); + }); + + // Create table for associating companies to users (Many To Many Polymorphic) + Schema::create('user_companies', function (Blueprint $table) { + $table->integer('user_id')->unsigned(); + $table->integer('company_id')->unsigned(); + $table->string('user_type'); + + $table->primary(['user_id', 'company_id', 'user_type']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // Cascade table first + Schema::dropIfExists('user_companies'); + Schema::dropIfExists('users'); + } +} diff --git a/database/migrations/2017_09_01_000000_create_vendors_table.php b/database/migrations/2017_09_01_000000_create_vendors_table.php new file mode 100644 index 000000000..935632503 --- /dev/null +++ b/database/migrations/2017_09_01_000000_create_vendors_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->integer('company_id'); + $table->integer('user_id')->nullable(); + $table->string('name'); + $table->string('email'); + $table->string('tax_number')->nullable(); + $table->string('phone')->nullable(); + $table->text('address')->nullable(); + $table->string('website')->nullable(); + $table->string('currency_code'); + $table->boolean('enabled'); + $table->timestamps(); + $table->softDeletes(); + + $table->index('company_id'); + $table->unique(['company_id', 'email', 'deleted_at']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('vendors'); + } +} diff --git a/database/migrations/2020_01_01_000000_add_locale_column.php b/database/migrations/2020_01_01_000000_add_locale_column.php new file mode 100644 index 000000000..957316270 --- /dev/null +++ b/database/migrations/2020_01_01_000000_add_locale_column.php @@ -0,0 +1,30 @@ +string('locale')->default(config('app.locale')); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function ($table) { + $table->dropColumn('locale'); + }); + } +} diff --git a/database/seeds/Accounts.php b/database/seeds/Accounts.php new file mode 100644 index 000000000..235145ef2 --- /dev/null +++ b/database/seeds/Accounts.php @@ -0,0 +1,47 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + $rows = [ + [ + 'company_id' => $company_id, + 'name' => trans('demo.accounts_cash'), + 'number' => '1', + 'currency_code' => 'USD', + 'bank_name' => trans('demo.accounts_cash'), + 'enabled' => '1', + ], + ]; + + foreach ($rows as $row) { + $account = Account::create($row); + + Setting::set('general.default_account', $account->id); + } + } +} diff --git a/database/seeds/BillStatuses.php b/database/seeds/BillStatuses.php new file mode 100644 index 000000000..7d7580aa7 --- /dev/null +++ b/database/seeds/BillStatuses.php @@ -0,0 +1,57 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + $rows = [ + [ + 'company_id' => $company_id, + 'name' => trans('bills.status.new'), + 'code' => 'new', + ], + [ + 'company_id' => $company_id, + 'name' => trans('bills.status.updated'), + 'code' => 'updated', + ], + [ + 'company_id' => $company_id, + 'name' => trans('bills.status.partial'), + 'code' => 'partial', + ], + [ + 'company_id' => $company_id, + 'name' => trans('bills.status.paid'), + 'code' => 'paid', + ], + ]; + + foreach ($rows as $row) { + BillStatus::create($row); + } + } +} diff --git a/database/seeds/Categories.php b/database/seeds/Categories.php new file mode 100644 index 000000000..bcf036e5b --- /dev/null +++ b/database/seeds/Categories.php @@ -0,0 +1,72 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + $rows = [ + [ + 'company_id' => $company_id, + 'name' => trans_choice('general.transfers', 1), + 'type' => 'other', + 'color' => '#605ca8', + 'enabled' => '1' + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.categories_deposit'), + 'type' => 'income', + 'color' => '#f39c12', + 'enabled' => '1' + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.categories_sales'), + 'type' => 'income', + 'color' => '#6da252', + 'enabled' => '1' + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.categories_uncat'), + 'type' => 'expense', + 'color' => '#d2d6de', + 'enabled' => '1' + ], + [ + 'company_id' => $company_id, + 'name' => trans('general.general'), + 'type' => 'item', + 'color' => '#00c0ef', + 'enabled' => '1' + ], + ]; + + foreach ($rows as $row) { + Category::create($row); + } + } +} diff --git a/database/seeds/CompanySeeder.php b/database/seeds/CompanySeeder.php new file mode 100644 index 000000000..e66269074 --- /dev/null +++ b/database/seeds/CompanySeeder.php @@ -0,0 +1,22 @@ +call(Database\Seeds\Accounts::class); + $this->call(Database\Seeds\BillStatuses::class); + $this->call(Database\Seeds\Categories::class); + $this->call(Database\Seeds\Currencies::class); + $this->call(Database\Seeds\InvoiceStatuses::class); + $this->call(Database\Seeds\Settings::class); + $this->call(Database\Seeds\Taxes::class); + } +} diff --git a/database/seeds/Currencies.php b/database/seeds/Currencies.php new file mode 100644 index 000000000..e4168d1d0 --- /dev/null +++ b/database/seeds/Currencies.php @@ -0,0 +1,62 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + $rows = [ + [ + 'company_id' => $company_id, + 'name' => trans('demo.currencies_usd'), + 'code' => 'USD', + 'rate' => '1.00', + 'enabled' => '1', + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.currencies_eur'), + 'code' => 'EUR', + 'rate' => '1.25', + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.currencies_gbp'), + 'code' => 'GBP', + 'rate' => '1.60', + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.currencies_try'), + 'code' => 'TRY', + 'rate' => '0.80', + ], + ]; + + foreach ($rows as $row) { + Currency::create($row); + } + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php new file mode 100644 index 000000000..0b788d2e4 --- /dev/null +++ b/database/seeds/DatabaseSeeder.php @@ -0,0 +1,16 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + $rows = [ + [ + 'company_id' => $company_id, + 'name' => trans('invoices.status.draft'), + 'code' => 'draft', + ], + [ + 'company_id' => $company_id, + 'name' => trans('invoices.status.sent'), + 'code' => 'sent', + ], + [ + 'company_id' => $company_id, + 'name' => trans('invoices.status.viewed'), + 'code' => 'viewed', + ], + [ + 'company_id' => $company_id, + 'name' => trans('invoices.status.approved'), + 'code' => 'approved', + ], + [ + 'company_id' => $company_id, + 'name' => trans('invoices.status.partial'), + 'code' => 'partial', + ], + [ + 'company_id' => $company_id, + 'name' => trans('invoices.status.paid'), + 'code' => 'paid', + ], + ]; + + foreach ($rows as $row) { + InvoiceStatus::create($row); + } + } +} diff --git a/database/seeds/Roles.php b/database/seeds/Roles.php new file mode 100644 index 000000000..fc3005018 --- /dev/null +++ b/database/seeds/Roles.php @@ -0,0 +1,152 @@ +create($this->roles(), $this->map()); + + Model::reguard(); + } + + private function roles() + { + $rows = [ + 'admin' => [ + 'admin-panel' => 'r', + 'api' => 'r', + 'auth-users' => 'c,r,u,d', + 'auth-roles' => 'c,r,u,d', + 'auth-permissions' => 'c,r,u,d', + 'auth-profile' => 'r,u', + 'companies-companies' => 'c,r,u,d', + 'items-items' => 'c,r,u,d', + 'incomes-invoices' => 'c,r,u,d', + 'incomes-revenues' => 'c,r,u,d', + 'incomes-customers' => 'c,r,u,d', + 'expenses-bills' => 'c,r,u,d', + 'expenses-payments' => 'c,r,u,d', + 'expenses-vendors' => 'c,r,u,d', + 'banking-accounts' => 'c,r,u,d', + 'banking-transfers' => 'c,r,u,d', + 'banking-transactions' => 'r', + 'settings-categories' => 'c,r,u,d', + 'settings-settings' => 'r,u', + 'settings-taxes' => 'c,r,u,d', + 'settings-currencies' => 'c,r,u,d', + 'settings-modules' => 'r,u', + 'modules-home' => 'r', + 'modules-tiles' => 'r', + 'modules-item' => 'c,r,u,d', + 'modules-token' => 'c,u', + 'install-updates' => 'r,u', + 'notifications' => 'r,u', + 'reports-income-summary' => 'r', + 'reports-expense-summary' => 'r', + 'reports-income-expense-summary' => 'r', + ], + 'manager' => [ + 'admin-panel' => 'r', + 'auth-profile' => 'r,u', + 'companies-companies' => 'c,r,u,d', + 'items-items' => 'c,r,u,d', + 'incomes-invoices' => 'c,r,u,d', + 'incomes-revenues' => 'c,r,u,d', + 'incomes-customers' => 'c,r,u,d', + 'expenses-bills' => 'c,r,u,d', + 'expenses-payments' => 'c,r,u,d', + 'expenses-vendors' => 'c,r,u,d', + 'banking-accounts' => 'c,r,u,d', + 'banking-transfers' => 'c,r,u,d', + 'banking-transactions' => 'r', + 'settings-settings' => 'r,u', + 'settings-categories' => 'c,r,u,d', + 'settings-taxes' => 'c,r,u,d', + 'settings-currencies' => 'c,r,u,d', + 'settings-modules' => 'r,u', + 'install-updates' => 'r,u', + 'notifications' => 'r,u', + 'reports-income-summary' => 'r', + 'reports-expense-summary' => 'r', + 'reports-income-expense-summary' => 'r', + ], + 'customer' => [ + 'customer-panel' => 'r', + 'customers-invoices' => 'r,u', + 'customers-payments' => 'r,u', + 'customers-transactions' => 'r', + 'customers-profile' => 'r,u', + ], + ]; + + return $rows; + } + + private function map() + { + $rows = [ + 'c' => 'create', + 'r' => 'read', + 'u' => 'update', + 'd' => 'delete' + ]; + + return $rows; + } + + private function create($roles, $map) + { + $mapPermission = collect($map); + + foreach ($roles as $key => $modules) { + // Create a new role + $role = Role::create([ + 'name' => $key, + 'display_name' => ucwords(str_replace("_", " ", $key)), + 'description' => ucwords(str_replace("_", " ", $key)) + ]); + + $this->command->info('Creating Role '. strtoupper($key)); + + // Reading role permission modules + foreach ($modules as $module => $value) { + $permissions = explode(',', $value); + + foreach ($permissions as $p => $perm) { + $permissionValue = $mapPermission->get($perm); + + $moduleName = ucwords(str_replace("-", " ", $module)); + + $permission = Permission::firstOrCreate([ + 'name' => $permissionValue . '-' . $module, + 'display_name' => ucfirst($permissionValue) . ' ' . $moduleName, + 'description' => ucfirst($permissionValue) . ' ' . $moduleName, + ]); + + $this->command->info('Creating Permission to '.$permissionValue.' for '. $moduleName); + + if (!$role->hasPermission($permission->name)) { + $role->attachPermission($permission); + } else { + $this->command->info($key . ': ' . $p . ' ' . $permissionValue . ' already exist'); + } + } + } + } + } +} diff --git a/database/seeds/Settings.php b/database/seeds/Settings.php new file mode 100644 index 000000000..c19209786 --- /dev/null +++ b/database/seeds/Settings.php @@ -0,0 +1,54 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + Setting::set([ + 'general.date_format' => 'd M Y', + 'general.date_separator' => 'space', + 'general.timezone' => 'Europe/London', + 'general.invoice_prefix' => 'INV-', + 'general.invoice_digit' => '5', + 'general.invoice_start' => '1', + 'general.default_payment_method' => 'cash', + 'general.email_protocol' => 'mail', + 'general.email_sendmail_path' => '/usr/sbin/sendmail -bs', + 'general.send_invoice_reminder' => '0', + 'general.schedule_invoice_days' => '1,3,5,10', + 'general.send_bill_reminder' => '0', + 'general.schedule_bill_days' => '10,5,3,1', + 'general.schedule_time' => '09:00', + 'general.admin_theme' => 'skin-green-light', + 'general.list_limit' => '25', + 'general.use_gravatar' => '0', + 'general.session_handler' => 'file', + 'general.session_lifetime' => '30', + 'general.file_size' => '2', + 'general.file_types' => 'pdf,jpeg,jpg,png', + 'offline.payment.methods' => '[{"code":"offline.cash.1","name":"Cash","order":"1","description":null},{"code":"offline.bank_transfer.2","name":"Bank Transfer","order":"2","description":null}]', + ]); + } +} diff --git a/database/seeds/Taxes.php b/database/seeds/Taxes.php new file mode 100644 index 000000000..20b8dda39 --- /dev/null +++ b/database/seeds/Taxes.php @@ -0,0 +1,55 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $company_id = $this->command->argument('company'); + + $rows = [ + [ + 'company_id' => $company_id, + 'name' => trans('demo.taxes_exempt'), + 'rate' => '0', + 'enabled' => '1' + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.taxes_normal'), + 'rate' => '5', + 'enabled' => '1' + ], + [ + 'company_id' => $company_id, + 'name' => trans('demo.taxes_sales'), + 'rate' => '15', + 'enabled' => '1' + ], + ]; + + foreach ($rows as $row) { + Tax::create($row); + } + } +} diff --git a/database/seeds/TestCompany.php b/database/seeds/TestCompany.php new file mode 100644 index 000000000..03792f49f --- /dev/null +++ b/database/seeds/TestCompany.php @@ -0,0 +1,75 @@ +call(Roles::class); + + $this->createCompany(); + + $this->createUser(); + + Model::reguard(); + } + + private function createCompany() + { + $rows = [ + [ + 'id' => '1', + 'domain' => 'test.com', + ], + ]; + + foreach ($rows as $row) { + Company::create($row); + } + + Setting::setExtraColumns(['company_id' => '1']); + Setting::set('general.company_name', 'Test Inc.'); + Setting::set('general.company_email', 'info@test.com'); + Setting::set('general.company_address', 'New Street 1254'); + Setting::set('general.default_currency', 'USD'); + Setting::set('general.default_account', '1'); + Setting::set('general.default_payment_method', 'cash'); + Setting::save(); + + $this->command->info('Test company created.'); + } + + public function createUser() + { + // Create user + $user = User::create([ + 'name' => 'Admin', + 'email' => 'admin@akaunting.com', + 'password' => '123456', + 'last_logged_in_at' => Date::now(), + ]); + + // Attach Role + $user->roles()->attach(1); + + // Attach company + $user->companies()->attach(1); + + $this->command->info('Admin user created.'); + } +} diff --git a/index.php b/index.php new file mode 100644 index 000000000..61339a274 --- /dev/null +++ b/index.php @@ -0,0 +1,24 @@ +make(Illuminate\Contracts\Http\Kernel::class); + +$response = $kernel->handle( + $request = Illuminate\Http\Request::capture() +); + +$response->send(); + +$kernel->terminate($request, $response); diff --git a/modules/Offline/Assets/.gitkeep b/modules/Offline/Assets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Config/.gitkeep b/modules/Offline/Config/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Config/config.php b/modules/Offline/Config/config.php new file mode 100644 index 000000000..d3e118f39 --- /dev/null +++ b/modules/Offline/Config/config.php @@ -0,0 +1,7 @@ + 'Offline', + +]; diff --git a/modules/Offline/Console/.gitkeep b/modules/Offline/Console/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Database/Migrations/.gitkeep b/modules/Offline/Database/Migrations/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Database/Seeders/.gitkeep b/modules/Offline/Database/Seeders/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Database/Seeders/OfflineDatabaseSeeder.php b/modules/Offline/Database/Seeders/OfflineDatabaseSeeder.php new file mode 100644 index 000000000..0dcbaa199 --- /dev/null +++ b/modules/Offline/Database/Seeders/OfflineDatabaseSeeder.php @@ -0,0 +1,45 @@ +create(); + + Model::reguard(); + } + + private function create() + { + $methods = array(); + + $methods[] = array( + 'code' => 'offline.cash.1', + 'name' => 'Cash', + 'order' => '1', + 'description' => null, + ); + + $methods[] = array( + 'code' => 'offline.bank_transfer.2', + 'name' => 'Bank Transfer', + 'order' => '2', + 'description' => null, + ); + + Setting::set('offline.payment.methods', json_encode($methods)); + } +} diff --git a/modules/Offline/Entities/.gitkeep b/modules/Offline/Entities/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Events/.gitkeep b/modules/Offline/Events/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Events/Handlers/.gitkeep b/modules/Offline/Events/Handlers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Events/Handlers/OfflineAdminMenu.php b/modules/Offline/Events/Handlers/OfflineAdminMenu.php new file mode 100644 index 000000000..753783f98 --- /dev/null +++ b/modules/Offline/Events/Handlers/OfflineAdminMenu.php @@ -0,0 +1,21 @@ +menu->whereTitle(trans_choice('general.settings', 2)); + $item->url('modules/offline/settings', trans('offline::offline.offline'), 4, ['icon' => 'fa fa-angle-double-right']); + } +} diff --git a/modules/Offline/Events/Handlers/OfflinePaymentGateway.php b/modules/Offline/Events/Handlers/OfflinePaymentGateway.php new file mode 100644 index 000000000..91691c053 --- /dev/null +++ b/modules/Offline/Events/Handlers/OfflinePaymentGateway.php @@ -0,0 +1,19 @@ + $method) { + if ($method['code'] == $request['method']) { + $offline[$key]['code'] = 'offline.' . $request['code'] . '.' . (count($offline) + 1); + $offline[$key]['name'] = $request['name']; + $offline[$key]['order'] = $request['order']; + $offline[$key]['description'] = $request['description']; + } + } + } else { + $offline[] = array( + 'code' => 'offline.' . $request['code'] . '.' . (count($offline) + 1), + 'name' => $request['name'], + 'order' => $request['order'], + 'description' => $request['description'] + ); + } + + // Set Api Token + setting()->set('offline.payment.methods', json_encode($offline)); + + setting()->save(); + + Artisan::call('cache:clear'); + + return redirect('modules/offline/settings'); + } + + /** + * Remove the specified resource from storage. + * @return Response + */ + public function get(GRequest $request) + { + $code = $request['code']; + + $offline = json_decode(setting('offline.payment.methods'), true); + + foreach ($offline as $key => $method) { + if ($method['code'] == $code) { + $data = $method; + } + } + + return response()->json([ + 'errors' => false, + 'success' => true, + 'data' => $data + ]); + } + + /** + * Remove the specified resource from storage. + * @return Response + */ + public function delete(DRequest $request) + { + $code = $request['code']; + + $offline = json_decode(setting('offline.payment.methods'), true); + + foreach ($offline as $key => $method) { + if ($method['code'] == $code) { + unset($offline[$key]); + } + } + + // Set Api Token + setting()->set('offline.payment.methods', json_encode($offline)); + + setting()->save(); + + Artisan::call('cache:clear'); + + return response()->json([ + 'errors' => false, + 'success' => true, + ]); + } +} diff --git a/modules/Offline/Http/Middleware/.gitkeep b/modules/Offline/Http/Middleware/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Http/Requests/.gitkeep b/modules/Offline/Http/Requests/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Http/Requests/Setting.php b/modules/Offline/Http/Requests/Setting.php new file mode 100644 index 000000000..209121d29 --- /dev/null +++ b/modules/Offline/Http/Requests/Setting.php @@ -0,0 +1,31 @@ + 'required|string', + 'code' => 'required|string', + ]; + } +} diff --git a/modules/Offline/Http/Requests/SettingDelete.php b/modules/Offline/Http/Requests/SettingDelete.php new file mode 100644 index 000000000..2f70db9fb --- /dev/null +++ b/modules/Offline/Http/Requests/SettingDelete.php @@ -0,0 +1,30 @@ + 'required|string', + ]; + } +} diff --git a/modules/Offline/Http/Requests/SettingGet.php b/modules/Offline/Http/Requests/SettingGet.php new file mode 100644 index 000000000..8f8f52433 --- /dev/null +++ b/modules/Offline/Http/Requests/SettingGet.php @@ -0,0 +1,30 @@ + 'required|string', + ]; + } +} diff --git a/modules/Offline/Http/routes.php b/modules/Offline/Http/routes.php new file mode 100644 index 000000000..ecef359ea --- /dev/null +++ b/modules/Offline/Http/routes.php @@ -0,0 +1,8 @@ + ['web', 'auth', 'language', 'adminmenu', 'permission:read-admin-panel'], 'prefix' => 'modules/offline', 'namespace' => 'Modules\Offline\Http\Controllers'], function () { + Route::get('settings', 'settings@edit'); + Route::post('settings', 'settings@update'); + Route::post('settings/get', 'settings@get'); + Route::post('settings/delete', 'settings@delete'); +}); diff --git a/modules/Offline/Jobs/.gitkeep b/modules/Offline/Jobs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Mail/.gitkeep b/modules/Offline/Mail/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Providers/.gitkeep b/modules/Offline/Providers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Providers/OfflineServiceProvider.php b/modules/Offline/Providers/OfflineServiceProvider.php new file mode 100644 index 000000000..eb082ebdb --- /dev/null +++ b/modules/Offline/Providers/OfflineServiceProvider.php @@ -0,0 +1,120 @@ +registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->registerFactories(); + + $this->app['events']->listen(AdminMenuCreated::class, OfflineAdminMenu::class); + $this->app['events']->listen(PaymentGatewayListing::class, OfflinePaymentGateway::class); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Register config. + * + * @return void + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../Config/config.php' => config_path('offline.php'), + ], 'config'); + $this->mergeConfigFrom( + __DIR__.'/../Config/config.php', 'offline' + ); + } + + /** + * Register views. + * + * @return void + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/offline'); + + $sourcePath = __DIR__.'/../Resources/views'; + + $this->publishes([ + $sourcePath => $viewPath + ]); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/offline'; + }, \Config::get('view.paths')), [$sourcePath]), 'offline'); + } + + /** + * Register translations. + * + * @return void + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/offline'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, 'offline'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'offline'); + } + } + + /** + * Register an additional directory of factories. + * @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66 + */ + public function registerFactories() + { + if (! app()->environment('production')) { + app(Factory::class)->load(__DIR__ . '/Database/factories'); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } +} diff --git a/modules/Offline/Repositories/.gitkeep b/modules/Offline/Repositories/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Resources/lang/.gitkeep b/modules/Offline/Resources/lang/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Resources/lang/en-GB/offline.php b/modules/Offline/Resources/lang/en-GB/offline.php new file mode 100644 index 000000000..c99a48b78 --- /dev/null +++ b/modules/Offline/Resources/lang/en-GB/offline.php @@ -0,0 +1,11 @@ + 'Offline Payments', + 'add_new' => 'Add New', + 'code' => 'Code', + 'order' => 'Order', + 'payment_gateways' => 'Offline Payment Methods', + +]; diff --git a/modules/Offline/Resources/views/.gitkeep b/modules/Offline/Resources/views/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/Resources/views/edit.blade.php b/modules/Offline/Resources/views/edit.blade.php new file mode 100644 index 000000000..b0efb55b9 --- /dev/null +++ b/modules/Offline/Resources/views/edit.blade.php @@ -0,0 +1,133 @@ +@extends('layouts.admin') + +@section('title', trans('offline::offline.offline')) + +@section('content') +
+
+
+

{{ trans('offline::offline.add_new') }}

+ +
+ + + {!! Form::open(['url' => 'modules/offline/settings', 'files' => true, 'role' => 'form']) !!} + +
+ {{ Form::textGroup('name', trans('general.name'), 'id-card-o', ['required' => 'required'], null, 'col-md-12') }} + + {{ Form::textGroup('code', trans('offline::offline.code'), 'key', ['required' => 'required'], null, 'col-md-12') }} + + {{ Form::textGroup('order', trans('offline::offline.order'), 'sort', [], 0, 'col-md-12') }} + + {{ Form::textareaGroup('description', trans('general.description')) }} +
+ + + + + + {!! Form::close() !!} +
+ +
+
+ +
+
+

{{ trans('offline::offline.payment_gateways') }}

+ +
+ +
+
+ + + + + + + + + + + @if($items) + @foreach($items as $item) + + + + + + + @endforeach + @else + + @endif + +
{{ trans('general.name') }}{{ trans('offline::offline.code') }}{{ trans('offline::offline.order') }}{{ trans('general.actions') }}
{{ $item->name }}{{ $item->code }}{{ $item->order }} + + +
+
+
+ +
+ +
+@endsection + +@section('scripts') + +@endsection + diff --git a/modules/Offline/Tests/.gitkeep b/modules/Offline/Tests/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/modules/Offline/composer.json b/modules/Offline/composer.json new file mode 100644 index 000000000..6231ff1dc --- /dev/null +++ b/modules/Offline/composer.json @@ -0,0 +1,15 @@ +{ + "name": "akaunting/offline", + "description": "", + "authors": [ + { + "name": "Akaunting", + "email": "info@akaunting.com" + } + ], + "autoload": { + "psr-4": { + "Modules\\Offline\\": "" + } + } +} diff --git a/modules/Offline/module.json b/modules/Offline/module.json new file mode 100644 index 000000000..350476d3b --- /dev/null +++ b/modules/Offline/module.json @@ -0,0 +1,19 @@ +{ + "name": "Offline", + "alias": "offline", + "description": "", + "version": "1.0.0", + "category": "payment-gateways", + "keywords": [], + "active": 1, + "order": 0, + "providers": [ + "Modules\\Offline\\Providers\\OfflineServiceProvider" + ], + "aliases": {}, + "files": [ + "start.php" + ], + "requires": [], + "settings": [] +} diff --git a/modules/Offline/start.php b/modules/Offline/start.php new file mode 100644 index 000000000..140a1055c --- /dev/null +++ b/modules/Offline/start.php @@ -0,0 +1,17 @@ +routesAreCached()) { + require __DIR__ . '/Http/routes.php'; +} diff --git a/public/css/addons.css b/public/css/addons.css new file mode 100644 index 000000000..6d14a754f --- /dev/null +++ b/public/css/addons.css @@ -0,0 +1,5 @@ +.item-image { + width: 100%; + max-height: 150px; + margin-bottom: 15px; +} \ No newline at end of file diff --git a/public/css/akaunting-green.css b/public/css/akaunting-green.css new file mode 100644 index 000000000..d5bfbc3fd --- /dev/null +++ b/public/css/akaunting-green.css @@ -0,0 +1,98 @@ +.nav-tabs-custom>.nav-tabs>li.active { + border-top-color: #6da252; +} + +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: #6da252 !important; +} + +.form-control:focus { + border-color: #6da252 !important; +} + +#result-search { + border-color: #6da252; +} + +#profit { + background: #6da252; +} + +.info-box .progress .progress-bar.progress-bar-green, .progress-bar-success { + background-color: #6da252; +} + +/* Bootstrap */ +.btn-success { + background-color: #6da252; + border-color: #629149; +} + +.btn-success.hover, .btn-success:hover { + background-color: #629149; +} + +.btn-success.focus, .btn-success:focus { + background-color: #629149; + border-color: #2b4020; +} + +.btn-success.active, .btn-success:active { + background-color: #6da252; + border-color: #629149; +} + +.btn-success.active.focus, .btn-success.active:focus { + background-color: #4c7139; + border-color: #416131; +} + +.bg-green { + background-color: #6da252 !important; +} + +.alert-success { + background-color: #6da252 !important; + border-color: #629149; +} + +.label-success { + background-color: #6da252 !important; +} + +.box.box-success { + border-top-color: #6da252; +} + +.box.box-solid.box-success>.box-header { + background-color: #6da252; +} + +.box.box-solid.box-success { + border-color: #629149; +} + +.text-green { + color: #6da252; +} + +/* AdminLTE green skin */ +.skin-green-light .main-header .navbar { + background-color: #6da252; +} + +.skin-green-light .main-header .navbar .sidebar-toggle:hover { + background-color: #629149; +} + +.skin-green-light .main-header .logo { + background-color: #6da252; +} + +.skin-green-light .main-header li.user-header { + background-color: #6da252; +} + +.skin-green-light .main-header .logo:hover { + background-color: #629149; +} \ No newline at end of file diff --git a/public/css/app.css b/public/css/app.css new file mode 100644 index 000000000..3bc9625d4 --- /dev/null +++ b/public/css/app.css @@ -0,0 +1,456 @@ +.logo-lg { + text-align: left; +} + +.logo-image-mini { + margin: 12px 3px 0 0; +} + +.logo-image-lg { + margin: -5px 5px 0 0; +} + +.input-group-addon { + min-width: 41px; +} + +.new-button { + margin-left: 20px; +} + +.content-center { + margin: 0 auto; + max-width : 1300px; +} + +.form-group { + /*max-width: 450px;*/ +} + +.tab-margin { + margin: 25px 0; +} + +.sort-icon { + opacity: 0.5; +} + +.input-filter { + display: inline; + width: inherit; +} + +.title-filter { + margin-right: 10px; +} + +.btn-filter { + margin-bottom: 1px; +} + +.setting-buttons { + /*padding: 15px 0 0 15px; + border-top: 1px solid #f4f4f4;*/ + float: none; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + border-top: 1px solid #f4f4f4; + padding: 10px; + background-color: #fff; +} + +#sale { + width: 15px; + height: 15px; + background: #00c0ef; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; +} + +#cost { + width: 15px; + height: 15px; + background: #F56954; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; +} + +#profit { + width: 15px; + height: 15px; + background: #2FB628; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; +} + +.table-responsive { + overflow-x: hidden; +} + +div.required .control-label:not(span):after, td.required:after { + content: ' *'; + color: #F00; + font-weight: bold; +} + +.form-group .select2-container { + width: 100% !important; +} + +.form-group .select2-container--default .select2-selection--single { + border-radius: 0px; +} + +.form-group .select2-container .select2-selection--single { + height: 34px; + border: 1px solid #d2d6de; +} + +.form-group .select2-container .select2-selection--single .select2-selection__rendered { + padding-left: 0px; +} + +.form-group .select2-container--default .select2-selection--single .select2-selection__placeholder { + color: inherit; +} + +.form-group .select2-container--default .select2-selection--single .select2-selection__arrow { + height: 30px; +} + +.form-group .select2-container--default .select2-selection--single .select2-selection__arrow b { + border-color: #555 transparent transparent transparent; +} + +.info-box .progress .progress-bar { + background: inherit; +} + +.info-box .progress .progress-bar.progress-bar-green, .progress-bar-success { + background-color: #00a65a; +} + +.info-box .progress .progress-bar.progress-bar-red, .progress-bar-danger { + background-color: #dd4b39; +} + +.info-box .progress .progress-bar.progress-bar-aqua, .progress-bar-info { + background-color: #00c0ef; +} + +.box.box-success .table.table-bordered { + font-size: 14px; +} + +.info-box-icon i { + margin-top: 20px; +} + +.box.box-success .chart svg, .chart canvas { + width: 96% !important; + margin-left: 25px; +} + +.daily-footer { + margin-left: 5px; + margin-top: 5px; + padding-top: 10px; + border-top: 1px solid #f4f4f4; +} + +.nav-tabs-custom>.nav-tabs>li.active { + border-top-color: #00a65a; +} + +.input-group .btn-group.radio-inline { + padding-left: inherit; +} + +.input-group input[type=file]:focus, input[type=checkbox]:focus, input[type=radio]:focus { + outline: inherit; + outline-offset: 0px; +} + +.input-group .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] { + margin-left: 0px; +} + +.users-image { + float: left; + width: 25px; + height: 25px; + border-radius: 50%; + margin-right: 10px; + margin-top: -2px; +} + +.setting-form .box-footer .col-sm-12 .form-group { + margin-left: 5px; +} + +/* +.setting-form .box-footer .col-sm-12 .form-group a { + margin-left: 10px; +} +*/ + +.col-sm-12 .nav-tabs-custom .tab-content .tab-pane { + overflow: auto; +} + +.fake-input { + /*width: 370px !important;*/ +} + +.user-panel { + position: inherit; +} + +.navbar-custom-menu .navbar-nav > li > a > i { + line-height: 20px; +} + +.tasks-menu img { + margin: 1px 0 2px 0; +} + +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: #00a65a !important; + color : #FFFFFF; +} + +.form-control:focus { + border-color: #00a65a !important; +} + +.box.box-success .invoice, .box.box-success .bill { + border: none; + margin: 0; +} + +.bill { + position: relative; + background: #fff; + padding: 20px; +} + +#loading { + position: absolute; + top: 40%; + left: 40%; +} + +#payment-modal .form-group.col-md-6 .help-block { + color : #F00; +} + +.login-page { + background-image: url('../img/login.jpg'); + background-size: cover; + background-repeat: no-repeat; + background-position: center center; + height: 100%; + width: 100%; + padding: 5% 0; + position: fixed; +} + +.login-logo img { + width: 70px; +} + +.user-panel > .image > img { + max-height: 45px; +} + +.main-header .add-new.nav.navbar-nav i { + margin-top: 3px; + line-height: 17px; +} + +.navbar-nav > .add-new-menu > .dropdown-menu { + width: 465px; + max-height: 180px; + padding: 0 0 0 0; + margin: 0; + top: 100%; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline { + margin-left: 0; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li { + width: 150px; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li > .list-unstyled > li .menu { + margin: 0; + padding: 0; + list-style: none; + overflow-x: hidden; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li > .list-unstyled > li.header { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + background-color: #ffffff; + padding: 7px 10px; + border-bottom: 1px solid #f4f4f4; + color: #444444; + font-size: 14px; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li > .list-unstyled > li > a { + color: #444444; + overflow: hidden; + text-overflow: ellipsis; + padding: 10px; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li > .list-unstyled > li .menu > li > a { + display: block; + white-space: nowrap; + border-bottom: 1px solid #f4f4f4; + color: #444444; + overflow: hidden; + text-overflow: ellipsis; + padding: 10px; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li > .list-unstyled > li .menu > li > a:hover { + background: #f4f4f4; + text-decoration: none; +} + +.navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li > .list-unstyled > li.footer > a { + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; + font-size: 12px; + background-color: #fff; + padding: 7px 10px; + border-bottom: 1px solid #eeeeee; + color: #444 !important; + text-align: center; +} + +.add-new .add-new-menu .menu { + width: 150px; +} + +.ajax-search { + padding: 5px; +} + +#result-search { + border-color: #00a65a; +} + +#result-search li a:hover { + color: #FFFFFF; + background-color : #00A65A !important; +} + +#result-search li a:hover .ajax-search .name { + color: #FFFFFF !important; +} + +.ajax-search .name { + font-size: 14px; + font-weight: bold; +} + +.ajax-search .type { + font-size: 12px; +} + +.table.table-responsive tbody tr td { + vertical-align: middle; +} + +.form-group.has-error .fancy-file { + margin-bottom: 15px; +} + +ul.add-new.nav.navbar-nav.pull-left { + margin: 0; +} + +.table { + font-weight: 400; + font-size: inherit; +} + +.no-padding-left { + padding-left: 0; +} + +.no-padding-right { + padding-right: 0; +} + +.invoice-header { + padding-bottom: 9px; + margin: 10px 0 20px 0; + border-bottom: 1px solid #eee; +} + +.invoice-company { + padding-left: 23px; +} + +.invoice-logo { + max-width: 430px; + max-height: 120px; +} + +@media only screen and (max-width : 768px) { + .main-header .add-new.nav.navbar-nav i { + margin-top: 3px; + line-height: 27px; + } + + ul.add-new.nav.navbar-nav.pull-left li { + position: initial; + } + + .navbar-nav .open .dropdown-menu { + position: absolute; + } + + .dropdown.add-new-menu.open .dropdown-menu { + background-color: #ffffff; + } +} + +@media only screen and (max-width : 480px) { + .main-header .add-new.nav.navbar-nav i { + margin-top: 3px; + line-height: 27px; + } + + ul.add-new.nav.navbar-nav.pull-left li { + position: initial; + } + + .navbar-nav .open .dropdown-menu { + position: absolute; + } + + .navbar-nav > .add-new-menu > .dropdown-menu > .list-inline > li { + width: 120px; + } + + .dropdown.add-new-menu.open .dropdown-menu { + background-color: #ffffff; + } +} diff --git a/public/css/bootstrap-fancyfile.css b/public/css/bootstrap-fancyfile.css new file mode 100644 index 000000000..039cdd8be --- /dev/null +++ b/public/css/bootstrap-fancyfile.css @@ -0,0 +1,43 @@ +.fancy-file { + display: block; + position: relative; +} + +.fancy-file input[type="file"] { + position: relative; + text-align: right; + -moz-opacity: 0; + filter: alpha(opacity: 0); + opacity: 0; + z-index: 2; + cursor: pointer; +} + +.fancy-file div { + position: absolute; + top: 0px; + left: 0px; + z-index: 1; + height: 36px; +} + +.fancy-file input[type="text"], +.fancy-file button, +.fancy-file .btn { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; +} + +.fancy-file input[type="text"] { + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} + +.fancy-file button, +.fancy-file .btn { + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} diff --git a/public/css/font-awesome.min.css b/public/css/font-awesome.min.css new file mode 100644 index 000000000..b7610d26a --- /dev/null +++ b/public/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} \ No newline at end of file diff --git a/public/css/install.css b/public/css/install.css new file mode 100644 index 000000000..fb0a756ea --- /dev/null +++ b/public/css/install.css @@ -0,0 +1,163 @@ +.install-image { + position: fixed; + left: 0; + right: 0; + z-index: 1; + + display: block; + background-image: url('../img/install.jpg'); + background-size: cover; + background-repeat: no-repeat; + background-position: center center; + height: 100%; + width: 100%; + + -webkit-filter: grayscale(50%); + -moz-filter: grayscale(50%); + -o-filter: grayscale(50%); + -ms-filter: grayscale(50%); + filter: grayscale(50%); +} + +.install-content { + position: fixed; + left: 0; + right: 0; + z-index: 9999; + margin: 0 auto; + max-width : 450px; +} + +.install-logo { + text-align: center; +} + +.install-logo img { + margin: 25px auto; + width: 70px; +} + +.install-loading-bar { + font-size: 35px; + position: absolute; + z-index: 500; + top: 45px; + left: 7px; + width: 434px; + background: rgb(136, 136, 136); + opacity: 0.2; + -moz-border-radius-bottomleft: 1px; + -moz-border-radius-bottomright: 1px; + border-bottom-left-radius: 1px; + border-bottom-right-radius: 1px; +} + +.install-loading-spin { + font-size: 100px; + position: absolute; + margin: auto; + color: #fff; + padding: 28% 40%; +} + +.table-responsive { + overflow-x: hidden; +} + +div.required .control-label:not(span):after, td.required:after { + content: ' *'; + color: #F00; + font-weight: bold; +} + +.form-group .select2-container { + width: 100% !important; +} + +.form-group .select2-container--default .select2-selection--single { + border-radius: 0px; +} + +.form-group .select2-container .select2-selection--single { + height: 34px; + border: 1px solid #d2d6de; +} + +.form-group .select2-container .select2-selection--single .select2-selection__rendered { + padding-left: 0px; +} + +.form-group .select2-container--default .select2-selection--single .select2-selection__placeholder { + color: inherit; +} + +.form-group .select2-container--default .select2-selection--single .select2-selection__arrow { + height: 30px; +} + +.form-group .select2-container--default .select2-selection--single .select2-selection__arrow b { + border-color: #555 transparent transparent transparent; +} + +.info-box .progress .progress-bar { + background: inherit; +} + +.info-box .progress .progress-bar.progress-bar-green, .progress-bar-success { + background-color: #00a65a; +} + +.info-box .progress .progress-bar.progress-bar-red, .progress-bar-danger { + background-color: #dd4b39; +} + +.info-box .progress .progress-bar.progress-bar-aqua, .progress-bar-info { + background-color: #00c0ef; +} + +.box.box-success .table.table-bordered { + font-size: 14px; +} + +.info-box-icon i { + margin-top: 20px; +} + +.box.box-success .chart svg, .chart canvas { + width: 96% !important; + margin-left: 25px; +} + +.nav-tabs-custom>.nav-tabs>li.active { + border-top-color: #00a65a; +} + +.input-group .btn-group.radio-inline { + padding-left: inherit; +} + +.input-group input[type=file]:focus, input[type=checkbox]:focus, input[type=radio]:focus { + outline: inherit; + outline-offset: 0px; +} + +.input-group .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] { + margin-left: 0px; +} + +.navbar-custom-menu .navbar-nav > li > a > i { + line-height: 20px; +} + +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: #00a65a !important; +} + +.form-control:focus { + border-color: #00a65a !important; +} + +.box.box-solid.box-success { + border: none; + box-shadow: 0 2px 10px rgba(153, 153, 153, 0.5); +} diff --git a/public/css/ionicons.min.css b/public/css/ionicons.min.css new file mode 100644 index 000000000..049b64865 --- /dev/null +++ b/public/css/ionicons.min.css @@ -0,0 +1,11 @@ +@charset "UTF-8";/*! + Ionicons, v2.0.0 + Created by Ben Sperry for the Ionic Framework, http://ionicons.com/ + https://twitter.com/benjsperry https://twitter.com/ionicframework + MIT License: https://github.com/driftyco/ionicons + + Android-style icons originally built by Google’s + Material Design Icons: https://github.com/google/material-design-icons + used under CC BY http://creativecommons.org/licenses/by/4.0/ + Modified icons to fit ionicon’s grid from original. +*/@font-face{font-family:"Ionicons";src:url("../fonts/ionicons.eot?v=2.0.0");src:url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"),url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"),url("../fonts/ionicons.woff?v=2.0.0") format("woff"),url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg");font-weight:normal;font-style:normal}.ion,.ionicons,.ion-alert:before,.ion-alert-circled:before,.ion-android-add:before,.ion-android-add-circle:before,.ion-android-alarm-clock:before,.ion-android-alert:before,.ion-android-apps:before,.ion-android-archive:before,.ion-android-arrow-back:before,.ion-android-arrow-down:before,.ion-android-arrow-dropdown:before,.ion-android-arrow-dropdown-circle:before,.ion-android-arrow-dropleft:before,.ion-android-arrow-dropleft-circle:before,.ion-android-arrow-dropright:before,.ion-android-arrow-dropright-circle:before,.ion-android-arrow-dropup:before,.ion-android-arrow-dropup-circle:before,.ion-android-arrow-forward:before,.ion-android-arrow-up:before,.ion-android-attach:before,.ion-android-bar:before,.ion-android-bicycle:before,.ion-android-boat:before,.ion-android-bookmark:before,.ion-android-bulb:before,.ion-android-bus:before,.ion-android-calendar:before,.ion-android-call:before,.ion-android-camera:before,.ion-android-cancel:before,.ion-android-car:before,.ion-android-cart:before,.ion-android-chat:before,.ion-android-checkbox:before,.ion-android-checkbox-blank:before,.ion-android-checkbox-outline:before,.ion-android-checkbox-outline-blank:before,.ion-android-checkmark-circle:before,.ion-android-clipboard:before,.ion-android-close:before,.ion-android-cloud:before,.ion-android-cloud-circle:before,.ion-android-cloud-done:before,.ion-android-cloud-outline:before,.ion-android-color-palette:before,.ion-android-compass:before,.ion-android-contact:before,.ion-android-contacts:before,.ion-android-contract:before,.ion-android-create:before,.ion-android-delete:before,.ion-android-desktop:before,.ion-android-document:before,.ion-android-done:before,.ion-android-done-all:before,.ion-android-download:before,.ion-android-drafts:before,.ion-android-exit:before,.ion-android-expand:before,.ion-android-favorite:before,.ion-android-favorite-outline:before,.ion-android-film:before,.ion-android-folder:before,.ion-android-folder-open:before,.ion-android-funnel:before,.ion-android-globe:before,.ion-android-hand:before,.ion-android-hangout:before,.ion-android-happy:before,.ion-android-home:before,.ion-android-image:before,.ion-android-laptop:before,.ion-android-list:before,.ion-android-locate:before,.ion-android-lock:before,.ion-android-mail:before,.ion-android-map:before,.ion-android-menu:before,.ion-android-microphone:before,.ion-android-microphone-off:before,.ion-android-more-horizontal:before,.ion-android-more-vertical:before,.ion-android-navigate:before,.ion-android-notifications:before,.ion-android-notifications-none:before,.ion-android-notifications-off:before,.ion-android-open:before,.ion-android-options:before,.ion-android-people:before,.ion-android-person:before,.ion-android-person-add:before,.ion-android-phone-landscape:before,.ion-android-phone-portrait:before,.ion-android-pin:before,.ion-android-plane:before,.ion-android-playstore:before,.ion-android-print:before,.ion-android-radio-button-off:before,.ion-android-radio-button-on:before,.ion-android-refresh:before,.ion-android-remove:before,.ion-android-remove-circle:before,.ion-android-restaurant:before,.ion-android-sad:before,.ion-android-search:before,.ion-android-send:before,.ion-android-settings:before,.ion-android-share:before,.ion-android-share-alt:before,.ion-android-star:before,.ion-android-star-half:before,.ion-android-star-outline:before,.ion-android-stopwatch:before,.ion-android-subway:before,.ion-android-sunny:before,.ion-android-sync:before,.ion-android-textsms:before,.ion-android-time:before,.ion-android-train:before,.ion-android-unlock:before,.ion-android-upload:before,.ion-android-volume-down:before,.ion-android-volume-mute:before,.ion-android-volume-off:before,.ion-android-volume-up:before,.ion-android-walk:before,.ion-android-warning:before,.ion-android-watch:before,.ion-android-wifi:before,.ion-aperture:before,.ion-archive:before,.ion-arrow-down-a:before,.ion-arrow-down-b:before,.ion-arrow-down-c:before,.ion-arrow-expand:before,.ion-arrow-graph-down-left:before,.ion-arrow-graph-down-right:before,.ion-arrow-graph-up-left:before,.ion-arrow-graph-up-right:before,.ion-arrow-left-a:before,.ion-arrow-left-b:before,.ion-arrow-left-c:before,.ion-arrow-move:before,.ion-arrow-resize:before,.ion-arrow-return-left:before,.ion-arrow-return-right:before,.ion-arrow-right-a:before,.ion-arrow-right-b:before,.ion-arrow-right-c:before,.ion-arrow-shrink:before,.ion-arrow-swap:before,.ion-arrow-up-a:before,.ion-arrow-up-b:before,.ion-arrow-up-c:before,.ion-asterisk:before,.ion-at:before,.ion-backspace:before,.ion-backspace-outline:before,.ion-bag:before,.ion-battery-charging:before,.ion-battery-empty:before,.ion-battery-full:before,.ion-battery-half:before,.ion-battery-low:before,.ion-beaker:before,.ion-beer:before,.ion-bluetooth:before,.ion-bonfire:before,.ion-bookmark:before,.ion-bowtie:before,.ion-briefcase:before,.ion-bug:before,.ion-calculator:before,.ion-calendar:before,.ion-camera:before,.ion-card:before,.ion-cash:before,.ion-chatbox:before,.ion-chatbox-working:before,.ion-chatboxes:before,.ion-chatbubble:before,.ion-chatbubble-working:before,.ion-chatbubbles:before,.ion-checkmark:before,.ion-checkmark-circled:before,.ion-checkmark-round:before,.ion-chevron-down:before,.ion-chevron-left:before,.ion-chevron-right:before,.ion-chevron-up:before,.ion-clipboard:before,.ion-clock:before,.ion-close:before,.ion-close-circled:before,.ion-close-round:before,.ion-closed-captioning:before,.ion-cloud:before,.ion-code:before,.ion-code-download:before,.ion-code-working:before,.ion-coffee:before,.ion-compass:before,.ion-compose:before,.ion-connection-bars:before,.ion-contrast:before,.ion-crop:before,.ion-cube:before,.ion-disc:before,.ion-document:before,.ion-document-text:before,.ion-drag:before,.ion-earth:before,.ion-easel:before,.ion-edit:before,.ion-egg:before,.ion-eject:before,.ion-email:before,.ion-email-unread:before,.ion-erlenmeyer-flask:before,.ion-erlenmeyer-flask-bubbles:before,.ion-eye:before,.ion-eye-disabled:before,.ion-female:before,.ion-filing:before,.ion-film-marker:before,.ion-fireball:before,.ion-flag:before,.ion-flame:before,.ion-flash:before,.ion-flash-off:before,.ion-folder:before,.ion-fork:before,.ion-fork-repo:before,.ion-forward:before,.ion-funnel:before,.ion-gear-a:before,.ion-gear-b:before,.ion-grid:before,.ion-hammer:before,.ion-happy:before,.ion-happy-outline:before,.ion-headphone:before,.ion-heart:before,.ion-heart-broken:before,.ion-help:before,.ion-help-buoy:before,.ion-help-circled:before,.ion-home:before,.ion-icecream:before,.ion-image:before,.ion-images:before,.ion-information:before,.ion-information-circled:before,.ion-ionic:before,.ion-ios-alarm:before,.ion-ios-alarm-outline:before,.ion-ios-albums:before,.ion-ios-albums-outline:before,.ion-ios-americanfootball:before,.ion-ios-americanfootball-outline:before,.ion-ios-analytics:before,.ion-ios-analytics-outline:before,.ion-ios-arrow-back:before,.ion-ios-arrow-down:before,.ion-ios-arrow-forward:before,.ion-ios-arrow-left:before,.ion-ios-arrow-right:before,.ion-ios-arrow-thin-down:before,.ion-ios-arrow-thin-left:before,.ion-ios-arrow-thin-right:before,.ion-ios-arrow-thin-up:before,.ion-ios-arrow-up:before,.ion-ios-at:before,.ion-ios-at-outline:before,.ion-ios-barcode:before,.ion-ios-barcode-outline:before,.ion-ios-baseball:before,.ion-ios-baseball-outline:before,.ion-ios-basketball:before,.ion-ios-basketball-outline:before,.ion-ios-bell:before,.ion-ios-bell-outline:before,.ion-ios-body:before,.ion-ios-body-outline:before,.ion-ios-bolt:before,.ion-ios-bolt-outline:before,.ion-ios-book:before,.ion-ios-book-outline:before,.ion-ios-bookmarks:before,.ion-ios-bookmarks-outline:before,.ion-ios-box:before,.ion-ios-box-outline:before,.ion-ios-briefcase:before,.ion-ios-briefcase-outline:before,.ion-ios-browsers:before,.ion-ios-browsers-outline:before,.ion-ios-calculator:before,.ion-ios-calculator-outline:before,.ion-ios-calendar:before,.ion-ios-calendar-outline:before,.ion-ios-camera:before,.ion-ios-camera-outline:before,.ion-ios-cart:before,.ion-ios-cart-outline:before,.ion-ios-chatboxes:before,.ion-ios-chatboxes-outline:before,.ion-ios-chatbubble:before,.ion-ios-chatbubble-outline:before,.ion-ios-checkmark:before,.ion-ios-checkmark-empty:before,.ion-ios-checkmark-outline:before,.ion-ios-circle-filled:before,.ion-ios-circle-outline:before,.ion-ios-clock:before,.ion-ios-clock-outline:before,.ion-ios-close:before,.ion-ios-close-empty:before,.ion-ios-close-outline:before,.ion-ios-cloud:before,.ion-ios-cloud-download:before,.ion-ios-cloud-download-outline:before,.ion-ios-cloud-outline:before,.ion-ios-cloud-upload:before,.ion-ios-cloud-upload-outline:before,.ion-ios-cloudy:before,.ion-ios-cloudy-night:before,.ion-ios-cloudy-night-outline:before,.ion-ios-cloudy-outline:before,.ion-ios-cog:before,.ion-ios-cog-outline:before,.ion-ios-color-filter:before,.ion-ios-color-filter-outline:before,.ion-ios-color-wand:before,.ion-ios-color-wand-outline:before,.ion-ios-compose:before,.ion-ios-compose-outline:before,.ion-ios-contact:before,.ion-ios-contact-outline:before,.ion-ios-copy:before,.ion-ios-copy-outline:before,.ion-ios-crop:before,.ion-ios-crop-strong:before,.ion-ios-download:before,.ion-ios-download-outline:before,.ion-ios-drag:before,.ion-ios-email:before,.ion-ios-email-outline:before,.ion-ios-eye:before,.ion-ios-eye-outline:before,.ion-ios-fastforward:before,.ion-ios-fastforward-outline:before,.ion-ios-filing:before,.ion-ios-filing-outline:before,.ion-ios-film:before,.ion-ios-film-outline:before,.ion-ios-flag:before,.ion-ios-flag-outline:before,.ion-ios-flame:before,.ion-ios-flame-outline:before,.ion-ios-flask:before,.ion-ios-flask-outline:before,.ion-ios-flower:before,.ion-ios-flower-outline:before,.ion-ios-folder:before,.ion-ios-folder-outline:before,.ion-ios-football:before,.ion-ios-football-outline:before,.ion-ios-game-controller-a:before,.ion-ios-game-controller-a-outline:before,.ion-ios-game-controller-b:before,.ion-ios-game-controller-b-outline:before,.ion-ios-gear:before,.ion-ios-gear-outline:before,.ion-ios-glasses:before,.ion-ios-glasses-outline:before,.ion-ios-grid-view:before,.ion-ios-grid-view-outline:before,.ion-ios-heart:before,.ion-ios-heart-outline:before,.ion-ios-help:before,.ion-ios-help-empty:before,.ion-ios-help-outline:before,.ion-ios-home:before,.ion-ios-home-outline:before,.ion-ios-infinite:before,.ion-ios-infinite-outline:before,.ion-ios-information:before,.ion-ios-information-empty:before,.ion-ios-information-outline:before,.ion-ios-ionic-outline:before,.ion-ios-keypad:before,.ion-ios-keypad-outline:before,.ion-ios-lightbulb:before,.ion-ios-lightbulb-outline:before,.ion-ios-list:before,.ion-ios-list-outline:before,.ion-ios-location:before,.ion-ios-location-outline:before,.ion-ios-locked:before,.ion-ios-locked-outline:before,.ion-ios-loop:before,.ion-ios-loop-strong:before,.ion-ios-medical:before,.ion-ios-medical-outline:before,.ion-ios-medkit:before,.ion-ios-medkit-outline:before,.ion-ios-mic:before,.ion-ios-mic-off:before,.ion-ios-mic-outline:before,.ion-ios-minus:before,.ion-ios-minus-empty:before,.ion-ios-minus-outline:before,.ion-ios-monitor:before,.ion-ios-monitor-outline:before,.ion-ios-moon:before,.ion-ios-moon-outline:before,.ion-ios-more:before,.ion-ios-more-outline:before,.ion-ios-musical-note:before,.ion-ios-musical-notes:before,.ion-ios-navigate:before,.ion-ios-navigate-outline:before,.ion-ios-nutrition:before,.ion-ios-nutrition-outline:before,.ion-ios-paper:before,.ion-ios-paper-outline:before,.ion-ios-paperplane:before,.ion-ios-paperplane-outline:before,.ion-ios-partlysunny:before,.ion-ios-partlysunny-outline:before,.ion-ios-pause:before,.ion-ios-pause-outline:before,.ion-ios-paw:before,.ion-ios-paw-outline:before,.ion-ios-people:before,.ion-ios-people-outline:before,.ion-ios-person:before,.ion-ios-person-outline:before,.ion-ios-personadd:before,.ion-ios-personadd-outline:before,.ion-ios-photos:before,.ion-ios-photos-outline:before,.ion-ios-pie:before,.ion-ios-pie-outline:before,.ion-ios-pint:before,.ion-ios-pint-outline:before,.ion-ios-play:before,.ion-ios-play-outline:before,.ion-ios-plus:before,.ion-ios-plus-empty:before,.ion-ios-plus-outline:before,.ion-ios-pricetag:before,.ion-ios-pricetag-outline:before,.ion-ios-pricetags:before,.ion-ios-pricetags-outline:before,.ion-ios-printer:before,.ion-ios-printer-outline:before,.ion-ios-pulse:before,.ion-ios-pulse-strong:before,.ion-ios-rainy:before,.ion-ios-rainy-outline:before,.ion-ios-recording:before,.ion-ios-recording-outline:before,.ion-ios-redo:before,.ion-ios-redo-outline:before,.ion-ios-refresh:before,.ion-ios-refresh-empty:before,.ion-ios-refresh-outline:before,.ion-ios-reload:before,.ion-ios-reverse-camera:before,.ion-ios-reverse-camera-outline:before,.ion-ios-rewind:before,.ion-ios-rewind-outline:before,.ion-ios-rose:before,.ion-ios-rose-outline:before,.ion-ios-search:before,.ion-ios-search-strong:before,.ion-ios-settings:before,.ion-ios-settings-strong:before,.ion-ios-shuffle:before,.ion-ios-shuffle-strong:before,.ion-ios-skipbackward:before,.ion-ios-skipbackward-outline:before,.ion-ios-skipforward:before,.ion-ios-skipforward-outline:before,.ion-ios-snowy:before,.ion-ios-speedometer:before,.ion-ios-speedometer-outline:before,.ion-ios-star:before,.ion-ios-star-half:before,.ion-ios-star-outline:before,.ion-ios-stopwatch:before,.ion-ios-stopwatch-outline:before,.ion-ios-sunny:before,.ion-ios-sunny-outline:before,.ion-ios-telephone:before,.ion-ios-telephone-outline:before,.ion-ios-tennisball:before,.ion-ios-tennisball-outline:before,.ion-ios-thunderstorm:before,.ion-ios-thunderstorm-outline:before,.ion-ios-time:before,.ion-ios-time-outline:before,.ion-ios-timer:before,.ion-ios-timer-outline:before,.ion-ios-toggle:before,.ion-ios-toggle-outline:before,.ion-ios-trash:before,.ion-ios-trash-outline:before,.ion-ios-undo:before,.ion-ios-undo-outline:before,.ion-ios-unlocked:before,.ion-ios-unlocked-outline:before,.ion-ios-upload:before,.ion-ios-upload-outline:before,.ion-ios-videocam:before,.ion-ios-videocam-outline:before,.ion-ios-volume-high:before,.ion-ios-volume-low:before,.ion-ios-wineglass:before,.ion-ios-wineglass-outline:before,.ion-ios-world:before,.ion-ios-world-outline:before,.ion-ipad:before,.ion-iphone:before,.ion-ipod:before,.ion-jet:before,.ion-key:before,.ion-knife:before,.ion-laptop:before,.ion-leaf:before,.ion-levels:before,.ion-lightbulb:before,.ion-link:before,.ion-load-a:before,.ion-load-b:before,.ion-load-c:before,.ion-load-d:before,.ion-location:before,.ion-lock-combination:before,.ion-locked:before,.ion-log-in:before,.ion-log-out:before,.ion-loop:before,.ion-magnet:before,.ion-male:before,.ion-man:before,.ion-map:before,.ion-medkit:before,.ion-merge:before,.ion-mic-a:before,.ion-mic-b:before,.ion-mic-c:before,.ion-minus:before,.ion-minus-circled:before,.ion-minus-round:before,.ion-model-s:before,.ion-monitor:before,.ion-more:before,.ion-mouse:before,.ion-music-note:before,.ion-navicon:before,.ion-navicon-round:before,.ion-navigate:before,.ion-network:before,.ion-no-smoking:before,.ion-nuclear:before,.ion-outlet:before,.ion-paintbrush:before,.ion-paintbucket:before,.ion-paper-airplane:before,.ion-paperclip:before,.ion-pause:before,.ion-person:before,.ion-person-add:before,.ion-person-stalker:before,.ion-pie-graph:before,.ion-pin:before,.ion-pinpoint:before,.ion-pizza:before,.ion-plane:before,.ion-planet:before,.ion-play:before,.ion-playstation:before,.ion-plus:before,.ion-plus-circled:before,.ion-plus-round:before,.ion-podium:before,.ion-pound:before,.ion-power:before,.ion-pricetag:before,.ion-pricetags:before,.ion-printer:before,.ion-pull-request:before,.ion-qr-scanner:before,.ion-quote:before,.ion-radio-waves:before,.ion-record:before,.ion-refresh:before,.ion-reply:before,.ion-reply-all:before,.ion-ribbon-a:before,.ion-ribbon-b:before,.ion-sad:before,.ion-sad-outline:before,.ion-scissors:before,.ion-search:before,.ion-settings:before,.ion-share:before,.ion-shuffle:before,.ion-skip-backward:before,.ion-skip-forward:before,.ion-social-android:before,.ion-social-android-outline:before,.ion-social-angular:before,.ion-social-angular-outline:before,.ion-social-apple:before,.ion-social-apple-outline:before,.ion-social-bitcoin:before,.ion-social-bitcoin-outline:before,.ion-social-buffer:before,.ion-social-buffer-outline:before,.ion-social-chrome:before,.ion-social-chrome-outline:before,.ion-social-codepen:before,.ion-social-codepen-outline:before,.ion-social-css3:before,.ion-social-css3-outline:before,.ion-social-designernews:before,.ion-social-designernews-outline:before,.ion-social-dribbble:before,.ion-social-dribbble-outline:before,.ion-social-dropbox:before,.ion-social-dropbox-outline:before,.ion-social-euro:before,.ion-social-euro-outline:before,.ion-social-facebook:before,.ion-social-facebook-outline:before,.ion-social-foursquare:before,.ion-social-foursquare-outline:before,.ion-social-freebsd-devil:before,.ion-social-github:before,.ion-social-github-outline:before,.ion-social-google:before,.ion-social-google-outline:before,.ion-social-googleplus:before,.ion-social-googleplus-outline:before,.ion-social-hackernews:before,.ion-social-hackernews-outline:before,.ion-social-html5:before,.ion-social-html5-outline:before,.ion-social-instagram:before,.ion-social-instagram-outline:before,.ion-social-javascript:before,.ion-social-javascript-outline:before,.ion-social-linkedin:before,.ion-social-linkedin-outline:before,.ion-social-markdown:before,.ion-social-nodejs:before,.ion-social-octocat:before,.ion-social-pinterest:before,.ion-social-pinterest-outline:before,.ion-social-python:before,.ion-social-reddit:before,.ion-social-reddit-outline:before,.ion-social-rss:before,.ion-social-rss-outline:before,.ion-social-sass:before,.ion-social-skype:before,.ion-social-skype-outline:before,.ion-social-snapchat:before,.ion-social-snapchat-outline:before,.ion-social-tumblr:before,.ion-social-tumblr-outline:before,.ion-social-tux:before,.ion-social-twitch:before,.ion-social-twitch-outline:before,.ion-social-twitter:before,.ion-social-twitter-outline:before,.ion-social-usd:before,.ion-social-usd-outline:before,.ion-social-vimeo:before,.ion-social-vimeo-outline:before,.ion-social-whatsapp:before,.ion-social-whatsapp-outline:before,.ion-social-windows:before,.ion-social-windows-outline:before,.ion-social-wordpress:before,.ion-social-wordpress-outline:before,.ion-social-yahoo:before,.ion-social-yahoo-outline:before,.ion-social-yen:before,.ion-social-yen-outline:before,.ion-social-youtube:before,.ion-social-youtube-outline:before,.ion-soup-can:before,.ion-soup-can-outline:before,.ion-speakerphone:before,.ion-speedometer:before,.ion-spoon:before,.ion-star:before,.ion-stats-bars:before,.ion-steam:before,.ion-stop:before,.ion-thermometer:before,.ion-thumbsdown:before,.ion-thumbsup:before,.ion-toggle:before,.ion-toggle-filled:before,.ion-transgender:before,.ion-trash-a:before,.ion-trash-b:before,.ion-trophy:before,.ion-tshirt:before,.ion-tshirt-outline:before,.ion-umbrella:before,.ion-university:before,.ion-unlocked:before,.ion-upload:before,.ion-usb:before,.ion-videocamera:before,.ion-volume-high:before,.ion-volume-low:before,.ion-volume-medium:before,.ion-volume-mute:before,.ion-wand:before,.ion-waterdrop:before,.ion-wifi:before,.ion-wineglass:before,.ion-woman:before,.ion-wrench:before,.ion-xbox:before{display:inline-block;font-family:"Ionicons";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;text-rendering:auto;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ion-alert:before{content:"\f101"}.ion-alert-circled:before{content:"\f100"}.ion-android-add:before{content:"\f2c7"}.ion-android-add-circle:before{content:"\f359"}.ion-android-alarm-clock:before{content:"\f35a"}.ion-android-alert:before{content:"\f35b"}.ion-android-apps:before{content:"\f35c"}.ion-android-archive:before{content:"\f2c9"}.ion-android-arrow-back:before{content:"\f2ca"}.ion-android-arrow-down:before{content:"\f35d"}.ion-android-arrow-dropdown:before{content:"\f35f"}.ion-android-arrow-dropdown-circle:before{content:"\f35e"}.ion-android-arrow-dropleft:before{content:"\f361"}.ion-android-arrow-dropleft-circle:before{content:"\f360"}.ion-android-arrow-dropright:before{content:"\f363"}.ion-android-arrow-dropright-circle:before{content:"\f362"}.ion-android-arrow-dropup:before{content:"\f365"}.ion-android-arrow-dropup-circle:before{content:"\f364"}.ion-android-arrow-forward:before{content:"\f30f"}.ion-android-arrow-up:before{content:"\f366"}.ion-android-attach:before{content:"\f367"}.ion-android-bar:before{content:"\f368"}.ion-android-bicycle:before{content:"\f369"}.ion-android-boat:before{content:"\f36a"}.ion-android-bookmark:before{content:"\f36b"}.ion-android-bulb:before{content:"\f36c"}.ion-android-bus:before{content:"\f36d"}.ion-android-calendar:before{content:"\f2d1"}.ion-android-call:before{content:"\f2d2"}.ion-android-camera:before{content:"\f2d3"}.ion-android-cancel:before{content:"\f36e"}.ion-android-car:before{content:"\f36f"}.ion-android-cart:before{content:"\f370"}.ion-android-chat:before{content:"\f2d4"}.ion-android-checkbox:before{content:"\f374"}.ion-android-checkbox-blank:before{content:"\f371"}.ion-android-checkbox-outline:before{content:"\f373"}.ion-android-checkbox-outline-blank:before{content:"\f372"}.ion-android-checkmark-circle:before{content:"\f375"}.ion-android-clipboard:before{content:"\f376"}.ion-android-close:before{content:"\f2d7"}.ion-android-cloud:before{content:"\f37a"}.ion-android-cloud-circle:before{content:"\f377"}.ion-android-cloud-done:before{content:"\f378"}.ion-android-cloud-outline:before{content:"\f379"}.ion-android-color-palette:before{content:"\f37b"}.ion-android-compass:before{content:"\f37c"}.ion-android-contact:before{content:"\f2d8"}.ion-android-contacts:before{content:"\f2d9"}.ion-android-contract:before{content:"\f37d"}.ion-android-create:before{content:"\f37e"}.ion-android-delete:before{content:"\f37f"}.ion-android-desktop:before{content:"\f380"}.ion-android-document:before{content:"\f381"}.ion-android-done:before{content:"\f383"}.ion-android-done-all:before{content:"\f382"}.ion-android-download:before{content:"\f2dd"}.ion-android-drafts:before{content:"\f384"}.ion-android-exit:before{content:"\f385"}.ion-android-expand:before{content:"\f386"}.ion-android-favorite:before{content:"\f388"}.ion-android-favorite-outline:before{content:"\f387"}.ion-android-film:before{content:"\f389"}.ion-android-folder:before{content:"\f2e0"}.ion-android-folder-open:before{content:"\f38a"}.ion-android-funnel:before{content:"\f38b"}.ion-android-globe:before{content:"\f38c"}.ion-android-hand:before{content:"\f2e3"}.ion-android-hangout:before{content:"\f38d"}.ion-android-happy:before{content:"\f38e"}.ion-android-home:before{content:"\f38f"}.ion-android-image:before{content:"\f2e4"}.ion-android-laptop:before{content:"\f390"}.ion-android-list:before{content:"\f391"}.ion-android-locate:before{content:"\f2e9"}.ion-android-lock:before{content:"\f392"}.ion-android-mail:before{content:"\f2eb"}.ion-android-map:before{content:"\f393"}.ion-android-menu:before{content:"\f394"}.ion-android-microphone:before{content:"\f2ec"}.ion-android-microphone-off:before{content:"\f395"}.ion-android-more-horizontal:before{content:"\f396"}.ion-android-more-vertical:before{content:"\f397"}.ion-android-navigate:before{content:"\f398"}.ion-android-notifications:before{content:"\f39b"}.ion-android-notifications-none:before{content:"\f399"}.ion-android-notifications-off:before{content:"\f39a"}.ion-android-open:before{content:"\f39c"}.ion-android-options:before{content:"\f39d"}.ion-android-people:before{content:"\f39e"}.ion-android-person:before{content:"\f3a0"}.ion-android-person-add:before{content:"\f39f"}.ion-android-phone-landscape:before{content:"\f3a1"}.ion-android-phone-portrait:before{content:"\f3a2"}.ion-android-pin:before{content:"\f3a3"}.ion-android-plane:before{content:"\f3a4"}.ion-android-playstore:before{content:"\f2f0"}.ion-android-print:before{content:"\f3a5"}.ion-android-radio-button-off:before{content:"\f3a6"}.ion-android-radio-button-on:before{content:"\f3a7"}.ion-android-refresh:before{content:"\f3a8"}.ion-android-remove:before{content:"\f2f4"}.ion-android-remove-circle:before{content:"\f3a9"}.ion-android-restaurant:before{content:"\f3aa"}.ion-android-sad:before{content:"\f3ab"}.ion-android-search:before{content:"\f2f5"}.ion-android-send:before{content:"\f2f6"}.ion-android-settings:before{content:"\f2f7"}.ion-android-share:before{content:"\f2f8"}.ion-android-share-alt:before{content:"\f3ac"}.ion-android-star:before{content:"\f2fc"}.ion-android-star-half:before{content:"\f3ad"}.ion-android-star-outline:before{content:"\f3ae"}.ion-android-stopwatch:before{content:"\f2fd"}.ion-android-subway:before{content:"\f3af"}.ion-android-sunny:before{content:"\f3b0"}.ion-android-sync:before{content:"\f3b1"}.ion-android-textsms:before{content:"\f3b2"}.ion-android-time:before{content:"\f3b3"}.ion-android-train:before{content:"\f3b4"}.ion-android-unlock:before{content:"\f3b5"}.ion-android-upload:before{content:"\f3b6"}.ion-android-volume-down:before{content:"\f3b7"}.ion-android-volume-mute:before{content:"\f3b8"}.ion-android-volume-off:before{content:"\f3b9"}.ion-android-volume-up:before{content:"\f3ba"}.ion-android-walk:before{content:"\f3bb"}.ion-android-warning:before{content:"\f3bc"}.ion-android-watch:before{content:"\f3bd"}.ion-android-wifi:before{content:"\f305"}.ion-aperture:before{content:"\f313"}.ion-archive:before{content:"\f102"}.ion-arrow-down-a:before{content:"\f103"}.ion-arrow-down-b:before{content:"\f104"}.ion-arrow-down-c:before{content:"\f105"}.ion-arrow-expand:before{content:"\f25e"}.ion-arrow-graph-down-left:before{content:"\f25f"}.ion-arrow-graph-down-right:before{content:"\f260"}.ion-arrow-graph-up-left:before{content:"\f261"}.ion-arrow-graph-up-right:before{content:"\f262"}.ion-arrow-left-a:before{content:"\f106"}.ion-arrow-left-b:before{content:"\f107"}.ion-arrow-left-c:before{content:"\f108"}.ion-arrow-move:before{content:"\f263"}.ion-arrow-resize:before{content:"\f264"}.ion-arrow-return-left:before{content:"\f265"}.ion-arrow-return-right:before{content:"\f266"}.ion-arrow-right-a:before{content:"\f109"}.ion-arrow-right-b:before{content:"\f10a"}.ion-arrow-right-c:before{content:"\f10b"}.ion-arrow-shrink:before{content:"\f267"}.ion-arrow-swap:before{content:"\f268"}.ion-arrow-up-a:before{content:"\f10c"}.ion-arrow-up-b:before{content:"\f10d"}.ion-arrow-up-c:before{content:"\f10e"}.ion-asterisk:before{content:"\f314"}.ion-at:before{content:"\f10f"}.ion-backspace:before{content:"\f3bf"}.ion-backspace-outline:before{content:"\f3be"}.ion-bag:before{content:"\f110"}.ion-battery-charging:before{content:"\f111"}.ion-battery-empty:before{content:"\f112"}.ion-battery-full:before{content:"\f113"}.ion-battery-half:before{content:"\f114"}.ion-battery-low:before{content:"\f115"}.ion-beaker:before{content:"\f269"}.ion-beer:before{content:"\f26a"}.ion-bluetooth:before{content:"\f116"}.ion-bonfire:before{content:"\f315"}.ion-bookmark:before{content:"\f26b"}.ion-bowtie:before{content:"\f3c0"}.ion-briefcase:before{content:"\f26c"}.ion-bug:before{content:"\f2be"}.ion-calculator:before{content:"\f26d"}.ion-calendar:before{content:"\f117"}.ion-camera:before{content:"\f118"}.ion-card:before{content:"\f119"}.ion-cash:before{content:"\f316"}.ion-chatbox:before{content:"\f11b"}.ion-chatbox-working:before{content:"\f11a"}.ion-chatboxes:before{content:"\f11c"}.ion-chatbubble:before{content:"\f11e"}.ion-chatbubble-working:before{content:"\f11d"}.ion-chatbubbles:before{content:"\f11f"}.ion-checkmark:before{content:"\f122"}.ion-checkmark-circled:before{content:"\f120"}.ion-checkmark-round:before{content:"\f121"}.ion-chevron-down:before{content:"\f123"}.ion-chevron-left:before{content:"\f124"}.ion-chevron-right:before{content:"\f125"}.ion-chevron-up:before{content:"\f126"}.ion-clipboard:before{content:"\f127"}.ion-clock:before{content:"\f26e"}.ion-close:before{content:"\f12a"}.ion-close-circled:before{content:"\f128"}.ion-close-round:before{content:"\f129"}.ion-closed-captioning:before{content:"\f317"}.ion-cloud:before{content:"\f12b"}.ion-code:before{content:"\f271"}.ion-code-download:before{content:"\f26f"}.ion-code-working:before{content:"\f270"}.ion-coffee:before{content:"\f272"}.ion-compass:before{content:"\f273"}.ion-compose:before{content:"\f12c"}.ion-connection-bars:before{content:"\f274"}.ion-contrast:before{content:"\f275"}.ion-crop:before{content:"\f3c1"}.ion-cube:before{content:"\f318"}.ion-disc:before{content:"\f12d"}.ion-document:before{content:"\f12f"}.ion-document-text:before{content:"\f12e"}.ion-drag:before{content:"\f130"}.ion-earth:before{content:"\f276"}.ion-easel:before{content:"\f3c2"}.ion-edit:before{content:"\f2bf"}.ion-egg:before{content:"\f277"}.ion-eject:before{content:"\f131"}.ion-email:before{content:"\f132"}.ion-email-unread:before{content:"\f3c3"}.ion-erlenmeyer-flask:before{content:"\f3c5"}.ion-erlenmeyer-flask-bubbles:before{content:"\f3c4"}.ion-eye:before{content:"\f133"}.ion-eye-disabled:before{content:"\f306"}.ion-female:before{content:"\f278"}.ion-filing:before{content:"\f134"}.ion-film-marker:before{content:"\f135"}.ion-fireball:before{content:"\f319"}.ion-flag:before{content:"\f279"}.ion-flame:before{content:"\f31a"}.ion-flash:before{content:"\f137"}.ion-flash-off:before{content:"\f136"}.ion-folder:before{content:"\f139"}.ion-fork:before{content:"\f27a"}.ion-fork-repo:before{content:"\f2c0"}.ion-forward:before{content:"\f13a"}.ion-funnel:before{content:"\f31b"}.ion-gear-a:before{content:"\f13d"}.ion-gear-b:before{content:"\f13e"}.ion-grid:before{content:"\f13f"}.ion-hammer:before{content:"\f27b"}.ion-happy:before{content:"\f31c"}.ion-happy-outline:before{content:"\f3c6"}.ion-headphone:before{content:"\f140"}.ion-heart:before{content:"\f141"}.ion-heart-broken:before{content:"\f31d"}.ion-help:before{content:"\f143"}.ion-help-buoy:before{content:"\f27c"}.ion-help-circled:before{content:"\f142"}.ion-home:before{content:"\f144"}.ion-icecream:before{content:"\f27d"}.ion-image:before{content:"\f147"}.ion-images:before{content:"\f148"}.ion-information:before{content:"\f14a"}.ion-information-circled:before{content:"\f149"}.ion-ionic:before{content:"\f14b"}.ion-ios-alarm:before{content:"\f3c8"}.ion-ios-alarm-outline:before{content:"\f3c7"}.ion-ios-albums:before{content:"\f3ca"}.ion-ios-albums-outline:before{content:"\f3c9"}.ion-ios-americanfootball:before{content:"\f3cc"}.ion-ios-americanfootball-outline:before{content:"\f3cb"}.ion-ios-analytics:before{content:"\f3ce"}.ion-ios-analytics-outline:before{content:"\f3cd"}.ion-ios-arrow-back:before{content:"\f3cf"}.ion-ios-arrow-down:before{content:"\f3d0"}.ion-ios-arrow-forward:before{content:"\f3d1"}.ion-ios-arrow-left:before{content:"\f3d2"}.ion-ios-arrow-right:before{content:"\f3d3"}.ion-ios-arrow-thin-down:before{content:"\f3d4"}.ion-ios-arrow-thin-left:before{content:"\f3d5"}.ion-ios-arrow-thin-right:before{content:"\f3d6"}.ion-ios-arrow-thin-up:before{content:"\f3d7"}.ion-ios-arrow-up:before{content:"\f3d8"}.ion-ios-at:before{content:"\f3da"}.ion-ios-at-outline:before{content:"\f3d9"}.ion-ios-barcode:before{content:"\f3dc"}.ion-ios-barcode-outline:before{content:"\f3db"}.ion-ios-baseball:before{content:"\f3de"}.ion-ios-baseball-outline:before{content:"\f3dd"}.ion-ios-basketball:before{content:"\f3e0"}.ion-ios-basketball-outline:before{content:"\f3df"}.ion-ios-bell:before{content:"\f3e2"}.ion-ios-bell-outline:before{content:"\f3e1"}.ion-ios-body:before{content:"\f3e4"}.ion-ios-body-outline:before{content:"\f3e3"}.ion-ios-bolt:before{content:"\f3e6"}.ion-ios-bolt-outline:before{content:"\f3e5"}.ion-ios-book:before{content:"\f3e8"}.ion-ios-book-outline:before{content:"\f3e7"}.ion-ios-bookmarks:before{content:"\f3ea"}.ion-ios-bookmarks-outline:before{content:"\f3e9"}.ion-ios-box:before{content:"\f3ec"}.ion-ios-box-outline:before{content:"\f3eb"}.ion-ios-briefcase:before{content:"\f3ee"}.ion-ios-briefcase-outline:before{content:"\f3ed"}.ion-ios-browsers:before{content:"\f3f0"}.ion-ios-browsers-outline:before{content:"\f3ef"}.ion-ios-calculator:before{content:"\f3f2"}.ion-ios-calculator-outline:before{content:"\f3f1"}.ion-ios-calendar:before{content:"\f3f4"}.ion-ios-calendar-outline:before{content:"\f3f3"}.ion-ios-camera:before{content:"\f3f6"}.ion-ios-camera-outline:before{content:"\f3f5"}.ion-ios-cart:before{content:"\f3f8"}.ion-ios-cart-outline:before{content:"\f3f7"}.ion-ios-chatboxes:before{content:"\f3fa"}.ion-ios-chatboxes-outline:before{content:"\f3f9"}.ion-ios-chatbubble:before{content:"\f3fc"}.ion-ios-chatbubble-outline:before{content:"\f3fb"}.ion-ios-checkmark:before{content:"\f3ff"}.ion-ios-checkmark-empty:before{content:"\f3fd"}.ion-ios-checkmark-outline:before{content:"\f3fe"}.ion-ios-circle-filled:before{content:"\f400"}.ion-ios-circle-outline:before{content:"\f401"}.ion-ios-clock:before{content:"\f403"}.ion-ios-clock-outline:before{content:"\f402"}.ion-ios-close:before{content:"\f406"}.ion-ios-close-empty:before{content:"\f404"}.ion-ios-close-outline:before{content:"\f405"}.ion-ios-cloud:before{content:"\f40c"}.ion-ios-cloud-download:before{content:"\f408"}.ion-ios-cloud-download-outline:before{content:"\f407"}.ion-ios-cloud-outline:before{content:"\f409"}.ion-ios-cloud-upload:before{content:"\f40b"}.ion-ios-cloud-upload-outline:before{content:"\f40a"}.ion-ios-cloudy:before{content:"\f410"}.ion-ios-cloudy-night:before{content:"\f40e"}.ion-ios-cloudy-night-outline:before{content:"\f40d"}.ion-ios-cloudy-outline:before{content:"\f40f"}.ion-ios-cog:before{content:"\f412"}.ion-ios-cog-outline:before{content:"\f411"}.ion-ios-color-filter:before{content:"\f414"}.ion-ios-color-filter-outline:before{content:"\f413"}.ion-ios-color-wand:before{content:"\f416"}.ion-ios-color-wand-outline:before{content:"\f415"}.ion-ios-compose:before{content:"\f418"}.ion-ios-compose-outline:before{content:"\f417"}.ion-ios-contact:before{content:"\f41a"}.ion-ios-contact-outline:before{content:"\f419"}.ion-ios-copy:before{content:"\f41c"}.ion-ios-copy-outline:before{content:"\f41b"}.ion-ios-crop:before{content:"\f41e"}.ion-ios-crop-strong:before{content:"\f41d"}.ion-ios-download:before{content:"\f420"}.ion-ios-download-outline:before{content:"\f41f"}.ion-ios-drag:before{content:"\f421"}.ion-ios-email:before{content:"\f423"}.ion-ios-email-outline:before{content:"\f422"}.ion-ios-eye:before{content:"\f425"}.ion-ios-eye-outline:before{content:"\f424"}.ion-ios-fastforward:before{content:"\f427"}.ion-ios-fastforward-outline:before{content:"\f426"}.ion-ios-filing:before{content:"\f429"}.ion-ios-filing-outline:before{content:"\f428"}.ion-ios-film:before{content:"\f42b"}.ion-ios-film-outline:before{content:"\f42a"}.ion-ios-flag:before{content:"\f42d"}.ion-ios-flag-outline:before{content:"\f42c"}.ion-ios-flame:before{content:"\f42f"}.ion-ios-flame-outline:before{content:"\f42e"}.ion-ios-flask:before{content:"\f431"}.ion-ios-flask-outline:before{content:"\f430"}.ion-ios-flower:before{content:"\f433"}.ion-ios-flower-outline:before{content:"\f432"}.ion-ios-folder:before{content:"\f435"}.ion-ios-folder-outline:before{content:"\f434"}.ion-ios-football:before{content:"\f437"}.ion-ios-football-outline:before{content:"\f436"}.ion-ios-game-controller-a:before{content:"\f439"}.ion-ios-game-controller-a-outline:before{content:"\f438"}.ion-ios-game-controller-b:before{content:"\f43b"}.ion-ios-game-controller-b-outline:before{content:"\f43a"}.ion-ios-gear:before{content:"\f43d"}.ion-ios-gear-outline:before{content:"\f43c"}.ion-ios-glasses:before{content:"\f43f"}.ion-ios-glasses-outline:before{content:"\f43e"}.ion-ios-grid-view:before{content:"\f441"}.ion-ios-grid-view-outline:before{content:"\f440"}.ion-ios-heart:before{content:"\f443"}.ion-ios-heart-outline:before{content:"\f442"}.ion-ios-help:before{content:"\f446"}.ion-ios-help-empty:before{content:"\f444"}.ion-ios-help-outline:before{content:"\f445"}.ion-ios-home:before{content:"\f448"}.ion-ios-home-outline:before{content:"\f447"}.ion-ios-infinite:before{content:"\f44a"}.ion-ios-infinite-outline:before{content:"\f449"}.ion-ios-information:before{content:"\f44d"}.ion-ios-information-empty:before{content:"\f44b"}.ion-ios-information-outline:before{content:"\f44c"}.ion-ios-ionic-outline:before{content:"\f44e"}.ion-ios-keypad:before{content:"\f450"}.ion-ios-keypad-outline:before{content:"\f44f"}.ion-ios-lightbulb:before{content:"\f452"}.ion-ios-lightbulb-outline:before{content:"\f451"}.ion-ios-list:before{content:"\f454"}.ion-ios-list-outline:before{content:"\f453"}.ion-ios-location:before{content:"\f456"}.ion-ios-location-outline:before{content:"\f455"}.ion-ios-locked:before{content:"\f458"}.ion-ios-locked-outline:before{content:"\f457"}.ion-ios-loop:before{content:"\f45a"}.ion-ios-loop-strong:before{content:"\f459"}.ion-ios-medical:before{content:"\f45c"}.ion-ios-medical-outline:before{content:"\f45b"}.ion-ios-medkit:before{content:"\f45e"}.ion-ios-medkit-outline:before{content:"\f45d"}.ion-ios-mic:before{content:"\f461"}.ion-ios-mic-off:before{content:"\f45f"}.ion-ios-mic-outline:before{content:"\f460"}.ion-ios-minus:before{content:"\f464"}.ion-ios-minus-empty:before{content:"\f462"}.ion-ios-minus-outline:before{content:"\f463"}.ion-ios-monitor:before{content:"\f466"}.ion-ios-monitor-outline:before{content:"\f465"}.ion-ios-moon:before{content:"\f468"}.ion-ios-moon-outline:before{content:"\f467"}.ion-ios-more:before{content:"\f46a"}.ion-ios-more-outline:before{content:"\f469"}.ion-ios-musical-note:before{content:"\f46b"}.ion-ios-musical-notes:before{content:"\f46c"}.ion-ios-navigate:before{content:"\f46e"}.ion-ios-navigate-outline:before{content:"\f46d"}.ion-ios-nutrition:before{content:"\f470"}.ion-ios-nutrition-outline:before{content:"\f46f"}.ion-ios-paper:before{content:"\f472"}.ion-ios-paper-outline:before{content:"\f471"}.ion-ios-paperplane:before{content:"\f474"}.ion-ios-paperplane-outline:before{content:"\f473"}.ion-ios-partlysunny:before{content:"\f476"}.ion-ios-partlysunny-outline:before{content:"\f475"}.ion-ios-pause:before{content:"\f478"}.ion-ios-pause-outline:before{content:"\f477"}.ion-ios-paw:before{content:"\f47a"}.ion-ios-paw-outline:before{content:"\f479"}.ion-ios-people:before{content:"\f47c"}.ion-ios-people-outline:before{content:"\f47b"}.ion-ios-person:before{content:"\f47e"}.ion-ios-person-outline:before{content:"\f47d"}.ion-ios-personadd:before{content:"\f480"}.ion-ios-personadd-outline:before{content:"\f47f"}.ion-ios-photos:before{content:"\f482"}.ion-ios-photos-outline:before{content:"\f481"}.ion-ios-pie:before{content:"\f484"}.ion-ios-pie-outline:before{content:"\f483"}.ion-ios-pint:before{content:"\f486"}.ion-ios-pint-outline:before{content:"\f485"}.ion-ios-play:before{content:"\f488"}.ion-ios-play-outline:before{content:"\f487"}.ion-ios-plus:before{content:"\f48b"}.ion-ios-plus-empty:before{content:"\f489"}.ion-ios-plus-outline:before{content:"\f48a"}.ion-ios-pricetag:before{content:"\f48d"}.ion-ios-pricetag-outline:before{content:"\f48c"}.ion-ios-pricetags:before{content:"\f48f"}.ion-ios-pricetags-outline:before{content:"\f48e"}.ion-ios-printer:before{content:"\f491"}.ion-ios-printer-outline:before{content:"\f490"}.ion-ios-pulse:before{content:"\f493"}.ion-ios-pulse-strong:before{content:"\f492"}.ion-ios-rainy:before{content:"\f495"}.ion-ios-rainy-outline:before{content:"\f494"}.ion-ios-recording:before{content:"\f497"}.ion-ios-recording-outline:before{content:"\f496"}.ion-ios-redo:before{content:"\f499"}.ion-ios-redo-outline:before{content:"\f498"}.ion-ios-refresh:before{content:"\f49c"}.ion-ios-refresh-empty:before{content:"\f49a"}.ion-ios-refresh-outline:before{content:"\f49b"}.ion-ios-reload:before{content:"\f49d"}.ion-ios-reverse-camera:before{content:"\f49f"}.ion-ios-reverse-camera-outline:before{content:"\f49e"}.ion-ios-rewind:before{content:"\f4a1"}.ion-ios-rewind-outline:before{content:"\f4a0"}.ion-ios-rose:before{content:"\f4a3"}.ion-ios-rose-outline:before{content:"\f4a2"}.ion-ios-search:before{content:"\f4a5"}.ion-ios-search-strong:before{content:"\f4a4"}.ion-ios-settings:before{content:"\f4a7"}.ion-ios-settings-strong:before{content:"\f4a6"}.ion-ios-shuffle:before{content:"\f4a9"}.ion-ios-shuffle-strong:before{content:"\f4a8"}.ion-ios-skipbackward:before{content:"\f4ab"}.ion-ios-skipbackward-outline:before{content:"\f4aa"}.ion-ios-skipforward:before{content:"\f4ad"}.ion-ios-skipforward-outline:before{content:"\f4ac"}.ion-ios-snowy:before{content:"\f4ae"}.ion-ios-speedometer:before{content:"\f4b0"}.ion-ios-speedometer-outline:before{content:"\f4af"}.ion-ios-star:before{content:"\f4b3"}.ion-ios-star-half:before{content:"\f4b1"}.ion-ios-star-outline:before{content:"\f4b2"}.ion-ios-stopwatch:before{content:"\f4b5"}.ion-ios-stopwatch-outline:before{content:"\f4b4"}.ion-ios-sunny:before{content:"\f4b7"}.ion-ios-sunny-outline:before{content:"\f4b6"}.ion-ios-telephone:before{content:"\f4b9"}.ion-ios-telephone-outline:before{content:"\f4b8"}.ion-ios-tennisball:before{content:"\f4bb"}.ion-ios-tennisball-outline:before{content:"\f4ba"}.ion-ios-thunderstorm:before{content:"\f4bd"}.ion-ios-thunderstorm-outline:before{content:"\f4bc"}.ion-ios-time:before{content:"\f4bf"}.ion-ios-time-outline:before{content:"\f4be"}.ion-ios-timer:before{content:"\f4c1"}.ion-ios-timer-outline:before{content:"\f4c0"}.ion-ios-toggle:before{content:"\f4c3"}.ion-ios-toggle-outline:before{content:"\f4c2"}.ion-ios-trash:before{content:"\f4c5"}.ion-ios-trash-outline:before{content:"\f4c4"}.ion-ios-undo:before{content:"\f4c7"}.ion-ios-undo-outline:before{content:"\f4c6"}.ion-ios-unlocked:before{content:"\f4c9"}.ion-ios-unlocked-outline:before{content:"\f4c8"}.ion-ios-upload:before{content:"\f4cb"}.ion-ios-upload-outline:before{content:"\f4ca"}.ion-ios-videocam:before{content:"\f4cd"}.ion-ios-videocam-outline:before{content:"\f4cc"}.ion-ios-volume-high:before{content:"\f4ce"}.ion-ios-volume-low:before{content:"\f4cf"}.ion-ios-wineglass:before{content:"\f4d1"}.ion-ios-wineglass-outline:before{content:"\f4d0"}.ion-ios-world:before{content:"\f4d3"}.ion-ios-world-outline:before{content:"\f4d2"}.ion-ipad:before{content:"\f1f9"}.ion-iphone:before{content:"\f1fa"}.ion-ipod:before{content:"\f1fb"}.ion-jet:before{content:"\f295"}.ion-key:before{content:"\f296"}.ion-knife:before{content:"\f297"}.ion-laptop:before{content:"\f1fc"}.ion-leaf:before{content:"\f1fd"}.ion-levels:before{content:"\f298"}.ion-lightbulb:before{content:"\f299"}.ion-link:before{content:"\f1fe"}.ion-load-a:before{content:"\f29a"}.ion-load-b:before{content:"\f29b"}.ion-load-c:before{content:"\f29c"}.ion-load-d:before{content:"\f29d"}.ion-location:before{content:"\f1ff"}.ion-lock-combination:before{content:"\f4d4"}.ion-locked:before{content:"\f200"}.ion-log-in:before{content:"\f29e"}.ion-log-out:before{content:"\f29f"}.ion-loop:before{content:"\f201"}.ion-magnet:before{content:"\f2a0"}.ion-male:before{content:"\f2a1"}.ion-man:before{content:"\f202"}.ion-map:before{content:"\f203"}.ion-medkit:before{content:"\f2a2"}.ion-merge:before{content:"\f33f"}.ion-mic-a:before{content:"\f204"}.ion-mic-b:before{content:"\f205"}.ion-mic-c:before{content:"\f206"}.ion-minus:before{content:"\f209"}.ion-minus-circled:before{content:"\f207"}.ion-minus-round:before{content:"\f208"}.ion-model-s:before{content:"\f2c1"}.ion-monitor:before{content:"\f20a"}.ion-more:before{content:"\f20b"}.ion-mouse:before{content:"\f340"}.ion-music-note:before{content:"\f20c"}.ion-navicon:before{content:"\f20e"}.ion-navicon-round:before{content:"\f20d"}.ion-navigate:before{content:"\f2a3"}.ion-network:before{content:"\f341"}.ion-no-smoking:before{content:"\f2c2"}.ion-nuclear:before{content:"\f2a4"}.ion-outlet:before{content:"\f342"}.ion-paintbrush:before{content:"\f4d5"}.ion-paintbucket:before{content:"\f4d6"}.ion-paper-airplane:before{content:"\f2c3"}.ion-paperclip:before{content:"\f20f"}.ion-pause:before{content:"\f210"}.ion-person:before{content:"\f213"}.ion-person-add:before{content:"\f211"}.ion-person-stalker:before{content:"\f212"}.ion-pie-graph:before{content:"\f2a5"}.ion-pin:before{content:"\f2a6"}.ion-pinpoint:before{content:"\f2a7"}.ion-pizza:before{content:"\f2a8"}.ion-plane:before{content:"\f214"}.ion-planet:before{content:"\f343"}.ion-play:before{content:"\f215"}.ion-playstation:before{content:"\f30a"}.ion-plus:before{content:"\f218"}.ion-plus-circled:before{content:"\f216"}.ion-plus-round:before{content:"\f217"}.ion-podium:before{content:"\f344"}.ion-pound:before{content:"\f219"}.ion-power:before{content:"\f2a9"}.ion-pricetag:before{content:"\f2aa"}.ion-pricetags:before{content:"\f2ab"}.ion-printer:before{content:"\f21a"}.ion-pull-request:before{content:"\f345"}.ion-qr-scanner:before{content:"\f346"}.ion-quote:before{content:"\f347"}.ion-radio-waves:before{content:"\f2ac"}.ion-record:before{content:"\f21b"}.ion-refresh:before{content:"\f21c"}.ion-reply:before{content:"\f21e"}.ion-reply-all:before{content:"\f21d"}.ion-ribbon-a:before{content:"\f348"}.ion-ribbon-b:before{content:"\f349"}.ion-sad:before{content:"\f34a"}.ion-sad-outline:before{content:"\f4d7"}.ion-scissors:before{content:"\f34b"}.ion-search:before{content:"\f21f"}.ion-settings:before{content:"\f2ad"}.ion-share:before{content:"\f220"}.ion-shuffle:before{content:"\f221"}.ion-skip-backward:before{content:"\f222"}.ion-skip-forward:before{content:"\f223"}.ion-social-android:before{content:"\f225"}.ion-social-android-outline:before{content:"\f224"}.ion-social-angular:before{content:"\f4d9"}.ion-social-angular-outline:before{content:"\f4d8"}.ion-social-apple:before{content:"\f227"}.ion-social-apple-outline:before{content:"\f226"}.ion-social-bitcoin:before{content:"\f2af"}.ion-social-bitcoin-outline:before{content:"\f2ae"}.ion-social-buffer:before{content:"\f229"}.ion-social-buffer-outline:before{content:"\f228"}.ion-social-chrome:before{content:"\f4db"}.ion-social-chrome-outline:before{content:"\f4da"}.ion-social-codepen:before{content:"\f4dd"}.ion-social-codepen-outline:before{content:"\f4dc"}.ion-social-css3:before{content:"\f4df"}.ion-social-css3-outline:before{content:"\f4de"}.ion-social-designernews:before{content:"\f22b"}.ion-social-designernews-outline:before{content:"\f22a"}.ion-social-dribbble:before{content:"\f22d"}.ion-social-dribbble-outline:before{content:"\f22c"}.ion-social-dropbox:before{content:"\f22f"}.ion-social-dropbox-outline:before{content:"\f22e"}.ion-social-euro:before{content:"\f4e1"}.ion-social-euro-outline:before{content:"\f4e0"}.ion-social-facebook:before{content:"\f231"}.ion-social-facebook-outline:before{content:"\f230"}.ion-social-foursquare:before{content:"\f34d"}.ion-social-foursquare-outline:before{content:"\f34c"}.ion-social-freebsd-devil:before{content:"\f2c4"}.ion-social-github:before{content:"\f233"}.ion-social-github-outline:before{content:"\f232"}.ion-social-google:before{content:"\f34f"}.ion-social-google-outline:before{content:"\f34e"}.ion-social-googleplus:before{content:"\f235"}.ion-social-googleplus-outline:before{content:"\f234"}.ion-social-hackernews:before{content:"\f237"}.ion-social-hackernews-outline:before{content:"\f236"}.ion-social-html5:before{content:"\f4e3"}.ion-social-html5-outline:before{content:"\f4e2"}.ion-social-instagram:before{content:"\f351"}.ion-social-instagram-outline:before{content:"\f350"}.ion-social-javascript:before{content:"\f4e5"}.ion-social-javascript-outline:before{content:"\f4e4"}.ion-social-linkedin:before{content:"\f239"}.ion-social-linkedin-outline:before{content:"\f238"}.ion-social-markdown:before{content:"\f4e6"}.ion-social-nodejs:before{content:"\f4e7"}.ion-social-octocat:before{content:"\f4e8"}.ion-social-pinterest:before{content:"\f2b1"}.ion-social-pinterest-outline:before{content:"\f2b0"}.ion-social-python:before{content:"\f4e9"}.ion-social-reddit:before{content:"\f23b"}.ion-social-reddit-outline:before{content:"\f23a"}.ion-social-rss:before{content:"\f23d"}.ion-social-rss-outline:before{content:"\f23c"}.ion-social-sass:before{content:"\f4ea"}.ion-social-skype:before{content:"\f23f"}.ion-social-skype-outline:before{content:"\f23e"}.ion-social-snapchat:before{content:"\f4ec"}.ion-social-snapchat-outline:before{content:"\f4eb"}.ion-social-tumblr:before{content:"\f241"}.ion-social-tumblr-outline:before{content:"\f240"}.ion-social-tux:before{content:"\f2c5"}.ion-social-twitch:before{content:"\f4ee"}.ion-social-twitch-outline:before{content:"\f4ed"}.ion-social-twitter:before{content:"\f243"}.ion-social-twitter-outline:before{content:"\f242"}.ion-social-usd:before{content:"\f353"}.ion-social-usd-outline:before{content:"\f352"}.ion-social-vimeo:before{content:"\f245"}.ion-social-vimeo-outline:before{content:"\f244"}.ion-social-whatsapp:before{content:"\f4f0"}.ion-social-whatsapp-outline:before{content:"\f4ef"}.ion-social-windows:before{content:"\f247"}.ion-social-windows-outline:before{content:"\f246"}.ion-social-wordpress:before{content:"\f249"}.ion-social-wordpress-outline:before{content:"\f248"}.ion-social-yahoo:before{content:"\f24b"}.ion-social-yahoo-outline:before{content:"\f24a"}.ion-social-yen:before{content:"\f4f2"}.ion-social-yen-outline:before{content:"\f4f1"}.ion-social-youtube:before{content:"\f24d"}.ion-social-youtube-outline:before{content:"\f24c"}.ion-soup-can:before{content:"\f4f4"}.ion-soup-can-outline:before{content:"\f4f3"}.ion-speakerphone:before{content:"\f2b2"}.ion-speedometer:before{content:"\f2b3"}.ion-spoon:before{content:"\f2b4"}.ion-star:before{content:"\f24e"}.ion-stats-bars:before{content:"\f2b5"}.ion-steam:before{content:"\f30b"}.ion-stop:before{content:"\f24f"}.ion-thermometer:before{content:"\f2b6"}.ion-thumbsdown:before{content:"\f250"}.ion-thumbsup:before{content:"\f251"}.ion-toggle:before{content:"\f355"}.ion-toggle-filled:before{content:"\f354"}.ion-transgender:before{content:"\f4f5"}.ion-trash-a:before{content:"\f252"}.ion-trash-b:before{content:"\f253"}.ion-trophy:before{content:"\f356"}.ion-tshirt:before{content:"\f4f7"}.ion-tshirt-outline:before{content:"\f4f6"}.ion-umbrella:before{content:"\f2b7"}.ion-university:before{content:"\f357"}.ion-unlocked:before{content:"\f254"}.ion-upload:before{content:"\f255"}.ion-usb:before{content:"\f2b8"}.ion-videocamera:before{content:"\f256"}.ion-volume-high:before{content:"\f257"}.ion-volume-low:before{content:"\f258"}.ion-volume-medium:before{content:"\f259"}.ion-volume-mute:before{content:"\f25a"}.ion-wand:before{content:"\f358"}.ion-waterdrop:before{content:"\f25b"}.ion-wifi:before{content:"\f25c"}.ion-wineglass:before{content:"\f2b9"}.ion-woman:before{content:"\f25d"}.ion-wrench:before{content:"\f2ba"}.ion-xbox:before{content:"\f30c"} \ No newline at end of file diff --git a/public/css/skin-black.css b/public/css/skin-black.css new file mode 100644 index 000000000..9706d508f --- /dev/null +++ b/public/css/skin-black.css @@ -0,0 +1,15 @@ +.skin-black .main-sidebar, .skin-black .left-side { + background-color: #2f4050; +} + +.skin-black .sidebar-menu>li:hover>a, .skin-black .sidebar-menu>li.active>a { + background: #293846; +} + +.skin-black .sidebar-menu>li>.treeview-menu { + background: #293846; +} + +.skin-black .sidebar-form input[type="text"], .skin-black .sidebar-form .btn { + background-color: #415365; +} \ No newline at end of file diff --git a/public/fonts/FontAwesome.otf b/public/fonts/FontAwesome.otf new file mode 100644 index 000000000..401ec0f36 Binary files /dev/null and b/public/fonts/FontAwesome.otf differ diff --git a/public/fonts/fontawesome-webfont.eot b/public/fonts/fontawesome-webfont.eot new file mode 100644 index 000000000..e9f60ca95 Binary files /dev/null and b/public/fonts/fontawesome-webfont.eot differ diff --git a/public/fonts/fontawesome-webfont.svg b/public/fonts/fontawesome-webfont.svg new file mode 100644 index 000000000..855c845e5 --- /dev/null +++ b/public/fonts/fontawesome-webfont.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/fonts/fontawesome-webfont.ttf b/public/fonts/fontawesome-webfont.ttf new file mode 100644 index 000000000..35acda2fa Binary files /dev/null and b/public/fonts/fontawesome-webfont.ttf differ diff --git a/public/fonts/fontawesome-webfont.woff b/public/fonts/fontawesome-webfont.woff new file mode 100644 index 000000000..400014a4b Binary files /dev/null and b/public/fonts/fontawesome-webfont.woff differ diff --git a/public/fonts/fontawesome-webfont.woff2 b/public/fonts/fontawesome-webfont.woff2 new file mode 100644 index 000000000..4d13fc604 Binary files /dev/null and b/public/fonts/fontawesome-webfont.woff2 differ diff --git a/public/img/akaunting-logo-green.png b/public/img/akaunting-logo-green.png new file mode 100644 index 000000000..866a1695f Binary files /dev/null and b/public/img/akaunting-logo-green.png differ diff --git a/public/img/akaunting-logo-white.png b/public/img/akaunting-logo-white.png new file mode 100644 index 000000000..a97bebf1d Binary files /dev/null and b/public/img/akaunting-logo-white.png differ diff --git a/public/img/avatar.png b/public/img/avatar.png new file mode 100644 index 000000000..2057833f6 Binary files /dev/null and b/public/img/avatar.png differ diff --git a/public/img/company.png b/public/img/company.png new file mode 100644 index 000000000..601fd27d3 Binary files /dev/null and b/public/img/company.png differ diff --git a/public/img/favicon.ico b/public/img/favicon.ico new file mode 100644 index 000000000..31707423a Binary files /dev/null and b/public/img/favicon.ico differ diff --git a/public/img/install.jpg b/public/img/install.jpg new file mode 100644 index 000000000..69082d919 Binary files /dev/null and b/public/img/install.jpg differ diff --git a/public/img/login.jpg b/public/img/login.jpg new file mode 100644 index 000000000..070f2b6b4 Binary files /dev/null and b/public/img/login.jpg differ diff --git a/public/img/maintanance.png b/public/img/maintanance.png new file mode 100644 index 000000000..602c52713 Binary files /dev/null and b/public/img/maintanance.png differ diff --git a/public/js/app.js b/public/js/app.js new file mode 100644 index 000000000..00a140c6b --- /dev/null +++ b/public/js/app.js @@ -0,0 +1,249 @@ +$(document).ready(function () { + // Live Search + $.fn.liveSearch = function (option) { + return this.each(function () { + this.timer = null; + this.items = new Array(); + + $.extend(this, option); + + $(this).attr('autocomplete', 'off'); + + // Blur + $(this).on('blur', function () { + setTimeout(function (object) { + object.hide(); + }, 200, this); + }); + + // Keydown + $(this).on('input', function (event) { + this.request(); + }); + + // Show + this.show = function () { + var pos = $('#search').position(); + + $(this).parent().parent().siblings('ul.dropdown-menu').css({ + top : pos.top + $('#search').height(), + width: $('#search').width(), + left: pos.left + }); + + $(this).parent().parent().siblings('ul.dropdown-menu').show(); + }; + + // Hide + this.hide = function () { + $(this).parent().parent().siblings('ul.dropdown-menu').hide(); + }; + + // Request + this.request = function () { + clearTimeout(this.timer); + + this.timer = setTimeout(function (object) { + object.source($(object).val(), $.proxy(object.response, object)); + }, 200, this); + }; + + // Response + this.response = function (json) { + html = ''; + + if (json.length) { + for (i = 0; i < json.length; i++) { + this.items[json[i]['id']] = json[i]; + } + + var count = json.length; + + for (i = 0; i < count; i++) { + html += '
  • '; + html += ' '; + html += ' '; + html += ' '; + html += '
  • '; + } + } + + if (html) { + this.show(); + } else { + this.hide(); + } + + $(this).parent().parent().siblings('ul.dropdown-menu').html(html); + }; + + $(this).parent().parent().after(''); + $(this).parent().parent().siblings('ul.dropdown-menu').delegate('a', 'click', $.proxy(this.click, this)); + }); + }; + + $('input[name=\'search\']').liveSearch({ + 'source': function (request, response) { + if (request != '' && request.length > 2) { + $.ajax({ + url : url_search, + type : 'GET', + dataType: 'JSON', + data : 'keyword=' + $(this).val(), + success : function (json) { + response($.map(json, function (item) { + return { + id : item.id, + name : item.name, + type : item.type, + color: item.color, + href : item.href + } + })); + } + }); + } else { + $('#search > .dropdown-menu').hide(); + } + } + }); + + last_radio = ''; + + $("input:radio").each(function () { + if ($(this).parent().parent().hasClass('radio-inline')) { + input_name = $(this).attr("name"); + input_value = $(this).attr("value"); + input_text = $(this).text(); + input_checked = $(this).is(':checked'); + + enable_class = 'btn-default'; + disable_class = 'btn-default'; + + if (last_radio == input_name) { + return; + } + + last_radio = input_name; + + if ($(':radio[name="' + input_name + '"]').length != 2) { + return; + } + + if ((input_value != 0) && (input_value != 1)) { + return; + } + + if ((input_text.localeCompare(text_yes) == 1) && (input_text.localeCompare(text_no) == 1)) { + return; + } + + if (input_value == 1 && input_checked == true) { + enable_class = 'btn-success active'; + } else { + disable_class = 'btn-danger active'; + } + + $('#' + input_name + '_1').removeClass('btn-default').addClass(enable_class); + $('#' + input_name + '_0').removeClass('btn-default').addClass(disable_class); + } + }); + + $(document).on('click', '.btn-group label:not(.active)', function (e) { + disable_label = $(this); + disable_input = $('#' + disable_label.attr('id') + ' :input'); + + if (disable_input.attr('type') != 'radio') { + return; + } + + if (!disable_input.is(':checked')) { + enable_input = $('input[name="' + disable_input.attr('name') + '"]:checked'); + enable_label = enable_input.parent(); + + enable_label.removeClass('btn-success active'); + enable_label.removeClass('btn-danger active'); + + enable_input.removeAttr('checked'); + enable_label.addClass('btn btn-default'); + + disable_label.removeClass('btn-default'); + + if (disable_input.val() == 0) { + disable_label.addClass('btn-danger active'); + } else { + disable_label.addClass('btn-success active'); + } + + disable_input.attr('checked', 'checked'); + + enable_input.trigger('change'); + disable_input.trigger('change'); + } + }); +}); + +function confirmDelete(form_id, title, message, button_cancel, button_delete) { + $('#confirm-modal').remove(); + + var html = ''; + + html += ''; + + $('body').append(html); + + $('#confirm-modal').modal('show'); +} + +$(document).on('click', '.popup', function(e) { + e.preventDefault(); + + $('#modal-popup').remove(); + + var element = this; + + $.ajax({ + url: $(element).attr('href'), + type: 'get', + dataType: 'html', + success: function(data) { + html = '