From badcdcb32913201f51b506eb931de9890536ea24 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 15 Jun 2021 22:16:57 +0200 Subject: [PATCH] Started work on Address --- .gitignore | 43 + Layout/default/Address/Form.php | 162 ++ Layout/default/Address/Index.php | 82 + Layout/default/footer.php | 4 - Layout/default/header.php | 14 +- Layout/default/menu.php | 137 +- Layout/default/topbar.php | 10 +- application/Address/Address.php | 21 + application/Address/AddressController.php | 87 + application/Address/AddressModel.php | 125 ++ lang/de.php | 14 + lib/mvcfronk/mfBase/mfBaseController.php | 3 + lib/mvcfronk/mfBase/mfBaseModel.php | 6 + lib/mvcfronk/mfLayout/mfLayout.php | 9 + lib/mvcfronk/mfRequest/mfRequest.php | 47 + nbproject/private/private.properties | 2 - nbproject/private/private.xml | 4 - nbproject/project.properties | 7 - nbproject/project.xml | 9 - public/assets/css/icons.css | 35 - public/assets/css/thetool.css | 17 +- public/css/main.css | 74 - public/js/adminlte.js | 1896 --------------------- public/js/adminlte.js.map | 1 - public/js/adminlte.min.js | 7 - public/js/adminlte.min.js.map | 1 - 26 files changed, 637 insertions(+), 2180 deletions(-) create mode 100644 .gitignore create mode 100644 Layout/default/Address/Form.php create mode 100644 Layout/default/Address/Index.php create mode 100644 application/Address/Address.php create mode 100644 application/Address/AddressController.php create mode 100644 application/Address/AddressModel.php create mode 100644 lang/de.php create mode 100644 lib/mvcfronk/mfRequest/mfRequest.php delete mode 100644 nbproject/private/private.properties delete mode 100644 nbproject/private/private.xml delete mode 100644 nbproject/project.properties delete mode 100644 nbproject/project.xml delete mode 100644 public/js/adminlte.js delete mode 100644 public/js/adminlte.js.map delete mode 100644 public/js/adminlte.min.js delete mode 100644 public/js/adminlte.min.js.map diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..442b1cf4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +composer.lock +.buildpath +.project +.settings +.idea +nbproject +config/config.php +todo +files/* +vendor/ + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.sql +*.tar +*.zip + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +*~ +*.bak +*.swp + diff --git a/Layout/default/Address/Form.php b/Layout/default/Address/Form.php new file mode 100644 index 000000000..de4f8489f --- /dev/null +++ b/Layout/default/Address/Form.php @@ -0,0 +1,162 @@ + + +
+
+ + +
+
+
+
+ +
+

Addressen

+
+
+
+ + +
+
+ +
+
+

id) ? "Adresse bearbeiten" : "Neue Adresse"?>

+ + + +
"> +
+
+ + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+ + + +
+
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/Layout/default/Address/Index.php b/Layout/default/Address/Index.php new file mode 100644 index 000000000..19093c815 --- /dev/null +++ b/Layout/default/Address/Index.php @@ -0,0 +1,82 @@ + + +
+
+ + +
+
+
+
+ +
+

Addressen

+
+
+
+ + +
+
+ +
+
+
+

Liste aller Adressen

+

Gefiltert nach Addresstyp:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
TypFirmaNameAdresseTelefonEmail
company)?>getFullName()?> + street?>
+ zip?> city?> +
phone?>email?> + $address->id])?>"> + + $address->id])?>" class="text-danger"> +
+
+
+ +
+
+ +
+
+ + + \ No newline at end of file diff --git a/Layout/default/footer.php b/Layout/default/footer.php index 547e67b6d..ee476d457 100644 --- a/Layout/default/footer.php +++ b/Layout/default/footer.php @@ -17,11 +17,7 @@ - - - - \ No newline at end of file diff --git a/Layout/default/header.php b/Layout/default/header.php index 5acdab91c..b08b0eeba 100644 --- a/Layout/default/header.php +++ b/Layout/default/header.php @@ -8,13 +8,21 @@ - + + - - + + + + + + + + + diff --git a/Layout/default/menu.php b/Layout/default/menu.php index 592fd8c85..8a3726e39 100644 --- a/Layout/default/menu.php +++ b/Layout/default/menu.php @@ -10,143 +10,20 @@
  • - Components
    + Stammdaten
    + -
  • - -
  • - Forms
    - -
  • - -
  • - Tables
    - -
  • -
  • - Icons
    - -
  • - - - -
  • - Pages
    - diff --git a/Layout/default/topbar.php b/Layout/default/topbar.php index 52001a031..497537ea2 100644 --- a/Layout/default/topbar.php +++ b/Layout/default/topbar.php @@ -38,7 +38,7 @@
    -
    +

    Cristina Pride

    Hi, How are you? What about our next meeting @@ -60,7 +60,7 @@

    +

    Karen Robinson

    Wow ! this admin looks good and awesome design @@ -96,7 +96,7 @@

  • diff --git a/application/Address/Address.php b/application/Address/Address.php new file mode 100644 index 000000000..00d118af5 --- /dev/null +++ b/application/Address/Address.php @@ -0,0 +1,21 @@ +firstname && $this->lastname) { + $name = $this->firstname . " " . $this->lastname; + } elseif($this->lastname) { + $name = $this->lastname; + } elseif($this->firstname) { + $name = $this->firstname; + } + + return $name; + + } +} \ No newline at end of file diff --git a/application/Address/AddressController.php b/application/Address/AddressController.php new file mode 100644 index 000000000..8645854f3 --- /dev/null +++ b/application/Address/AddressController.php @@ -0,0 +1,87 @@ +request->filter; + $addresses = AddressModel::search($filter); + + $this->layout()->set("addresses", $addresses); + $this->layout()->set("filter", $filter); + $this->layout()->set("request", $this->request); + } + + protected function addAction() { + $this->layout()->setTemplate("Address/Form"); + } + + protected function editAction() { + $address = new Address($this->request->id); + $this->layout()->set("address", $address); + + if(!$address->id) { + $this->layout()->setFlash("Addresse nicht gefunden", "error"); + return $this->addAction(); + } + + return $this->addAction(); + } + + protected function saveAction() { + $r = $this->request; + + //var_dump($r->get());exit; + + $id = $r->id; + + if(is_numeric($id) && $id > 0) { + $mode = "edit"; + $address = new Address($id); + if(!$address->id) { + $this->layout()->setFlash("Addresse nicht gefunden", "error"); + $this->redirect("Address"); + } + } else { + $mode = "add"; + } + + + $data = []; + $data['parent_id'] = $r->parent_id; + $data['company'] = $r->company; + $data['firstname'] = $r->firstname; + $data['lastname'] = $r->lastname; + $data['street'] = $r->street; + $data['zip'] = $r->zip; + $data['city'] = $r->city; + $data['country'] = $r->country; + $data['phone'] = $r->phone; + $data['fax'] = $r->fax; + $data['mobile'] = $r->mobile; + $data['email'] = $r->email; + $data['note'] = $r->note; + + $data['edit_by'] = 1; + + if($mode == "add") { + $data['create_by'] = 1; + $address = AddressModel::create($data); + } else { + $address->update($data); + } + + //var_dump($address);exit; + + $new_id = $address->save(); + if(!$new_id) { + $this->layout()->setFlash("Fehler beim Speichern", "error"); + $this->layout()->set("address", $address); + return $this->add(); + } + + $this->layout()->setFlash("Adresse erfolgreich gespeichert.", "success"); + $this->redirect("Address", "Edit", ['id' => $new_id]); + } + +} \ No newline at end of file diff --git a/application/Address/AddressModel.php b/application/Address/AddressModel.php new file mode 100644 index 000000000..bebaa1922 --- /dev/null +++ b/application/Address/AddressModel.php @@ -0,0 +1,125 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model ->$field = $value; + } + } + + return $model; + } + + public static function getOne($id) { + if(!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("Address", "*", "id=$id LIMIT 1"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new Address($data); + } + return $item; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("Address", "*"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new Address($data); + } + } + return $items; + + } + + public static function search($filter) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT Address.* FROM Address + LEFT JOIN Addresstype ON (Addresstype.address_id = Address.id) + WHERE $where + ORDER BY Address.id"; + //var_dump($sql); + $res = $db->query($sql); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new Address($data); + } + } + return $items; + } + + private function getSqlFilter($filter) { + $where = "1=1 "; + + /* + * Address Type + */ + if(is_array($filter['addresstype']) && count($filter['addresstype'])) { + $at = $filter['addresstype']; + $in = []; + if(in_array("owner", $at)) { + $in[] = "Addresstype.type = 'owner'"; + } + if(in_array("employee", $at)) { + $in[] = "Addresstype.type = 'employee'"; + } + if(in_array("customer", $at)) { + $in[] = "Addresstype.type = 'customer'"; + } + if(in_array("supplier", $at)) { + $in[] = "Addresstype.type = 'supplier'"; + } + if(in_array("contact", $at)) { + $in[] = "Addresstype.type = 'contact'"; + } + if(in_array("billing", $at)) { + $in[] = "Addresstype.type = 'billing'"; + } + + $or = ""; + if(count($in)) { + $or = implode(" OR ", $in); + $where .= " AND ( $or )"; + } + } + + return $where; + } +} \ No newline at end of file diff --git a/lang/de.php b/lang/de.php new file mode 100644 index 000000000..c695bc658 --- /dev/null +++ b/lang/de.php @@ -0,0 +1,14 @@ +request = new mfRequest($params); + // now run action if($params['action']) { $this->__call($params['action'],$params); diff --git a/lib/mvcfronk/mfBase/mfBaseModel.php b/lib/mvcfronk/mfBase/mfBaseModel.php index cf70e2915..a4c3ddbcf 100644 --- a/lib/mvcfronk/mfBase/mfBaseModel.php +++ b/lib/mvcfronk/mfBase/mfBaseModel.php @@ -100,6 +100,12 @@ class mfBaseModel { return false; } + public function update(Array $data) { + foreach($data as $key => $value) { + $this->$key = $value; + } + } + public function save() { if(method_exists($this, "beforeSave")) { $this->beforeSave(); diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index dd24bc1d0..0bd461baa 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -211,3 +211,12 @@ class mfLayout { return $this->inline->cycle[$this->inline->cyclecount++]; } } + +function __($string) { + $lang = []; + include(BASEDIR."/lang/de.php"); + if(array_key_exists($string, $lang['de'])) { + return $lang['de'][$string]; + } + return $string; +} \ No newline at end of file diff --git a/lib/mvcfronk/mfRequest/mfRequest.php b/lib/mvcfronk/mfRequest/mfRequest.php new file mode 100644 index 000000000..faef3c2ae --- /dev/null +++ b/lib/mvcfronk/mfRequest/mfRequest.php @@ -0,0 +1,47 @@ +request = $request; + } else { + // get request from POST/GET + if(isset($_POST) && isset($_GET)) { + $this->request = array_merge($_GET, $_POST); + } + } + } + + public static function singleton($request = false) { + if(!isset(self::$instance)) { + $c=__CLASS__; + self::$instance=new $c($request); + } + return self::$instance; + } + + public function set($name, $value) { + if($name) { + $this->request[$name] = $value; + } + } + + public function get($name = null) { + if($name) { + if(array_key_exists($name, $this->request)) { + //var_dump($this->request);exit; + return $this->request[$name]; + } else { + return null; + } + } + return $this->request; + } + + public function __get($name) { + return $this->get($name); + } +} \ No newline at end of file diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties deleted file mode 100644 index 13aa29a49..000000000 --- a/nbproject/private/private.properties +++ /dev/null @@ -1,2 +0,0 @@ -index.file=index.php -url=http://localhost/thetool/ diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml deleted file mode 100644 index 475096252..000000000 --- a/nbproject/private/private.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/nbproject/project.properties b/nbproject/project.properties deleted file mode 100644 index c0c2ef45b..000000000 --- a/nbproject/project.properties +++ /dev/null @@ -1,7 +0,0 @@ -include.path=${php.global.include.path} -php.version=PHP_73 -source.encoding=UTF-8 -src.dir=. -tags.asp=false -tags.short=false -web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml deleted file mode 100644 index ef6d9598b..000000000 --- a/nbproject/project.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - org.netbeans.modules.php.project - - - thetool - - - diff --git a/public/assets/css/icons.css b/public/assets/css/icons.css index 882d3ce08..52ab75f1d 100644 --- a/public/assets/css/icons.css +++ b/public/assets/css/icons.css @@ -17003,41 +17003,6 @@ readers do not read off random characters that represent icons */ position: static; width: auto; } -@font-face { - font-family: 'Font Awesome 5 Brands'; - font-style: normal; - font-weight: normal; - font-display: auto; - src: url("../fonts/fa-brands-400.eot"); - src: url("../fonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-brands-400.woff2") format("woff2"), url("../fonts/fa-brands-400.woff") format("woff"), url("../fonts/fa-brands-400.ttf") format("truetype"), url("../fonts/fa-brands-400.svg#fontawesome") format("svg"); } - -.fab { - font-family: 'Font Awesome 5 Brands'; } - -@font-face { - font-family: 'Font Awesome 5 Free'; - font-style: normal; - font-weight: 400; - font-display: auto; - src: url("../fonts/fa-regular-400.eot"); - src: url("../fonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-regular-400.woff2") format("woff2"), url("../fonts/fa-regular-400.woff") format("woff"), url("../fonts/fa-regular-400.ttf") format("truetype"), url("../fonts/fa-regular-400.svg#fontawesome") format("svg"); } - -.far { - font-family: 'Font Awesome 5 Free'; - font-weight: 400; } - -@font-face { - font-family: 'Font Awesome 5 Free'; - font-style: normal; - font-weight: 900; - font-display: auto; - src: url("../fonts/fa-solid-900.eot"); - src: url("../fonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-solid-900.woff2") format("woff2"), url("../fonts/fa-solid-900.woff") format("woff"), url("../fonts/fa-solid-900.ttf") format("truetype"), url("../fonts/fa-solid-900.svg#fontawesome") format("svg"); } - -.fa, -.fas { - font-family: 'Font Awesome 5 Free'; - font-weight: 900; } /*! * Line Awesome 1.1.0 by @icons_8 - https://icons8.com/line-awesome diff --git a/public/assets/css/thetool.css b/public/assets/css/thetool.css index b5041fb51..07f95bd32 100644 --- a/public/assets/css/thetool.css +++ b/public/assets/css/thetool.css @@ -1,3 +1,16 @@ -#topnav { - //background-color: #38414a; +.subsubmenu { + padding-left: 12px !important; + background-color: #fafafa; +} + + +.select2-container .select2-selection--multiple .select2-selection__choice { + background-color: #00acc1 !important; + color: #fff !important; + border: none !important; +} + +.select2-container .select2-selection--multiple .select2-selection__choice__remove { + color: #fff !important; + margin-right: 5px !important; } \ No newline at end of file diff --git a/public/css/main.css b/public/css/main.css index 585c08be5..e69de29bb 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -1,74 +0,0 @@ -/* select2 styles */ - -.select2-selection__choice { - color: #fff !important; - background-color: #28a745 !important; - border-radius: 4px !important; -} - -.nav-pills .nav-link.active, -.nav-pills .show > .nav-link { - color: #ffffff; - background-color: #28a745 !important; -} - -.card-header { - border-top: 2px solid #28a745; -} - -.card-header.changelog, -.note-toolbar.card-header { - border-top: 2px solid #17a2b8; -} - -.card-header.no-decoration { - border-top: none; -} - - -.custom-control-input:checked ~ .custom-control-label::before { - color: #ffffff; - border-color: #28a745; - background-color: #28a745; - box-shadow: none; -} - -.time { - float:right; - color:#999; - font-size: 12px; - padding: 4px; -} - -.ticket-text .date { - float: right; -} - -.ticket-text .card-header { - /*text-align: center;*/ -} - -.bg-light-red { - background-color: #ffecec; -} - -.bg-light-blue { - background-color: #ececff; -} - -.card-header.slim { - padding-top: 0.3em !important; - padding-bottom: 0.15em !important; -} - -.text-monospace { - font-size: 0.9em; -} - -.ticket-text.outgoing-email { - display: none; -} - -.clickable { - cursor: pointer; -} \ No newline at end of file diff --git a/public/js/adminlte.js b/public/js/adminlte.js deleted file mode 100644 index 9d91e2665..000000000 --- a/public/js/adminlte.js +++ /dev/null @@ -1,1896 +0,0 @@ -/*! - * AdminLTE v3.0.5 (https://adminlte.io) - * Copyright 2014-2020 Colorlib - * Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE) - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.adminlte = {})); -}(this, (function (exports) { 'use strict'; - - /** - * -------------------------------------------- - * AdminLTE ControlSidebar.js - * License MIT - * -------------------------------------------- - */ - var ControlSidebar = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'ControlSidebar'; - var DATA_KEY = 'lte.controlsidebar'; - var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - COLLAPSED: "collapsed" + EVENT_KEY, - EXPANDED: "expanded" + EVENT_KEY - }; - var Selector = { - CONTROL_SIDEBAR: '.control-sidebar', - CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content', - DATA_TOGGLE: '[data-widget="control-sidebar"]', - CONTENT: '.content-wrapper', - HEADER: '.main-header', - FOOTER: '.main-footer' - }; - var ClassName = { - CONTROL_SIDEBAR_ANIMATE: 'control-sidebar-animate', - CONTROL_SIDEBAR_OPEN: 'control-sidebar-open', - CONTROL_SIDEBAR_SLIDE: 'control-sidebar-slide-open', - LAYOUT_FIXED: 'layout-fixed', - NAVBAR_FIXED: 'layout-navbar-fixed', - NAVBAR_SM_FIXED: 'layout-sm-navbar-fixed', - NAVBAR_MD_FIXED: 'layout-md-navbar-fixed', - NAVBAR_LG_FIXED: 'layout-lg-navbar-fixed', - NAVBAR_XL_FIXED: 'layout-xl-navbar-fixed', - FOOTER_FIXED: 'layout-footer-fixed', - FOOTER_SM_FIXED: 'layout-sm-footer-fixed', - FOOTER_MD_FIXED: 'layout-md-footer-fixed', - FOOTER_LG_FIXED: 'layout-lg-footer-fixed', - FOOTER_XL_FIXED: 'layout-xl-footer-fixed' - }; - var Default = { - controlsidebarSlide: true, - scrollbarTheme: 'os-theme-light', - scrollbarAutoHide: 'l' - }; - /** - * Class Definition - * ==================================================== - */ - - var ControlSidebar = /*#__PURE__*/function () { - function ControlSidebar(element, config) { - this._element = element; - this._config = config; - - this._init(); - } // Public - - - var _proto = ControlSidebar.prototype; - - _proto.collapse = function collapse() { - // Show the control sidebar - if (this._config.controlsidebarSlide) { - $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE); - $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () { - $(Selector.CONTROL_SIDEBAR).hide(); - $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE); - $(this).dequeue(); - }); - } else { - $('body').removeClass(ClassName.CONTROL_SIDEBAR_OPEN); - } - - var collapsedEvent = $.Event(Event.COLLAPSED); - $(this._element).trigger(collapsedEvent); - }; - - _proto.show = function show() { - // Collapse the control sidebar - if (this._config.controlsidebarSlide) { - $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE); - $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function () { - $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () { - $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE); - $(this).dequeue(); - }); - $(this).dequeue(); - }); - } else { - $('body').addClass(ClassName.CONTROL_SIDEBAR_OPEN); - } - - var expandedEvent = $.Event(Event.EXPANDED); - $(this._element).trigger(expandedEvent); - }; - - _proto.toggle = function toggle() { - var shouldClose = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE); - - if (shouldClose) { - // Close the control sidebar - this.collapse(); - } else { - // Open the control sidebar - this.show(); - } - } // Private - ; - - _proto._init = function _init() { - var _this = this; - - this._fixHeight(); - - this._fixScrollHeight(); - - $(window).resize(function () { - _this._fixHeight(); - - _this._fixScrollHeight(); - }); - $(window).scroll(function () { - if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)) { - _this._fixScrollHeight(); - } - }); - }; - - _proto._fixScrollHeight = function _fixScrollHeight() { - var heights = { - scroll: $(document).height(), - window: $(window).height(), - header: $(Selector.HEADER).outerHeight(), - footer: $(Selector.FOOTER).outerHeight() - }; - var positions = { - bottom: Math.abs(heights.window + $(window).scrollTop() - heights.scroll), - top: $(window).scrollTop() - }; - var navbarFixed = false; - var footerFixed = false; - - if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { - if ($('body').hasClass(ClassName.NAVBAR_FIXED) || $('body').hasClass(ClassName.NAVBAR_SM_FIXED) || $('body').hasClass(ClassName.NAVBAR_MD_FIXED) || $('body').hasClass(ClassName.NAVBAR_LG_FIXED) || $('body').hasClass(ClassName.NAVBAR_XL_FIXED)) { - if ($(Selector.HEADER).css("position") === "fixed") { - navbarFixed = true; - } - } - - if ($('body').hasClass(ClassName.FOOTER_FIXED) || $('body').hasClass(ClassName.FOOTER_SM_FIXED) || $('body').hasClass(ClassName.FOOTER_MD_FIXED) || $('body').hasClass(ClassName.FOOTER_LG_FIXED) || $('body').hasClass(ClassName.FOOTER_XL_FIXED)) { - if ($(Selector.FOOTER).css("position") === "fixed") { - footerFixed = true; - } - } - - if (positions.top === 0 && positions.bottom === 0) { - $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer); - $(Selector.CONTROL_SIDEBAR).css('top', heights.header); - $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header + heights.footer)); - } else if (positions.bottom <= heights.footer) { - if (footerFixed === false) { - $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer - positions.bottom); - $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.footer - positions.bottom)); - } else { - $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer); - } - } else if (positions.top <= heights.header) { - if (navbarFixed === false) { - $(Selector.CONTROL_SIDEBAR).css('top', heights.header - positions.top); - $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header - positions.top)); - } else { - $(Selector.CONTROL_SIDEBAR).css('top', heights.header); - } - } else { - if (navbarFixed === false) { - $(Selector.CONTROL_SIDEBAR).css('top', 0); - $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window); - } else { - $(Selector.CONTROL_SIDEBAR).css('top', heights.header); - } - } - } - }; - - _proto._fixHeight = function _fixHeight() { - var heights = { - window: $(window).height(), - header: $(Selector.HEADER).outerHeight(), - footer: $(Selector.FOOTER).outerHeight() - }; - - if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { - var sidebarHeight = heights.window - heights.header; - - if ($('body').hasClass(ClassName.FOOTER_FIXED) || $('body').hasClass(ClassName.FOOTER_SM_FIXED) || $('body').hasClass(ClassName.FOOTER_MD_FIXED) || $('body').hasClass(ClassName.FOOTER_LG_FIXED) || $('body').hasClass(ClassName.FOOTER_XL_FIXED)) { - if ($(Selector.FOOTER).css("position") === "fixed") { - sidebarHeight = heights.window - heights.header - heights.footer; - } - } - - $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', sidebarHeight); - - if (typeof $.fn.overlayScrollbars !== 'undefined') { - $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).overlayScrollbars({ - className: this._config.scrollbarTheme, - sizeAutoCapable: true, - scrollbars: { - autoHide: this._config.scrollbarAutoHide, - clickScrolling: true - } - }); - } - } - } // Static - ; - - ControlSidebar._jQueryInterface = function _jQueryInterface(operation) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new ControlSidebar(this, _options); - $(this).data(DATA_KEY, data); - } - - if (data[operation] === 'undefined') { - throw new Error(operation + " is not a function"); - } - - data[operation](); - }); - }; - - return ControlSidebar; - }(); - /** - * - * Data Api implementation - * ==================================================== - */ - - - $(document).on('click', Selector.DATA_TOGGLE, function (event) { - event.preventDefault(); - - ControlSidebar._jQueryInterface.call($(this), 'toggle'); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = ControlSidebar._jQueryInterface; - $.fn[NAME].Constructor = ControlSidebar; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return ControlSidebar._jQueryInterface; - }; - - return ControlSidebar; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE Layout.js - * License MIT - * -------------------------------------------- - */ - var Layout = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'Layout'; - var DATA_KEY = 'lte.layout'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Selector = { - HEADER: '.main-header', - MAIN_SIDEBAR: '.main-sidebar', - SIDEBAR: '.main-sidebar .sidebar', - CONTENT: '.content-wrapper', - BRAND: '.brand-link', - CONTENT_HEADER: '.content-header', - WRAPPER: '.wrapper', - CONTROL_SIDEBAR: '.control-sidebar', - CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content', - CONTROL_SIDEBAR_BTN: '[data-widget="control-sidebar"]', - LAYOUT_FIXED: '.layout-fixed', - FOOTER: '.main-footer', - PUSHMENU_BTN: '[data-widget="pushmenu"]', - LOGIN_BOX: '.login-box', - REGISTER_BOX: '.register-box' - }; - var ClassName = { - HOLD: 'hold-transition', - SIDEBAR: 'main-sidebar', - CONTENT_FIXED: 'content-fixed', - SIDEBAR_FOCUSED: 'sidebar-focused', - LAYOUT_FIXED: 'layout-fixed', - NAVBAR_FIXED: 'layout-navbar-fixed', - FOOTER_FIXED: 'layout-footer-fixed', - LOGIN_PAGE: 'login-page', - REGISTER_PAGE: 'register-page', - CONTROL_SIDEBAR_SLIDE_OPEN: 'control-sidebar-slide-open', - CONTROL_SIDEBAR_OPEN: 'control-sidebar-open' - }; - var Default = { - scrollbarTheme: 'os-theme-light', - scrollbarAutoHide: 'l', - panelAutoHeight: true, - loginRegisterAutoHeight: true - }; - /** - * Class Definition - * ==================================================== - */ - - var Layout = /*#__PURE__*/function () { - function Layout(element, config) { - this._config = config; - this._element = element; - - this._init(); - } // Public - - - var _proto = Layout.prototype; - - _proto.fixLayoutHeight = function fixLayoutHeight(extra) { - if (extra === void 0) { - extra = null; - } - - var control_sidebar = 0; - - if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || extra == 'control_sidebar') { - control_sidebar = $(Selector.CONTROL_SIDEBAR_CONTENT).height(); - } - - var heights = { - window: $(window).height(), - header: $(Selector.HEADER).length !== 0 ? $(Selector.HEADER).outerHeight() : 0, - footer: $(Selector.FOOTER).length !== 0 ? $(Selector.FOOTER).outerHeight() : 0, - sidebar: $(Selector.SIDEBAR).length !== 0 ? $(Selector.SIDEBAR).height() : 0, - control_sidebar: control_sidebar - }; - - var max = this._max(heights); - - var offset = this._config.panelAutoHeight; - - if (offset === true) { - offset = 0; - } - - if (offset !== false) { - if (max == heights.control_sidebar) { - $(Selector.CONTENT).css('min-height', max + offset); - } else if (max == heights.window) { - $(Selector.CONTENT).css('min-height', max + offset - heights.header - heights.footer); - } else { - $(Selector.CONTENT).css('min-height', max + offset - heights.header); - } - - if (this._isFooterFixed()) { - $(Selector.CONTENT).css('min-height', parseFloat($(Selector.CONTENT).css('min-height')) + heights.footer); - } - } - - if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { - if (offset !== false) { - $(Selector.CONTENT).css('min-height', max + offset - heights.header - heights.footer); - } - - if (typeof $.fn.overlayScrollbars !== 'undefined') { - $(Selector.SIDEBAR).overlayScrollbars({ - className: this._config.scrollbarTheme, - sizeAutoCapable: true, - scrollbars: { - autoHide: this._config.scrollbarAutoHide, - clickScrolling: true - } - }); - } - } - }; - - _proto.fixLoginRegisterHeight = function fixLoginRegisterHeight() { - if ($(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).length === 0) { - $('body, html').css('height', 'auto'); - } else if ($(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).length !== 0) { - var box_height = $(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).height(); - - if ($('body').css('min-height') !== box_height) { - $('body').css('min-height', box_height); - } - } - } // Private - ; - - _proto._init = function _init() { - var _this = this; - - // Activate layout height watcher - this.fixLayoutHeight(); - - if (this._config.loginRegisterAutoHeight === true) { - this.fixLoginRegisterHeight(); - } else if (Number.isInteger(this._config.loginRegisterAutoHeight)) { - setInterval(this.fixLoginRegisterHeight, this._config.loginRegisterAutoHeight); - } - - $(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview', function () { - _this.fixLayoutHeight(); - }); - $(Selector.PUSHMENU_BTN).on('collapsed.lte.pushmenu shown.lte.pushmenu', function () { - _this.fixLayoutHeight(); - }); - $(Selector.CONTROL_SIDEBAR_BTN).on('collapsed.lte.controlsidebar', function () { - _this.fixLayoutHeight(); - }).on('expanded.lte.controlsidebar', function () { - _this.fixLayoutHeight('control_sidebar'); - }); - $(window).resize(function () { - _this.fixLayoutHeight(); - }); - setTimeout(function () { - $('body.hold-transition').removeClass('hold-transition'); - }, 50); - }; - - _proto._max = function _max(numbers) { - // Calculate the maximum number in a list - var max = 0; - Object.keys(numbers).forEach(function (key) { - if (numbers[key] > max) { - max = numbers[key]; - } - }); - return max; - }; - - _proto._isFooterFixed = function _isFooterFixed() { - return $('.main-footer').css('position') === 'fixed'; - } // Static - ; - - Layout._jQueryInterface = function _jQueryInterface(config) { - if (config === void 0) { - config = ''; - } - - return this.each(function () { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new Layout($(this), _options); - $(this).data(DATA_KEY, data); - } - - if (config === 'init' || config === '') { - data['_init'](); - } else if (config === 'fixLayoutHeight' || config === 'fixLoginRegisterHeight') { - data[config](); - } - }); - }; - - return Layout; - }(); - /** - * Data API - * ==================================================== - */ - - - $(window).on('load', function () { - Layout._jQueryInterface.call($('body')); - }); - $(Selector.SIDEBAR + ' a').on('focusin', function () { - $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED); - }); - $(Selector.SIDEBAR + ' a').on('focusout', function () { - $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = Layout._jQueryInterface; - $.fn[NAME].Constructor = Layout; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Layout._jQueryInterface; - }; - - return Layout; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE PushMenu.js - * License MIT - * -------------------------------------------- - */ - var PushMenu = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'PushMenu'; - var DATA_KEY = 'lte.pushmenu'; - var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - COLLAPSED: "collapsed" + EVENT_KEY, - SHOWN: "shown" + EVENT_KEY - }; - var Default = { - autoCollapseSize: 992, - enableRemember: false, - noTransitionAfterReload: true - }; - var Selector = { - TOGGLE_BUTTON: '[data-widget="pushmenu"]', - SIDEBAR_MINI: '.sidebar-mini', - SIDEBAR_COLLAPSED: '.sidebar-collapse', - BODY: 'body', - OVERLAY: '#sidebar-overlay', - WRAPPER: '.wrapper' - }; - var ClassName = { - COLLAPSED: 'sidebar-collapse', - OPEN: 'sidebar-open', - CLOSED: 'sidebar-closed' - }; - /** - * Class Definition - * ==================================================== - */ - - var PushMenu = /*#__PURE__*/function () { - function PushMenu(element, options) { - this._element = element; - this._options = $.extend({}, Default, options); - - if (!$(Selector.OVERLAY).length) { - this._addOverlay(); - } - - this._init(); - } // Public - - - var _proto = PushMenu.prototype; - - _proto.expand = function expand() { - if (this._options.autoCollapseSize) { - if ($(window).width() <= this._options.autoCollapseSize) { - $(Selector.BODY).addClass(ClassName.OPEN); - } - } - - $(Selector.BODY).removeClass(ClassName.COLLAPSED).removeClass(ClassName.CLOSED); - - if (this._options.enableRemember) { - localStorage.setItem("remember" + EVENT_KEY, ClassName.OPEN); - } - - var shownEvent = $.Event(Event.SHOWN); - $(this._element).trigger(shownEvent); - }; - - _proto.collapse = function collapse() { - if (this._options.autoCollapseSize) { - if ($(window).width() <= this._options.autoCollapseSize) { - $(Selector.BODY).removeClass(ClassName.OPEN).addClass(ClassName.CLOSED); - } - } - - $(Selector.BODY).addClass(ClassName.COLLAPSED); - - if (this._options.enableRemember) { - localStorage.setItem("remember" + EVENT_KEY, ClassName.COLLAPSED); - } - - var collapsedEvent = $.Event(Event.COLLAPSED); - $(this._element).trigger(collapsedEvent); - }; - - _proto.toggle = function toggle() { - if (!$(Selector.BODY).hasClass(ClassName.COLLAPSED)) { - this.collapse(); - } else { - this.expand(); - } - }; - - _proto.autoCollapse = function autoCollapse(resize) { - if (resize === void 0) { - resize = false; - } - - if (this._options.autoCollapseSize) { - if ($(window).width() <= this._options.autoCollapseSize) { - if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { - this.collapse(); - } - } else if (resize == true) { - if ($(Selector.BODY).hasClass(ClassName.OPEN)) { - $(Selector.BODY).removeClass(ClassName.OPEN); - } else if ($(Selector.BODY).hasClass(ClassName.CLOSED)) { - this.expand(); - } - } - } - }; - - _proto.remember = function remember() { - if (this._options.enableRemember) { - var toggleState = localStorage.getItem("remember" + EVENT_KEY); - - if (toggleState == ClassName.COLLAPSED) { - if (this._options.noTransitionAfterReload) { - $("body").addClass('hold-transition').addClass(ClassName.COLLAPSED).delay(50).queue(function () { - $(this).removeClass('hold-transition'); - $(this).dequeue(); - }); - } else { - $("body").addClass(ClassName.COLLAPSED); - } - } else { - if (this._options.noTransitionAfterReload) { - $("body").addClass('hold-transition').removeClass(ClassName.COLLAPSED).delay(50).queue(function () { - $(this).removeClass('hold-transition'); - $(this).dequeue(); - }); - } else { - $("body").removeClass(ClassName.COLLAPSED); - } - } - } - } // Private - ; - - _proto._init = function _init() { - var _this = this; - - this.remember(); - this.autoCollapse(); - $(window).resize(function () { - _this.autoCollapse(true); - }); - }; - - _proto._addOverlay = function _addOverlay() { - var _this2 = this; - - var overlay = $('
    ', { - id: 'sidebar-overlay' - }); - overlay.on('click', function () { - _this2.collapse(); - }); - $(Selector.WRAPPER).append(overlay); - } // Static - ; - - PushMenu._jQueryInterface = function _jQueryInterface(operation) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new PushMenu(this, _options); - $(this).data(DATA_KEY, data); - } - - if (typeof operation === 'string' && operation.match(/collapse|expand|toggle/)) { - data[operation](); - } - }); - }; - - return PushMenu; - }(); - /** - * Data API - * ==================================================== - */ - - - $(document).on('click', Selector.TOGGLE_BUTTON, function (event) { - event.preventDefault(); - var button = event.currentTarget; - - if ($(button).data('widget') !== 'pushmenu') { - button = $(button).closest(Selector.TOGGLE_BUTTON); - } - - PushMenu._jQueryInterface.call($(button), 'toggle'); - }); - $(window).on('load', function () { - PushMenu._jQueryInterface.call($(Selector.TOGGLE_BUTTON)); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = PushMenu._jQueryInterface; - $.fn[NAME].Constructor = PushMenu; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return PushMenu._jQueryInterface; - }; - - return PushMenu; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE Treeview.js - * License MIT - * -------------------------------------------- - */ - var Treeview = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'Treeview'; - var DATA_KEY = 'lte.treeview'; - var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - SELECTED: "selected" + EVENT_KEY, - EXPANDED: "expanded" + EVENT_KEY, - COLLAPSED: "collapsed" + EVENT_KEY, - LOAD_DATA_API: "load" + EVENT_KEY - }; - var Selector = { - LI: '.nav-item', - LINK: '.nav-link', - TREEVIEW_MENU: '.nav-treeview', - OPEN: '.menu-open', - DATA_WIDGET: '[data-widget="treeview"]' - }; - var ClassName = { - LI: 'nav-item', - LINK: 'nav-link', - TREEVIEW_MENU: 'nav-treeview', - OPEN: 'menu-open', - SIDEBAR_COLLAPSED: 'sidebar-collapse' - }; - var Default = { - trigger: Selector.DATA_WIDGET + " " + Selector.LINK, - animationSpeed: 300, - accordion: true, - expandSidebar: false, - sidebarButtonSelector: '[data-widget="pushmenu"]' - }; - /** - * Class Definition - * ==================================================== - */ - - var Treeview = /*#__PURE__*/function () { - function Treeview(element, config) { - this._config = config; - this._element = element; - } // Public - - - var _proto = Treeview.prototype; - - _proto.init = function init() { - this._setupListeners(); - }; - - _proto.expand = function expand(treeviewMenu, parentLi) { - var _this = this; - - var expandedEvent = $.Event(Event.EXPANDED); - - if (this._config.accordion) { - var openMenuLi = parentLi.siblings(Selector.OPEN).first(); - var openTreeview = openMenuLi.find(Selector.TREEVIEW_MENU).first(); - this.collapse(openTreeview, openMenuLi); - } - - treeviewMenu.stop().slideDown(this._config.animationSpeed, function () { - parentLi.addClass(ClassName.OPEN); - $(_this._element).trigger(expandedEvent); - }); - - if (this._config.expandSidebar) { - this._expandSidebar(); - } - }; - - _proto.collapse = function collapse(treeviewMenu, parentLi) { - var _this2 = this; - - var collapsedEvent = $.Event(Event.COLLAPSED); - treeviewMenu.stop().slideUp(this._config.animationSpeed, function () { - parentLi.removeClass(ClassName.OPEN); - $(_this2._element).trigger(collapsedEvent); - treeviewMenu.find(Selector.OPEN + " > " + Selector.TREEVIEW_MENU).slideUp(); - treeviewMenu.find(Selector.OPEN).removeClass(ClassName.OPEN); - }); - }; - - _proto.toggle = function toggle(event) { - var $relativeTarget = $(event.currentTarget); - var $parent = $relativeTarget.parent(); - var treeviewMenu = $parent.find('> ' + Selector.TREEVIEW_MENU); - - if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) { - if (!$parent.is(Selector.LI)) { - treeviewMenu = $parent.parent().find('> ' + Selector.TREEVIEW_MENU); - } - - if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) { - return; - } - } - - event.preventDefault(); - var parentLi = $relativeTarget.parents(Selector.LI).first(); - var isOpen = parentLi.hasClass(ClassName.OPEN); - - if (isOpen) { - this.collapse($(treeviewMenu), parentLi); - } else { - this.expand($(treeviewMenu), parentLi); - } - } // Private - ; - - _proto._setupListeners = function _setupListeners() { - var _this3 = this; - - $(document).on('click', this._config.trigger, function (event) { - _this3.toggle(event); - }); - }; - - _proto._expandSidebar = function _expandSidebar() { - if ($('body').hasClass(ClassName.SIDEBAR_COLLAPSED)) { - $(this._config.sidebarButtonSelector).PushMenu('expand'); - } - } // Static - ; - - Treeview._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new Treeview($(this), _options); - $(this).data(DATA_KEY, data); - } - - if (config === 'init') { - data[config](); - } - }); - }; - - return Treeview; - }(); - /** - * Data API - * ==================================================== - */ - - - $(window).on(Event.LOAD_DATA_API, function () { - $(Selector.DATA_WIDGET).each(function () { - Treeview._jQueryInterface.call($(this), 'init'); - }); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = Treeview._jQueryInterface; - $.fn[NAME].Constructor = Treeview; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Treeview._jQueryInterface; - }; - - return Treeview; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE DirectChat.js - * License MIT - * -------------------------------------------- - */ - var DirectChat = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'DirectChat'; - var DATA_KEY = 'lte.directchat'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - TOGGLED: "toggled{EVENT_KEY}" - }; - var Selector = { - DATA_TOGGLE: '[data-widget="chat-pane-toggle"]', - DIRECT_CHAT: '.direct-chat' - }; - var ClassName = { - DIRECT_CHAT_OPEN: 'direct-chat-contacts-open' - }; - /** - * Class Definition - * ==================================================== - */ - - var DirectChat = /*#__PURE__*/function () { - function DirectChat(element, config) { - this._element = element; - } - - var _proto = DirectChat.prototype; - - _proto.toggle = function toggle() { - $(this._element).parents(Selector.DIRECT_CHAT).first().toggleClass(ClassName.DIRECT_CHAT_OPEN); - var toggledEvent = $.Event(Event.TOGGLED); - $(this._element).trigger(toggledEvent); - } // Static - ; - - DirectChat._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - - if (!data) { - data = new DirectChat($(this)); - $(this).data(DATA_KEY, data); - } - - data[config](); - }); - }; - - return DirectChat; - }(); - /** - * - * Data Api implementation - * ==================================================== - */ - - - $(document).on('click', Selector.DATA_TOGGLE, function (event) { - if (event) event.preventDefault(); - - DirectChat._jQueryInterface.call($(this), 'toggle'); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = DirectChat._jQueryInterface; - $.fn[NAME].Constructor = DirectChat; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return DirectChat._jQueryInterface; - }; - - return DirectChat; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE TodoList.js - * License MIT - * -------------------------------------------- - */ - var TodoList = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'TodoList'; - var DATA_KEY = 'lte.todolist'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Selector = { - DATA_TOGGLE: '[data-widget="todo-list"]' - }; - var ClassName = { - TODO_LIST_DONE: 'done' - }; - var Default = { - onCheck: function onCheck(item) { - return item; - }, - onUnCheck: function onUnCheck(item) { - return item; - } - }; - /** - * Class Definition - * ==================================================== - */ - - var TodoList = /*#__PURE__*/function () { - function TodoList(element, config) { - this._config = config; - this._element = element; - - this._init(); - } // Public - - - var _proto = TodoList.prototype; - - _proto.toggle = function toggle(item) { - item.parents('li').toggleClass(ClassName.TODO_LIST_DONE); - - if (!$(item).prop('checked')) { - this.unCheck($(item)); - return; - } - - this.check(item); - }; - - _proto.check = function check(item) { - this._config.onCheck.call(item); - }; - - _proto.unCheck = function unCheck(item) { - this._config.onUnCheck.call(item); - } // Private - ; - - _proto._init = function _init() { - var that = this; - $(Selector.DATA_TOGGLE).find('input:checkbox:checked').parents('li').toggleClass(ClassName.TODO_LIST_DONE); - $(Selector.DATA_TOGGLE).on('change', 'input:checkbox', function (event) { - that.toggle($(event.target)); - }); - } // Static - ; - - TodoList._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new TodoList($(this), _options); - $(this).data(DATA_KEY, data); - } - - if (config === 'init') { - data[config](); - } - }); - }; - - return TodoList; - }(); - /** - * Data API - * ==================================================== - */ - - - $(window).on('load', function () { - TodoList._jQueryInterface.call($(Selector.DATA_TOGGLE)); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = TodoList._jQueryInterface; - $.fn[NAME].Constructor = TodoList; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return TodoList._jQueryInterface; - }; - - return TodoList; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE CardWidget.js - * License MIT - * -------------------------------------------- - */ - var CardWidget = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'CardWidget'; - var DATA_KEY = 'lte.cardwidget'; - var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - EXPANDED: "expanded" + EVENT_KEY, - COLLAPSED: "collapsed" + EVENT_KEY, - MAXIMIZED: "maximized" + EVENT_KEY, - MINIMIZED: "minimized" + EVENT_KEY, - REMOVED: "removed" + EVENT_KEY - }; - var ClassName = { - CARD: 'card', - COLLAPSED: 'collapsed-card', - COLLAPSING: 'collapsing-card', - EXPANDING: 'expanding-card', - WAS_COLLAPSED: 'was-collapsed', - MAXIMIZED: 'maximized-card' - }; - var Selector = { - DATA_REMOVE: '[data-card-widget="remove"]', - DATA_COLLAPSE: '[data-card-widget="collapse"]', - DATA_MAXIMIZE: '[data-card-widget="maximize"]', - CARD: "." + ClassName.CARD, - CARD_HEADER: '.card-header', - CARD_BODY: '.card-body', - CARD_FOOTER: '.card-footer', - COLLAPSED: "." + ClassName.COLLAPSED - }; - var Default = { - animationSpeed: 'normal', - collapseTrigger: Selector.DATA_COLLAPSE, - removeTrigger: Selector.DATA_REMOVE, - maximizeTrigger: Selector.DATA_MAXIMIZE, - collapseIcon: 'fa-minus', - expandIcon: 'fa-plus', - maximizeIcon: 'fa-expand', - minimizeIcon: 'fa-compress' - }; - - var CardWidget = /*#__PURE__*/function () { - function CardWidget(element, settings) { - this._element = element; - this._parent = element.parents(Selector.CARD).first(); - - if (element.hasClass(ClassName.CARD)) { - this._parent = element; - } - - this._settings = $.extend({}, Default, settings); - } - - var _proto = CardWidget.prototype; - - _proto.collapse = function collapse() { - var _this = this; - - this._parent.addClass(ClassName.COLLAPSING).children(Selector.CARD_BODY + ", " + Selector.CARD_FOOTER).slideUp(this._settings.animationSpeed, function () { - _this._parent.addClass(ClassName.COLLAPSED).removeClass(ClassName.COLLAPSING); - }); - - this._parent.find('> ' + Selector.CARD_HEADER + ' ' + this._settings.collapseTrigger + ' .' + this._settings.collapseIcon).addClass(this._settings.expandIcon).removeClass(this._settings.collapseIcon); - - var collapsed = $.Event(Event.COLLAPSED); - - this._element.trigger(collapsed, this._parent); - }; - - _proto.expand = function expand() { - var _this2 = this; - - this._parent.addClass(ClassName.EXPANDING).children(Selector.CARD_BODY + ", " + Selector.CARD_FOOTER).slideDown(this._settings.animationSpeed, function () { - _this2._parent.removeClass(ClassName.COLLAPSED).removeClass(ClassName.EXPANDING); - }); - - this._parent.find('> ' + Selector.CARD_HEADER + ' ' + this._settings.collapseTrigger + ' .' + this._settings.expandIcon).addClass(this._settings.collapseIcon).removeClass(this._settings.expandIcon); - - var expanded = $.Event(Event.EXPANDED); - - this._element.trigger(expanded, this._parent); - }; - - _proto.remove = function remove() { - this._parent.slideUp(); - - var removed = $.Event(Event.REMOVED); - - this._element.trigger(removed, this._parent); - }; - - _proto.toggle = function toggle() { - if (this._parent.hasClass(ClassName.COLLAPSED)) { - this.expand(); - return; - } - - this.collapse(); - }; - - _proto.maximize = function maximize() { - this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.maximizeIcon).addClass(this._settings.minimizeIcon).removeClass(this._settings.maximizeIcon); - - this._parent.css({ - 'height': this._parent.height(), - 'width': this._parent.width(), - 'transition': 'all .15s' - }).delay(150).queue(function () { - $(this).addClass(ClassName.MAXIMIZED); - $('html').addClass(ClassName.MAXIMIZED); - - if ($(this).hasClass(ClassName.COLLAPSED)) { - $(this).addClass(ClassName.WAS_COLLAPSED); - } - - $(this).dequeue(); - }); - - var maximized = $.Event(Event.MAXIMIZED); - - this._element.trigger(maximized, this._parent); - }; - - _proto.minimize = function minimize() { - this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.minimizeIcon).addClass(this._settings.maximizeIcon).removeClass(this._settings.minimizeIcon); - - this._parent.css('cssText', 'height:' + this._parent[0].style.height + ' !important;' + 'width:' + this._parent[0].style.width + ' !important; transition: all .15s;').delay(10).queue(function () { - $(this).removeClass(ClassName.MAXIMIZED); - $('html').removeClass(ClassName.MAXIMIZED); - $(this).css({ - 'height': 'inherit', - 'width': 'inherit' - }); - - if ($(this).hasClass(ClassName.WAS_COLLAPSED)) { - $(this).removeClass(ClassName.WAS_COLLAPSED); - } - - $(this).dequeue(); - }); - - var MINIMIZED = $.Event(Event.MINIMIZED); - - this._element.trigger(MINIMIZED, this._parent); - }; - - _proto.toggleMaximize = function toggleMaximize() { - if (this._parent.hasClass(ClassName.MAXIMIZED)) { - this.minimize(); - return; - } - - this.maximize(); - } // Private - ; - - _proto._init = function _init(card) { - var _this3 = this; - - this._parent = card; - $(this).find(this._settings.collapseTrigger).click(function () { - _this3.toggle(); - }); - $(this).find(this._settings.maximizeTrigger).click(function () { - _this3.toggleMaximize(); - }); - $(this).find(this._settings.removeTrigger).click(function () { - _this3.remove(); - }); - } // Static - ; - - CardWidget._jQueryInterface = function _jQueryInterface(config) { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new CardWidget($(this), _options); - $(this).data(DATA_KEY, typeof config === 'string' ? data : config); - } - - if (typeof config === 'string' && config.match(/collapse|expand|remove|toggle|maximize|minimize|toggleMaximize/)) { - data[config](); - } else if (typeof config === 'object') { - data._init($(this)); - } - }; - - return CardWidget; - }(); - /** - * Data API - * ==================================================== - */ - - - $(document).on('click', Selector.DATA_COLLAPSE, function (event) { - if (event) { - event.preventDefault(); - } - - CardWidget._jQueryInterface.call($(this), 'toggle'); - }); - $(document).on('click', Selector.DATA_REMOVE, function (event) { - if (event) { - event.preventDefault(); - } - - CardWidget._jQueryInterface.call($(this), 'remove'); - }); - $(document).on('click', Selector.DATA_MAXIMIZE, function (event) { - if (event) { - event.preventDefault(); - } - - CardWidget._jQueryInterface.call($(this), 'toggleMaximize'); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = CardWidget._jQueryInterface; - $.fn[NAME].Constructor = CardWidget; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return CardWidget._jQueryInterface; - }; - - return CardWidget; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE CardRefresh.js - * License MIT - * -------------------------------------------- - */ - var CardRefresh = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'CardRefresh'; - var DATA_KEY = 'lte.cardrefresh'; - var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - LOADED: "loaded" + EVENT_KEY, - OVERLAY_ADDED: "overlay.added" + EVENT_KEY, - OVERLAY_REMOVED: "overlay.removed" + EVENT_KEY - }; - var ClassName = { - CARD: 'card' - }; - var Selector = { - CARD: "." + ClassName.CARD, - DATA_REFRESH: '[data-card-widget="card-refresh"]' - }; - var Default = { - source: '', - sourceSelector: '', - params: {}, - trigger: Selector.DATA_REFRESH, - content: '.card-body', - loadInContent: true, - loadOnInit: true, - responseType: '', - overlayTemplate: '
    ', - onLoadStart: function onLoadStart() {}, - onLoadDone: function onLoadDone(response) { - return response; - } - }; - - var CardRefresh = /*#__PURE__*/function () { - function CardRefresh(element, settings) { - this._element = element; - this._parent = element.parents(Selector.CARD).first(); - this._settings = $.extend({}, Default, settings); - this._overlay = $(this._settings.overlayTemplate); - - if (element.hasClass(ClassName.CARD)) { - this._parent = element; - } - - if (this._settings.source === '') { - throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.'); - } - } - - var _proto = CardRefresh.prototype; - - _proto.load = function load() { - this._addOverlay(); - - this._settings.onLoadStart.call($(this)); - - $.get(this._settings.source, this._settings.params, function (response) { - if (this._settings.loadInContent) { - if (this._settings.sourceSelector != '') { - response = $(response).find(this._settings.sourceSelector).html(); - } - - this._parent.find(this._settings.content).html(response); - } - - this._settings.onLoadDone.call($(this), response); - - this._removeOverlay(); - }.bind(this), this._settings.responseType !== '' && this._settings.responseType); - var loadedEvent = $.Event(Event.LOADED); - $(this._element).trigger(loadedEvent); - }; - - _proto._addOverlay = function _addOverlay() { - this._parent.append(this._overlay); - - var overlayAddedEvent = $.Event(Event.OVERLAY_ADDED); - $(this._element).trigger(overlayAddedEvent); - }; - - _proto._removeOverlay = function _removeOverlay() { - this._parent.find(this._overlay).remove(); - - var overlayRemovedEvent = $.Event(Event.OVERLAY_REMOVED); - $(this._element).trigger(overlayRemovedEvent); - }; - - // Private - _proto._init = function _init(card) { - var _this = this; - - $(this).find(this._settings.trigger).on('click', function () { - _this.load(); - }); - - if (this._settings.loadOnInit) { - this.load(); - } - } // Static - ; - - CardRefresh._jQueryInterface = function _jQueryInterface(config) { - var data = $(this).data(DATA_KEY); - - var _options = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new CardRefresh($(this), _options); - $(this).data(DATA_KEY, typeof config === 'string' ? data : config); - } - - if (typeof config === 'string' && config.match(/load/)) { - data[config](); - } else { - data._init($(this)); - } - }; - - return CardRefresh; - }(); - /** - * Data API - * ==================================================== - */ - - - $(document).on('click', Selector.DATA_REFRESH, function (event) { - if (event) { - event.preventDefault(); - } - - CardRefresh._jQueryInterface.call($(this), 'load'); - }); - $(document).ready(function () { - $(Selector.DATA_REFRESH).each(function () { - CardRefresh._jQueryInterface.call($(this)); - }); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = CardRefresh._jQueryInterface; - $.fn[NAME].Constructor = CardRefresh; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return CardRefresh._jQueryInterface; - }; - - return CardRefresh; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE Dropdown.js - * License MIT - * -------------------------------------------- - */ - var Dropdown = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'Dropdown'; - var DATA_KEY = 'lte.dropdown'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Selector = { - NAVBAR: '.navbar', - DROPDOWN_MENU: '.dropdown-menu', - DROPDOWN_MENU_ACTIVE: '.dropdown-menu.show', - DROPDOWN_TOGGLE: '[data-toggle="dropdown"]' - }; - var ClassName = { - DROPDOWN_HOVER: 'dropdown-hover', - DROPDOWN_RIGHT: 'dropdown-menu-right' - }; - var Default = {}; - /** - * Class Definition - * ==================================================== - */ - - var Dropdown = /*#__PURE__*/function () { - function Dropdown(element, config) { - this._config = config; - this._element = element; - } // Public - - - var _proto = Dropdown.prototype; - - _proto.toggleSubmenu = function toggleSubmenu() { - this._element.siblings().show().toggleClass("show"); - - if (!this._element.next().hasClass('show')) { - this._element.parents('.dropdown-menu').first().find('.show').removeClass("show").hide(); - } - - this._element.parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function (e) { - $('.dropdown-submenu .show').removeClass("show").hide(); - }); - }; - - _proto.fixPosition = function fixPosition() { - var elm = $(Selector.DROPDOWN_MENU_ACTIVE); - - if (elm.length !== 0) { - if (elm.hasClass(ClassName.DROPDOWN_RIGHT)) { - elm.css('left', 'inherit'); - elm.css('right', 0); - } else { - elm.css('left', 0); - elm.css('right', 'inherit'); - } - - var offset = elm.offset(); - var width = elm.width(); - var windowWidth = $(window).width(); - var visiblePart = windowWidth - offset.left; - - if (offset.left < 0) { - elm.css('left', 'inherit'); - elm.css('right', offset.left - 5); - } else { - if (visiblePart < width) { - elm.css('left', 'inherit'); - elm.css('right', 0); - } - } - } - } // Static - ; - - Dropdown._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - - var _config = $.extend({}, Default, $(this).data()); - - if (!data) { - data = new Dropdown($(this), _config); - $(this).data(DATA_KEY, data); - } - - if (config === 'toggleSubmenu' || config == 'fixPosition') { - data[config](); - } - }); - }; - - return Dropdown; - }(); - /** - * Data API - * ==================================================== - */ - - - $(Selector.DROPDOWN_MENU + ' ' + Selector.DROPDOWN_TOGGLE).on("click", function (event) { - event.preventDefault(); - event.stopPropagation(); - - Dropdown._jQueryInterface.call($(this), 'toggleSubmenu'); - }); - $(Selector.NAVBAR + ' ' + Selector.DROPDOWN_TOGGLE).on("click", function (event) { - event.preventDefault(); - setTimeout(function () { - Dropdown._jQueryInterface.call($(this), 'fixPosition'); - }, 1); - }); - /** - * jQuery API - * ==================================================== - */ - - $.fn[NAME] = Dropdown._jQueryInterface; - $.fn[NAME].Constructor = Dropdown; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Dropdown._jQueryInterface; - }; - - return Dropdown; - }(jQuery); - - /** - * -------------------------------------------- - * AdminLTE Toasts.js - * License MIT - * -------------------------------------------- - */ - var Toasts = function ($) { - /** - * Constants - * ==================================================== - */ - var NAME = 'Toasts'; - var DATA_KEY = 'lte.toasts'; - var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - INIT: "init" + EVENT_KEY, - CREATED: "created" + EVENT_KEY, - REMOVED: "removed" + EVENT_KEY - }; - var Selector = { - BODY: 'toast-body', - CONTAINER_TOP_RIGHT: '#toastsContainerTopRight', - CONTAINER_TOP_LEFT: '#toastsContainerTopLeft', - CONTAINER_BOTTOM_RIGHT: '#toastsContainerBottomRight', - CONTAINER_BOTTOM_LEFT: '#toastsContainerBottomLeft' - }; - var ClassName = { - TOP_RIGHT: 'toasts-top-right', - TOP_LEFT: 'toasts-top-left', - BOTTOM_RIGHT: 'toasts-bottom-right', - BOTTOM_LEFT: 'toasts-bottom-left', - FADE: 'fade' - }; - var Position = { - TOP_RIGHT: 'topRight', - TOP_LEFT: 'topLeft', - BOTTOM_RIGHT: 'bottomRight', - BOTTOM_LEFT: 'bottomLeft' - }; - var Default = { - position: Position.TOP_RIGHT, - fixed: true, - autohide: false, - autoremove: true, - delay: 1000, - fade: true, - icon: null, - image: null, - imageAlt: null, - imageHeight: '25px', - title: null, - subtitle: null, - close: true, - body: null, - class: null - }; - /** - * Class Definition - * ==================================================== - */ - - var Toasts = /*#__PURE__*/function () { - function Toasts(element, config) { - this._config = config; - - this._prepareContainer(); - - var initEvent = $.Event(Event.INIT); - $('body').trigger(initEvent); - } // Public - - - var _proto = Toasts.prototype; - - _proto.create = function create() { - var toast = $('