diff options
author | Camil Staps | 2016-07-27 16:28:19 +0200 |
---|---|---|
committer | Camil Staps | 2016-07-27 16:28:19 +0200 |
commit | 9714f3d8cc311f3b75a4727156de2ab33cf3895e (patch) | |
tree | 647d3370ad70827be8c83bfec9e98ae156c4ea9e | |
parent | Reorganise to have client use Model (diff) |
Removed redundant whitespace & retab
39 files changed, 905 insertions, 906 deletions
diff --git a/classes/file.php b/classes/file.php index f6019ec..b07064e 100644 --- a/classes/file.php +++ b/classes/file.php @@ -1,22 +1,22 @@ <?php /** * Provides the file class, an interface to the file table in the database - * + * * @author Camil Staps - * + * * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -25,124 +25,124 @@ * An interface to the file table in the database */ class file { - /** - * @var PDO $pdo The PDO class for database communication - * @var int $id The id of the file - * @var string $filename The relative path to the file - */ - protected $pdo, $id, $filename; + /** + * @var PDO $pdo The PDO class for database communication + * @var int $id The id of the file + * @var string $filename The relative path to the file + */ + protected $pdo, $id, $filename; - /** - * Create a new instance - * - * @param PDO $pdo The PDO class, to access the database - * @param int $id The id of the file to fetch - * - * @throws PDOException If something went wrong with the database - * @throws Exception If the file could not be found - */ - public function __construct($pdo, $id) { - $this->pdo = $pdo; + /** + * Create a new instance + * + * @param PDO $pdo The PDO class, to access the database + * @param int $id The id of the file to fetch + * + * @throws PDOException If something went wrong with the database + * @throws Exception If the file could not be found + */ + public function __construct($pdo, $id) { + $this->pdo = $pdo; - $stmt = $this->pdo->prepare("SELECT * FROM `".constants::db_prefix."file` WHERE `id`=?"); - $stmt->execute(array($id)); - if ($stmt->rowCount() == 0) { - throw new Exception("The file with id '$id' could not be found."); - } - $file = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt = $this->pdo->prepare("SELECT * FROM `".constants::db_prefix."file` WHERE `id`=?"); + $stmt->execute(array($id)); + if ($stmt->rowCount() == 0) { + throw new Exception("The file with id '$id' could not be found."); + } + $file = $stmt->fetch(PDO::FETCH_ASSOC); - $this->id = $file['id']; - $this->filename = $file['filename']; - } + $this->id = $file['id']; + $this->filename = $file['filename']; + } - //------------------------------------------------------------------------------ - // Getters and setters - //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ + // Getters and setters + //------------------------------------------------------------------------------ - /** - * Get the ID of the file - * - * @return int The ID - */ - public function getId() { - return $this->id; - } + /** + * Get the ID of the file + * + * @return int The ID + */ + public function getId() { + return $this->id; + } - /** - * Get the relative filename of the file - * - * @see file::getFilenamePath To get the full internal path to the file - * @see file::getFilenameURI To get the full external path to the file - * - * @return string The filename - */ - public function getFilename() { - return $this->filename; - } + /** + * Get the relative filename of the file + * + * @see file::getFilenamePath To get the full internal path to the file + * @see file::getFilenameURI To get the full external path to the file + * + * @return string The filename + */ + public function getFilename() { + return $this->filename; + } - /** - * Get the full internal path to the file - * - * @see file::getFilename To get the relative filename - * @see file::getFilenameURI To get the full external path to the file - * - * @return string The path - */ - public function getFilenamePath() { - return constants::files_folder . $this->filename; - } + /** + * Get the full internal path to the file + * + * @see file::getFilename To get the relative filename + * @see file::getFilenameURI To get the full external path to the file + * + * @return string The path + */ + public function getFilenamePath() { + return constants::files_folder . $this->filename; + } - /** - * Get the full external path to the file - * - * @see file::getFilename To get the relative filename - * @see file::getFilenamePath To get the full internal path to the file - * - * @return string The URI - */ - public function getFilenameURI() { - return constants::files_folder_external . $this->filename; - } + /** + * Get the full external path to the file + * + * @see file::getFilename To get the relative filename + * @see file::getFilenamePath To get the full internal path to the file + * + * @return string The URI + */ + public function getFilenameURI() { + return constants::files_folder_external . $this->filename; + } - //------------------------------------------------------------------------------ - // Other functions - //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ + // Other functions + //------------------------------------------------------------------------------ - /** - * Move this file to the trash and delete all records for it - * - * Physically, this moves the file to a trash folder - * Then, the file will be removed from the file table in the database - * Any appendices linking to this file with fileId will have fileId NULL - * Any offers linking to this file with invoice_fileId will have invoice_fileId NULL - * - * @throws PDOException If there's something wrong with the database - * - * @return bool True on success, false on failure - */ - public function delete() { - // Try to move the file to trash - $newname = pathinfo($this->filename, PATHINFO_FILENAME) . '--' . date('Y-m-d.H.i.s.') . pathinfo($this->filename, PATHINFO_EXTENSION); - $newdir = pathinfo($this->getFilenamePath(), PATHINFO_DIRNAME) . '/' . constants::files_folder_trash . '/'; - if (!file_exists($newdir)) { - if (!mkdir($newdir)) { - return false; - } - } - if (!(@rename($this->getFilenamePath(), $newdir . $newname))) { - return false; - } + /** + * Move this file to the trash and delete all records for it + * + * Physically, this moves the file to a trash folder + * Then, the file will be removed from the file table in the database + * Any appendices linking to this file with fileId will have fileId NULL + * Any offers linking to this file with invoice_fileId will have invoice_fileId NULL + * + * @throws PDOException If there's something wrong with the database + * + * @return bool True on success, false on failure + */ + public function delete() { + // Try to move the file to trash + $newname = pathinfo($this->filename, PATHINFO_FILENAME) . '--' . date('Y-m-d.H.i.s.') . pathinfo($this->filename, PATHINFO_EXTENSION); + $newdir = pathinfo($this->getFilenamePath(), PATHINFO_DIRNAME) . '/' . constants::files_folder_trash . '/'; + if (!file_exists($newdir)) { + if (!mkdir($newdir)) { + return false; + } + } + if (!(@rename($this->getFilenamePath(), $newdir . $newname))) { + return false; + } - // Remove offers linked by invoice_fileId - $this->pdo->query("UPDATE `".constants::db_prefix."offer` SET `invoice_fileId`=NULL WHERE `invoice_fileId`={$this->id}"); + // Remove offers linked by invoice_fileId + $this->pdo->query("UPDATE `".constants::db_prefix."offer` SET `invoice_fileId`=NULL WHERE `invoice_fileId`={$this->id}"); - // Remove the record of the file - $stmt = $this->pdo->prepare("DELETE FROM `".constants::db_prefix."file` WHERE `id`=?"); - $stmt->execute(array($this->id)); - if ($stmt->rowCount() == 1) { - return true; - } else { - return false; - } - } -}
\ No newline at end of file + // Remove the record of the file + $stmt = $this->pdo->prepare("DELETE FROM `".constants::db_prefix."file` WHERE `id`=?"); + $stmt->execute(array($this->id)); + if ($stmt->rowCount() == 1) { + return true; + } else { + return false; + } + } +} diff --git a/classes/response.php b/classes/response.php index babf5ed..d997c00 100644 --- a/classes/response.php +++ b/classes/response.php @@ -1,22 +1,22 @@ <?php /** * Provides the response class - * + * * @author Camil Staps - * + * * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -25,88 +25,88 @@ * Provides a standard to base all responses to be called with AJAX on */ class response { - /** The variable to keep the response in until output */ - private $response; - /** The variable to keep the HTTP response code in until output */ - private $http_response_code; + /** The variable to keep the response in until output */ + private $response; + /** The variable to keep the HTTP response code in until output */ + private $http_response_code; - /** - * Create a new instance - */ - public function __construct() { - $this->response = array(); - $this->http_response_code = 200; - } + /** + * Create a new instance + */ + public function __construct() { + $this->response = array(); + $this->http_response_code = 200; + } - /** - * Set a variable of the response - * - * @param string $name The name of the variable to set - * @param string $value The (new) value for the variable - */ - public function __set($name, $value) { - $this->response[$name] = $value; - } + /** + * Set a variable of the response + * + * @param string $name The name of the variable to set + * @param string $value The (new) value for the variable + */ + public function __set($name, $value) { + $this->response[$name] = $value; + } - /** - * Get a variable of the response - * - * @param string $name The name of the variable to get - * - * @return mixed The value of the variable - */ - public function __get($name) { - return $this->response[$name]; - } + /** + * Get a variable of the response + * + * @param string $name The name of the variable to get + * + * @return mixed The value of the variable + */ + public function __get($name) { + return $this->response[$name]; + } - /** - * Check if a variable of the response is set - * - * @param string $name The name of the variable to check - * - * @return bool True if the variable exists, false otherwise - */ - public function __isset($name) { - return isset($this->response[$name]); - } + /** + * Check if a variable of the response is set + * + * @param string $name The name of the variable to check + * + * @return bool True if the variable exists, false otherwise + */ + public function __isset($name) { + return isset($this->response[$name]); + } - /** - * Unset a variable of the response - * - * @param string $name The variable to unset - */ - public function __unset($name) { - unset($this->response[$name]); - } + /** + * Unset a variable of the response + * + * @param string $name The variable to unset + */ + public function __unset($name) { + unset($this->response[$name]); + } - /** - * Get or set the HTTP response code - * - * If a parameter is provided, it is used as the new HTTP response code, and a bool is returned for success or failure. Otherwise, the current one is returned. - * - * @param int $code The new code - * - * @return int|bool True on successful change, false on unsuccesful change, int when the current code is returned - */ - public function http_response_code($code = null) { - if ($code === null) { - return $this->http_response_code; - } else { - if (http_response_code($code)) { - $this->http_response_code = $code; - return true; - } else { - return false; - } - } - } + /** + * Get or set the HTTP response code + * + * If a parameter is provided, it is used as the new HTTP response code, and a bool is returned for success or failure. Otherwise, the current one is returned. + * + * @param int $code The new code + * + * @return int|bool True on successful change, false on unsuccesful change, int when the current code is returned + */ + public function http_response_code($code = null) { + if ($code === null) { + return $this->http_response_code; + } else { + if (http_response_code($code)) { + $this->http_response_code = $code; + return true; + } else { + return false; + } + } + } - /** - * Output the response in json - * - * @return string The response in json format - */ - public function getJson() { - return json_encode($this->response); - } -}
\ No newline at end of file + /** + * Output the response in json + * + * @return string The response in json format + */ + public function getJson() { + return json_encode($this->response); + } +} @@ -11,17 +11,17 @@ * * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/css/businessadmin.css b/css/businessadmin.css index 07bf218..e898740 100644 --- a/css/businessadmin.css +++ b/css/businessadmin.css @@ -1,17 +1,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -19,24 +19,24 @@ /* If you change the external URL of the control panel, also change the URLs below: */ @font-face { - font-family: Ubuntu; - src: url('/BusinessAdmin/fonts/Ubuntu-R.ttf'); + font-family: Ubuntu; + src: url('/BusinessAdmin/fonts/Ubuntu-R.ttf'); } @font-face { - font-family: Ubuntu; - font-style: italic; - src: url('/BusinessAdmin/fonts/Ubuntu-RI.ttf'); + font-family: Ubuntu; + font-style: italic; + src: url('/BusinessAdmin/fonts/Ubuntu-RI.ttf'); } @font-face { - font-family: Ubuntu; - font-weight: bold; - src: url('/BusinessAdmin/fonts/Ubuntu-B.ttf'); + font-family: Ubuntu; + font-weight: bold; + src: url('/BusinessAdmin/fonts/Ubuntu-B.ttf'); } @font-face { - font-family: Ubuntu; - font-style: italic; - font-weight: bold; - src: url('/BusinessAdmin/fonts/Ubuntu-BI.ttf'); + font-family: Ubuntu; + font-style: italic; + font-weight: bold; + src: url('/BusinessAdmin/fonts/Ubuntu-BI.ttf'); } /********************** Do not edit below this line **********************/ @@ -101,13 +101,13 @@ td .btn.btn-circle:last-child { } #collapse-menu { - margin-right: 16px; - margin-top: 16px; - float: right; + margin-right: 16px; + margin-top: 16px; + float: right; } @media (max-width: 767px) { - #collapse-menu { - display: none; - } + #collapse-menu { + display: none; + } } @@ -1,3 +1,2 @@ </body> - -</html>
\ No newline at end of file +</html> @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -22,45 +22,45 @@ <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> - <title><?=constants::my_name?></title> + <title><?=constants::my_name?></title> - <link href="<?=constants::url_external?>/css/bootstrap.min.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/css/plugins/timeline.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/css/plugins/bootstrapValidator/bootstrapValidator.min.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/css/plugins/bootstrap-editable.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/css/plugins/bootstrap-select.min.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> - <link href="<?=constants::url_external?>/css/sb-admin-2.css" rel="stylesheet"> - <link href="<?=constants::url_external?>/css/businessadmin.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/bootstrap.min.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/plugins/timeline.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/plugins/bootstrapValidator/bootstrapValidator.min.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/plugins/bootstrap-editable.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/plugins/bootstrap-select.min.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> + <link href="<?=constants::url_external?>/css/sb-admin-2.css" rel="stylesheet"> + <link href="<?=constants::url_external?>/css/businessadmin.css" rel="stylesheet"> - <!-- jQuery Version 1.11.0 --> - <script src="<?=constants::url_external?>/js/jquery-1.11.0.js"></script> + <!-- jQuery Version 1.11.0 --> + <script src="<?=constants::url_external?>/js/jquery-1.11.0.js"></script> - <!-- Bootstrap Core JavaScript --> - <script src="<?=constants::url_external?>/js/bootstrap.min.js"></script> + <!-- Bootstrap Core JavaScript --> + <script src="<?=constants::url_external?>/js/bootstrap.min.js"></script> - <!-- Plugins --> - <script src="<?=constants::url_external?>/js/plugins/metisMenu/metisMenu.min.js"></script> - <script src="<?=constants::url_external?>/js/plugins/bootstrapValidator/bootstrapValidator.min.js"></script> - <script src="<?=constants::url_external?>/js/plugins/form/jquery.form.min.js"></script> - <script src="<?=constants::url_external?>/js/plugins/bootstrap-editable.min.js"></script> - <script src="<?=constants::url_external?>/js/plugins/bootstrap-select.min.js"></script> - <script src="<?=constants::url_external?>/js/plugins/jquery.mixitup.min.js"></script> + <!-- Plugins --> + <script src="<?=constants::url_external?>/js/plugins/metisMenu/metisMenu.min.js"></script> + <script src="<?=constants::url_external?>/js/plugins/bootstrapValidator/bootstrapValidator.min.js"></script> + <script src="<?=constants::url_external?>/js/plugins/form/jquery.form.min.js"></script> + <script src="<?=constants::url_external?>/js/plugins/bootstrap-editable.min.js"></script> + <script src="<?=constants::url_external?>/js/plugins/bootstrap-select.min.js"></script> + <script src="<?=constants::url_external?>/js/plugins/jquery.mixitup.min.js"></script> - <!-- Custom Theme JavaScript --> - <script src="<?=constants::url_external?>/js/sb-admin-2.js"></script> + <!-- Custom Theme JavaScript --> + <script src="<?=constants::url_external?>/js/sb-admin-2.js"></script> - <!-- Fudge Custom JavaScript --> - <script src="<?=constants::url_external?>/js/businessadmin.js"></script> + <!-- Fudge Custom JavaScript --> + <script src="<?=constants::url_external?>/js/businessadmin.js"></script> - <script type="text/javascript"> - var const_url_external = '<?=constants::url_external?>'; - </script> + <script type="text/javascript"> + var const_url_external = '<?=constants::url_external?>'; + </script> </head> diff --git a/include/404.php b/include/404.php index 335ebf7..dc0cff0 100644 --- a/include/404.php +++ b/include/404.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -23,23 +23,23 @@ require('./header.php'); <div id="wrapper"> - <?php require('nav.php'); ?> - - <!-- Page Content --> - <div id="page-wrapper"> - <div class="row"> - <div class="col-lg-12"> - <h1>404</h1> - <p class="lead">The page you requested could not be found.</p> - </div> - <!-- /.col-lg-12 --> - </div> - <!-- /.row --> - </div> - <!-- /#page-wrapper --> + <?php require('nav.php'); ?> + + <!-- Page Content --> + <div id="page-wrapper"> + <div class="row"> + <div class="col-lg-12"> + <h1>404</h1> + <p class="lead">The page you requested could not be found.</p> + </div> + <!-- /.col-lg-12 --> + </div> + <!-- /.row --> + </div> + <!-- /#page-wrapper --> </div> <!-- /#wrapper --> <?php require('./footer.php'); -?>
\ No newline at end of file +?> diff --git a/include/about.php b/include/about.php index 554a80f..e7ab3d4 100644 --- a/include/about.php +++ b/include/about.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -24,25 +24,25 @@ require('./header.php'); <div id="wrapper"> - <?php require('nav.php'); ?> - - <!-- Page Content --> - <div id="page-wrapper"> - <div class="row"> - <div class="col-lg-12"> - <h1 class="page-header">About</h1> - </div> - <!-- /.col-lg-12 --> - </div> + <?php require('nav.php'); ?> - <div class="row"> - <div class="col-md-8"> - <div class="panel panel-default"> - <div class="panel-heading">About</div> - <div class="panel-body"> - <p class="lead">BusinessAdmin <?=constants::version?> is open source software under the GPL 3.0 license.</p> - <p>A full version of the license is available <a href="<?=constants::url_external?>LICENSE">here</a>. An excerpt is shown below:</p> - <pre>BusinessAdmin: administrative software for small companies + <!-- Page Content --> + <div id="page-wrapper"> + <div class="row"> + <div class="col-lg-12"> + <h1 class="page-header">About</h1> + </div> + <!-- /.col-lg-12 --> + </div> + + <div class="row"> + <div class="col-md-8"> + <div class="panel panel-default"> + <div class="panel-heading">About</div> + <div class="panel-body"> + <p class="lead">BusinessAdmin <?=constants::version?> is open source software under the GPL 3.0 license.</p> + <p>A full version of the license is available <a href="<?=constants::url_external?>LICENSE">here</a>. An excerpt is shown below:</p> + <pre>BusinessAdmin: administrative software for small companies Copyright (C) 2015 Camil Staps (ViviSoft) This program is free software: you can redistribute it and/or modify @@ -63,43 +63,43 @@ You can contact me, Camil Staps, here: Camil Staps www.camilstaps.nl info@camilstaps.nl</pre> - </div> - </div> - </div> - <!-- /.col-lg-12 --> + </div> + </div> + </div> + <!-- /.col-lg-12 --> - <div class="col-md-4"> - <div class="panel panel-default" id="panel-contact"> - <div class="panel-heading">Contact</div> - <div class="panel-body"> - <img class="gravatar pull-right" src="https://www.gravatar.com/avatar/<?=md5('info@camilstaps.nl')?>?d=mm"/> - <p>For things related to BusinessAdmin, please use GitHub: <a href="https://github.com/camilstaps/BusinessAdmin">camilstaps/BusinessAdmin</a></p> - <p>The BusinessAdmin system was developed by <a href="http://camilstaps.nl/">Camil Staps</a>. See my website for contact details.</p> - </div> - </div> - </div> + <div class="col-md-4"> + <div class="panel panel-default" id="panel-contact"> + <div class="panel-heading">Contact</div> + <div class="panel-body"> + <img class="gravatar pull-right" src="https://www.gravatar.com/avatar/<?=md5('info@camilstaps.nl')?>?d=mm"/> + <p>For things related to BusinessAdmin, please use GitHub: <a href="https://github.com/camilstaps/BusinessAdmin">camilstaps/BusinessAdmin</a></p> + <p>The BusinessAdmin system was developed by <a href="http://camilstaps.nl/">Camil Staps</a>. See my website for contact details.</p> + </div> + </div> + </div> - <div class="col-md-4"> - <div class="panel panel-default" id="panel-contact"> - <div class="panel-heading">Thanks</div> - <div class="panel-body"> - <p>BusinessAdmin was created using:</p> - <ul> - <li><a href="http://startbootstrap.com/template-overviews/sb-admin-2/">SB Admin 2</a></li> - <li><a href="http://getbootstrap.com">Bootstrap 3.2.0</a></li> - <li><a href="http://jquery.org/">jQuery 1.11.0</a></li> - <li><a href="http://fontawesome.io/">Font Awesome 4.3.0</a></li> - <li><a href="http://font.ubuntu.com/">Ubuntu fonts</a></li> - <li>And various jQuery plugins</li> - </ul> - <p>Many thanks go to the creators and developers of these software packages.</p> - </div> - </div> - </div> - </div> - <!-- /.row --> - </div> - <!-- /#page-wrapper --> + <div class="col-md-4"> + <div class="panel panel-default" id="panel-contact"> + <div class="panel-heading">Thanks</div> + <div class="panel-body"> + <p>BusinessAdmin was created using:</p> + <ul> + <li><a href="http://startbootstrap.com/template-overviews/sb-admin-2/">SB Admin 2</a></li> + <li><a href="http://getbootstrap.com">Bootstrap 3.2.0</a></li> + <li><a href="http://jquery.org/">jQuery 1.11.0</a></li> + <li><a href="http://fontawesome.io/">Font Awesome 4.3.0</a></li> + <li><a href="http://font.ubuntu.com/">Ubuntu fonts</a></li> + <li>And various jQuery plugins</li> + </ul> + <p>Many thanks go to the creators and developers of these software packages.</p> + </div> + </div> + </div> + </div> + <!-- /.row --> + </div> + <!-- /#page-wrapper --> </div> <!-- /#wrapper --> diff --git a/include/ajax-collapse.php b/include/ajax-collapse.php index e49c6fd..402d057 100644 --- a/include/ajax-collapse.php +++ b/include/ajax-collapse.php @@ -1,8 +1,8 @@ <?php $collapsed = true; if ($_REQUEST['setting'] !== 'true') - $collapsed = false; + $collapsed = false; $_SESSION['ba-collapse'] = $collapsed; -echo $collapsed;
\ No newline at end of file +echo $collapsed; diff --git a/include/assignments-edit.php b/include/assignments-edit.php index b52311a..7c63680 100644 --- a/include/assignments-edit.php +++ b/include/assignments-edit.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/assignments-new.php b/include/assignments-new.php index 7898a42..405c5fa 100644 --- a/include/assignments-new.php +++ b/include/assignments-new.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/assignments-overview.php b/include/assignments-overview.php index ee46928..0e364d1 100644 --- a/include/assignments-overview.php +++ b/include/assignments-overview.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -21,151 +21,151 @@ require_once('./login.php'); ?> <div class="col-lg-12"> - <div class="panel panel-default"> - <div class="panel-heading">Overview</div> - <div class="panel-body table-responsive"> - <table class="table table-bordered table-striped mixitup dataTable" id="overview-assignments"> - <thead> - <tr> - <th class="mixitup-sort sorting" data-sort="mixerOrderId:desc">#</th> - <th class="mixitup-sort sorting" data-sort="mixerOrderOffer:desc">Offer</th> - <th>Briefing</th> - <th class="mixitup-sort sorting" data-sort="mixerOrderTime:desc">Time</th> - <th class="mixitup-sort sorting" data-sort="mixerOrderPrice:desc">Price</th> - <th>Tools</th> - </tr> - </thead> - <tbody> - <?php - $assignments = BusinessAdmin::getAssignments($_pdo); - foreach ($assignments as $assignment) { - echo "<tr class='mix' - data-mixer-order-id='{$assignment->getId()}' - data-mixer-order-offer='{$assignment->getOffer()->getId()}' - data-mixer-order-time='{$assignment->getHours()}' - data-mixer-order-price='{$assignment->getPricePerHour()}'> - <td class='col-min-width'>{$assignment->getId()}</td> - <td class='col-min-width'> - <a href='".constants::url_internal."/offers?id={$assignment->getOffer()->getId()}'>#{$assignment->getOffer()->getId()}</a> to - <a href='".constants::url_internal."/contacts?id={$assignment->getOffer()->getContact()->getId()}'>{$assignment->getOffer()->getContact()->getName()}</a> - (<a href='".constants::url_internal."/clients?id={$assignment->getOffer()->getContact()->getClient()->id}'>{$assignment->getOffer()->getContact()->getClient()->name}</a>) - <td class='col-max-width'> - <b><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-title' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getTitle()}</a></b><br/> - <p><a href='#' class='editable editable-noshow' id='editable-assignment-{$assignment->getId()}-description' data-type='textarea' data-mode='inline' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getDescription(false)}</a></p> - </td> - <td class='col-min-width'><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-hours' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getHours()}</a>h</td> - <td class='col-min-width'> - ".constants::invoice_valuta."<a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-price_per_hour' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getPricePerHour()}</a> / hr<br/> - <a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-vat' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getVAT()}</a>% VAT - </td> - <td class='col-min-width'> - <a title='View' href='?id={$assignment->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> - <a title='Delete' href='?delete={$assignment->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> - </td> - </tr>"; - } - if (count($assignments) == 0) { - echo "<tr><td colspan='6'>There are no assignments in the database. Why not start with creating one, below?</td></tr>"; - } - ?> - </tbody> - </table> - </div> - </div> + <div class="panel panel-default"> + <div class="panel-heading">Overview</div> + <div class="panel-body table-responsive"> + <table class="table table-bordered table-striped mixitup dataTable" id="overview-assignments"> + <thead> + <tr> + <th class="mixitup-sort sorting" data-sort="mixerOrderId:desc">#</th> + <th class="mixitup-sort sorting" data-sort="mixerOrderOffer:desc">Offer</th> + <th>Briefing</th> + <th class="mixitup-sort sorting" data-sort="mixerOrderTime:desc">Time</th> + <th class="mixitup-sort sorting" data-sort="mixerOrderPrice:desc">Price</th> + <th>Tools</th> + </tr> + </thead> + <tbody> + <?php + $assignments = BusinessAdmin::getAssignments($_pdo); + foreach ($assignments as $assignment) { + echo "<tr class='mix' + data-mixer-order-id='{$assignment->getId()}' + data-mixer-order-offer='{$assignment->getOffer()->getId()}' + data-mixer-order-time='{$assignment->getHours()}' + data-mixer-order-price='{$assignment->getPricePerHour()}'> + <td class='col-min-width'>{$assignment->getId()}</td> + <td class='col-min-width'> + <a href='".constants::url_internal."/offers?id={$assignment->getOffer()->getId()}'>#{$assignment->getOffer()->getId()}</a> to + <a href='".constants::url_internal."/contacts?id={$assignment->getOffer()->getContact()->getId()}'>{$assignment->getOffer()->getContact()->getName()}</a> + (<a href='".constants::url_internal."/clients?id={$assignment->getOffer()->getContact()->getClient()->id}'>{$assignment->getOffer()->getContact()->getClient()->name}</a>) + <td class='col-max-width'> + <b><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-title' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getTitle()}</a></b><br/> + <p><a href='#' class='editable editable-noshow' id='editable-assignment-{$assignment->getId()}-description' data-type='textarea' data-mode='inline' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getDescription(false)}</a></p> + </td> + <td class='col-min-width'><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-hours' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getHours()}</a>h</td> + <td class='col-min-width'> + ".constants::invoice_valuta."<a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-price_per_hour' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getPricePerHour()}</a> / hr<br/> + <a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-vat' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getVAT()}</a>% VAT + </td> + <td class='col-min-width'> + <a title='View' href='?id={$assignment->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> + <a title='Delete' href='?delete={$assignment->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> + </td> + </tr>"; + } + if (count($assignments) == 0) { + echo "<tr><td colspan='6'>There are no assignments in the database. Why not start with creating one, below?</td></tr>"; + } + ?> + </tbody> + </table> + </div> + </div> </div> <div class="col-lg-12"> - <div class="panel panel-default"> - <div class="panel-heading">Create new</div> - <div class="panel-body"> - <form role="form" id="newAssignment" action='<?=constants::url_external?>assignments/new' method="post" class="bootstrapValidator ajaxify" - data-ajaxify-options='{"success":"newAssignmentSuccess","error":"newAssignmentError","beforeSubmit":"newAssignmentBeforeSubmit"}'> - <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> - <div class="col-lg-6"> - <div class="form-group"> - <label>Offer:</label> - <select name="offerId" class="form-control"> - <?php - foreach (BusinessAdmin::getOffers($_pdo) as $offer) { - echo "<option value='{$offer->getId()}'>#{$offer->getId()} to {$offer->getContact()->getName()} ({$offer->getContact()->getClient()->name})</option>"; - } - ?> - </select> - </div> - <div class="form-group"> - <label>Title:</label> - <input - type="text" name="title" class="form-control" placeholder="Title" - data-bv-notempty="true" data-bv-notempty-message="You have to provide a title"/> - </div> - <div class="form-group"> - <label>Description:</label> - <textarea - name="description" class="form-control" placeholder="Description" rows="4" - data-bv-notempty="true" data-bv-notempty-message="You have to provide a description" - data-bv-stringlength="true" data-bv-stringlength-message="The description should at most 1000 characters" data-bv-stringlength-max="1000"></textarea> - </div> - </div> - <div class="col-lg-6"> - <div class="form-group"> - <label>Estimated time (h):</label> - <input - type="text" name="hours" class="form-control" placeholder="Time in hours" - data-bv-notempty="true" data-bv-notempty-message="You have to give an estimation" - data-bv-integer="true" data-bv-integer-message="Please enter an integer" /> - </div> - <div class="form-group"> - <label>Price per hour (<?=constants::invoice_valuta?>):</label> - <input - type="text" name="price_per_hour" class="form-control" placeholder="Price per hour" - data-bv-notempty="true" data-bv-notempty-message="You have to give a rate" - data-bv-numeric="true" data-bv-numeric-message="Please enter a number (with a '.' as decimal separator)" /> - </div> - <div class="form-group"> - <label>VAT (%):</label> - <input - type="text" name="vat" class="form-control" placeholder="VAT" - data-bv-notempty="true" data-bv-notempty-message="You have to provide a VAT percentage" - data-bv-numeric="true" data-bv-numeric-message="Please enter a number (with a '.' as decimal separator)" /> - </div> - </div> - <div class="col-lg-6"> - <button type="submit" class="btn btn-default">Go</button> - </div> - </form> - <script type="text/javascript"> - // Callback for before the form is submitted - function newAssignmentBeforeSubmit() { - $('#newAssignment input').prop('disabled', true); - $('#newAssignment .ajaxify-response').hide().removeClass('alert-success alert-danger').find('.ajaxify-response-text').html(''); - } + <div class="panel panel-default"> + <div class="panel-heading">Create new</div> + <div class="panel-body"> + <form role="form" id="newAssignment" action='<?=constants::url_external?>assignments/new' method="post" class="bootstrapValidator ajaxify" + data-ajaxify-options='{"success":"newAssignmentSuccess","error":"newAssignmentError","beforeSubmit":"newAssignmentBeforeSubmit"}'> + <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> + <div class="col-lg-6"> + <div class="form-group"> + <label>Offer:</label> + <select name="offerId" class="form-control"> + <?php + foreach (BusinessAdmin::getOffers($_pdo) as $offer) { + echo "<option value='{$offer->getId()}'>#{$offer->getId()} to {$offer->getContact()->getName()} ({$offer->getContact()->getClient()->name})</option>"; + } + ?> + </select> + </div> + <div class="form-group"> + <label>Title:</label> + <input + type="text" name="title" class="form-control" placeholder="Title" + data-bv-notempty="true" data-bv-notempty-message="You have to provide a title"/> + </div> + <div class="form-group"> + <label>Description:</label> + <textarea + name="description" class="form-control" placeholder="Description" rows="4" + data-bv-notempty="true" data-bv-notempty-message="You have to provide a description" + data-bv-stringlength="true" data-bv-stringlength-message="The description should at most 1000 characters" data-bv-stringlength-max="1000"></textarea> + </div> + </div> + <div class="col-lg-6"> + <div class="form-group"> + <label>Estimated time (h):</label> + <input + type="text" name="hours" class="form-control" placeholder="Time in hours" + data-bv-notempty="true" data-bv-notempty-message="You have to give an estimation" + data-bv-integer="true" data-bv-integer-message="Please enter an integer" /> + </div> + <div class="form-group"> + <label>Price per hour (<?=constants::invoice_valuta?>):</label> + <input + type="text" name="price_per_hour" class="form-control" placeholder="Price per hour" + data-bv-notempty="true" data-bv-notempty-message="You have to give a rate" + data-bv-numeric="true" data-bv-numeric-message="Please enter a number (with a '.' as decimal separator)" /> + </div> + <div class="form-group"> + <label>VAT (%):</label> + <input + type="text" name="vat" class="form-control" placeholder="VAT" + data-bv-notempty="true" data-bv-notempty-message="You have to provide a VAT percentage" + data-bv-numeric="true" data-bv-numeric-message="Please enter a number (with a '.' as decimal separator)" /> + </div> + </div> + <div class="col-lg-6"> + <button type="submit" class="btn btn-default">Go</button> + </div> + </form> + <script type="text/javascript"> + // Callback for before the form is submitted + function newAssignmentBeforeSubmit() { + $('#newAssignment input').prop('disabled', true); + $('#newAssignment .ajaxify-response').hide().removeClass('alert-success alert-danger').find('.ajaxify-response-text').html(''); + } - // Callback for when the form is successfully submitted - function newAssignmentSuccess(data) { - $('#newAssignment .ajaxify-response') - .addClass(data.success ? 'alert-success' : 'alert-danger') - .show() - .find('.ajaxify-response-text') - .html(data.message); + // Callback for when the form is successfully submitted + function newAssignmentSuccess(data) { + $('#newAssignment .ajaxify-response') + .addClass(data.success ? 'alert-success' : 'alert-danger') + .show() + .find('.ajaxify-response-text') + .html(data.message); - $('#newAssignment input, #newAssignment button').prop('disabled', false); - $('#newAssignment').data('bootstrapValidator').resetForm(); - if (data.success) { - $('#newAssignment input, #newAssignment textarea').val(''); - } - } + $('#newAssignment input, #newAssignment button').prop('disabled', false); + $('#newAssignment').data('bootstrapValidator').resetForm(); + if (data.success) { + $('#newAssignment input, #newAssignment textarea').val(''); + } + } - // Callback for when form submission encountered an error - function newAssignmentError() { - $('#newAssignment .ajaxify-response') - .addClass('alert-danger') - .show() - .find('.ajaxify-response-text') - .html('An unknown error occurred. Please contact support.'); + // Callback for when form submission encountered an error + function newAssignmentError() { + $('#newAssignment .ajaxify-response') + .addClass('alert-danger') + .show() + .find('.ajaxify-response-text') + .html('An unknown error occurred. Please contact support.'); - $('#newAssignment input, #newAssignment button').prop('disabled', false); - $('#newAssignment').data('bootstrapValidator').resetForm(); - } - </script> - </div> - </div> + $('#newAssignment input, #newAssignment button').prop('disabled', false); + $('#newAssignment').data('bootstrapValidator').resetForm(); + } + </script> + </div> + </div> </div> diff --git a/include/assignments-view.php b/include/assignments-view.php index f2717b0..0bac039 100644 --- a/include/assignments-view.php +++ b/include/assignments-view.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -36,8 +36,8 @@ $_assignment = new assignment($_pdo, $_id); </thead> <tbody> <?php - echo "<tr class='mix' - data-mixer-order-id='{$_assignment->getId()}' + echo "<tr class='mix' + data-mixer-order-id='{$_assignment->getId()}' data-mixer-order-offer='{$_assignment->getOffer()->getId()}' data-mixer-order-time='{$_assignment->getHours()}' data-mixer-order-price='{$_assignment->getPricePerHour()}'> diff --git a/include/assignments.php b/include/assignments.php index eaa7163..14ed8da 100644 --- a/include/assignments.php +++ b/include/assignments.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/clients-edit.php b/include/clients-edit.php index 7d8d6fa..3d92d06 100644 --- a/include/clients-edit.php +++ b/include/clients-edit.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/clients-new.php b/include/clients-new.php index e87557e..fe66026 100644 --- a/include/clients-new.php +++ b/include/clients-new.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/clients-overview.php b/include/clients-overview.php index 58fad49..860e671 100644 --- a/include/clients-overview.php +++ b/include/clients-overview.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -21,102 +21,102 @@ require_once('./login.php'); ?> <div class="col-lg-6 col-md-6"> - <div class="panel panel-default"> - <div class="panel-heading">Overview</div> - <div class="panel-body table-responsive"> - <table class="table table-bordered table-striped mixitup dataTable" id="overview-clients"> - <thead> - <tr> - <th class="mixitup-sort sorting" data-sort="mixerOrderId:desc">#</th> - <th class="mixitup-sort sorting" data-sort="mixerOrderName:desc">Name</th> - <th>Tools</th> - </tr> - </thead> - <tbody> - <?php - $clients = BusinessAdmin::getClients($_pdo); - foreach ($clients as $client) { - echo "<tr class='mix' - data-mixer-order-id='{$client->id}' - data-mixer-order-name='{$client->name}'> - <td class='col-min-width'>{$client->id}</td> - <td class='col-max-width'> - <a href='#' class='editable' id='editable-client-{$client->id}-name' data-type='text' data-pk='{$client->id}' data-url='".constants::url_external."clients/edit' data-title='Enter new name'> - {$client->name} - </a> - </td> - <td class='col-min-width'> - <a title='View' href='?id={$client->id}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> - <a title='Delete' href='?delete={$client->id}' class='btn btn-danger btn-circle fa fa-times'></a> - </td> - </tr>"; - } - if (count($clients) == 0) { - echo "<tr><td colspan='3'>There are no clients in the database. Why not start with creating one, on the right?</td></tr>"; - } - ?> - </tbody> - </table> - </div> - </div> + <div class="panel panel-default"> + <div class="panel-heading">Overview</div> + <div class="panel-body table-responsive"> + <table class="table table-bordered table-striped mixitup dataTable" id="overview-clients"> + <thead> + <tr> + <th class="mixitup-sort sorting" data-sort="mixerOrderId:desc">#</th> + <th class="mixitup-sort sorting" data-sort="mixerOrderName:desc">Name</th> + <th>Tools</th> + </tr> + </thead> + <tbody> + <?php + $clients = BusinessAdmin::getClients($_pdo); + foreach ($clients as $client) { + echo "<tr class='mix' + data-mixer-order-id='{$client->id}' + data-mixer-order-name='{$client->name}'> + <td class='col-min-width'>{$client->id}</td> + <td class='col-max-width'> + <a href='#' class='editable' id='editable-client-{$client->id}-name' data-type='text' data-pk='{$client->id}' data-url='".constants::url_external."clients/edit' data-title='Enter new name'> + {$client->name} + </a> + </td> + <td class='col-min-width'> + <a title='View' href='?id={$client->id}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> + <a title='Delete' href='?delete={$client->id}' class='btn btn-danger btn-circle fa fa-times'></a> + </td> + </tr>"; + } + if (count($clients) == 0) { + echo "<tr><td colspan='3'>There are no clients in the database. Why not start with creating one, on the right?</td></tr>"; + } + ?> + </tbody> + </table> + </div> + </div> </div> <div class="col-lg-6 col-md-6"> - <div class="panel panel-default"> - <div class="panel-heading">Create new</div> - <div class="panel-body"> - <form role="form" id="newClient" action='<?=constants::url_external?>clients/new' method="post" class="bootstrapValidator ajaxify" - data-ajaxify-options='{"success":"newClientSuccess","error":"newClientError","beforeSubmit":"newClientBeforeSubmit","clearForm":true}'> - <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> - <div class="form-group"> - <label>Name:</label> - <input - type="text" name="name" class="form-control" placeholder="Name" - data-bv-notempty="true" data-bv-notempty-message="You have to provide a name"/> - </div> - <button type="submit" class="btn btn-default">Go</button> - </form> - <script type="text/javascript"> - // Callback for before the form is submitted - function newClientBeforeSubmit() { - $('#newClient input').prop('disabled', true); - $('#newClient .ajaxify-response').hide().removeClass('alert-success alert-danger').find('.ajaxify-response-text').html(''); - } + <div class="panel panel-default"> + <div class="panel-heading">Create new</div> + <div class="panel-body"> + <form role="form" id="newClient" action='<?=constants::url_external?>clients/new' method="post" class="bootstrapValidator ajaxify" + data-ajaxify-options='{"success":"newClientSuccess","error":"newClientError","beforeSubmit":"newClientBeforeSubmit","clearForm":true}'> + <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> + <div class="form-group"> + <label>Name:</label> + <input + type="text" name="name" class="form-control" placeholder="Name" + data-bv-notempty="true" data-bv-notempty-message="You have to provide a name"/> + </div> + <button type="submit" class="btn btn-default">Go</button> + </form> + <script type="text/javascript"> + // Callback for before the form is submitted + function newClientBeforeSubmit() { + $('#newClient input').prop('disabled', true); + $('#newClient .ajaxify-response').hide().removeClass('alert-success alert-danger').find('.ajaxify-response-text').html(''); + } - // Callback for when the form is successfully submitted - function newClientSuccess(data) { - if (data.success == true) { - $('#newClient .ajaxify-response') - .addClass('alert-success') - .show() - .find('.ajaxify-response-text') - .html(data.message); + // Callback for when the form is successfully submitted + function newClientSuccess(data) { + if (data.success == true) { + $('#newClient .ajaxify-response') + .addClass('alert-success') + .show() + .find('.ajaxify-response-text') + .html(data.message); - $('#newClient input, #newClient button').prop('disabled', false); - $('#newClient').data('bootstrapValidator').resetForm(); - } else { - $('#newClient .ajaxify-response') - .addClass('alert-danger') - .show() - .find('.ajaxify-response-text') - .html(data.message); + $('#newClient input, #newClient button').prop('disabled', false); + $('#newClient').data('bootstrapValidator').resetForm(); + } else { + $('#newClient .ajaxify-response') + .addClass('alert-danger') + .show() + .find('.ajaxify-response-text') + .html(data.message); - $('#newClient input, #newClient button').prop('disabled', false); - $('#newClient').data('bootstrapValidator').resetForm(); - } - } + $('#newClient input, #newClient button').prop('disabled', false); + $('#newClient').data('bootstrapValidator').resetForm(); + } + } - // Callback for when form submission encountered an error - function newClientError() { - $('#newClient .ajaxify-response') - .addClass('alert-danger') - .show() - .find('.ajaxify-response-text') - .html('An unknown error occurred. Please contact support.'); - - $('#newClient input, #newClient button').prop('disabled', false); - $('#newClient').data('bootstrapValidator').resetForm(); - } - </script> - </div> - </div> + // Callback for when form submission encountered an error + function newClientError() { + $('#newClient .ajaxify-response') + .addClass('alert-danger') + .show() + .find('.ajaxify-response-text') + .html('An unknown error occurred. Please contact support.'); + + $('#newClient input, #newClient button').prop('disabled', false); + $('#newClient').data('bootstrapValidator').resetForm(); + } + </script> + </div> + </div> </div> diff --git a/include/clients-view.php b/include/clients-view.php index 514e4e4..007d94c 100644 --- a/include/clients-view.php +++ b/include/clients-view.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/clients.php b/include/clients.php index b07a7c8..f762859 100644 --- a/include/clients.php +++ b/include/clients.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/contacts-edit.php b/include/contacts-edit.php index a5b3bdd..ac924a9 100644 --- a/include/contacts-edit.php +++ b/include/contacts-edit.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/contacts-new.php b/include/contacts-new.php index 0a72afb..440e744 100644 --- a/include/contacts-new.php +++ b/include/contacts-new.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/contacts.php b/include/contacts.php index 4b35603..09a452f 100644 --- a/include/contacts.php +++ b/include/contacts.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/discounts-edit.php b/include/discounts-edit.php index a760e9c..2d64bd9 100644 --- a/include/discounts-edit.php +++ b/include/discounts-edit.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/discounts-new.php b/include/discounts-new.php index 8a5f527..b0cfa07 100644 --- a/include/discounts-new.php +++ b/include/discounts-new.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/discounts-overview.php b/include/discounts-overview.php index d4d8245..1bf55d6 100644 --- a/include/discounts-overview.php +++ b/include/discounts-overview.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -39,7 +39,7 @@ require_once('./login.php'); $discounts = BusinessAdmin::getDiscounts($_pdo); foreach ($discounts as $discount) { echo "<tr class='mix' - data-mixer-order-id='{$discount->getId()}' + data-mixer-order-id='{$discount->getId()}' data-mixer-order-offer='{$discount->getOffer()->getId()}' data-mixer-order-value='{$discount->getValue()}'> <td class='col-min-width'>{$discount->getId()}</td> @@ -56,7 +56,7 @@ require_once('./login.php'); <a href='#' class='editable' id='editable-discount-{$discount->getId()}-vat' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getVAT()}</a>% VAT </td> <td class='col-min-width'> - <a title='View' href='?id={$discount->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> + <a title='View' href='?id={$discount->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> <a title='Delete' href='?delete={$discount->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> </td> </tr>"; @@ -74,7 +74,7 @@ require_once('./login.php'); <div class="panel panel-default"> <div class="panel-heading">Create new</div> <div class="panel-body"> - <form role="form" id="newDiscount" action='<?=constants::url_external?>discounts/new' method="post" class="bootstrapValidator ajaxify" + <form role="form" id="newDiscount" action='<?=constants::url_external?>discounts/new' method="post" class="bootstrapValidator ajaxify" data-ajaxify-options='{"success":"newDiscountSuccess","error":"newDiscountError","beforeSubmit":"newDiscountBeforeSubmit"}'> <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> <div class="col-lg-6"> @@ -90,30 +90,30 @@ require_once('./login.php'); </div> <div class="form-group"> <label>Title:</label> - <input - type="text" name="title" class="form-control" placeholder="Title" + <input + type="text" name="title" class="form-control" placeholder="Title" data-bv-notempty="true" data-bv-notempty-message="You have to provide a title"/> </div> <div class="form-group"> <label>Description:</label> - <textarea + <textarea name="description" class="form-control" placeholder="Description" rows="4" - data-bv-notempty="true" data-bv-notempty-message="You have to provide a description" + data-bv-notempty="true" data-bv-notempty-message="You have to provide a description" data-bv-stringlength="true" data-bv-stringlength-message="The description should have at most 1000 characters" data-bv-stringlength-max="1000"></textarea> </div> </div> <div class="col-lg-6"> <div class="form-group"> <label>Value (<?=constants::invoice_valuta?>):</label> - <input - type="text" name="value" class="form-control" placeholder="Value" + <input + type="text" name="value" class="form-control" placeholder="Value" data-bv-notempty="true" data-bv-notempty-message="You have to give a value" data-bv-numeric="true" data-bv-numeric-message="Please enter a number (with a '.' as decimal separator)" /> </div> <div class="form-group"> <label>VAT (%):</label> - <input - type="text" name="vat" class="form-control" placeholder="VAT" + <input + type="text" name="vat" class="form-control" placeholder="VAT" data-bv-notempty="true" data-bv-notempty-message="You have to provide a VAT percentage" data-bv-numeric="true" data-bv-numeric-message="Please enter a number (with a '.' as decimal separator)" /> </div> diff --git a/include/discounts.php b/include/discounts.php index 8b160ab..ff2a69a 100644 --- a/include/discounts.php +++ b/include/discounts.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/home.php b/include/home.php index a9dca1e..6a25743 100644 --- a/include/home.php +++ b/include/home.php @@ -279,7 +279,7 @@ require('./header.php'); $sort_list = array(); foreach ($offers as $offer) { $temp = array( - 'id' => $offer->getId(), + 'id' => $offer->getId(), 'contact' => $offer->getContact()->getName(), 'assignments' => '', 'assignments_header' => '' diff --git a/include/offers-edit.php b/include/offers-edit.php index 225a18c..7f050c3 100644 --- a/include/offers-edit.php +++ b/include/offers-edit.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/offers-new.php b/include/offers-new.php index 0d86293..9c499a8 100644 --- a/include/offers-new.php +++ b/include/offers-new.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/offers-overview.php b/include/offers-overview.php index a246190..9eaf25d 100644 --- a/include/offers-overview.php +++ b/include/offers-overview.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -112,7 +112,7 @@ require_once('./login.php'); <div class="panel panel-default"> <div class="panel-heading">Create new</div> <div class="panel-body"> - <form role="form" id="newOffer" action='<?=constants::url_external?>offers/new' method="post" class="bootstrapValidator ajaxify" + <form role="form" id="newOffer" action='<?=constants::url_external?>offers/new' method="post" class="bootstrapValidator ajaxify" data-ajaxify-options='{"success":"newOfferSuccess","error":"newOfferError","beforeSubmit":"newOfferBeforeSubmit"}'> <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> <div class="form-group"> diff --git a/include/offers-view.php b/include/offers-view.php index 082af35..8f741c2 100644 --- a/include/offers-view.php +++ b/include/offers-view.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -22,152 +22,152 @@ require_once('./login.php'); $_offer = new offer($_pdo, $_id); ?> <div class="col-lg-6"> - <div class="panel panel-default" id="panel-timeline"> - <div class="panel-heading"> - <i class="fa fa-clock-o fa-fw"></i> Timeline - </div> - <!-- /.panel-heading --> - <div class="panel-body"> - <ul class="timeline"> - <?php - $list = array(); - $sort_list = array(); - - $temp = array( - 'id' => $_offer->getId(), - 'contact' => $_offer->getContact()->getName(), - 'assignments' => '', - 'assignments_header' => '' - ); - foreach ($_offer->getAssignments() as $assignment) { - $temp['assignments'] .= "<b>{$assignment->getTitle()}</b><br/><span class='smaller'>(".constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)</span><br/><p>{$assignment->getDescription()}</p>"; - $temp['assignments_header'] .= "<b>{$assignment->getTitle()}</b><br/><span class='smaller'>(".constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)</span><br/>"; - } - $list[] = array_merge($temp, array('type' => 'start', 'time' => $_offer->getStartDate(), 'description' => 'Offer started')); - $sort_list[] = $_offer->getStartDate() . $_offer->getId() . 0; - $list[] = array_merge($temp, array('type' => 'end', 'time' => $_offer->getEndDate(), 'description' => 'Offer ended')); - $sort_list[] = $_offer->getEndDate() . $_offer->getId() . 1; - if ($_offer->getInvoiceDate() > 0) { - $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $_offer->getInvoiceDate(), 'description' => 'Invoice sent')); - $sort_list[] = $_offer->getInvoiceDate() . $_offer->getId() . 2; - if ($_offer->getPaymentReceived() > 0) { - $list[] = array_merge($temp, array('type' => 'payment_received', 'time' => $_offer->getPaymentReceived(), 'description' => 'Payment received')); - $sort_list[] = $_offer->getPaymentReceived() . $_offer->getId() . 3; - } - } + <div class="panel panel-default" id="panel-timeline"> + <div class="panel-heading"> + <i class="fa fa-clock-o fa-fw"></i> Timeline + </div> + <!-- /.panel-heading --> + <div class="panel-body"> + <ul class="timeline"> + <?php + $list = array(); + $sort_list = array(); - array_multisort($sort_list, SORT_DESC, $list); - $i = 0; - foreach ($list as $item) { - if ($item['time'] > time()) { - continue; - } - echo "<li" . ($i++ % 2 == 0 ? ' class="timeline-inverted"' : '') . ">"; - switch ($item['type']) { - case 'start': echo "<div class='timeline-badge info' title='{$item['description']}'><i class='fa fa-circle-o-notch'></i></div>"; break; - case 'end': echo "<div class='timeline-badge primary' title='{$item['description']}'><i class='fa fa-circle-o'></i></div>"; break; - case 'invoice': echo "<div class='timeline-badge warning' title='{$item['description']}'><i class='fa fa-check-circle-o'></i></div>"; break; - case 'payment_received': echo "<div class='timeline-badge success' title='{$item['description']}'><i class='fa fa-eur'></i></div>"; break; - } - echo "<div class='timeline-panel'>"; - echo "<div class='timeline-heading'><h4 class='timeline-title'>#{$item['id']} to {$item['contact']}: {$item['description']}</h4><p><small class='text-muted'><i class='fa fa-clock-o fa-fw'></i> ".BusinessAdmin::formatDate($item['time'],false,true,true)."</small></p></div>"; - switch ($item['type']) { - case 'start': echo "<div class='timeline-body'>{$item['assignments']}</div>"; break; - default: echo "<div class='timeline-body'>{$item['assignments_header']}</div>"; - } - echo "</div>"; - echo "</li>"; - } - ?> - </ul> - </div> - <!-- /.panel-body --> - </div> - <!-- /.panel --> + $temp = array( + 'id' => $_offer->getId(), + 'contact' => $_offer->getContact()->getName(), + 'assignments' => '', + 'assignments_header' => '' + ); + foreach ($_offer->getAssignments() as $assignment) { + $temp['assignments'] .= "<b>{$assignment->getTitle()}</b><br/><span class='smaller'>(".constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)</span><br/><p>{$assignment->getDescription()}</p>"; + $temp['assignments_header'] .= "<b>{$assignment->getTitle()}</b><br/><span class='smaller'>(".constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)</span><br/>"; + } + $list[] = array_merge($temp, array('type' => 'start', 'time' => $_offer->getStartDate(), 'description' => 'Offer started')); + $sort_list[] = $_offer->getStartDate() . $_offer->getId() . 0; + $list[] = array_merge($temp, array('type' => 'end', 'time' => $_offer->getEndDate(), 'description' => 'Offer ended')); + $sort_list[] = $_offer->getEndDate() . $_offer->getId() . 1; + if ($_offer->getInvoiceDate() > 0) { + $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $_offer->getInvoiceDate(), 'description' => 'Invoice sent')); + $sort_list[] = $_offer->getInvoiceDate() . $_offer->getId() . 2; + if ($_offer->getPaymentReceived() > 0) { + $list[] = array_merge($temp, array('type' => 'payment_received', 'time' => $_offer->getPaymentReceived(), 'description' => 'Payment received')); + $sort_list[] = $_offer->getPaymentReceived() . $_offer->getId() . 3; + } + } + + array_multisort($sort_list, SORT_DESC, $list); + $i = 0; + foreach ($list as $item) { + if ($item['time'] > time()) { + continue; + } + echo "<li" . ($i++ % 2 == 0 ? ' class="timeline-inverted"' : '') . ">"; + switch ($item['type']) { + case 'start': echo "<div class='timeline-badge info' title='{$item['description']}'><i class='fa fa-circle-o-notch'></i></div>"; break; + case 'end': echo "<div class='timeline-badge primary' title='{$item['description']}'><i class='fa fa-circle-o'></i></div>"; break; + case 'invoice': echo "<div class='timeline-badge warning' title='{$item['description']}'><i class='fa fa-check-circle-o'></i></div>"; break; + case 'payment_received': echo "<div class='timeline-badge success' title='{$item['description']}'><i class='fa fa-eur'></i></div>"; break; + } + echo "<div class='timeline-panel'>"; + echo "<div class='timeline-heading'><h4 class='timeline-title'>#{$item['id']} to {$item['contact']}: {$item['description']}</h4><p><small class='text-muted'><i class='fa fa-clock-o fa-fw'></i> ".BusinessAdmin::formatDate($item['time'],false,true,true)."</small></p></div>"; + switch ($item['type']) { + case 'start': echo "<div class='timeline-body'>{$item['assignments']}</div>"; break; + default: echo "<div class='timeline-body'>{$item['assignments_header']}</div>"; + } + echo "</div>"; + echo "</li>"; + } + ?> + </ul> + </div> + <!-- /.panel-body --> + </div> + <!-- /.panel --> </div> <div class="col-lg-6"> - <div class="panel panel-default"> - <div class="panel-heading">Assignments</div> - <div class="panel-body table-responsive"> - <table class="table table-bordered table-striped"> - <thead> - <tr> - <th>#</th> - <th>Briefing</th> - <th>Time</th> - <th>Price</th> - <th>Tools</th> - </tr> - </thead> - <tbody> - <?php - $assignments = BusinessAdmin::getAssignments($_pdo, array("offerId = {$_offer->getId()}")); - foreach ($assignments as $assignment) { - echo "<tr> - <td class='col-min-width'>{$assignment->getId()}</td> - <td class='col-max-width'> - <b><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-title' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getTitle()}</a></b><br/> - <p>{$assignment->getDescription()}</p> - </td> - <td class='col-min-width'><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-hours' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getHours()}</a>h</td> - <td class='col-min-width'> - ".constants::invoice_valuta."<a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-price_per_hour' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getPricePerHour()}</a> / hr<br/> - <a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-vat' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getVAT()}</a>% VAT - </td> - <td class='col-min-width'> - <a title='View' href='".constants::url_internal."/assignments?id={$assignment->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> - <a title='Delete' href='".constants::url_internal."/assignments?delete={$assignment->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> - </td> - </tr>"; - } - if (count($assignments) == 0) { - echo "<tr><td colspan='6'>There are no assignments in the database. Why not start with creating one, below?</td></tr>"; - } - ?> - </tbody> - </table> - </div> - </div> + <div class="panel panel-default"> + <div class="panel-heading">Assignments</div> + <div class="panel-body table-responsive"> + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th>#</th> + <th>Briefing</th> + <th>Time</th> + <th>Price</th> + <th>Tools</th> + </tr> + </thead> + <tbody> + <?php + $assignments = BusinessAdmin::getAssignments($_pdo, array("offerId = {$_offer->getId()}")); + foreach ($assignments as $assignment) { + echo "<tr> + <td class='col-min-width'>{$assignment->getId()}</td> + <td class='col-max-width'> + <b><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-title' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getTitle()}</a></b><br/> + <p>{$assignment->getDescription()}</p> + </td> + <td class='col-min-width'><a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-hours' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getHours()}</a>h</td> + <td class='col-min-width'> + ".constants::invoice_valuta."<a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-price_per_hour' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getPricePerHour()}</a> / hr<br/> + <a href='#' class='editable' id='editable-assignment-{$assignment->getId()}-vat' data-type='text' data-pk='{$assignment->getId()}' data-url='".constants::url_external."assignments/edit'>{$assignment->getVAT()}</a>% VAT + </td> + <td class='col-min-width'> + <a title='View' href='".constants::url_internal."/assignments?id={$assignment->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> + <a title='Delete' href='".constants::url_internal."/assignments?delete={$assignment->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> + </td> + </tr>"; + } + if (count($assignments) == 0) { + echo "<tr><td colspan='6'>There are no assignments in the database. Why not start with creating one, below?</td></tr>"; + } + ?> + </tbody> + </table> + </div> + </div> </div> <div class="col-lg-6"> - <div class="panel panel-default"> - <div class="panel-heading">Discounts</div> - <div class="panel-body table-responsive"> - <table class="table table-bordered table-striped"> - <thead> - <tr> - <th>#</th> - <th>Briefing</th> - <th>Value</th> - <th>Tools</th> - </tr> - </thead> - <tbody> - <?php - $discounts = BusinessAdmin::getDiscounts($_pdo, array("offerId = {$_offer->getId()}")); - foreach ($discounts as $discount) { - echo "<tr> - <td class='col-min-width'>{$discount->getId()}</td> - <td class='col-max-width'> - <b><a href='#' class='editable' id='editable-discount-{$discount->getId()}-title' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getTitle()}</a></b><br/> - <p>{$discount->getDescription()}</p> - </td> - <td class='col-min-width'> - ".constants::invoice_valuta."<a href='#' class='editable' id='editable-discount-{$discount->getId()}-value' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getValue()}</a> / hr<br/> - <a href='#' class='editable' id='editable-discount-{$discount->getId()}-vat' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getVAT()}</a>% VAT - </td> - <td class='col-min-width'> - <a title='View' href='".constants::url_internal."/discounts?id={$discount->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> - <a title='Delete' href='".constants::url_internal."/discounts?delete={$discount->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> - </td> - </tr>"; - } - if (count($discounts) == 0) { - echo "<tr><td colspan='6'>There are no discounts in the database. Why not start with creating one, below?</td></tr>"; - } - ?> - </tbody> - </table> - </div> - </div> + <div class="panel panel-default"> + <div class="panel-heading">Discounts</div> + <div class="panel-body table-responsive"> + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th>#</th> + <th>Briefing</th> + <th>Value</th> + <th>Tools</th> + </tr> + </thead> + <tbody> + <?php + $discounts = BusinessAdmin::getDiscounts($_pdo, array("offerId = {$_offer->getId()}")); + foreach ($discounts as $discount) { + echo "<tr> + <td class='col-min-width'>{$discount->getId()}</td> + <td class='col-max-width'> + <b><a href='#' class='editable' id='editable-discount-{$discount->getId()}-title' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getTitle()}</a></b><br/> + <p>{$discount->getDescription()}</p> + </td> + <td class='col-min-width'> + ".constants::invoice_valuta."<a href='#' class='editable' id='editable-discount-{$discount->getId()}-value' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getValue()}</a> / hr<br/> + <a href='#' class='editable' id='editable-discount-{$discount->getId()}-vat' data-type='text' data-pk='{$discount->getId()}' data-url='".constants::url_external."discounts/edit'>{$discount->getVAT()}</a>% VAT + </td> + <td class='col-min-width'> + <a title='View' href='".constants::url_internal."/discounts?id={$discount->getId()}' class='btn btn-primary btn-circle fa fa-arrow-right'></a> + <a title='Delete' href='".constants::url_internal."/discounts?delete={$discount->getId()}' class='btn btn-danger btn-circle fa fa-times'></a> + </td> + </tr>"; + } + if (count($discounts) == 0) { + echo "<tr><td colspan='6'>There are no discounts in the database. Why not start with creating one, below?</td></tr>"; + } + ?> + </tbody> + </table> + </div> + </div> </div> diff --git a/include/offers.php b/include/offers.php index 1aa871a..81781ba 100644 --- a/include/offers.php +++ b/include/offers.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/include/users-new.php b/include/users-new.php index 5d86a83..d32e201 100644 --- a/include/users-new.php +++ b/include/users-new.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/install/index.php b/install/index.php index f565696..3873ce3 100644 --- a/install/index.php +++ b/install/index.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -95,7 +95,7 @@ if (isset($_GET['create_tables'])) { `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"); - + $_pdo->query("CREATE TABLE IF NOT EXISTS `".constants::db_prefix."user` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(24) NOT NULL, diff --git a/install/upgrade.php b/install/upgrade.php index 78f5dff..0643ff5 100644 --- a/install/upgrade.php +++ b/install/upgrade.php @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ diff --git a/js/businessadmin.js b/js/businessadmin.js index a82be81..e5da52e 100644 --- a/js/businessadmin.js +++ b/js/businessadmin.js @@ -1,17 +1,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -21,101 +21,101 @@ $(document).ready(function(){ // The input elements should have data attributes containing all necessary information $('.bootstrapValidator').bootstrapValidator({ feedbackIcons: { - valid: 'glyphicon glyphicon-ok', - invalid: 'glyphicon glyphicon-remove', - validating: 'glyphicon glyphicon-refresh' - } - }); + valid: 'glyphicon glyphicon-ok', + invalid: 'glyphicon glyphicon-remove', + validating: 'glyphicon glyphicon-refresh' + } + }); - // Use the plugin form (to ajax-ify forms) for all forms with class ajaxify - $('.ajaxify').each(function(){ - var options = jQuery.extend( - {dataType: 'json'}, - $(this).data('ajaxify-options') - ); - if (options.success != undefined) - options.success = window[options.success]; - if (options.error != undefined) - options.error = window[options.error]; - if (options.beforeSubmit != undefined) - options.beforeSubmit = window[options.beforeSubmit]; - $(this).ajaxForm(options); - }); + // Use the plugin form (to ajax-ify forms) for all forms with class ajaxify + $('.ajaxify').each(function(){ + var options = jQuery.extend( + {dataType: 'json'}, + $(this).data('ajaxify-options') + ); + if (options.success != undefined) + options.success = window[options.success]; + if (options.error != undefined) + options.error = window[options.error]; + if (options.beforeSubmit != undefined) + options.beforeSubmit = window[options.beforeSubmit]; + $(this).ajaxForm(options); + }); - // Use the plugin X-editable for .editable elements - // Editables are disabled by default - $('.editable').editable().editable('disable'); - // Open the editable on double click - $('.editable').dblclick(function(){ - if ($(this).hasClass('editable-disabled')) { - $(this).editable('enable').editable('show').editable('activate'); - } - // Disable the editable again when it's hidden - }).on('hidden', function(e, reason){ - $(this).editable('disable'); - }).click(function(e){ - e.preventDefault(); - }); + // Use the plugin X-editable for .editable elements + // Editables are disabled by default + $('.editable').editable().editable('disable'); + // Open the editable on double click + $('.editable').dblclick(function(){ + if ($(this).hasClass('editable-disabled')) { + $(this).editable('enable').editable('show').editable('activate'); + } + // Disable the editable again when it's hidden + }).on('hidden', function(e, reason){ + $(this).editable('disable'); + }).click(function(e){ + e.preventDefault(); + }); - // Use the bootstrap-select plugin on all selects - $('select').selectpicker(); + // Use the bootstrap-select plugin on all selects + $('select').selectpicker(); - // Use the MixItUp plugin for sorting tables - $('.mixitup').mixItUp({ - animation: { - duration: 200, - effects: 'fade' - }, - layout: { - display: 'table-row' - } - }); - $('.mixitup .mixitup-sort').click(function(){ - var mapping = { - desc: 'asc', - asc: 'desc' - } - $(this).data('sort', $(this).data('sort').replace(/asc|desc/gi, function(m){ return mapping[m]; })); - $(this).closest('.mixitup').mixItUp('sort', $(this).data('sort')); - var sorting = $(this).data('sort').substring($(this).data('sort').indexOf(':') + 1); - - $(this).parent().find('.mixitup-sort').removeClass('active sorting_asc sorting_desc').addClass('sorting'); - $(this).addClass('active sorting_' + sorting).removeClass('sorting'); - }); + // Use the MixItUp plugin for sorting tables + $('.mixitup').mixItUp({ + animation: { + duration: 200, + effects: 'fade' + }, + layout: { + display: 'table-row' + } + }); + $('.mixitup .mixitup-sort').click(function(){ + var mapping = { + desc: 'asc', + asc: 'desc' + } + $(this).data('sort', $(this).data('sort').replace(/asc|desc/gi, function(m){ return mapping[m]; })); + $(this).closest('.mixitup').mixItUp('sort', $(this).data('sort')); + var sorting = $(this).data('sort').substring($(this).data('sort').indexOf(':') + 1); - // Collapse menu - var collapsed = false; - $('#collapse-menu').click(function(e, p){ - var animation = 200; - if (typeof p != 'undefined' && p.load) - animation = 0; + $(this).parent().find('.mixitup-sort').removeClass('active sorting_asc sorting_desc').addClass('sorting'); + $(this).addClass('active sorting_' + sorting).removeClass('sorting'); + }); - if (!collapsed) - $('.nav-title').finish().hide(); - $('.sidebar').animate({ - width: collapsed ? 250 : 50 - }, animation); - $('#page-wrapper').animate({ - marginLeft: collapsed ? 250 : 50 - }, animation); - if (collapsed) - $('.nav-title').finish().delay(animation).queue(function(){$(this).show()}); - $(this).find('i.fa').removeClass('fa-caret-square-o-left fa-caret-square-o-right').addClass('fa-caret-square-o-' + (collapsed ? 'left' : 'right')); - collapsed = !collapsed; + // Collapse menu + var collapsed = false; + $('#collapse-menu').click(function(e, p){ + var animation = 200; + if (typeof p != 'undefined' && p.load) + animation = 0; - $.ajax({ - url: const_url_external + 'ajax/collapse', - method: 'GET', - crossDomain: true, - cache: false, - xhrFields: { - withCredentials: true - }, - data: { - setting: collapsed - } - }); + if (!collapsed) + $('.nav-title').finish().hide(); + $('.sidebar').animate({ + width: collapsed ? 250 : 50 + }, animation); + $('#page-wrapper').animate({ + marginLeft: collapsed ? 250 : 50 + }, animation); + if (collapsed) + $('.nav-title').finish().delay(animation).queue(function(){$(this).show()}); + $(this).find('i.fa').removeClass('fa-caret-square-o-left fa-caret-square-o-right').addClass('fa-caret-square-o-' + (collapsed ? 'left' : 'right')); + collapsed = !collapsed; - return true; - }); -});
\ No newline at end of file + $.ajax({ + url: const_url_external + 'ajax/collapse', + method: 'GET', + crossDomain: true, + cache: false, + xhrFields: { + withCredentials: true + }, + data: { + setting: collapsed + } + }); + + return true; + }); +}); diff --git a/login-ajax.php b/login-ajax.php index beb2f66..cf9eb1b 100644 --- a/login-ajax.php +++ b/login-ajax.php @@ -1,28 +1,28 @@ <?php /** * Check if the user is logged in - * + * * This file should be required by all sensitive PHP scripts. It verifies that * the client has been logged in, and if not, displays a login page. * * This file is only for files that are called through Ajax, and need a json * response. For other files, there is login.php. - * + * * @author Camil Staps * * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -1,28 +1,28 @@ <?php /** * Check if the user is logged in - * + * * This file should be required by all sensitive PHP scripts. It verifies that * the client has been logged in, and if not, displays a login page. * * See also login-ajax.php, which is specific for files that are loaded through * Ajax (and typically require a json response). - * + * * @author Camil Staps * * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ @@ -2,17 +2,17 @@ /** * BusinessAdmin: administrative software for small companies * Copyright (C) 2015 Camil Staps (ViviSoft) - * + * * 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 <http://www.gnu.org/licenses/>. */ |