From 8214acd3e97e1b38a73d3495de68bd1fad44653b Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 4 May 2023 15:01:28 +0200 Subject: [PATCH] Added Voiceplan, Admin IVT product matcher and Voicenumber update updates number in ContractConfig --- Layout/default/Admin/Index.php | 18 +- .../default/Admin/ivtimport_product_match.php | 65 ++++ Layout/default/Contract/Form.php | 337 ++++++++++-------- Layout/default/Contract/Index.php | 3 +- Layout/default/Contract/View.php | 9 +- Layout/default/Contractconfig/Form.php | 7 +- Layout/default/Voiceplan/Form.php | 95 +++++ Layout/default/Voiceplan/Index.php | 122 +++++++ Layout/default/Voiceplan/View.php | 105 ++++++ Layout/default/Voiceplandestination/Form.php | 106 ++++++ Layout/default/header.php | 5 +- application/Admin/AdminController.php | 7 + application/Contract/ContractController.php | 30 +- .../CpeprovisioningController.php | 57 +-- application/File/File.php | 23 ++ application/IvtProduct/IvtProduct.php | 37 ++ application/IvtProduct/IvtProductModel.php | 89 +++++ application/Product/ProductController.php | 5 +- .../Termination/TerminationController.php | 11 + application/Voicenumber/Voicenumber.php | 61 ++++ .../Voicenumber/VoicenumberController.php | 8 + application/Voiceplan/Voiceplan.php | 110 ++++++ application/Voiceplan/VoiceplanController.php | 195 ++++++++++ application/Voiceplan/VoiceplanModel.php | 139 ++++++++ application/VoiceplanFile/VoiceplanFile.php | 39 ++ .../VoiceplanFile/VoiceplanFileModel.php | 149 ++++++++ .../Voiceplandestination.php | 6 + .../VoiceplandestinationController.php | 105 ++++++ .../VoiceplandestinationModel.php | 159 +++++++++ public/assets/css/thetool.css | 3 + public/assets/js/pages/calendar.init.js | 1 - public/assets/js/pages/chartjs.init.js | 1 - public/assets/js/pages/contract_form.js | 66 ++++ public/assets/js/pages/dashboard.init.js | 1 - public/assets/js/pages/datatables.init.js | 1 - public/assets/js/pages/form-advanced.init.js | 1 - public/assets/js/pages/form-editor.init.js | 1 - public/assets/js/pages/maps.init.js | 1 - public/assets/js/pages/range-sliders.init.js | 1 - public/assets/js/pages/sparkline.init.js | 1 - public/assets/js/pages/sweet-alerts.init.js | 1 - public/assets/js/pages/toastr.init.js | 1 - 42 files changed, 1975 insertions(+), 207 deletions(-) create mode 100644 Layout/default/Admin/ivtimport_product_match.php create mode 100644 Layout/default/Voiceplan/Form.php create mode 100644 Layout/default/Voiceplan/Index.php create mode 100644 Layout/default/Voiceplan/View.php create mode 100644 Layout/default/Voiceplandestination/Form.php create mode 100644 application/IvtProduct/IvtProduct.php create mode 100644 application/IvtProduct/IvtProductModel.php create mode 100644 application/Voiceplan/Voiceplan.php create mode 100644 application/Voiceplan/VoiceplanController.php create mode 100644 application/Voiceplan/VoiceplanModel.php create mode 100644 application/VoiceplanFile/VoiceplanFile.php create mode 100644 application/VoiceplanFile/VoiceplanFileModel.php create mode 100644 application/Voiceplandestination/Voiceplandestination.php create mode 100644 application/Voiceplandestination/VoiceplandestinationController.php create mode 100644 application/Voiceplandestination/VoiceplandestinationModel.php delete mode 100644 public/assets/js/pages/calendar.init.js delete mode 100644 public/assets/js/pages/chartjs.init.js create mode 100644 public/assets/js/pages/contract_form.js delete mode 100644 public/assets/js/pages/dashboard.init.js delete mode 100644 public/assets/js/pages/datatables.init.js delete mode 100644 public/assets/js/pages/form-advanced.init.js delete mode 100644 public/assets/js/pages/form-editor.init.js delete mode 100644 public/assets/js/pages/maps.init.js delete mode 100644 public/assets/js/pages/range-sliders.init.js delete mode 100644 public/assets/js/pages/sparkline.init.js delete mode 100644 public/assets/js/pages/sweet-alerts.init.js delete mode 100644 public/assets/js/pages/toastr.init.js diff --git a/Layout/default/Admin/Index.php b/Layout/default/Admin/Index.php index 1054cdbfe..2eafc512f 100644 --- a/Layout/default/Admin/Index.php +++ b/Layout/default/Admin/Index.php @@ -10,16 +10,15 @@ -

Admin

+

Secret Admin functions

-

Secret Admin functions

-
+
Network
@@ -29,6 +28,19 @@
+ +
+ +
\ No newline at end of file diff --git a/Layout/default/Admin/ivtimport_product_match.php b/Layout/default/Admin/ivtimport_product_match.php new file mode 100644 index 000000000..eef62b011 --- /dev/null +++ b/Layout/default/Admin/ivtimport_product_match.php @@ -0,0 +1,65 @@ + + + +
+
+
+
+ +
+

IVT Product Match

+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + +
IVT ProduktPreisIntervalTypthetool Produkt
name?>price?>interval?>typ?> + +
+
+
+ + + + \ No newline at end of file diff --git a/Layout/default/Contract/Form.php b/Layout/default/Contract/Form.php index 5434a08d2..fc02e4c32 100644 --- a/Layout/default/Contract/Form.php +++ b/Layout/default/Contract/Form.php @@ -42,153 +42,189 @@ -
- -
- +
+
+ +
+ +
+ + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ + Eindeutige Identifizierung das Produkts. Z.B. Anschlussadresse, Domainname usw. +
+
+ +
+ +
+ +
+
+ + +
+ +
+ + Scheint statt dem echten Produktnamen auf der Rechnung auf +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ order_date) : ""?>"> +
+
+ +
+ +
+ finish_date) : ""?>"> +
+
+ +
+ +
+ cancel_date) : ""?>"> +
+
+ +
-
-
- -
- +
+ + +
-
- -
- -
- -
-
- -
- -
- - Eindeutige Identifizierung das Produkts. Z.B. Anschlussadresse, Domainname usw. -
-
- -
- -
- -
-
- - -
- -
- - Scheint statt dem echten Produktnamen auf der Rechnung auf -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- -
- -
-
- -
- -
- -
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
- order_date) : ""?>"> -
-
- -
- -
- finish_date) : ""?>"> -
-
- -
- -
- cancel_date) : ""?>"> -
-
- - -
+
+ + \ No newline at end of file diff --git a/Layout/default/Voiceplan/View.php b/Layout/default/Voiceplan/View.php new file mode 100644 index 000000000..6daaad60d --- /dev/null +++ b/Layout/default/Voiceplan/View.php @@ -0,0 +1,105 @@ +getUrl($Mod,"View"); + $pagination_baseurl_params = ["filter" => $filter, "id" => $plan->id]; + $pagination_entity_name = "Destinations"; +?> + + + +
+
+
+
+ +
+

Sprachtarife

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

Destinations für Sprachtarifpaket name?>

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
DestinationPrefixTaktungEinkaufspreisVerkaufspreisErstelltBearbeitet
destination?>prefix?>increment_first && $destination->increment) ? "$destination->increment_first"."/".$destination->increment : ""?>purchase_price?>price?>create)?> (creator->name?>)edit)?> (editor->name?>) + $destination->id])?>"> + $destination->id])?>"> + $destination->id])?>" onclick="if(!confirm('Destination wirklich löschen?')) return false;" class="text-danger" title="Löschen"> +
+ + + + + +
+
+ +
+
+ + + \ No newline at end of file diff --git a/Layout/default/Voiceplandestination/Form.php b/Layout/default/Voiceplandestination/Form.php new file mode 100644 index 000000000..2230525d7 --- /dev/null +++ b/Layout/default/Voiceplandestination/Form.php @@ -0,0 +1,106 @@ + + +
+
+
+
+ +
+

Sprachtarife

+
+
+
+ + +
+
+ +
+
+

id) ? "Destination bearbeiten" : "Neues Destination"?>

