Bläddra i källkod

some checkpoint for serverhosts

szollosil 1 år sedan
förälder
incheckning
b909e1c229

+ 25 - 10
custom/bbus/class/api_bbus.class.php

@@ -1866,7 +1866,7 @@ class BBus extends DolibarrApi
 	 */
 	public function invoice(array $invoice, array $lines, array $payment, string $cardPaymentLog = '', string $sendId = '', $server_host_curl = false, $company_invoice = '')
 	{
-		global $user;
+		global $user, $conf;
 		$lockLabel = 'CREATE_INVOICE';
 		if (empty($sendId)) {
 			$sendId = substr(md5(rand()), 0, 8);
@@ -1955,16 +1955,31 @@ class BBus extends DolibarrApi
 		ApiBbusLog::appLog("{$sendId}####################################################################");
 		dol_syslog("{$sendId}####################################################################", LOG_INFO, 0);
 
-		$BookingApi->updateBbticket(get_object_vars($invoiceObj), null);
 		#-------------- UPDATE BTICKET --------------
-		ApiBbusLog::appLog("{$sendId}: Update bbticket with curl");
-		$invoiceForCurl['id'] = $invoiceObj->id;
-		$invoiceForCurl['ref'] = $invoiceObj->ref;
-		//$array['fk_booking_history'] = null;
-		$array['invoice'] = $invoiceForCurl;
-		$updateBBticketPostFields = json_encode($array);
-		ApiBbusLog::appLog("{$updateBBticketPostFields}");
-		$this->curlRunner('bookingapi/curlUpdateBbticket', $updateBBticketPostFields, 'POST', true);
+		foreach ($products as $product) {
+			$server_host = '';
+			$proSQL = "SELECT bbs.server_host FROM llx_product as pr 
+			INNER JOIN llx_product_extrafields as pre ON pre.fk_object = pr.rowid
+			INNER JOIN llx_bbus_basicservices as bbs ON bbs.rowid = CAST(pre.basic_service AS integer)
+			WHERE pr.rowid = {$product['id']}";
+			$proResult = $this->db->query($proSQL);
+			if ($this->db->num_rows($proResult) > 0) {
+				while ($proRow = $this->db->fetch_object($proResult)) {
+					$server_host = $proRow->server_host;
+				}
+			}
+			if ($server_host == $conf->global->LOCAL_SERVER_HOST) {
+				$BookingApi->updateBbticket(get_object_vars($invoiceObj), null);
+			} else {
+				ApiBbusLog::appLog("{$sendId}: Update bbticket with curl");
+				$invoiceForCurl['id'] = $invoiceObj->id;
+				$invoiceForCurl['ref'] = $invoiceObj->ref;
+				$array['invoice'] = $invoiceForCurl;
+				$updateBBticketPostFields = json_encode($array);
+				ApiBbusLog::appLog("{$updateBBticketPostFields}");
+				$this->curlRunner('bookingapi/curlUpdateBbticket', $updateBBticketPostFields, 'POST', true);
+			}
+		}
 
 		return [
 			'sendId' => $sendId,

+ 25 - 9
custom/bbus/class/bbtickethandler.class.php

@@ -35,7 +35,7 @@ class BbTicketHandler
         if ($object->subprice >= 0) {
             $GroupUsersObj = new GroupUsers($this->db);
             $groupUsersResult = $GroupUsersObj->fetchAll('DESC', 'rowid', 1, 0, ['customsql' => "fk_user = {$this->user->id}"]);
-            foreach($groupUsersResult as $group){
+            foreach ($groupUsersResult as $group) {
                 $group_id = $group->fk_settlements_group;
             }
             $factureObj = new Facture($this->db);
@@ -86,12 +86,13 @@ class BbTicketHandler
         }
     }
 
-    public function addTicketForPrintingCrossShopping($object){
+    public function addTicketForPrintingCrossShopping($object)
+    {
         $helper = new ApiBBusHelper();
         $ticketIds = [];
         $this->getProductAssociationFils($object);
         $params = '{"ref":"' . $object->invoice_number . '"}';
-		$this->datec = $this->curlRunner('bbus/curlgetdatecfromfacture', $params, 'POST', true);
+        $this->datec = $this->curlRunner('bbus/curlgetdatecfromfacture', $params, 'POST', true);
         $booking_history = $helper->getbookingHistoryId($object->invoice_number);
         foreach ($object->fk_product as $record) {
             $ticket = $this->createTicketObject($this->pere[0], $record, null, $object->invoice_number, 10000, $booking_history);
@@ -114,7 +115,7 @@ class BbTicketHandler
         foreach ($object->fk_product as $record) {
             $GroupUsersObj = new GroupUsers($this->db);
             $groupUsersResult = $GroupUsersObj->fetchAll('DESC', 'rowid', 1, 0, ['customsql' => "fk_user = {$this->user->id}"]);
-            foreach($groupUsersResult as $group){
+            foreach ($groupUsersResult as $group) {
                 $group_id = $group->fk_settlements_group;
             }
             $ticket = $this->createTicketObject($this->pere[0], $record, $object->fk_facture, $object->invoice_number, $group_id, $booking_history_id);
@@ -127,11 +128,12 @@ class BbTicketHandler
         return $ticketIds;
     }
 
-    private function getBookingHistoryId($invoice_number){
+    private function getBookingHistoryId($invoice_number)
+    {
         $sql = "SELECT rowid FROM llx_booking_bookinghistory WHERE invoice_number = '{$invoice_number}'";
         $result = $this->db->query($sql);
-        if($this->db->num_rows($result) > 0){
-            while($row = $this->db->fetch_object($result)){
+        if ($this->db->num_rows($result) > 0) {
+            while ($row = $this->db->fetch_object($result)) {
                 return $row->rowid;
             }
         }
@@ -140,7 +142,7 @@ class BbTicketHandler
 
     private function getProductAssociationFils($object)
     {
-        $arrayForIN = implode(",",$object->fk_product);
+        $arrayForIN = implode(",", $object->fk_product);
         $sql = "SELECT fk_product_pere FROM " . $this->db->prefix() . "product_association WHERE fk_product_fils IN (" . $arrayForIN . ")";
         $result = $this->db->query($sql);
         if (pg_num_rows($result) == 0) {
@@ -229,4 +231,18 @@ class BbTicketHandler
         $available_at = date('Y-m-d H:i:s', strtotime($date . ' +' . $validperiod . ' days'));
         return $available_at;
     }
-}
+
+    public function getCorrectBasicServiceArray($SERVER_HOST)
+    {
+        global $db;
+        $basicservicesArray = [];
+        $basicServicesSQL = "SELECT bs.rowid FROM llx_bbus_basicservices as bs WHERE server_host = '{$SERVER_HOST}' ORDER BY rowid ASC";
+        $basicServiceResult = $db->query($basicServicesSQL);
+        if ($db->num_rows($basicServiceResult) > 0) {
+            while ($basicServiceRow = $db->fetch_object($basicServiceResult)) {
+                $basicservicesArray[] = $basicServiceRow->rowid;
+            }
+        }
+        return $basicservicesArray;
+    }
+}

+ 6 - 3
custom/bbus/core/triggers/interface_99_modBBus_BBusTriggers.class.php

@@ -131,13 +131,16 @@ class InterfaceBBusTriggers extends DolibarrTriggers
 		// Or you can execute some code here
 		switch ($action) {
 			case 'LINEBILL_INSERT':
+				global $conf;
+				$bbTicketHandler = new BbTicketHandler();
 				$productObj = new Product($this->db);
 				$productObj->fetch($object->fk_product);
-				if ($productObj->array_options['options_basic_service'] == '3'   || $productObj->array_options['options_basic_service'] == '4') {
+				$basicservicesLocalArray = $bbTicketHandler->getCorrectBasicServiceArray($conf->global->LOCAL_SERVER_HOST);
+				$basicservicesCurlArray = $bbTicketHandler->getCorrectBasicServiceArray($conf->global->CURL_SERVER_HOST);
+				if (in_array($productObj->array_options['options_basic_service'], $basicservicesLocalArray)) {
 					ApiBbusLog::appLog("LINEBILL_INSERT->basic_service = " . $productObj->array_options['options_basic_service']);
-					$bbTicketHandler = new BbTicketHandler();
 					$bbTicketHandler->addTicket($object, $action);
-				} else if($productObj->array_options['options_basic_service'] == '1' || $productObj->array_options['options_basic_service'] == '2' || $productObj->array_options['options_basic_service'] == '5'){
+				} else if(in_array($productObj->array_options['options_basic_service'], $basicservicesCurlArray )){
 					ApiBbusLog::appLog("LINEBILL_INSERT->basic_service = " . $productObj->array_options['options_basic_service']);
 					$factureObj = new Facture($this->db);
 					$result = $factureObj->fetch($object->fk_facture);

+ 0 - 1
custom/booking/class/api_booking.class.php

@@ -894,7 +894,6 @@ class BookingApi extends DolibarrApi
 		} else {
 			ApiBbusLog::appLog("{$this->db->error()}");
 			ApiBbusLog::appLog("api_booking (Excelia): updateBbticket error");
-			throw new RestException(401, 'api_booking: updateBbticket error');
 		}
 	}
 

+ 42 - 0
custom/voucher/class/helper.class.php

@@ -33,5 +33,47 @@ class VoucherHelper
         $inputFieldString .= '</select>';
         return $inputFieldString;
     }
+
+    function JSGeneratorForSelectInput($id){
+        print '<script>$("#' . $id . '").select2({
+            dir: "ltr",
+            width: "resolve",
+            minimumInputLength: 0,
+            language: select2arrayoflanguage,
+            matcher: function(params, data) {
+                if ($.trim(params.term) === "") {
+                    return data;
+                }
+                keywords = (params.term).split(" ");
+                for (var i = 0; i < keywords.length; i++) {
+                    if (((data.text).toUpperCase()).indexOf((keywords[i]).toUpperCase()) == -1) {
+                        return null;
+                    }
+                }
+                return data;
+            },
+            theme: "default",
+            containerCssClass: ":all:",
+            selectionCssClass: ":all:",
+            templateResult: function(data, container) {
+                if (data.element) {
+                    $(container).addClass($(data.element).attr("class"));
+                }
+                if (data.id == -1 && $(data.element).attr("data-html") == undefined) {
+                    return "&nbsp;";
+                }
+                if ($(data.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(data.element).attr("data-html")); // If property html set, we decode html entities and use this
+                return data.text;
+            },
+            templateSelection: function(selection) {
+                if (selection.id == -1) return "<span class="placeholder">" + selection.text + "</span>";
+                return selection.text;
+            },
+            escapeMarkup: function(markup) {
+                return markup;
+            },
+            dropdownCssClass: "ui-dialog"
+        });</script>';
+    }
 }
 ?>

+ 16 - 5
custom/voucher/core/tpl/commonfields_add.tpl.php

@@ -44,7 +44,7 @@ foreach ($object->fields as $key => $val) {
 		continue; // We don't want this field
 	}
 
-	print '<tr class="field_'.$key.'">';
+	print '<tr class="field_' . $key . '">';
 	print '<td';
 	print ' class="titlefieldcreate';
 	if (isset($val['notnull']) && $val['notnull'] > 0) {
@@ -72,9 +72,9 @@ foreach ($object->fields as $key => $val) {
 	} elseif ($val['type'] == 'text' || $val['type'] == 'html') {
 		$value = GETPOST($key, 'restricthtml');
 	} elseif ($val['type'] == 'date') {
-		$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
+		$value = dol_mktime(12, 0, 0, GETPOST($key . 'month', 'int'), GETPOST($key . 'day', 'int'), GETPOST($key . 'year', 'int'));
 	} elseif ($val['type'] == 'datetime') {
-		$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
+		$value = dol_mktime(GETPOST($key . 'hour', 'int'), GETPOST($key . 'min', 'int'), 0, GETPOST($key . 'month', 'int'), GETPOST($key . 'day', 'int'), GETPOST($key . 'year', 'int'));
 	} elseif ($val['type'] == 'boolean') {
 		$value = (GETPOST($key) == 'on' ? 1 : 0);
 	} elseif ($val['type'] == 'price') {
@@ -90,6 +90,10 @@ foreach ($object->fields as $key => $val) {
 		if ($key == 'lang') {
 			print img_picto('', 'language', 'class="pictofixedwidth"');
 			print $formadmin->select_language($value, $key, 0, null, 1, 0, 0, 'minwidth300', 2);
+		} elseif ($key == 'fk_product') {
+			print $VoucherHelper->showInputField($fk_product);
+			print '<!-- ' . $key . ' JS for SELECT input -->';
+			print $VoucherHelper->JSGeneratorForSelectInput($key);
 		} else {
 			print $VoucherHelper->showInputField($fk_product);
 		}
@@ -102,9 +106,16 @@ foreach ($object->fields as $key => $val) {
 	print '</tr>';
 	print '<tr id="eventDateSelector" class="' . $display . '">
 		<td class="titlefieldcreate fieldrequired">Dátum</td>
-		<td class="valuefieldcreateflat"><input style="width: 250px;" type="text" id="date-range" name="date_range" date-start="2024-09-02" date-end="2024-09-02"></td>
+		
+		<td class="valuefieldcreateflat"><input type="date" id="date" name="date">
+    	<p class="error-message" id="error-message">Ez a dátum nem választható!</p></td>
 		</tr>';
+	print '<tr id="eventTimeSelector" class="TDhideClass">
+	<td class="titlefieldcreate fieldrequired">Időpont</td>
+	<td><select id="eventId" name="eventId">
+    </select>
+	</td></tr>';
 }
 
 ?>
-<!-- END PHP TEMPLATE commonfields_add.tpl.php -->
+<!-- END PHP TEMPLATE commonfields_add.tpl.php -->

+ 38 - 361
custom/voucher/voucherhistory_card.php

@@ -82,6 +82,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
 require_once DOL_DOCUMENT_ROOT . '/custom/voucher/class/helper.class.php';
 require_once DOL_DOCUMENT_ROOT . '/custom/voucher/class/voucherhistory.class.php';
+require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
+
 dol_include_once('/voucher/class/voucherhistory.class.php');
 dol_include_once('/voucher/lib/voucher_voucherhistory.lib.php');
 
@@ -102,6 +104,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
 $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
 
 $fk_product = GETPOST('fk_product', 'int');
+$eventId = GETPOST('eventId', 'int');
 
 // Initialize technical objects
 $object = new Voucherhistory($db);
@@ -190,6 +193,36 @@ if (empty($reshook)) {
 
 	$triggermodname = 'VOUCHER_VOUCHERHISTORY_MODIFY'; // Name of trigger action code to execute when we modify record
 
+	if ($action == 'add') {
+		# Search Product
+		$productObj = new Product($db);
+		$productResult = $productObj->fetch($product_id);
+		print_r($productResult);exit;
+		# Search bundle
+		# Create BBTicket
+		$newticket = new BbTicket($db);
+		$newticket->fk_facture = null;
+		$newticket->bundle_id = $fk_product;
+		$newticket->usable_occasions = $ticket->usable_occasions;
+		$newticket->usage = $ticket->usage;
+		$newticket->available_at = $ticket->available_at;
+		$newticket->validated_at = $ticket->validated_at;
+		$newticket->expire_at = $ticket->expire_at;
+		$newticket->ticket_id = $ticket->ticket_id;
+		$newticket->fk_settlements_group_id = $group_id;
+		if ($newticket->create($this->user) == -1) {
+			dol_syslog("Nem sikerult a ticketek mentese. facture_id: " . $object->fk_facture);
+		}
+		# Save VoucherHistory OBject
+		$object->fk_bundle = $fk_product;
+		$object->fk_product = $fk_product;
+		$object->fk_event = $eventId;
+		$object->fk_ticket = 100;
+		$object->pdf_path = 'asd';
+		$object->date_creation = dol_now();
+		$object->status = "0";
+	}
+
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
 	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
 
@@ -236,21 +269,6 @@ $title = $langs->trans("Voucherhistory");
 $help_url = '';
 llxHeader('', $title, $help_url);
 
-// Example : Adding jquery code
-// print '<script type="text/javascript">
-// jQuery(document).ready(function() {
-// 	function init_myfunc()
-// 	{
-// 		jQuery("#myid").removeAttr(\'disabled\');
-// 		jQuery("#myid").attr(\'disabled\',\'disabled\');
-// 	}
-// 	init_myfunc();
-// 	jQuery("#mybutton").click(function() {
-// 		init_myfunc();
-// 	});
-// });
-// </script>';
-
 
 // Part to create
 if ($action == 'create') {
@@ -279,6 +297,7 @@ if ($action == 'create') {
 
 	// Common attributes
 	include DOL_DOCUMENT_ROOT . '/custom/voucher/core/tpl/commonfields_add.tpl.php';
+	//include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
 
 	// Other attributes
 	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
@@ -624,355 +643,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
 
 	include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
 }
-
+//print_r($_REQUEST);
 // End of page
 llxFooter();
 $db->close();
+echo '<link rel="stylesheet" type="text/css" href="' . dol_buildpath('/custom/voucher/css/voucher.css', 1) . '">';
+echo '<script type="text/javascript" src="' . dol_buildpath('/custom/voucher/scripts/voucher.js', 1) . '"></script>';
 ?>
-
-<style>
-	td.in-range:not(.end-date) {
-		background-color: #c8e4f1 !important;
-	}
-
-	.hide {
-		display: none;
-	}
-
-	.timeSelectBox {
-		display: inline-block;
-		width: 150px;
-		margin: 0 10px 0 0;
-		vertical-align: top;
-		border: 1px silver solid;
-		padding: 5px 10px;
-	}
-
-	input#date-range {
-		padding: 0 10px;
-	}
-
-	.time_slider {
-		display: none !important;
-		height: 0px !important;
-	}
-	.TDhideClass {
-		display: none !important;
-	}
-</style>
 <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
 <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
-<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css">
-<script>
-	var gen = {
-		setElem: "ok",
-		init: function() {
-			var now = new Date;
-			$("#date-range").attr("date-start", now.toISOString().slice(0, 10));
-			$("#date-range").attr("date-end", now.toISOString().slice(0, 10));
-			$(document).on("click", "#eventGen", function() {
-				var elem = $(this);
-				var sendAjax = false;
-				var data = {
-					action: "generateEvents",
-					id_eventdetails: 1,
-					token: "151c561ba2f4ffff0adfe5866cc1dcc3",
-					// id_eventdetails: $("#addproduct input[name='id').val(),
-					dates: {},
-					max_num: (!Number.isNaN(parseInt($("#max_num").val()))) ? parseInt($("#max_num").val()) : 0,
-					buffer: (!Number.isNaN(parseInt($("#buffer").val()))) ? parseInt($("#buffer").val()) : 0,
-					participants: (!Number.isNaN(parseInt($("#participants").val()))) ? parseInt($("#participants").val()) : 0,
-				};
-				var from = new Date($("#date-range").attr("date-start"));
-				var to = new Date($("#date-range").attr("date-end"));
-
-				var d = from;
-				while (d <= to) {
-					// console.log(DAYS[d.getDay()]);
-					dayNum = d.getDay();
-					// console.log(d.getDay());
-					if ($("#Day" + dayNum).is(":checked")) {
-						data.dates[d.toISOString().split("T")[0]] = [];
-						$.each($("input[name='Day" + dayNum + "-timestart[]']"), function(k, v) {
-							if ($(v).val() && $("input[name='Day" + dayNum + "-time-duration[]']").eq(k).val()) {
-								timeRange = {
-									start: $("input[name='Day" + dayNum + "-timestart[]']").eq(k).val(),
-									// end: $("input[name='Day"+dayNum+"-timeend[]']").eq(k).val(),
-									duration: $("input[name='Day" + dayNum + "-time-duration[]']").eq(k).val(),
-								};
-								data.dates[d.toISOString().split("T")[0]].push(timeRange);
-								sendAjax = true;
-							}
-						});
-					}
-					d = new Date(d.getTime() + (24 * 60 * 60 * 1000));
-				}
-				if (sendAjax) {
-					$.ajax({
-						type: "POST",
-						url: "/custom/eventwizard/eventdetails_card.php",
-						data: data,
-						success: function(response) {
-							if (response.s) {
-								location.href = $("#agenda").attr("href");
-							}
-						},
-						error: function(response) {
-
-						}
-					});
-				}
-
-			});
-
-
-
-			$(document).on("input", ".timestart", function(event) {
-				if (gen.setElem == "ok") {
-					gen.setElem = "input";
-					var elem = $(this);
-					var a = (elem.val()).split(":");
-					var b = (elem.parent().find(".durationtime").val()).split(":");
-					var time = new Date();
-					time.setHours(parseInt(a[0]), parseInt(a[1]), 00, 000);
-					time.setMinutes(time.getMinutes() + parseInt(b[1]));
-					time.setHours(time.getHours() + parseInt(b[0]));
-					// var c = [time.getHours(), time.getMinutes()];
-					elem.parent().find(".timeend").val(time.getHours() + ":" + time.getMinutes())
-					var minutes = [parseInt(a[0]) * 60 + parseInt(a[1]), parseInt(b[0]) * 60 + parseInt(b[1])];
-					if (isNaN(minutes[0])) {
-						minutes[0] = 0;
-					}
-					if (isNaN(minutes[1])) {
-						minutes[1] = 0;
-					}
-					elem.parent().parent().find(".time_slider").slider("values", 0, minutes[0]);
-					elem.parent().parent().find(".time_slider").slider("values", 1, minutes[0] + minutes[1]);
-					elem.parent().find(".timestart").attr("info", minutes[0]);
-					elem.parent().find(".timeend").attr("info", minutes[0] + minutes[1]);
-					// elem.parent().find(".durationtime").attr("info",minutes[1]);
-					gen.setElem = "ok";
-				}
-			});
-			$(document).on("input", ".durationtime", function(event) {
-				if (gen.setElem == "ok") {
-					gen.setElem = "input";
-					var elem = $(this);
-					var a = (elem.parent().find(".timestart").val()).split(":");
-					var b = (elem.val()).split(":");
-					var time = new Date();
-					time.setHours(parseInt(a[0]), parseInt(a[1]), 00, 000);
-					time.setMinutes(time.getMinutes() + parseInt(b[1]));
-					time.setHours(time.getHours() + parseInt(b[0]));
-					// var c = [time.getHours(), time.getMinutes()];
-					elem.parent().find(".timeend").val(time.getHours() + ":" + time.getMinutes())
-					var minutes = [parseInt(a[0]) * 60 + parseInt(a[1]), parseInt(b[0]) * 60 + parseInt(b[1])];
-					if (isNaN(minutes[0])) {
-						minutes[0] = 0;
-					}
-					if (isNaN(minutes[1])) {
-						minutes[1] = 0;
-					}
-					// console.log(minutes);
-					elem.parent().parent().find(".time_slider").slider("values", 0, minutes[0]);
-					elem.parent().parent().find(".time_slider").slider("values", 1, minutes[0] + minutes[1]);
-					elem.parent().find(".timestart").attr("info", minutes[0]);
-					elem.parent().find(".timeend").attr("info", minutes[0] + minutes[1]);
-					// elem.parent().find(".durationtime").attr("info",minutes[1]);
-					gen.setElem = "ok";
-				}
-			});
-
-			$(document).on("click", ".addTime", function() {
-				var elem = $(this);
-				// var html = '<span class="addedTimes"> & <input type="time" name="Day'+elem.attr("info")+'-timestart[]"> - <input type="time" name="Day'+elem.attr("info")+'-timeend[]">ASD</span>';
-				var html = '<span class="addedTimes timeSelectBox"><span class="time_slider" style="display:inline-block;width:150px;"></span><span class="time_slider_details">Kezd&eacute;s:<input type="time" name="Day' + elem.attr("info") + '-timestart[]" info="0" class="timepicker timestart"><br/> Időtartam: <input name="Day' + elem.attr("info") + '-time-duration[]" pattern="[0-9]+:[0-9]{2}$" placeholder="hh:mm" type="text" class="durationtime" style="width:45px !important"/><input name="Day' + elem.attr("info") + '-timeend[]" class="timeend hide" info="0"/></span></span>';
-				elem.parent().parent().find("td.dayTime").append(html);
-				$(function() {
-					// gen.setTimeRange(".time_slider");
-				});
-			});
-			$(document).on("click", ".delTime", function() {
-				var elem = $(this);
-				$(elem.parent().parent().find('td.dayTime span.addedTimes').last()).remove();
-				// var listTimeStart = elem.parent().parent().find('td.dayTime input[name="Day'+elem.attr("info")+'-timestart[]"]');
-				// var listTimeEnd = elem.parent().parent().find('td.dayTime input[name="Day'+elem.attr("info")+'-timeend[]"]');
-
-				// if(listTimeStart.length > 1){
-				// $(listTimeStart.last()).remove();
-				// }
-				// if(listTimeEnd.length > 1){
-				// $(listTimeEnd.last()).remove();
-				// }
-			});
-
-			var option = {
-				//autoUpdateInput: false,
-				locale: {
-					"format": "YYYY-MM-DD",
-					cancelLabel: "M&eacute;gse",
-					applyLabel: "Ok",
-					"monthNames": [
-						"janu&aacute;r",
-						"febru&aacute;r",
-						"m&aacute;rcius",
-						"&aacute;prilis",
-						"m&aacute;jus",
-						"j&uacute;nius",
-						"j&uacute;lius",
-						"augusztus",
-						"szeptember",
-						"okt&oacute;ber",
-						"november",
-						"december"
-					],
-					"daysOfWeek": [
-						"Vas",
-						"H&eacute;",
-						"Ke",
-						"Sze",
-						"Cs&uuml;t",
-						"P&eacute;",
-						"Szo"
-					],
-				}
-			};
-			$("#date-range").daterangepicker(option, function(start, end, label) {
-				$("#date-range").attr("date-start", start.format("YYYY-MM-DD"));
-				$("#date-range").attr("date-end", end.format("YYYY-MM-DD"));
-			});
-
-			// gen.setTimeRange(".time_slider");
-
-			$(document).on("mousewheel", ".time_slider", function(event) {
-				event.preventDefault();
-				var elem = $(this);
-				value = elem.slider("value");
-
-				//console.log(event.deltaX, event.deltaY, event.deltaFactor);
-
-				//Mousewheel Scrolled up
-				if (event.deltaY == -1) {
-					//alert("scrolled down");
-					value = value + 1;
-					elem.slider("value", value);
-					// $("#slider_val").html(value);
-				}
-				//Mousewheel Scrolled down
-				else if (event.deltaY == 1) {
-					//alert("scrolled up");
-					value = value - 1;
-					elem.slider("value", value);
-					// $("#slider_val").html(value);
-				}
-			});
-		},
-		setTimeRange: function(elem) {
-			//".time_slider"
-			$(elem).slider({
-				// width: 320px,
-				// height: 2px,
-				range: true,
-				min: 0,
-				max: 2880,
-				step: 5,
-				slide: function(e, ui) {
-					if (gen.setElem == "ok") {
-						gen.setElem = "slider";
-						var hours = Math.floor(ui.value / 60);
-						var minutes = ui.value - (hours * 60);
-						hours = hours % 24;
-						if (hours.toString().length == 1) hours = "0" + hours;
-						if (minutes.toString().length == 1) minutes = "0" + minutes;
-
-						// $("#something").html(hours+":"+minutes);
-						if (ui.handleIndex == 0) {
-							$(ui.handle).parent().parent().find(".timestart").val(hours + ":" + minutes);
-							$(ui.handle).parent().parent().find(".timestart").attr("info", ui.value);
-						}
-						if (ui.handleIndex == 1) {
-							$(ui.handle).parent().parent().find(".timeend").val(hours + ":" + minutes);
-							$(ui.handle).parent().parent().find(".timeend").attr("info", ui.value);
-						}
-						var diff = parseInt($(ui.handle).parent().parent().find(".timeend").attr("info")) - parseInt($(ui.handle).parent().parent().find(".timestart").attr("info"));
-						// console.log(parseInt($(ui.handle).parent().parent().find(".timestart").attr("info")));
-						// console.log(parseInt($(ui.handle).parent().parent().find(".timeend").attr("info")));
-						// console.log(diff);
-						if (!isNaN(diff)) {
-							hours = Math.floor(diff / 60);
-							minutes = diff - (hours * 60);
-							// hours = hours%24;
-							if (hours.toString().length == 1) hours = "0" + hours;
-							if (minutes.toString().length == 1) minutes = "0" + minutes;
-
-							$(ui.handle).parent().parent().find(".durationtime").val(hours + ":" + minutes + "");
-
-							// var start = $(ui.handle).parent().parent().find(".timepicker").val();
-							// details = "Kezdés: "+start+"<br/>Időtartam: "+hours+"ó "+minutes+"p";
-						}
-						// $(ui.handle).parent().parent().find(".time_slider_details").html(details);
-
-						// console.log(hours+":"+minutes);
-						// console.log(ui);
-						gen.setElem = "ok";
-					}
-				}
-			});
-
-		},
-	};
-	$(function() {
-		gen.init();
-	});
-
-	$(document).ready(function() {
-		$('#fk_product').on('change', function() {
-			var selectedValue = $(this).val(); // A kiválasztott érték lekérése
-			if(selectedValue == -1){
-				$("#eventDateSelector").addClass("TDhideClass");;
-			}else{
-				$("#eventDateSelector").removeClass('TDhideClass');
-			}
-		})
-
-		$('#fk_product').select2({
-			dir: 'ltr',
-			width: 'resolve',
-			minimumInputLength: 0,
-			language: select2arrayoflanguage,
-			matcher: function(params, data) {
-				if ($.trim(params.term) === "") {
-					return data;
-				}
-				keywords = (params.term).split(" ");
-				for (var i = 0; i < keywords.length; i++) {
-					if (((data.text).toUpperCase()).indexOf((keywords[i]).toUpperCase()) == -1) {
-						return null;
-					}
-				}
-				return data;
-			},
-			theme: 'default',
-			containerCssClass: ':all:',
-			selectionCssClass: ':all:',
-			templateResult: function(data, container) {
-				if (data.element) {
-					$(container).addClass($(data.element).attr("class"));
-				}
-				if (data.id == -1 && $(data.element).attr("data-html") == undefined) {
-					return '&nbsp;';
-				}
-				if ($(data.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(data.element).attr("data-html")); // If property html set, we decode html entities and use this
-				return data.text;
-			},
-			templateSelection: function(selection) {
-				if (selection.id == -1) return '<span class="placeholder">' + selection.text + '</span>';
-				return selection.text;
-			},
-			escapeMarkup: function(markup) {
-				return markup;
-			},
-			dropdownCssClass: 'ui-dialog'
-		});
-	});
-</script>
+<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css">