+ +
"> +
+
+ + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ increment : ""?>" placeholder="60/30" /> +
+
+ +
+
+ +
+ +
+ +
+
+ + + +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/Layout/default/header.php b/Layout/default/header.php index e07a9a4d9..f5c0f363a 100644 --- a/Layout/default/header.php +++ b/Layout/default/header.php @@ -45,7 +45,10 @@ - + +
diff --git a/application/Admin/AdminController.php b/application/Admin/AdminController.php index b99bff025..59ad538a4 100644 --- a/application/Admin/AdminController.php +++ b/application/Admin/AdminController.php @@ -38,4 +38,11 @@ class AdminController extends mfBaseController { $this->redirect("Admin"); } + protected function ivtImportMatchProductsAction() { + $this->layout()->setTemplate("Admin/ivtimport_product_match"); + + $ivtproducts = IvtProductModel::getAll(); + $this->layout()->set("ivtproducts", $ivtproducts); + } + } \ No newline at end of file diff --git a/application/Contract/ContractController.php b/application/Contract/ContractController.php index d32a3149e..31b6d89a2 100644 --- a/application/Contract/ContractController.php +++ b/application/Contract/ContractController.php @@ -18,14 +18,22 @@ class ContractController extends mfBaseController { protected function indexAction() { $this->layout()->setTemplate("Contract/Index"); - $rfilter = $this->request->filter; - iF(!is_array($rfilter)) { - $rfilter = []; + if($this->request->resetFilter) { + unset($_SESSION[MFAPPNAME.'-Contract-filter']); } - $this->layout->set("filter", $rfilter); + $filter = []; + if(is_array($this->request->filter)) { + $filter = $this->request->filter; + $_SESSION[MFAPPNAME.'-Contract-filter'] = $filter; + } else { + if(array_key_exists(MFAPPNAME.'-Contract-filter', $_SESSION) && count($_SESSION[MFAPPNAME.'-Contract-filter'])) { + $filter = $_SESSION[MFAPPNAME.'-Contract-filter']; + } + } - $filter = $this->getPreparedFilter($rfilter); + $this->layout->set("filter", $filter); + $filter = $this->getPreparedFilter($filter); // pagination defaults $pagination = []; @@ -344,6 +352,18 @@ class ContractController extends mfBaseController { } + protected function cancelAction() { + $id = $this->request->contract_id; + if(!$id) $id = $this->request->id; + + $this->layout()->setFlash("Not implemented", "error"); + if($id) { + $this->redirect("Contract","view",["id" => $id]); + } else { + $this->redirect("Contract"); + } + } + protected function addAction() { $this->layout()->setTemplate("Contract/Form"); $this->layout()->set("terminations", TerminationModel::getAll()); diff --git a/application/Cpeprovisioning/CpeprovisioningController.php b/application/Cpeprovisioning/CpeprovisioningController.php index 1dfa09325..22f7eadf8 100644 --- a/application/Cpeprovisioning/CpeprovisioningController.php +++ b/application/Cpeprovisioning/CpeprovisioningController.php @@ -61,39 +61,42 @@ class CpeprovisioningController extends mfBaseController continue; } } + + if(array_key_exists($order->id, $orderproductsprefetch)) { + foreach ($orderproductsprefetch[$order->id] as $orderproduct) { + if(!$orderproduct) continue; + if(!is_array($orderproduct)) continue; + + if ($orderproduct['routerconfig_finished'] == 1) { + if (!$filter['routerconfig_finished']) continue; + } else { + if ($filter['routerconfig_finished']) continue; + } + - foreach ($orderproductsprefetch[$order->id] as $orderproduct) { + $productattributes = $orderproduct['attributes']; - if ($orderproduct['routerconfig_finished'] == 1) { - if (!$filter['routerconfig_finished']) continue; - } else { - if ($filter['routerconfig_finished']) continue; - } + if (is_array($productattributes) && count($productattributes)) { + // filter out products without bras_type + if (array_key_exists("bras_type", $productattributes) && $productattributes) { + $pagination['maxItems']++; + if ($pagination['maxItems'] >= $pagination['start']+1 && $pagination['maxItems'] <= $pagination['start'] + $pagination['count']) { + $cpeproducts[] = OrderProductModel::getOne($orderproduct['id']); + } - $productattributes = $orderproduct['attributes']; - - - if (is_array($productattributes) && count($productattributes)) { - // filter out products without bras_type - - if (array_key_exists("bras_type", $productattributes) && $productattributes) { - $pagination['maxItems']++; - if ($pagination['maxItems'] >= $pagination['start']+1 && $pagination['maxItems'] <= $pagination['start'] + $pagination['count']) { - $cpeproducts[] = OrderProductModel::getOne($orderproduct['id']); - } - - } else { - $this->log->debug("no bras_type oid " . $order->id); - continue; - } - } else { - // ignore products without attributes - $this->log->debug("no attributes oid " . $order->id); - continue; - } + } else { + $this->log->debug("no bras_type oid " . $order->id); + continue; + } + } else { + // ignore products without attributes + $this->log->debug("no attributes oid " . $order->id); + continue; + } + } } } diff --git a/application/File/File.php b/application/File/File.php index bf7d0be76..b31d476f9 100644 --- a/application/File/File.php +++ b/application/File/File.php @@ -40,6 +40,29 @@ class File extends mfBaseModel { return false; } + public function getFullPath() { + if(!is_numeric($this->id) || $this->id < 1) { + throw new Exception("File not found", 4040); + } + + $filename = $this->store_filename; + $path = MFUPLOAD_FILE_SAVE_PATH; + $path .= ($this->subfolder) ? "/".$this->subfolder : ""; + $path .= "/$filename"; + + if(!file_exists($path)) { + throw new Exception("File not found", 4041); + } + + return $path; + } + + public function getContents() { + $outname = $this->getFullPath(); + return file_get_contents($outname); + } + + public function getProperty($name) { if($this->$name == null) { diff --git a/application/IvtProduct/IvtProduct.php b/application/IvtProduct/IvtProduct.php new file mode 100644 index 000000000..158f3b1b2 --- /dev/null +++ b/application/IvtProduct/IvtProduct.php @@ -0,0 +1,37 @@ +log = mfLoghandler::singleton(); + $this->data = new stdClass(); + $this->table = "products"; + + $this->db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME); + + if(is_numeric($_)) { + $this->fetch($_); + } elseif(is_object($_)) { + $this->load($_); + } + } + + public function save() { + return true; + } + + + + public function __debugInfo() { + $vars = get_object_vars($this); + if(is_object($vars['db'])) $vars['db'] = "object(FronkDB)"; + if(is_object($vars['log'])) $vars['log'] = 'object(mfLoghandler)'; + return $vars; + } + +} \ No newline at end of file diff --git a/application/IvtProduct/IvtProductModel.php b/application/IvtProduct/IvtProductModel.php new file mode 100644 index 000000000..4d5d23a4b --- /dev/null +++ b/application/IvtProduct/IvtProductModel.php @@ -0,0 +1,89 @@ +select("products", "*", "1=1 ORDER BY id"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new IvtProduct($data); + } + } + return $items; + } + + public static function getFirst() { + $db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME); + + $where = self::getSqlFilter($filter); + $res = $db->select("products", "*", "$where ORDER BY id LIMIT 1"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new IvtProduct($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter, $limit = false) { + $items = []; + $db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME); + + $where = self::getSqlFilter($filter); + $sql = "SELECT * FROM products $where ORDER by id"; + + mfLoghandler::singleton()->debug($sql); + if(is_array($limit) && count($limit)) { + if(is_numeric($limit['start']) && is_numeric($limit['count'])) { + $sql .= " LIMIT ".$limit['start'].", ".$limit['count']; + } elseif(is_numeric($count)) { + $sql .= " LIMIT ".$limit['count']; + } + } + + $res = $db->query($sql); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new IvtProduct($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) { + $where = "1=1 "; + + /* + if(array_key_exists("status_id", $filter)) { + $status_id = $filter['status_id']; + if(is_numeric($status_id)) { + $where .= " AND IvtProduct.status_id=$status_id"; + } + } + + + if(array_key_exists("street", $filter)) { + $street = FronkDB::singleton()->escape($filter["street"]); + if($street) { + $where .= " AND street like '%$street%'"; + } + } + */ + + //var_dump($filter, $where);exit; + return $where; + } + +} diff --git a/application/Product/ProductController.php b/application/Product/ProductController.php index 5f8d385ea..82e53042b 100644 --- a/application/Product/ProductController.php +++ b/application/Product/ProductController.php @@ -330,7 +330,6 @@ class ProductController extends mfBaseController { private function findProductApi() { $search = trim($this->request->q); - $autocomplete = $this->request->autocomplete; $products = []; @@ -341,8 +340,8 @@ class ProductController extends mfBaseController { } } - - $products = array_merge($products, ProductModel::search(["active" => 1, "name%" => $search])); + $wild_search = implode("%", explode(" ", $search)); + $products = array_merge($products, ProductModel::search(["active" => 1, "name%" => $wild_search])); if(!is_array($products) && !count($products)) { return false; diff --git a/application/Termination/TerminationController.php b/application/Termination/TerminationController.php index 7b1aa02fe..7b21cf476 100644 --- a/application/Termination/TerminationController.php +++ b/application/Termination/TerminationController.php @@ -150,6 +150,9 @@ class TerminationController extends mfBaseController { case "setValue": $return = $this->setValueApi(); break; + case "find": + $return = $this->findTerminationApi(); + break; default: $return = false; } @@ -193,4 +196,12 @@ class TerminationController extends mfBaseController { return ["msg" => "Saved successfully"]; } + + private function findTerminationApi() { + $search = $this->request->search; + + $terminations = []; + + + } } diff --git a/application/Voicenumber/Voicenumber.php b/application/Voicenumber/Voicenumber.php index 7f7947edc..97ee64dab 100644 --- a/application/Voicenumber/Voicenumber.php +++ b/application/Voicenumber/Voicenumber.php @@ -33,6 +33,67 @@ class Voicenumber extends mfBaseModel { } } + public function afterSave() { + // if contract_id is given, add number to contract + if($this->contract_id) { + if(is_array($this->contract->configvalues) && array_key_exists("voicenumberblock_voicenumber", $this->contract->configvalues)) { + $cc_item = $this->contract->configvalues["voicenumberblock_voicenumber"]; + } else { + $cc_item = ContractconfigItemModel::getFirst(["name" => "voicenumberblock_voicenumber"]); + $cc_item->setContractId($this->contract_id); + } + + $contract_numbers = []; + + $numbers_json = $cc_item->value->json; + if($numbers_json) { + $contract_numbers = json_decode($numbers_json); + } + + //var_dump($contract_numbers); + if(!in_array($this->number, $contract_numbers)) { + $contract_numbers[] = $this->number; + $cc_item->value->set($contract_numbers); + $cc_item->value->save(); + } + + // if contract_id was changed, remove number from old contract + if($this->_old_data->contract_id > 0 && $this->_old_data->contract_id != $this->contract_id) { + $old_contract = new Contract($this->_old_data->contract_id); + $cc_item = $old_contract->configvalues["voicenumberblock_voicenumber"]; + $numbers_json = $cc_item->value->json; + if($numbers_json) { + $contract_numbers = json_decode($numbers_json); + $new_numbers = []; + foreach($contract_numbers as $cnum) { + if($this->number != $cnum) { + $new_numbers[] = $cnum; + } + } + $cc_item->value->set($new_numbers); + $cc_item->value->save(); + } + } + + } elseif($this->_old_data->contract_id > 0) { + // removed contract_id, so remove number from old contract + $old_contract = new Contract($this->_old_data->contract_id); + $cc_item = $old_contract->configvalues["voicenumberblock_voicenumber"]; + $numbers_json = $cc_item->value->json; + if($numbers_json) { + $contract_numbers = json_decode($numbers_json); + $new_numbers = []; + foreach($contract_numbers as $cnum) { + if($this->number != $cnum) { + $new_numbers[] = $cnum; + } + } + $cc_item->value->set($new_numbers); + $cc_item->value->save(); + } + } + } + public function getProperty($name) { if($this->$name == null) { diff --git a/application/Voicenumber/VoicenumberController.php b/application/Voicenumber/VoicenumberController.php index ac3cd4e4c..29c4e2ba7 100644 --- a/application/Voicenumber/VoicenumberController.php +++ b/application/Voicenumber/VoicenumberController.php @@ -155,12 +155,20 @@ class VoicenumberController extends mfBaseController { $number->update($number_data); $number_id = $number->save(); + + if(!$number_id) { $this->layout()->setFlash("Fehler beim Speichern", "error"); $this->redirect("Voicenumber", "edit", ["block_id" => $block_id, "number" => $num]); } + //var_dump($number->_old_data);exit; + + + // save number to contract + + $this->layout()->setFlash("Rufnummer erfolgreich gespeichert", "success"); $this->redirect("Voicenumberblock", "Index", null, "block=".$block->id); diff --git a/application/Voiceplan/Voiceplan.php b/application/Voiceplan/Voiceplan.php new file mode 100644 index 000000000..52bf000c3 --- /dev/null +++ b/application/Voiceplan/Voiceplan.php @@ -0,0 +1,110 @@ +id) { + return false; + } + try { + $i = 0; + $filename = $file->getFullPath(); + $input = fopen($filename, "r"); + while($csv = fgetcsv($input, 0, ",")) { + $i++; + if($i == 1) continue; + + if(!trim($csv[0])) { + continue; + } + + $name = trim($csv[0]); + $prefix = trim($csv[1]); + $price_ek = str_replace(",",".", trim($csv[2])); + $price_vk = str_replace(",",".", trim($csv[3])); + + if(!$name || !$prefix || !$price_ek || !$price_vk) { + $this->log->warning("not Importing Voiceplandestination with empty value: destination: $name | prefix: $prefix | ek: $price_ek | vk: $price_vk"); + continue; + } + + $destination = VoiceplandestinationModel::getFirst(["voiceplan_id" => $this->id, "destination" => $name, "prefix" => $prefix]); + + if($destination) { + $this->log->warning("Destination gibts schon, updateing prices: voiceplan_id: ".$this->id." | destination: $name | prefix: $prefix"); + + $destination->purchase_price = $price_ek; + $destination->price = $price_vk; + $destination->save(); + continue; + } + + $destination = VoiceplandestinationModel::create([ + 'voiceplan_id' => $this->id, + 'destination' => $name, + 'prefix' => $prefix, + 'increment_first' => $this->increment_first, + 'increment' => $this->increment, + 'purchase_price' => $price_ek, + 'price' => $price_vk + ]); + $destination->save(); + + } + return true; + + + } catch(Exception $e) { + echo $e->getCode().": ".$e->getMessage();exit; + return false; + } + } + + public function getProperty($name) { + if($this->$name == null) { + + if($name == "destinations") { + $this->destinations = VoiceplandestinationModel::search(["voiceplan_id" => $this->id]); + return $this->destinations; + } + + if($name == "creator") { + $user = mfValuecache::singleton()->get("Worker-id-".$this->create_by); + if($user) { + $this->creator = $user; + return $this->creator; + } + $this->creator = new User($this->create_by); + if($this->creator->id) { + mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); + } + return $this->creator; + } + + if($name == "editor") { + $this->editor = new User($this->edit_by); + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield); + if($this->$name === null) { + $this->$name = new $classname($this->$idfield); + } + + if($this->$name->id) { + mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name); + return $this->$name; + } else { + return null; + } + } + + return $this->$name; + } +} \ No newline at end of file diff --git a/application/Voiceplan/VoiceplanController.php b/application/Voiceplan/VoiceplanController.php new file mode 100644 index 000000000..2e485b96e --- /dev/null +++ b/application/Voiceplan/VoiceplanController.php @@ -0,0 +1,195 @@ +needlogin=true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me",$me); + + if(!$me->isAdmin()) { + $this->redirect("Dashboard"); + } + } + + + protected function indexAction() { + $filter = []; + if(is_array($this->request->filter)) { + $filter = $this->request->filter; + } + + $this->layout->set("filter", $filter); + + if($filter) { + $filter = $this->getPreparedFilter($filter); + } + + // pagination defaults + $pagination = []; + $pagination['start'] = 0; + $pagination['count'] = 20; + $pagination['maxItems'] = 0; + + if(is_numeric($this->request->s)) { + $pagination['start'] = intval($this->request->s); + } + + $pagination['maxItems'] = VoiceplanModel::count($filter); + + $voiceplans = VoiceplanModel::getAll(); + $this->layout()->set("voiceplans", $voiceplans); + $this->layout()->set("pagination", $pagination); + } + + private function getPreparedFilter($filter) { + return $filter; + } + + protected function viewAction() { + $this->layout()->setTemplate("Voiceplan/View"); + $id = $this->request->id; + if(!is_numeric($id) || $id < 1) { + $this->layout()->setFlash("Tarifpaket nicht gefunden.", "error"); + $this->redirect("Voiceplan"); + } + + $plan = new Voiceplan($id); + if(!$plan->id) { + $this->layout()->setFlash("Tarifpaket nicht gefunden.", "error"); + $this->redirect("Voiceplan"); + } + + $this->layout()->set("plan", $plan); + + $pagination = []; + $pagination['start'] = 0; + $pagination['count'] = 20; + $pagination['maxItems'] = 0; + + if(is_numeric($this->request->s)) { + $pagination['start'] = intval($this->request->s); + } + + $pagination['maxItems'] = VoiceplandestinationModel::count(['voiceplan_id' => $id]); + $destinations = VoiceplandestinationModel::search(['voiceplan_id' => $id], $pagination); + $this->layout()->set("destinations", $destinations); + + $this->layout()->set("pagination", $pagination); + + } + + protected function addAction() { + $this->layout()->setTemplate("Voiceplan/Form"); + + } + + protected function editAction() { + $id = $this->request->id; + if(!is_numeric($id) || $id < 1) { + $this->layout()->setFlash("Tarifpaket nicht gefunden.", "error"); + $this->redirect("Voiceplan"); + } + + $plan = new Voiceplan($id); + if(!$plan->id) { + $this->layout()->setFlash("Tarifpaket nicht gefunden.", "error"); + $this->redirect("Voiceplan"); + } + + $this->layout()->set("plan", $plan); + return $this->addAction(); + } + + + protected function saveAction() { + $r = $this->request; + //var_dump($r);exit; + + $id = $r->id; + if(is_numeric($id) && $id > 0) { + $mode = "edit"; + $voiceplan = new Voiceplan($id); + if(!$voiceplan->id) { + $this->layout()->setFlash("Tarifpaket nicht gefunden", "error"); + $this->redirect("Voiceplan"); + } + } else { + $id = false; + $mode = "add"; + } + + $data = []; + $data['name'] = $r->name; + $data['description'] = $r->description; + + if($r->increment) { + $increments = explode("/",$r->increment); + if(count($increments) != 2) { + $this->layout()->setFlash("Ungültige Taktung", "error"); + return $this->editAction(); + } + + $data["increment_first"] = $increments[0]; + $data["increment"] = $increments[1]; + } + + if(!$data['name']) { + $this->layout()->setFlash("Bitte Name eingeben", "error"); + return $this->editAction(); + } + + if($mode == "edit") { + $voiceplan->update($data); + } else { + $voiceplan = VoiceplanModel::create($data); + } + + $id = $voiceplan->save(); + if(!$id) { + $this->layout()->setFlash("Fehler beim Speichern!", "error"); + return $this->editAction(); + } + + + if(is_array($_FILES) && array_key_exists("voiceplanfile", $_FILES) && !$_FILES['voiceplanfile']['error']) { + // look for uploaded import file + try { + // returns File object or throws Exception on error + $file = mfUpload::handleFormUpload("voiceplanfile"); + } catch (Exception $ex) { + $this->layout()->setFlash("Fehler beim Dateiupload: ".$ex->getMessage(), "error"); + return $this->editAction(); + } + + $vpf = VoiceplanFileModel::create([ + 'voiceplan_id' => $id, + 'file_id' => $file->id, + 'name' => "voiceplan-import-".date("Y-m-d_H-i-s").".csv", + ]); + $voiceplanfile_id = $vpf->save(); + if(!$voiceplanfile_id) { + $this->layout()->setFlash("Fehler beim Speichern der hochgeladenen Datei", "error"); + return $this->editAction(); + } + + + // if file was uploaded successfully, delete old destinations + foreach(VoiceplandestinationModel::search(['voiceplan_id' => $id]) as $destination) { + $destination->delete(); + + } + + if(!$voiceplan->importDestinationsFromCsv($file)) { + $this->layout()->setFlash("Fehler beim Importieren!", "error"); + return $this->editAction(); + } + } + + $this->layout()->setFlash("Sprachtarifpaket erfolgreich gespeichert!", "success"); + $this->redirect("Voiceplan", "view", ["id" => $id]); + + } +} \ No newline at end of file diff --git a/application/Voiceplan/VoiceplanModel.php b/application/Voiceplan/VoiceplanModel.php new file mode 100644 index 000000000..01066ed35 --- /dev/null +++ b/application/Voiceplan/VoiceplanModel.php @@ -0,0 +1,139 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model->$field = $value; + } + } + + $me = new User(); + $me->loadMe(); + + if($model->create_by === null) { + $model->create_by = $me->id; + } + if($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("Voiceplan", "*", "1=1 ORDER BY name"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new Voiceplan($data); + } + } + return $items; + + } + + public static function getFirst($filter = null) { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + mfLoghandler::singleton()->debug($where); + $res = $db->select("Voiceplan", "*", "$where"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new Voiceplan($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function count($filter) { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT COUNT(*) as cnt FROM Voiceplan + WHERE $where + "; + + $res = $db->query($sql); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + return $data->cnt; + } + return 0; + } + + public static function search($filter, $limit = false) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT * FROM Voiceplan + WHERE $where + ORDER BY name"; + + if(is_array($limit) && count($limit)) { + if(is_numeric($limit['start']) && is_numeric($limit['count'])) { + $sql .= " LIMIT ".$limit['start'].", ".$limit['count']; + } elseif(is_numeric($count)) { + $sql .= " LIMIT ".$limit['count']; + } + } + + $res = $db->query($sql); + + //mfLoghandler::singleton()->debug($sql); + + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new Voiceplan($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) { + $db = FronkDB::singleton(); + $where = "1=1 "; + + if(!is_array($filter)) { + return $where; + } + + /*if(array_key_exists("block_id", $filter)) { + $block_id = $filter['block_id']; + if(is_numeric($block_id)) { + $where .= " AND voiceplanblock_id = $block_id"; + } + }*/ + + if(array_key_exists("name", $filter)) { + $name = $db->escape($filter['name']); + if($name) { + $where .= " AND name like '%$name%'"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} \ No newline at end of file diff --git a/application/VoiceplanFile/VoiceplanFile.php b/application/VoiceplanFile/VoiceplanFile.php new file mode 100644 index 000000000..b0e419530 --- /dev/null +++ b/application/VoiceplanFile/VoiceplanFile.php @@ -0,0 +1,39 @@ +$name == null) { + + if(!$this->id) { + return null; + } + + if($name == "creator") { + $this->creator = new User($this->create_by); + return $this->creator; + } + + if($name == "editor") { + $this->editor = new User($this->edit_by); + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = new $classname($this->$idfield); + + if($this->$name->id) { + return $this->$name; + } else { + return null; + } + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/VoiceplanFile/VoiceplanFileModel.php b/application/VoiceplanFile/VoiceplanFileModel.php new file mode 100644 index 000000000..29631087e --- /dev/null +++ b/application/VoiceplanFile/VoiceplanFileModel.php @@ -0,0 +1,149 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model ->$field = $value; + } + } + + $me = new User(); + $me->loadMe(); + + if($model->create_by === null) { + $model->create_by = $me->id; + } + if($model->edit_by === null) { + $model->edit_by = $me->id; + } + + 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("VoiceplanFile", "*", "id=$id LIMIT 1"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new VoiceplanFile($data); + } + return $item; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("VoiceplanFile", "*", "1=1 ORDER BY voiceplan_id, `create`"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new VoiceplanFile($data); + } + } + return $items; + + } + + public static function getFirst() { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("VoiceplanFile", "*", "$where ORDER BY voiceplan_id, `create`"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new VoiceplanFile($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + + $sql = "SELECT VoiceplanFile.* FROM VoiceplanFile + LEFT JOIN File ON (VoiceplanFile.file_id = File.id) + WHERE $where + ORDER BY voiceplan_id, `create`"; + + $res = $db->query($sql); + + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new VoiceplanFile($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) { + $where = "1=1 "; + + + if(array_key_exists("file_id", $filter)) { + $file_id = $filter['file_id']; + if(is_numeric($file_id)) { + $where .= " AND file_id=$file_id"; + } + } + + if(array_key_exists("voiceplan_id", $filter)) { + $voiceplan_id = $filter['voiceplan_id']; + if(is_numeric($voiceplan_id)) { + $where .= " AND voiceplan_id=$voiceplan_id"; + } + } + + //var_dump($filter);exit; + if(array_key_exists("name", $filter)) { + $name = FronkDB::singleton()->escape($filter['name']); + if($name) { + $where .= " AND name='$name'"; + } + } + + if(array_key_exists("filename", $filter)) { + $filename = FronkDB::singleton()->escape($filter['filename']); + if($filename) { + $where .= " AND File.filename='$filename'"; + } + } + + if(array_key_exists("subfolder", $filter)) { + $subfolder = FronkDB::singleton()->escape($filter['subfolder']); + if($subfolder) { + $where .= " AND File.subfolder='$subfolder'"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} \ No newline at end of file diff --git a/application/Voiceplandestination/Voiceplandestination.php b/application/Voiceplandestination/Voiceplandestination.php new file mode 100644 index 000000000..abe6654c8 --- /dev/null +++ b/application/Voiceplandestination/Voiceplandestination.php @@ -0,0 +1,6 @@ +needlogin=true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me",$me); + + if(!$me->isAdmin()) { + $this->redirect("Dashboard"); + } + } + + protected function addAction() { + $this->layout()->setTemplate("Voiceplandestination/Form"); + + $voiceplans = VoiceplanModel::getAll(); + $this->layout()->set("voiceplans", $voiceplans); + + $voiceplan_id = $this->request->voiceplan_id; + if($voiceplan_id) { + $voiceplan = new Voiceplan($voiceplan_id); + $this->layout()->set("voiceplan", $voiceplan); + } + } + + protected function editAction() { + $id = $this->request->id; + if(!is_numeric($id) || $id < 1) { + $this->layout()->setFlash("Destination nicht gefunden", "error"); + $this->redirect("Voiceplan"); + } + + $destination = new Voiceplandestination($id); + if(!$destination->id) { + $this->layout()->setFlash("Destination nicht gefunden", "error"); + $this->redirect("Voiceplan"); + } + + $this->layout()->set("destination", $destination); + + return $this->addAction(); + } + + protected function saveAction() { + $r = $this->request; + var_dump($r); + + $id = $r->id; + if(is_numeric($id) && $id > 0) { + $mode = "edit"; + $destination = new Voiceplandestination($id); + if(!$destination->id) { + $this->layout()->setFlash("Destination nicht gefunden", "error"); + $this->redirect("Voiceplan"); + } + } else { + $id = false; + $mode = "add"; + } + + $data = []; + $data['voiceplan_id'] = $r->voiceplan_id; + $data['destination'] = $r->destination; + $data['prefix'] = intval($r->prefix); + $data['purchase_price'] = (str_replace(",",".",$r->purchase_price)) ? str_replace(",",".",$r->purchase_price) : 0; + $data['price'] = (str_replace(",",".",$r->price)) ? str_replace(",",".",$r->price) : 0; + + if($r->increment) { + $increments = explode("/",$r->increment); + if(count($increments) != 2) { + $this->layout()->setFlash("Ungültige Taktung", "error"); + $this->layout()->set("destination", VoiceplandestinationModel::create($data)); + return $this->addAction(); + } + + $data["increment_first"] = $increments[0]; + $data["increment"] = $increments[1]; + } + + if(!$data['destination'] || !$data['prefix'] || !$data['voiceplan_id']) { + $this->layout()->setFlash("Destination, Prefix und Tarifpaket sind erforderlich", "error"); + $this->layout()->set("destination", VoiceplandestinationModel::create($data)); + return $this->addAction(); + } + + if($mode == "edit") { + $destination->update($data); + } else { + $destination = VoiceplandestinationModel::create($data); + } + + $id = $destination->save(); + if(!$id) { + $this->layout()->setFlash("Fehler beim Speichern!", "error"); + $this->layout()->set("destination", $destination); + return $this->addAction(); + } + + $this->redirect("Voiceplan", "view", ["id" => $destination->voiceplan_id]); + } +} \ No newline at end of file diff --git a/application/Voiceplandestination/VoiceplandestinationModel.php b/application/Voiceplandestination/VoiceplandestinationModel.php new file mode 100644 index 000000000..9a9548165 --- /dev/null +++ b/application/Voiceplandestination/VoiceplandestinationModel.php @@ -0,0 +1,159 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model->$field = $value; + } + } + + $me = new User(); + $me->loadMe(); + + if($model->create_by === null) { + $model->create_by = $me->id; + } + if($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("Voiceplandestination", "*", "1=1 ORDER BY destination,prefix"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new Voiceplandestination($data); + } + } + return $items; + + } + + public static function getFirst($filter = null) { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + mfLoghandler::singleton()->debug($where); + $res = $db->select("Voiceplandestination", "*", "$where ORDER BY destination,prefix"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new Voiceplandestination($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function count($filter) { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT COUNT(*) as cnt FROM Voiceplandestination + WHERE $where + "; + + $res = $db->query($sql); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + return $data->cnt; + } + return 0; + } + + public static function search($filter, $limit = false) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $sql = "SELECT * FROM Voiceplandestination + WHERE $where + ORDER BY destination,prefix"; + + if(is_array($limit) && count($limit)) { + if(is_numeric($limit['start']) && is_numeric($limit['count'])) { + $sql .= " LIMIT ".$limit['start'].", ".$limit['count']; + } elseif(is_numeric($count)) { + $sql .= " LIMIT ".$limit['count']; + } + } + + $res = $db->query($sql); + + //mfLoghandler::singleton()->debug($sql); + + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new Voiceplandestination($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) { + $db = FronkDB::singleton(); + $where = "1=1 "; + + if(!is_array($filter)) { + return $where; + } + + if(array_key_exists("voiceplan_id", $filter)) { + $voiceplan_id = $filter['voiceplan_id']; + if(is_numeric($voiceplan_id)) { + $where .= " AND voiceplan_id = $voiceplan_id"; + } + } + + if(array_key_exists("name", $filter)) { + $name = $db->escape($filter['name']); + if($name) { + $where .= " AND name like '%$name%'"; + } + } + + if(array_key_exists("destination", $filter)) { + $destination = $db->escape($filter['destination']); + if($destination) { + $where .= " AND destination like '%$destination%'"; + } + } + + if(array_key_exists("prefix", $filter)) { + $prefix = $db->escape($filter['prefix']); + if($prefix) { + $where .= " AND prefix like '%$prefix%'"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} \ No newline at end of file diff --git a/public/assets/css/thetool.css b/public/assets/css/thetool.css index eda01a462..5b6e8ad5d 100644 --- a/public/assets/css/thetool.css +++ b/public/assets/css/thetool.css @@ -348,6 +348,9 @@ td.controls { background-color: orange; } +.bg-lightblue { + background-color: #f4faff; +} .connected { color: limegreen; diff --git a/public/assets/js/pages/calendar.init.js b/public/assets/js/pages/calendar.init.js deleted file mode 100644 index 498113773..000000000 --- a/public/assets/js/pages/calendar.init.js +++ /dev/null @@ -1 +0,0 @@ -!function(o){"use strict";var e=function(){this.$body=o("body"),this.$modal=o("#event-modal"),this.$event="#external-events div.external-event",this.$calendar=o("#calendar"),this.$saveCategoryBtn=o(".save-category"),this.$categoryForm=o("#add-category form"),this.$extEvents=o("#external-events"),this.$calendarObj=null};e.prototype.onDrop=function(e,t){var n=e.data("eventObject"),a=e.attr("data-class"),l=o.extend({},n);l.start=t,a&&(l.className=[a]),this.$calendar.fullCalendar("renderEvent",l,!0),o("#drop-remove").is(":checked")&&e.remove()},e.prototype.onEventClick=function(t,e,n){var a=this,l=o("
");l.append(""),l.append("
"),a.$modal.modal({backdrop:"static"}),a.$modal.find(".delete-event").show().end().find(".save-event").hide().end().find(".modal-body").empty().prepend(l).end().find(".delete-event").unbind("click").click(function(){a.$calendarObj.fullCalendar("removeEvents",function(e){return e._id==t._id}),a.$modal.modal("hide")}),a.$modal.find("form").on("submit",function(){return t.title=l.find("input[type=text]").val(),a.$calendarObj.fullCalendar("updateEvent",t),a.$modal.modal("hide"),!1})},e.prototype.onSelect=function(n,a,e){var l=this;l.$modal.modal({backdrop:"static"});var i=o("
");i.append("
"),i.find(".row").append("
").append("
").find("select[name='category']").append("").append("").append("").append("").append("").append("
"),l.$modal.find(".delete-event").hide().end().find(".save-event").show().end().find(".modal-body").empty().prepend(i).end().find(".save-event").unbind("click").click(function(){i.submit()}),l.$modal.find("form").on("submit",function(){var e=i.find("input[name='title']").val(),t=(i.find("input[name='beginning']").val(),i.find("input[name='ending']").val(),i.find("select[name='category'] option:checked").val());return null!==e&&0!=e.length?(l.$calendarObj.fullCalendar("renderEvent",{title:e,start:n,end:a,allDay:!1,className:t},!0),l.$modal.modal("hide")):alert("You have to give a title to your event"),!1}),l.$calendarObj.fullCalendar("unselect")},e.prototype.enableDrag=function(){o(this.$event).each(function(){var e={title:o.trim(o(this).text())};o(this).data("eventObject",e),o(this).draggable({zIndex:999,revert:!0,revertDuration:0})})},e.prototype.init=function(){this.enableDrag();var e=new Date,t=(e.getDate(),e.getMonth(),e.getFullYear(),new Date(o.now())),n=[{title:"Hey!",start:new Date(o.now()+158e6),className:"bg-warning"},{title:"See John Deo",start:t,end:t,className:"bg-success"},{title:"Meet John Deo",start:new Date(o.now()+168e6),className:"bg-info"},{title:"Buy a Theme",start:new Date(o.now()+338e6),className:"bg-primary"}],a=this;a.$calendarObj=a.$calendar.fullCalendar({slotDuration:"00:15:00",minTime:"08:00:00",maxTime:"19:00:00",defaultView:"month",handleWindowResize:!0,height:o(window).height()-200,header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"},events:n,editable:!0,droppable:!0,eventLimit:!0,selectable:!0,drop:function(e){a.onDrop(o(this),e)},select:function(e,t,n){a.onSelect(e,t,n)},eventClick:function(e,t,n){a.onEventClick(e,t,n)}}),this.$saveCategoryBtn.on("click",function(){var e=a.$categoryForm.find("input[name='category-name']").val(),t=a.$categoryForm.find("select[name='category-color']").val();null!==e&&0!=e.length&&(a.$extEvents.append('
'+e+"
"),a.enableDrag())})},o.CalendarApp=new e,o.CalendarApp.Constructor=e}(window.jQuery),function(e){"use strict";window.jQuery.CalendarApp.init()}(); \ No newline at end of file diff --git a/public/assets/js/pages/chartjs.init.js b/public/assets/js/pages/chartjs.init.js deleted file mode 100644 index e078100e4..000000000 --- a/public/assets/js/pages/chartjs.init.js +++ /dev/null @@ -1 +0,0 @@ -!function(i){"use strict";var e=function(){};e.prototype.respChart=function(e,r,a,o){var t=e.get(0).getContext("2d"),n=i(e).parent();function s(){e.attr("width",i(n).width());switch(r){case"Line":new Chart(t,{type:"line",data:a,options:o});break;case"Doughnut":new Chart(t,{type:"doughnut",data:a,options:o});break;case"Pie":new Chart(t,{type:"pie",data:a,options:o});break;case"Bar":new Chart(t,{type:"bar",data:a,options:o});break;case"Radar":new Chart(t,{type:"radar",data:a,options:o});break;case"PolarArea":new Chart(t,{data:a,type:"polarArea",options:o})}}i(window).resize(s),s()},e.prototype.init=function(){this.respChart(i("#lineChart"),"Line",{labels:["January","February","March","April","May","June","July","August","September","October"],datasets:[{label:"Conversion Rate",fill:!1,backgroundColor:"#25b343",borderColor:"#25b343",data:[44,60,-33,58,-4,57,-89,60,-33,58]},{label:"Average Sale Value",fill:!1,backgroundColor:"#e3eaef",borderColor:"#e3eaef",borderDash:[5,5],data:[-68,41,86,-49,2,65,-64,86,-49,2]}]},{responsive:!0,tooltips:{mode:"index",intersect:!1},hover:{mode:"nearest",intersect:!0},scales:{xAxes:[{display:!0,gridLines:{color:"rgba(0,0,0,0.1)"}}],yAxes:[{gridLines:{color:"rgba(255,255,255,0.05)",fontColor:"#fff"},ticks:{max:100,min:-100,stepSize:20}}]}});this.respChart(i("#doughnut"),"Doughnut",{labels:["Bitcoin","Ethereum","Cardano"],datasets:[{data:[80,50,100],backgroundColor:["#02a8b5","#fd7e14","#e3eaef"],hoverBackgroundColor:["#02a8b5","#fd7e14","#e3eaef"],borderWidth:3,hoverBorderColor:"#fff"}]},{cutoutPercentage:80});this.respChart(i("#pie"),"Pie",{labels:["Desktops","Tablets","Mobiles"],datasets:[{data:[100,121,77],backgroundColor:["#d33319","#675aa9","#e3eaef"],hoverBackgroundColor:["#d33319","#675aa9","#e3eaef"],hoverBorderColor:"#fff"}]});this.respChart(i("#bar"),"Bar",{labels:["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15"],datasets:[{label:"Sales Analytics",backgroundColor:"#4b88e4",borderColor:"#4b88e4",borderWidth:1,hoverBackgroundColor:"#675aa9",hoverBorderColor:"#675aa9",data:[65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40]}]},{legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1},ticks:{max:100,min:20,stepSize:20}}],xAxes:[{barPercentage:.3,gridLines:{color:"rgba(0,0,0,0.05)"}}]}});this.respChart(i("#radar"),"Radar",{labels:["Eating","Drinking","Sleeping","Designing","Coding","Cycling","Running"],datasets:[{label:"Desktops",backgroundColor:"rgba(179,181,198,0.2)",borderColor:"rgba(179,181,198,1)",pointBackgroundColor:"rgba(179,181,198,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(179,181,198,1)",data:[65,59,90,81,56,55,40]},{label:"Tablets",backgroundColor:"rgba(255,99,132,0.2)",borderColor:"rgba(255,99,132,1)",pointBackgroundColor:"rgba(255,99,132,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(255,99,132,1)",data:[28,48,40,19,96,27,100]}]});this.respChart(i("#polarArea"),"PolarArea",{datasets:[{data:[11,16,7,18],backgroundColor:["#297ef6","#45bbe0","#ebeff2","#1ea69a"],label:"My dataset",hoverBorderColor:"#fff"}],labels:["Series 1","Series 2","Series 3","Series 4"]})},i.ChartJs=new e,i.ChartJs.Constructor=e}(window.jQuery),function(e){"use strict";window.jQuery.ChartJs.init()}(); \ No newline at end of file diff --git a/public/assets/js/pages/contract_form.js b/public/assets/js/pages/contract_form.js new file mode 100644 index 000000000..8af7a3cd6 --- /dev/null +++ b/public/assets/js/pages/contract_form.js @@ -0,0 +1,66 @@ +var searchAddressTimer = false; + +$(document).ready(function() { + /* + * Address search + */ + + $("#owner_text").keyup(function() { + var search_string = $("#owner_text").val(); + + /* + * Rate limit search, by waiting 400 ms before really searching + * If input is received while waiting, clear timeout and set it anew + */ + + // clear timeout if it is set + if(searchAddressTimer) { + clearTimeout(searchAddressTimer); + } + // wait for additional input before starting the search + searchAddressTimer = setTimeout(searchAddress, 400, "owner", search_string); + }); + + + + + /* + * Prevent accidental submit + */ + + $('#owner_text').keydown(function() { + if(event.keyCode == 13) { + event.preventDefault(); + return false; + } + }); +}); + +function searchAddress(type = "owner", search_string) { + if(search_string.length < 2) return; + console.log("suchen..."); + + + $.get(baseurl + "Address/Api",{ + do: "findAddress", + search: search_string + }, + function(success) { + console.log(success); + if(success.status != "OK") { + return; + } + showAddressResults(type, success.result); + }, + "json"); + + $("#address_results").show(); +} + +function showAddressResults(type, result) { + console.log(type); + + result.addresses.forEach(function(address) { + cnosole.log(address); + }); +} \ No newline at end of file diff --git a/public/assets/js/pages/dashboard.init.js b/public/assets/js/pages/dashboard.init.js deleted file mode 100644 index 72e4c7df5..000000000 --- a/public/assets/js/pages/dashboard.init.js +++ /dev/null @@ -1 +0,0 @@ -!function(n){"use strict";var o=function(){};o.prototype.respChart=function(o,t,r,e){var i=o.get(0).getContext("2d"),a=n(o).parent();function l(){o.attr("width",n(a).width());switch(t){case"Doughnut":new Chart(i,{type:"doughnut",data:r,options:e});break;case"Bar":new Chart(i,{type:"bar",data:r,options:e})}}n(window).resize(l),l()},o.prototype.init=function(){this.respChart(n("#bar"),"Bar",{labels:["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"],datasets:[{label:"Sales Analytics",backgroundColor:"#00acc1",borderColor:"#00acc1",borderWidth:1,hoverBackgroundColor:"#d4570f",hoverBorderColor:"#d4570f",data:[65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40,32,65,59,80,81,56,89,40]}]},{legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1},ticks:{max:100,min:20,stepSize:20}}],xAxes:[{barPercentage:.3,gridLines:{color:"rgba(0,0,0,0.05)"}}]}});this.respChart(n("#doughnut"),"Doughnut",{labels:["Bitcoin","Ethereum","Cardano"],datasets:[{data:[80,50,100],backgroundColor:["#02a8b5","#f1556c","#e3eaef"],hoverBackgroundColor:["#02a8b5","#f1556c","#e3eaef"],borderWidth:3,hoverBorderColor:"#fff"}]},{cutoutPercentage:80,legend:{position:"bottom",labels:{padding:30}}})},n.ChartJs=new o,n.ChartJs.Constructor=o}(window.jQuery),function(o){"use strict";window.jQuery.ChartJs.init()}(),$(document).ready(function(){var t,r=function(){$("#sparkline1").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"80",chartRangeMax:35,lineColor:"#f1556c",fillColor:"rgba(229, 43, 76, 0.3)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline2").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"80",chartRangeMax:50,lineColor:"#00acc1",fillColor:"rgba(0, 172, 193, 0.2)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline3").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"80",chartRangeMax:35,lineColor:"#f1556c",fillColor:"rgba(229, 43, 76, 0.3)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline4").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"80",chartRangeMax:50,lineColor:"#00acc1",fillColor:"rgba(0, 172, 193, 0.2)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1})};r(),$(window).resize(function(o){clearTimeout(t),t=setTimeout(function(){r()},300)})}); \ No newline at end of file diff --git a/public/assets/js/pages/datatables.init.js b/public/assets/js/pages/datatables.init.js deleted file mode 100644 index f7abdd437..000000000 --- a/public/assets/js/pages/datatables.init.js +++ /dev/null @@ -1 +0,0 @@ -$(document).ready(function(){$("#basic-datatable").DataTable({language:{paginate:{previous:"",next:""}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}});var a=$("#datatable-buttons").DataTable({lengthChange:!1,buttons:["copy","print"],language:{paginate:{previous:"",next:""}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}});$("#selection-datatable").DataTable({select:{style:"multi"},language:{paginate:{previous:"",next:""}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}}),$("#key-datatable").DataTable({keys:!0,language:{paginate:{previous:"",next:""}},drawCallback:function(){$(".dataTables_paginate > .pagination").addClass("pagination-rounded")}}),a.buttons().container().appendTo("#datatable-buttons_wrapper .col-md-6:eq(0)")}); \ No newline at end of file diff --git a/public/assets/js/pages/form-advanced.init.js b/public/assets/js/pages/form-advanced.init.js deleted file mode 100644 index 7ad05b80c..000000000 --- a/public/assets/js/pages/form-advanced.init.js +++ /dev/null @@ -1 +0,0 @@ -!function(i){"use strict";var t=function(){};t.prototype.initCustomSelect=function(){i('[data-plugin="customselect"]').niceSelect()},t.prototype.initSwitchery=function(){i('[data-plugin="switchery"]').each(function(t,e){new Switchery(i(this)[0],i(this).data())})},t.prototype.initSelect2=function(){i('[data-toggle="select2"]').select2()},t.prototype.initMaxLength=function(){i("input#defaultconfig").maxlength({warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("input#thresholdconfig").maxlength({threshold:20,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("input#alloptions").maxlength({alwaysShow:!0,separator:" out of ",preText:"You typed ",postText:" chars available.",validate:!0,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("textarea#textarea").maxlength({alwaysShow:!0,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"}),i("input#placement").maxlength({alwaysShow:!0,placement:"top-left",warningClass:"badge badge-success",limitReachedClass:"badge badge-danger"})},t.prototype.initDateRange=function(){var n={cancelClass:"btn-light",applyButtonClasses:"btn-success"};i('[data-toggle="date-picker"]').each(function(t,e){var a=i.extend({},n,i(e).data());i(e).daterangepicker(a)});var s={startDate:moment().subtract(29,"days"),endDate:moment(),ranges:{Today:[moment(),moment()],Yesterday:[moment().subtract(1,"days"),moment().subtract(1,"days")],"Last 7 Days":[moment().subtract(6,"days"),moment()],"Last 30 Days":[moment().subtract(29,"days"),moment()],"This Month":[moment().startOf("month"),moment().endOf("month")],"Last Month":[moment().subtract(1,"month").startOf("month"),moment().subtract(1,"month").endOf("month")]}};i('[data-toggle="date-picker-range"]').each(function(t,e){var a=i.extend({},s,i(e).data()),n=a.targetDisplay;i(e).daterangepicker(a,function(t,e){n&&i(n).html(t.format("MMMM D, YYYY")+" - "+e.format("MMMM D, YYYY"))})})},t.prototype.initMask=function(){i('[data-toggle="input-mask"]').each(function(t,e){var a=i(e).data("maskFormat"),n=i(e).data("reverse");null!=n?i(e).mask(a,{reverse:n}):i(e).mask(a)})},t.prototype.init=function(){this.initCustomSelect(),this.initSwitchery(),this.initSelect2(),this.initMaxLength(),this.initDateRange(),this.initMask()},i.Components=new t,i.Components.Constructor=t}(window.jQuery),function(t){"use strict";window.jQuery.Components.init()}(); \ No newline at end of file diff --git a/public/assets/js/pages/form-editor.init.js b/public/assets/js/pages/form-editor.init.js deleted file mode 100644 index 52e71da4d..000000000 --- a/public/assets/js/pages/form-editor.init.js +++ /dev/null @@ -1 +0,0 @@ -$(document).ready(function(){$("#summernote-editor").summernote({height:250,minHeight:null,maxHeight:null,focus:!1}),$("#summernote-inline").summernote({airMode:!0})}); \ No newline at end of file diff --git a/public/assets/js/pages/maps.init.js b/public/assets/js/pages/maps.init.js deleted file mode 100644 index 9f6e98408..000000000 --- a/public/assets/js/pages/maps.init.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){"use strict";var a=function(){};a.prototype.createBasic=function(a){return new GMaps({div:a,lat:-12.043333,lng:-77.028333})},a.prototype.createMarkers=function(a){var e=new GMaps({div:a,lat:-12.043333,lng:-77.028333});return e.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")}}),e.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),e},a.prototype.createWithStreetview=function(a,e,t){return GMaps.createPanorama({el:a,lat:e,lng:t})},a.prototype.createMapByType=function(a,e,t){var n=new GMaps({div:a,lat:e,lng:t,mapTypeControlOptions:{mapTypeIds:["hybrid","roadmap","satellite","terrain","osm","cloudmade"]}});return n.addMapType("osm",{getTileUrl:function(a,e){return"http://tile.openstreetmap.org/"+e+"/"+a.x+"/"+a.y+".png"},tileSize:new google.maps.Size(256,256),name:"OpenStreetMap",maxZoom:18}),n.addMapType("cloudmade",{getTileUrl:function(a,e){return"http://b.tile.cloudmade.com/8ee2a50541944fb9bcedded5165f09d9/1/256/"+e+"/"+a.x+"/"+a.y+".png"},tileSize:new google.maps.Size(256,256),name:"CloudMade",maxZoom:18}),n.setMapTypeId("osm"),n},a.prototype.init=function(){var a=this;e(document).ready(function(){a.createBasic("#gmaps-basic"),a.createMarkers("#gmaps-markers"),a.createWithStreetview("#panorama",40.7295174,-73.9986496),a.createMapByType("#gmaps-types",-12.043333,-77.028333)})},e.GoogleMap=new a,e.GoogleMap.Constructor=a}(window.jQuery),function(a){"use strict";window.jQuery.GoogleMap.init()}(),function(a){"use strict";var e=function(){};e.prototype.init=function(){a("#world-map-markers").vectorMap({map:"world_mill_en",normalizeFunction:"polynomial",hoverOpacity:.7,hoverColor:!1,regionStyle:{initial:{fill:"#98a6ad"}},markerStyle:{initial:{r:9,fill:"#00acc1","fill-opacity":.9,stroke:"#fff","stroke-width":7,"stroke-opacity":.4},hover:{stroke:"#fff","fill-opacity":1,"stroke-width":1.5}},backgroundColor:"transparent",markers:[{latLng:[41.9,12.45],name:"Vatican City"},{latLng:[43.73,7.41],name:"Monaco"},{latLng:[-.52,166.93],name:"Nauru"},{latLng:[-8.51,179.21],name:"Tuvalu"},{latLng:[43.93,12.46],name:"San Marino"},{latLng:[47.14,9.52],name:"Liechtenstein"},{latLng:[7.11,171.06],name:"Marshall Islands"},{latLng:[17.3,-62.73],name:"Saint Kitts and Nevis"},{latLng:[3.2,73.22],name:"Maldives"},{latLng:[35.88,14.5],name:"Malta"},{latLng:[12.05,-61.75],name:"Grenada"},{latLng:[13.16,-61.23],name:"Saint Vincent and the Grenadines"},{latLng:[13.16,-59.55],name:"Barbados"},{latLng:[17.11,-61.85],name:"Antigua and Barbuda"},{latLng:[-4.61,55.45],name:"Seychelles"},{latLng:[7.35,134.46],name:"Palau"},{latLng:[42.5,1.51],name:"Andorra"},{latLng:[14.01,-60.98],name:"Saint Lucia"},{latLng:[6.91,158.18],name:"Federated States of Micronesia"},{latLng:[1.3,103.8],name:"Singapore"},{latLng:[.33,6.73],name:"São Tomé and Príncipe"}]}),a("#usa-vectormap").vectorMap({map:"us_merc_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}}),a("#india-vectormap").vectorMap({map:"in_mill_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}}),a("#australia-vectormap").vectorMap({map:"au_mill_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}}),a("#chicago-vectormap").vectorMap({map:"us-il-chicago_mill_en",backgroundColor:"transparent",regionStyle:{initial:{fill:"#00acc1"}}})},a.VectorMap=new e,a.VectorMap.Constructor=e}(window.jQuery),function(a){"use strict";window.jQuery.VectorMap.init()}(); \ No newline at end of file diff --git a/public/assets/js/pages/range-sliders.init.js b/public/assets/js/pages/range-sliders.init.js deleted file mode 100644 index b88c7ca34..000000000 --- a/public/assets/js/pages/range-sliders.init.js +++ /dev/null @@ -1 +0,0 @@ -$(document).ready(function(){$("#range_01").ionRangeSlider({skin:"modern"}),$("#range_02").ionRangeSlider({skin:"modern",min:100,max:1e3,from:550}),$("#range_03").ionRangeSlider({skin:"modern",type:"double",grid:!0,min:0,max:1e3,from:200,to:800,prefix:"$"}),$("#range_04").ionRangeSlider({skin:"modern",type:"double",grid:!0,min:-1e3,max:1e3,from:-500,to:500}),$("#range_05").ionRangeSlider({skin:"modern",type:"double",grid:!0,min:-1e3,max:1e3,from:-500,to:500,step:250}),$("#range_06").ionRangeSlider({skin:"modern",grid:!0,from:3,values:["January","February","March","April","May","June","July","August","September","October","November","December"]}),$("#range_07").ionRangeSlider({skin:"modern",grid:!0,min:1e3,max:1e6,from:2e5,step:1e3,prettify_enabled:!0}),$("#range_08").ionRangeSlider({skin:"modern",min:100,max:1e3,from:550,disable:!0}),$("#range_09").ionRangeSlider({skin:"modern",grid:!0,min:18,max:70,from:30,prefix:"Age ",max_postfix:"+"}),$("#range_10").ionRangeSlider({skin:"modern",type:"double",min:100,max:200,from:145,to:155,prefix:"Weight: ",postfix:" million pounds",decorate_both:!0}),$("#range_11").ionRangeSlider({skin:"modern",type:"single",grid:!0,min:-90,max:90,from:0,postfix:"°"}),$("#range_12").ionRangeSlider({skin:"modern",type:"double",min:1e3,max:2e3,from:1200,to:1800,hide_min_max:!0,hide_from_to:!0,grid:!0})}); \ No newline at end of file diff --git a/public/assets/js/pages/sparkline.init.js b/public/assets/js/pages/sparkline.init.js deleted file mode 100644 index f2eba5a06..000000000 --- a/public/assets/js/pages/sparkline.init.js +++ /dev/null @@ -1 +0,0 @@ -$(document).ready(function(){var o,l=function(){$("#sparkline1").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"165",chartRangeMax:50,lineColor:"#00acc1",fillColor:"rgba(0, 172, 193, 0.2)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline1").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"165",chartRangeMax:40,lineColor:"#f1556c",fillColor:"rgba(229, 43, 76, 0.3)",composite:!0,highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1,lineWidth:1}),$("#sparkline2").sparkline([3,6,7,8,6,4,7,10,12,7,4,9,12,13,11,12],{type:"bar",height:"165",barWidth:"10",barSpacing:"3",barColor:"#00acc1"}),$("#sparkline3").sparkline([20,40,30,10],{type:"pie",width:"165",height:"165",sliceColors:["#00acc1","#4b88e4","#e3eaef","#fd7e14"]}),$("#sparkline4").sparkline([0,23,43,35,44,45,56,37,40],{type:"line",width:"100%",height:"165",chartRangeMax:50,lineColor:"#675aa9",fillColor:"transparent",lineWidth:2,highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)",maxSpotColor:!1,minSpotColor:!1,spotColor:!1}),$("#sparkline4").sparkline([25,23,26,24,25,32,30,24,19],{type:"line",width:"100%",height:"165",chartRangeMax:40,lineColor:"#f672a7",fillColor:"transparent",composite:!0,lineWidth:2,maxSpotColor:!1,minSpotColor:!1,spotColor:!1,highlightLineColor:"rgba(0,0,0,1)",highlightSpotColor:"rgba(0,0,0,1)"}),$("#sparkline5").sparkline([4,6,7,7,4,3,2,1,4,4,5,6,3,4,5,8,7,6,9,3,2,4,1,5,6,4,3,7],{type:"discrete",width:"280",height:"165",lineColor:"#36404c"}),$("#sparkline6").sparkline([3,6,7,8,6,4,7,10,12,7,4,9,12,13,11,12],{type:"line",width:"100%",height:"165",lineColor:"#e3eaef",lineWidth:2,fillColor:"rgba(227,234,239,0.3)",highlightLineColor:"rgba(0,0,0,.1)",highlightSpotColor:"rgba(0,0,0,.2)"}),$("#sparkline6").sparkline([3,6,7,8,6,4,7,10,12,7,4,9,12,13,11,12],{type:"bar",height:"165",barWidth:"10",barSpacing:"5",composite:!0,barColor:"#d33319"})};l(),$(window).resize(function(i){clearTimeout(o),o=setTimeout(function(){l()},300)})}); \ No newline at end of file diff --git a/public/assets/js/pages/sweet-alerts.init.js b/public/assets/js/pages/sweet-alerts.init.js deleted file mode 100644 index 788631c7c..000000000 --- a/public/assets/js/pages/sweet-alerts.init.js +++ /dev/null @@ -1 +0,0 @@ -!function(t){"use strict";var e=function(){};e.prototype.init=function(){t("#sa-basic").on("click",function(){Swal.fire({title:"Any fool can use a computer!",confirmButtonColor:"#00acc1"})}),t("#sa-title").click(function(){Swal.fire({title:"The Internet?",text:"That thing is still around?",type:"question",confirmButtonColor:"#00acc1"})}),t("#sa-success").click(function(){Swal.fire({title:"Good job!",text:"You clicked the button!",type:"success",confirmButtonColor:"#00acc1"})}),t("#sa-error").click(function(){Swal.fire({type:"error",title:"Oops...",text:"Something went wrong!",confirmButtonColor:"#00acc1",footer:'Why do I have this issue?'})}),t("#sa-long-content").click(function(){Swal.fire({imageUrl:"https://placeholder.pics/svg/300x1500",imageHeight:1500,imageAlt:"A tall image",confirmButtonColor:"#00acc1"})}),t("#sa-custom-position").click(function(){Swal.fire({position:"top-end",type:"success",title:"Your work has been saved",showConfirmButton:!1,timer:1500})}),t("#sa-warning").click(function(){Swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",type:"warning",showCancelButton:!0,confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",confirmButtonText:"Yes, delete it!"}).then(function(t){t.value&&Swal.fire("Deleted!","Your file has been deleted.","success")})}),t("#sa-params").click(function(){Swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",type:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete it!",cancelButtonText:"No, cancel!",confirmButtonClass:"btn btn-success mt-2",cancelButtonClass:"btn btn-danger ml-2 mt-2",buttonsStyling:!1}).then(function(t){t.value?Swal.fire({title:"Deleted!",text:"Your file has been deleted.",type:"success"}):t.dismiss===Swal.DismissReason.cancel&&Swal.fire({title:"Cancelled",text:"Your imaginary file is safe :)",type:"error"})})}),t("#sa-image").click(function(){Swal.fire({title:"Simulor",text:"Responsive Bootstrap 4 Admin Dashboard",imageUrl:"assets/images/logo-sm.png",imageHeight:50,animation:!1,confirmButtonColor:"#00acc1"})}),t("#sa-close").click(function(){var t;Swal.fire({title:"Auto close alert!",html:"I will close in seconds.",timer:2e3,onBeforeOpen:function(){Swal.showLoading(),t=setInterval(function(){Swal.getContent().querySelector("strong").textContent=Swal.getTimerLeft()},100)},onClose:function(){clearInterval(t)}}).then(function(t){t.dismiss===Swal.DismissReason.timer&&console.log("I was closed by the timer")})}),t("#custom-html-alert").click(function(){Swal.fire({title:"HTML example",type:"info",html:'You can use bold text, links and other HTML tags',showCloseButton:!0,showCancelButton:!0,confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",confirmButtonText:' Great!',cancelButtonText:''})}),t("#custom-padding-width-alert").click(function(){Swal.fire({title:"Custom width, padding, background.",width:600,padding:100,confirmButtonColor:"#00acc1",background:"#fff url(//subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/geometry.png)"})}),t("#ajax-alert").click(function(){Swal.fire({title:"Submit your Github username",input:"text",inputAttributes:{autocapitalize:"off"},showCancelButton:!0,confirmButtonText:"Look up",confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",showLoaderOnConfirm:!0,preConfirm:function(t){return fetch("//api.github.com/users/"+t).then(function(t){if(!t.ok)throw new Error(t.statusText);return t.json()}).catch(function(t){Swal.showValidationMessage("Request failed: "+t)})},allowOutsideClick:function(){Swal.isLoading()}}).then(function(t){t.value&&Swal.fire({title:t.value.login+"'s avatar",imageUrl:t.value.avatar_url})})}),t("#chaining-alert").click(function(){Swal.mixin({input:"text",confirmButtonText:"Next →",showCancelButton:!0,confirmButtonColor:"#00acc1",cancelButtonColor:"#f1556c",progressSteps:["1","2","3"]}).queue([{title:"Question 1",text:"Chaining swal2 modals is easy"},"Question 2","Question 3"]).then(function(t){t.value&&Swal.fire({title:"All done!",html:"Your answers:
"+JSON.stringify(t.value)+"
",confirmButtonText:"Lovely!"})})}),t("#dynamic-alert").click(function(){swal.queue([{title:"Your public IP",confirmButtonText:"Show my public IP",confirmButtonColor:"#00acc1",text:"Your public IP will be received via AJAX request",showLoaderOnConfirm:!0,preConfirm:function(){return new Promise(function(e){t.get("https://api.ipify.org?format=json").done(function(t){swal.insertQueueStep(t.ip),e()})})}}])})},t.SweetAlert=new e,t.SweetAlert.Constructor=e}(window.jQuery),function(t){"use strict";window.jQuery.SweetAlert.init()}(); \ No newline at end of file diff --git a/public/assets/js/pages/toastr.init.js b/public/assets/js/pages/toastr.init.js deleted file mode 100644 index 747e61b26..000000000 --- a/public/assets/js/pages/toastr.init.js +++ /dev/null @@ -1 +0,0 @@ -$(function(){var k,f=-1,m=0;$("#showtoast").click(function(){var t,o,e=$("#toastTypeGroup input:radio:checked").val(),a=$("#message1").val(),n=$("#title").val()||"",s=$("#showDuration"),i=$("#hideDuration"),r=$("#timeOut"),l=$("#extendedTimeOut"),c=$("#showEasing"),p=$("#hideEasing"),d=$("#showMethod"),h=$("#hideMethod"),u=m++,g=$("#addClear").prop("checked");toastr.options={closeButton:$("#closeButton").prop("checked"),debug:$("#debugInfo").prop("checked"),newestOnTop:$("#newestOnTop").prop("checked"),progressBar:$("#progressBar").prop("checked"),positionClass:$("#positionGroup input:radio:checked").val()||"toast-top-right",preventDuplicates:$("#preventDuplicates").prop("checked"),onclick:null},$("#addBehaviorOnToastClick").prop("checked")&&(toastr.options.onclick=function(){alert("You can perform some custom action after a toast goes away")}),s.val().length&&(toastr.options.showDuration=s.val()),i.val().length&&(toastr.options.hideDuration=i.val()),r.val().length&&(toastr.options.timeOut=g?0:r.val()),l.val().length&&(toastr.options.extendedTimeOut=g?0:l.val()),c.val().length&&(toastr.options.showEasing=c.val()),p.val().length&&(toastr.options.hideEasing=p.val()),d.val().length&&(toastr.options.showMethod=d.val()),h.val().length&&(toastr.options.hideMethod=h.val()),g&&(t=(t=a)||"Clear itself?",a=t+='

',toastr.options.tapToDismiss=!1),a||(++f===(o=["My name is Inigo Montoya. You killed my father. Prepare to die!","Are you the six fingered man?","Inconceivable!","I do not think that means what you think it means.","Have fun storming the castle!"]).length&&(f=0),a=o[f]),$("#toastrOptions").text('Command: toastr["'+e+'"]("'+a+(n?'", "'+n:"")+'")\n\ntoastr.options = '+JSON.stringify(toastr.options,null,2));var v=toastr[e](a,n);void 0!==(k=v)&&(v.find("#okBtn").length&&v.delegate("#okBtn","click",function(){alert("you clicked me. i was toast #"+u+". goodbye!"),v.remove()}),v.find("#surpriseBtn").length&&v.delegate("#surpriseBtn","click",function(){alert("Surprise! you clicked me. i was toast #"+u+". You could perform an action here.")}),v.find(".clear").length&&v.delegate(".clear","click",function(){toastr.clear(v,{force:!0})}))}),$("#clearlasttoast").click(function(){toastr.clear(k)}),$("#cleartoasts").click(function(){toastr.clear()})}); \ No newline at end of file