/*
 * ATTENTION: An "eval-source-map" devtool has been used.
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./resources/js/admin/dashboard.js"
/*!*****************************************!*\
  !*** ./resources/js/admin/dashboard.js ***!
  \*****************************************/
() {

eval("{window.Dashboard = function () {\n  var Opts = {\n    active: false,\n    containerCssSelector: \".dashboard\",\n    testFileMod: false,\n    isAdmin: false,\n    URL: {\n      create: '',\n      store: '',\n      getDataTableContent: '',\n      destroy: ''\n    }\n  };\n  var root = this;\n  /*\r\n   * Constructor\r\n   */\n  this.construct = function (options) {\n    debug('Dashboard constructor called');\n    $.extend(Opts, options);\n  };\n  this.getOpts = function () {\n    return Opts;\n  };\n  this.init = function (options) {\n    console.log('Dashboard init called');\n    $.extend(Opts, options);\n    /*\r\n            APP.setOpts({\r\n                afterLoadMainContent:root.initEditor,\r\n            })\r\n    */\n    /*\r\n    Init list view\r\n    */\n    root.initEditorButtons();\n  };\n  this.initEditorButtons = function () {\n    $('.DashboardEditable button.edit').off('click');\n    $('.DashboardEditable button.edit').on('click', function () {\n      root.initEditor();\n      $('.btnGroupEdit').toggleClass('d-none');\n      $('.btnGroupModify').toggleClass('d-none');\n    });\n    $('.DashboardEditable button.btnSave').off('click');\n    $('.DashboardEditable button.btnSave').on('click', function () {\n      /*$('.btnGroupEdit').toggleClass('d-none');\r\n      $('.btnGroupModify').toggleClass('d-none');\r\n      */\n      root.saveCustomContent();\n      //tinymce.activeEditor.isDirty() //true when modified\n    });\n    $('.DashboardEditable button.btnCancel').off('click');\n    $('.DashboardEditable button.btnCancel').on('click', function () {\n      $('.btnGroupEdit').toggleClass('d-none');\n      $('.btnGroupModify').toggleClass('d-none');\n      root.removeEditor();\n    });\n  };\n  this.saveCustomContent = function () {\n    var ajaxData = new FormData($('.dashboardForm')[0]);\n    ajaxData.append('stored_data', tinymce.activeEditor.getContent());\n    var ajaxUrl = Opts.URL.update.replace('%id%', $('div.dashboardCustomContent').data('id'));\n    ajaxData.append('_method', 'PUT');\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      type: 'POST',\n      contentType: false,\n      processData: false,\n      beforeSend: function beforeSend() {},\n      success: function success(data) {\n        Toast.create({\n          title: \"Siekeres mentés!\",\n          message: 'Új tartalom elmentve.',\n          status: TOAST_STATUS.INFO,\n          timeout: 5000\n        });\n      },\n      error: function error(data) {\n        console.log(data.responseJSON);\n        ajaxErrorFieldHandler(data.responseJSON.error);\n      }\n    });\n  };\n  this.loadTinymce = function () {\n    $.getScript('https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js', function () {\n      root.initEditor();\n    });\n  };\n  this.removeEditor = function (options) {\n    if (typeof tinymce !== \"undefined\") {\n      tinymce.remove();\n    }\n  };\n  this.initEditor = function (options) {\n    if (typeof tinymce === \"undefined\") {\n      root.loadTinymce();\n      return;\n    }\n    tinymce.init({\n      selector: 'div.dashboardCustomContent',\n      // Replace this CSS selector to match the placeholder element for TinyMCE\n      language: 'hu_HU',\n      plugins: 'code table lists',\n      toolbar: ' undo redo | formatselect| bold italic | alignleft aligncenter alignright | indent outdent | bullist numlist | code | table'\n\n      /*\r\n                  toolbar: 'customInsertButton | undo redo | formatselect| bold italic | alignleft aligncenter alignright | indent outdent | bullist numlist | code | table',\r\n                  setup: function (editor) {\r\n                      editor.ui.registry.addButton('customInsertButton', {\r\n                          text: 'My Button',\r\n                          onAction: function (_) {\r\n                              editor.insertContent('&nbsp;<strong>It\\'s my button!</strong>&nbsp;');\r\n                          }});\r\n                  }\r\n      */\n    });\n  };\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 11168 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/dashboard.js\n\n}");

/***/ },

/***/ "./resources/js/admin/priceList.js"
/*!*****************************************!*\
  !*** ./resources/js/admin/priceList.js ***!
  \*****************************************/
() {

eval("{window.PriceListAdmin = function (options, ProfitCenterItem) {\n  /*\r\n   * Variables accessible\r\n   * in the class\r\n   */\n  var Opts = {\n    active: false,\n    containerCssSelector: \".priceListForm\",\n    testFileMod: false,\n    URL: {\n      create: '',\n      store: '',\n      getDataTableContent: '',\n      destroy: ''\n    }\n  };\n  var PriceList = {};\n  var root = this;\n  var dataTableCSSSelector = null;\n\n  /*\r\n   * Constructor\r\n   */\n  this.construct = function (options) {\n    debug('PriceListAdmin constructor called');\n    $.extend(Opts, options);\n  };\n  var errorRowPointer = null;\n  var errorRowCount = 0;\n  this.initErrorNavigationButton = function () {\n    errorRowCount = $('.statusError').length;\n    errorRowPointer = null;\n    $('.priceListForm .buttonPrevError .buttonNextError').off('click');\n    $('.priceListForm .buttonPrevError').on('click', function () {\n      if (errorRowPointer == null) {\n        errorRowPointer = 0;\n      } else {\n        if (errorRowPointer > 0) {\n          errorRowPointer--;\n        } else {\n          return;\n        }\n      }\n      $('.statusError').removeClass('highlightedErrorRow');\n      $('.priceListTableWrapper').scrollTop($($('.statusError')[errorRowPointer]).position().top);\n      $($('.statusError')[errorRowPointer]).addClass('highlightedErrorRow');\n    });\n    $('.priceListForm .buttonNextError').off('click');\n    $('.priceListForm .buttonNextError').on('click', function () {\n      if (errorRowPointer == null) {\n        errorRowPointer = 0;\n      } else {\n        if (errorRowPointer < errorRowCount - 1) {\n          errorRowPointer++;\n        } else {\n          return;\n        }\n      }\n      $('.statusError').removeClass('highlightedErrorRow');\n      $('.priceListTableWrapper').scrollTop($($('.statusError')[errorRowPointer]).position().top);\n      $($('.statusError')[errorRowPointer]).addClass('highlightedErrorRow');\n    });\n  };\n  this.selectedUploadFileToggle = function (fileInput) {\n    /*\r\n    console.log(fileInput.attr('name'));\r\n    console.log(fileInput[0].files[0]);\r\n    console.log(fileInput[0].files[0].name);\r\n    */\n    if (fileInput) {\n      $('.containerFileUpload').addClass('d-none');\n      if (fileInput[0].files[0]) {\n        $('.containerUploadedFileName').text(fileInput[0].files[0].name);\n      }\n      $('.containerFileUploadStarted').removeClass('d-none');\n      $('.containerUploadedSpinner').removeClass('d-none');\n    } else {\n      $('.containerUploadedFileName').text('');\n      $('.containerFileUploadStarted').addClass('d-none');\n      $('.uploadStatusRow').addClass('d-none');\n      $('.priceListTable > tbody').empty();\n      $('.containerFileUpload').removeClass('d-none');\n    }\n  };\n  this.clickNewPriceListCallBack = function () {\n    root.initViewDetails();\n  };\n  this.clickNewPriceList = function () {\n    APP.loadMainContent(Opts.URL.create, root.clickNewPriceListCallBack);\n  };\n  this.datatableRowActionButtonClick = function (event) {\n    var node = $(event[0].currentTarget);\n    var row = $(dataTableCSSSelector).DataTable().row(node.parents('tr'));\n    var rowData = row.data();\n    //_token\n    var ajaxData = {};\n    var ajaxUrl = Opts.URL.destroy.replace('%id%', rowData.id);\n    ajaxData._token = $('input[name=_token]').val();\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      method: \"DELETE\",\n      success: function success(data) {\n        if (data.success == true) {\n          row.remove().draw();\n        }\n      }\n    });\n    /*\r\n    */\n  };\n  this.initViewList = function (options) {\n    debug('listview inicialization');\n    dataTableCSSSelector = Opts.containerCssSelector + ' .dataTable'; //\n\n    var colNum = $(dataTableCSSSelector + ' thead th').length; //buttons insert position need\n    APP.setOpts({\n      datatableActionButtonClickCallBack: root.clickNewPriceList,\n      datatableRowActionButtonClickCallBack: root.datatableRowActionButtonClick\n    });\n    APP.dataTablePriceList = $(dataTableCSSSelector).DataTable({\n      language: {\n        url: '//cdn.datatables.net/plug-ins/1.10.24/i18n/Hungarian.json'\n      },\n      //\"ajax\": \"{{asset('exapmle2.json')}}\",\n      \"ajax\": Opts.URL.getDataTableContent,\n      \"columnDefs\": [{\n        \"targets\": colNum - 1,\n        \"render\": function render(data, type, row) {\n          var buttons = APP.datatableAddRowTrashButton(0, arguments);\n          //buttons+=APP.datatableAddRowEditButton(0,arguments);\n          return buttons;\n        }\n      }\n      //{ \"visible\": false,  \"targets\": [ 0 ] }\n      ],\n      buttons: {\n        buttons: [\n        //'createState', 'savedStates',\n        'excel', 'pdf', {\n          extend: 'print',\n          //text: 'Print current page',\n          'title': 'title custom text',\n          'messageTop': 'Message On Top',\n          autoPrint: true\n        }, /**/\n\n        {\n          text: 'Új felvitele',\n          className: 'btn btn-success newItem',\n          attr: {\n            /*\r\n                                        data:{\r\n                                            a:1,\r\n                                            b:2\r\n                                          }\r\n            */\n            'data': 'newItem'\n          },\n          init: function init(api, node, config) {\n            $(node).removeClass('ui-button');\n          },\n          action: function action(e, dt, node, config) {\n            APP.datatableActionButtonClickCallBack(arguments);\n            /* console.log(e);\r\n             console.log(dt);\r\n             console.log(node);\r\n             console.log(config);*/\n          }\n        }]\n      },\n      \"columns\": [{\n        \"data\": \"id\"\n      }, {\n        \"data\": \"supplierName\"\n      }, {\n        \"data\": \"available\"\n      }, {\n        \"data\": \"created_at\"\n      }, {\n        \"data\": \"note\"\n      }, null],\n      \"stateSave\": true,\n      \"drawCallback\": function drawCallback(settings) {\n        APP.datatableAddRowAction(dataTableCSSSelector);\n      }\n    });\n  };\n  this.initViewDetails = function (options) {\n    $(Opts.containerCssSelector + ' .datePickerClick').off('click');\n    $(Opts.containerCssSelector + ' .datePickerClick').on('click', function () {\n      $(Opts.containerCssSelector + ' .datePicker').datepicker('show');\n    });\n    $(Opts.containerCssSelector + ' .datePicker').datepicker({\n      dateFormat: 'yy-mm-dd',\n      onSelect: function onSelect(dateText) {\n        console.log(dateText);\n        $('.selectedDateText').text(dateText.replaceAll('-', '.'));\n        $('input[name=\"availableDate\"]').val(dateText);\n      }\n    });\n    $(Opts.containerCssSelector + ' .buttonNewUpload').off('click');\n    $(Opts.containerCssSelector + ' .buttonNewUpload').on('click', function () {\n      root.selectedUploadFileToggle();\n    });\n    $(Opts.containerCssSelector + ' .buttonUpload').off('click');\n    $(Opts.containerCssSelector + ' .buttonUpload').on('click', function () {\n      console.log('------------------');\n      root.selectedUploadFileToggle();\n      var data = new FormData($('.priceListForm')[0]);\n      if ($('.supplierSelect').val().length < 1) {\n        Toast.create({\n          title: \"Hiba!\",\n          message: 'Adjon meg beszállítót!',\n          status: TOAST_STATUS.DANGER,\n          timeout: 10000\n        });\n        return;\n      }\n      var fileInput = $('#inputGroupPriceListFile');\n      console.log(fileInput[0].files.length < 1);\n\n      /* teszteles miatt kikapcsolva a fajl ellenorzes\r\n      */\n      if (!Opts.testFileMod) {\n        console.log(fileInput[0].files.length < 1);\n        if (fileInput[0].files.length < 1) {\n          Toast.create({\n            title: \"Hiba!\",\n            message: 'Vállaszon ki fájlt!',\n            status: TOAST_STATUS.DANGER,\n            timeout: 10000\n          });\n          return;\n        }\n      }\n      data.append(fileInput.attr('name'), fileInput[0].files[0]);\n      root.selectedUploadFileToggle(fileInput);\n      $.ajax({\n        url: Opts.URL.store,\n        data: data,\n        type: 'POST',\n        contentType: false,\n        processData: false,\n        beforeSend: function beforeSend() {},\n        success: function success(data) {\n          console.log(data);\n          if (data.success == true) {\n            root.processCheckedPriceListResponse(data);\n          }\n        },\n        error: function error(data) {\n          console.log(data.responseJSON);\n          root.selectedUploadFileToggle();\n          ajaxErrorFieldHandler(data.responseJSON.error);\n        }\n      });\n    });\n    $(Opts.containerCssSelector + ' .buttonFinalization').on('click', function () {\n      var data = new FormData($('.priceListForm')[0]);\n      var fileInput = $('#inputGroupPriceListFile');\n      data.append(fileInput.attr('name'), fileInput[0].files[0]);\n      data.append('finalization', 1);\n      $.ajax({\n        url: Opts.URL.store,\n        data: data,\n        type: 'POST',\n        contentType: false,\n        processData: false,\n        beforeSend: function beforeSend() {},\n        success: function success(data) {\n          console.log(data);\n          if (data.success) {\n            $('.priceListTable tbody tr').remove();\n            $('.uploadStatusRow >.canFinish').hide();\n            $('.uploadStatusRow').addClass('d-none');\n            $('.priceListTable tbody').append('<tr><td colspan=\"99\" style=\"text-align: center;' + '    font-size: 2em;\"> Árlistát elmentettük.</td></tr>');\n          }\n          /*\r\n          if(data.success==1){\r\n              root.processCheckedPriceListResponse(data);\r\n          }\r\n           */\n        },\n        error: function error(data) {\n          console.log(data.responseJSON);\n          ajaxErrorFieldHandler(data.responseJSON.error);\n        }\n      });\n    });\n  };\n  this.init = function (options) {\n    console.log('PriceListAdmin init called');\n    $.extend(Opts, options);\n    console.log('Opt extended');\n    console.log(Opts);\n    /*\r\n    Init list view\r\n    */\n    console.log('call list view Init');\n    root.initViewList(options);\n  };\n  this.getOpts = function () {\n    return Opts;\n  };\n  var priceListHasError = false;\n  this.processCheckedPriceListResponse = function (responseData) {\n    priceListHasError = false;\n    root.processCheckedPriceListResponseRows(responseData.rows);\n    if (priceListHasError) {\n      $('.uploadStatusRow >.canFinish').hide();\n      $('.uploadStatusRow >.canFinishError').show();\n      root.initErrorNavigationButton();\n    } else {\n      $('.uploadStatusRow >.canFinish').show();\n      $('.uploadStatusRow >.canFinishError').hide();\n    }\n    $('.uploadStatusRow').removeClass('d-none');\n    $('.containerUploadedSpinner').addClass('d-none');\n  };\n  this.processCheckedPriceListResponseRows = function (responseRowsData) {\n    console.log('processingRows');\n    for (var key in responseRowsData) {\n      var rowData = responseRowsData[key];\n      var templateData = rowData.originalData;\n      templateData.rowNum = rowData.rowNum;\n      var template = $('template[data-name=\"priceListTableRow\"]').html();\n      var render = Mustache.render(template, templateData);\n      $('.priceListTable tbody').append(render);\n      $('tr[data-rownum=' + rowData.rowNum + ']').addClass('status' + $.ucFirst(rowData.status));\n      root.processResponseRowErrors(rowData.error, rowData.rowNum);\n      if (rowData.changed) {\n        root.processResponseRowChanged(rowData.changed, rowData.rowNum);\n      }\n    }\n  };\n  this.processResponseRowChanged = function (changedArray, rowNum) {\n    if (changedArray.length < 1) {\n      return;\n    }\n    console.log(changedArray);\n    //fields error resz\n    var trNode = $('tr[data-rownum=' + rowNum + ']');\n    for (var key in changedArray) {\n      var tdNode = trNode.find('td[data-pointer=\"' + key + '\"]');\n      tdNode.addClass('bg-primary');\n      var changedTxtNode = $(document.createElement(\"span\")).text(changedArray[key].old).addClass('fieldChanged');\n      tdNode.append(changedTxtNode);\n    }\n  };\n  this.processResponseRowErrors = function (errorArray, rowNum) {\n    if (errorArray.length < 1) {\n      return;\n    }\n    //general error resz\n    console.log(errorArray);\n    priceListHasError = true;\n\n    //fields error resz\n    if (typeof errorArray.fields == 'undefined') {\n      return;\n    }\n    var trNode = $('tr[data-rownum=' + rowNum + ']');\n    for (var key in errorArray.fields) {\n      var tdNode = trNode.find('td[data-pointer=\"' + key + '\"]');\n      tdNode.addClass('bg-danger');\n      var errorTxtNode = $(document.createElement(\"span\")).text(errorArray.fields[key]).addClass('fieldError');\n      tdNode.append(errorTxtNode);\n    }\n  };\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 39740 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/priceList.js\n\n}");

/***/ },

/***/ "./resources/js/admin/priceListProfitCenter.js"
/*!*****************************************************!*\
  !*** ./resources/js/admin/priceListProfitCenter.js ***!
  \*****************************************************/
() {

eval("{window.PriceListProfitCenterAdmin = function (options) {\n  /*\r\n   * Variables accessible\r\n   * in the class\r\n   */\n  var Opts = {\n    token: null,\n    containerCssSelector: '.containerPriceListProfitCenter',\n    testMode: false,\n    URL: {\n      getDataTableContent: '',\n      getProductGroupHTML: '',\n      index: '',\n      show: '',\n      edit: '',\n      create: '',\n      store: '',\n      update: '',\n      destroy: ''\n    },\n    dataTable: {\n      orderDirective: [1, 'asc']\n    },\n    onAfterInitViewDetails: function onAfterInitViewDetails() {}\n  };\n  var root = this;\n  /*\r\n   * Constructor\r\n   */\n  this.construct = function (options, SupplierItem) {\n    console.log('PriceListProfitCenterAdmin constructor called');\n    $.extend(Opts, options);\n  };\n  this.getOpts = function () {\n    return Opts;\n  };\n  var changeParameter = {\n    supplier: '',\n    profitCenter: '',\n    deliveryDate: ''\n    /*\r\n    supplier:26,\r\n    profitCenter:49,\r\n    deliveryDate:'2023-09-10',\r\n    */\n  };\n  this.checkRefreshPossible = function () {\n    console.log('check need parameter');\n    var needRefresh = true;\n    $.each(changeParameter, function (name, data) {\n      if (data === '') {\n        needRefresh = false;\n      }\n    });\n    if (needRefresh) {\n      root.refreshDatatable();\n      root.refreshProductGroup();\n      root.setDatatableHeaderText('');\n    }\n  };\n  this.setDatatableHeaderText = function (text) {\n    $('.tableHeaderText').text(text);\n  };\n  this.getTreePathName = function (node) {\n    var res = '';\n    var items = $(node).parents('li').toArray();\n    items.shift();\n    items.reverse();\n    for (var item in items) {\n      if ($(items[item]).children('a.categoryItem').length > 0) {\n        res += $(items[item]).children('a.categoryItem').text() + '/';\n      }\n    }\n    res += $(node).text();\n    return res;\n  };\n  this.bindProductGroupItem = function () {\n    $('.sidebar-menu .sidebar-dropdown .sidebar-submenu li a.categoryItem.clickable').off('click');\n    $('.sidebar-menu .sidebar-dropdown .sidebar-submenu li a.categoryItem.clickable').on('click', function () {\n      var groupId = $(this).data('id');\n      selectedProductGroup = groupId;\n      root.setDatatableHeaderText(root.getTreePathName(this));\n      /*\r\n      console.log(groupId);\r\n      console.log(root.getTreePathName(this));\r\n      */\n      root.refreshDatatable();\n    });\n  };\n  this.refreshProductGroup = function () {\n    var ajaxData = {\n      'supplierId': changeParameter.supplier,\n      'deliveryDate': changeParameter.deliveryDate\n    };\n    var ajaxUrl = Opts.URL.getProductGroupHTML;\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      type: 'GET',\n      contentType: false,\n      processData: true,\n      beforeSend: function beforeSend() {},\n      success: function success(data) {\n        $('.sidebar-menu .productGroup').find('ul').html(data);\n        root.bindProductGroupItem();\n      },\n      error: function error(data) {\n        ajaxErrorFieldHandler(data.responseJSON.error);\n      }\n    });\n  };\n  this.refreshDatatable = function () {\n    $('.dataTableOrderProductSelect').DataTable().ajax.reload();\n  };\n  this.changePriceListProfitCenterParameter = function (e, obj) {\n    if (typeof obj == 'undefined') {\n      obj = $(this);\n    }\n    var objName = obj.attr(\"name\");\n    if (objName == 'supplier') {\n      selectedProductGroup = null;\n    }\n    var data = '';\n    if (obj.get(0).nodeName == 'SELECT') {\n      if (obj.select2('data').length > 0) {\n        data = obj.select2('data')[0].id;\n      }\n      ;\n    } else {\n      data = obj.val();\n    }\n    if (changeParameter[objName] != data) {\n      changeParameter[objName] = data;\n      root.checkRefreshPossible();\n    }\n  };\n  this.init = function (options) {\n    $.extend(Opts, options);\n    var CSSSelectorForm = Opts.containerCssSelector;\n    $(CSSSelectorForm + ' .datePickerClick').click(function () {\n      $(CSSSelectorForm + ' .datePicker').datepicker('show');\n    });\n    $('.supplierSelect').on('change', root.changePriceListProfitCenterParameter);\n    $('.profitCenterSelect').on('change', root.changePriceListProfitCenterParameter);\n\n    //$('input[name=\"deliveryDate\"]').on('change',changePriceListProfitCenterParameter);\n\n    $(\".supplierSelect\").select2({\n      maximumSelectionLength: 1\n    });\n    /*\r\n    */\n    $(\".profitCenterSelect\").select2({\n      maximumSelectionLength: 1\n    });\n    $(CSSSelectorForm + ' .datePicker').datepicker({\n      dateFormat: 'yy-mm-dd',\n      minDate: new Date(),\n      onSelect: function onSelect(dateText, obj) {\n        $(CSSSelectorForm + ' .selectedDateText').text(dateText);\n        $('.deliveryDatePlace').text(dateText.replaceAll('-', '.') + '.');\n        $(CSSSelectorForm + ' input[name=\"deliveryDate\"]').val(dateText);\n        root.changePriceListProfitCenterParameter(null, $(obj.input));\n      }\n    });\n    //root.initViewList();\n    var table = root.getDatatables('');\n    $('.dataTableOrderProductSelect').on('draw.dt', root.productSelectDataTableDrawDT).dataTable();\n    /*\r\n      /!*\r\n      ----------------------------------------------------------\r\n       Add event listener for opening and closing details\r\n       *!/\r\n        $('.dataTableOrderProductSelect tbody').on('click', 'td.details-control', function () {\r\n          let tr = $(this).closest('tr');\r\n          let row = table.row( tr );\r\n            if ( row.child.isShown() ) {\r\n              // This row is already open - close it\r\n              row.child.hide();\r\n              tr.removeClass('shown');\r\n          }\r\n          else {\r\n              // Open this row\r\n              row.child( root.productSelectDatatablesRowFormatter(row.data()) ).show();\r\n              tr.addClass('shown');\r\n              root.bindProductDetailsAction();\r\n          }\r\n      } );*/\n  };\n  this.productSelectDataTableDrawDT = function (e) {\n    //debug( 'Table draw complete: '+new Date().getTime() );\n\n    $('td:contains(\"*\")').html('<i class=\"bi bi-check-circle-fill\"></i>');\n    $('td.details-control').removeClass('details-control');\n  };\n  var selectedProductGroup = null;\n  this.getDatatables = function (orderType) {\n    var table = $('.dataTableOrderProductSelect').DataTable({\n      language: {\n        url: '//cdn.datatables.net/plug-ins/1.10.24/i18n/Hungarian.json'\n      },\n      //\"ajax\": \"{{asset('exapmle2.json')}}\",\n      \"ajax\": {\n        url: Opts.URL.getDataTableContent,\n        data: function data(_data) {\n          /*\r\n                                  data.searchStr=dataTableSearchStr;\r\n                                  data.krel=dataTableSearchKrel;\r\n                                  data.groupId=selectedProductGroup;\r\n          */\n          _data.supplierId = changeParameter.supplier;\n          _data.profitCenterId = changeParameter.profitCenter;\n          _data.deliveryDate = changeParameter.deliveryDate;\n          _data.groupId = selectedProductGroup;\n        }\n      },\n      buttons: {\n        buttons: []\n      },\n      \"columnDefs\": APP.OrderModule.productSelectDataTableColumnDefs(),\n      \"columns\": APP.OrderModule.productSelectDataTableColumn(),\n      \"order\": [[1, 'asc']]\n    });\n    return table;\n  };\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 22152 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/priceListProfitCenter.js\n\n}");

/***/ },

/***/ "./resources/js/admin/product.js"
/*!***************************************!*\
  !*** ./resources/js/admin/product.js ***!
  \***************************************/
() {

eval("{function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t[\"return\"] || t[\"return\"](); } finally { if (u) throw o; } } }; }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nif (typeof Product === 'undefined') {\n  var _Product = /*#__PURE__*/function (_DataModel) {\n    /*\n     * Constructor\n     */\n    function _Product(data, options) {\n      var _this;\n      _classCallCheck(this, _Product);\n      _this = _callSuper(this, _Product, [data, options]);\n      if (typeof _this.contact === \"undefined\") {\n        _this.contact = [];\n      }\n      console.log('Product constructor called');\n      return _this;\n    }\n    _inherits(_Product, _DataModel);\n    return _createClass(_Product);\n  }(DataModel);\n  ;\n  window.Product = _Product;\n}\nwindow.ProductAdmin = function (options, ProductItem) {\n  /*\n   * Variables accessible\n   * in the class\n   */\n  var Opts = {\n    token: null,\n    containerCssSelector: '.containerProduct',\n    container: null,\n    resultContainerSelector: '.containerProduct .containerResult',\n    resultContainer: null,\n    testMode: false,\n    filters: {\n      Product: {}\n    },\n    URL: {\n      getDataTableContent: '',\n      index: '',\n      show: '',\n      edit: '',\n      create: '',\n      store: '',\n      update: '',\n      destroy: '',\n      attachFile: '',\n      detachFile: ''\n    },\n    dataTable: {\n      orderDirective: [1, 'asc']\n    },\n    onAfterInitViewDetails: function onAfterInitViewDetails() {}\n  };\n  var Product = {};\n  var root = this;\n  var contactPopupWorkflow = 'new';\n  var dataTable = null;\n  /*\n   * Constructor\n   */\n  this.construct = function (options, ProductItem) {\n    console.log('ProductAdmin constructor called');\n    $.extend(Opts, options);\n    if (!ProductItem) {\n      console.log('Product letre kellet hozni ');\n      if (!APP.Product) {\n        APP.Product = new window.Product();\n      }\n      root.Product = APP.Product;\n    }\n  };\n  this.getOpts = function () {\n    return Opts;\n  };\n  this.datatableRowActionButtonClick = function (event) {\n    debug('datatableRowActionButtonClick');\n    var node = $(event[0].currentTarget);\n    var row = $(dataTableCSSSelector).DataTable().row(node.parents('tr'));\n    var rowData = row.data();\n    var actionName = 'datatableRowAction' + node.data('buttontype').capitalize();\n    if (typeof root[actionName] === \"function\") {\n      return root[actionName](rowData, node);\n    }\n  };\n  this.datatableRowActionEdit = function (rowData, node) {\n    console.log('datatableRowActionEdit Called');\n    //Opts.onAfterInitViewDetails=root.autofillDetails;\n    var ajaxUrl = Opts.URL.edit.replace('%id%', rowData.id);\n    APP.loadMainContent(ajaxUrl, root.initViewDetails);\n    console.log('datatableRowActionEdit End');\n  };\n  this.initViewListOld = function () {\n    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    debug('listview inicialization');\n    dataTableCSSSelector = Opts.containerCssSelector + ' .dataTable'; //\n\n    var colNum = $(dataTableCSSSelector + ' thead th').length; //buttons insert position need\n    APP.setOpts({\n      datatableRowActionButtonClickCallBack: root.datatableRowActionButtonClick\n    });\n    var orderDirective = Opts.dataTable.orderDirective;\n    if (typeof options['orderDirective'] != 'undefined') {\n      orderDirective = options['orderDirective'];\n    }\n    $(dataTableCSSSelector).DataTable({\n      language: {\n        url: '//cdn.datatables.net/plug-ins/1.10.24/i18n/Hungarian.json'\n      },\n      //\"ajax\": \"{{asset('exapmle2.json')}}\",\n      \"ajax\": Opts.URL.getDataTableContent,\n      serverSide: true,\n      \"columnDefs\": [{\n        \"targets\": colNum - 1,\n        orderable: false,\n        \"render\": function render(data, type, row) {\n          var buttons = APP.datatableAddRowEditButton(0, arguments);\n          return buttons;\n        }\n      }, {\n        \"targets\": 1,\n        \"render\": function render(data, type, row) {\n          return type === \"sort\" ? data.latinise() : data;\n        }\n      }\n      //{ \"visible\": false,  \"targets\": [ 0 ] }\n      ],\n      buttons: {\n        buttons: ['excel', 'pdf', {\n          extend: 'print',\n          //text: 'Print current page',\n          'title': 'title custom text',\n          'messageTop': 'Message On Top',\n          autoPrint: true\n        }]\n      },\n      \"columns\": [{\n        \"data\": \"id\"\n      }, {\n        \"data\": \"name\"\n      }, {\n        \"data\": \"hooreycaId\"\n      }, {\n        \"data\": \"productGroup\"\n      }, {\n        \"data\": \"supplierName\"\n      }, {\n        \"data\": \"price\"\n      }, {\n        \"data\": \"created_at\"\n      }, null],\n      \"order\": orderDirective,\n      \"stateSave\": true,\n      \"drawCallback\": function drawCallback(settings) {\n        APP.datatableAddRowAction(dataTableCSSSelector);\n      }\n    });\n    debug('listview end');\n  };\n  this.initViewList = function () {\n    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    debug('initViewSearch inicialization 1');\n    root.container.find('select.supplierSelect, select.profitCenterSelect, select.productGroupSelect, select.producerSelect, select.hooreycaNamesSelect, select.specialOfferSelect').select2();\n    root.container.find('select.productSelect').select2({\n      placeholder: '...',\n      allowClear: true,\n      ajax: {\n        url: Opts.URL.getProductSearch,\n        dataType: 'json',\n        data: function data(params) {\n          return {\n            term: params.term || '',\n            page: params.page || 1,\n            supplierId: root.container.find('select.supplierSelect').val()\n          };\n        },\n        cache: true\n      }\n    });\n    root.container.find('.datePickerFrom, .datePickerTo').datepicker({\n      dateFormat: 'yy-mm-dd',\n      onSelect: function onSelect(dateText, obj) {\n        debug(this);\n        debug(obj.input);\n        /*\n                                root.container.find('.selectedDateText').text(dateText);\n                                $('.deliveryDatePlace').text(dateText.replaceAll('-', '.') + '.');\n                                root.container.find(' input[name=\"deliveryDate\"]').val(dateText);\n        */\n        //root.changePriceListProfitCenterParameter(null,$(obj.input));\n      }\n    });\n    root.container.find('.datePickerClick').click(function () {\n      debug($(this).data('action'));\n      root.container.find('input[name=\"' + $(this).data('action') + '\"]').datepicker('show');\n    });\n    var button = root.container.find('.FormSendButton');\n    button.off('click');\n    button.on('click', function () {\n      debug('FormSendButton click');\n      root.loadingResultContainer();\n      root.requestProducts();\n    });\n    root.setVisibleFilters('Product');\n    if (root.loadFiltersFromLocalStorage()) {\n      root.loadingResultContainer();\n      root.requestProducts();\n    }\n    debug('initViewSearch end');\n  };\n  this.loadingResultContainer = function () {\n    debug('clearResultContainer');\n    debug(root.resultContainer);\n    root.hideResultContainer();\n    root.container.find('.containerLoading').show();\n    /*\n    let template=root.container.find('template[data-name=\"loading\"]').html()\n    root.resultContainer.html(template);\n      */\n  };\n  this.hideResultContainer = function () {\n    debug('hide containerResult');\n    debug(root.resultContainer);\n    root.resultContainer.hide();\n  };\n  this.showResultContainer = function () {\n    root.container.find('.containerLoading').hide();\n    root.resultContainer.show();\n  };\n  this.init = function (options, ProductItem) {\n    console.log('ProductAdmin init');\n    $.extend(Opts, options);\n    if (Opts.testMode) {\n      return root.testMode();\n    }\n    if (ProductItem) {\n      root.Product = ProductItem;\n    }\n    root.dataTable = null;\n    root.container = $(Opts.containerCssSelector);\n    root.resultContainer = $(Opts.resultContainerSelector);\n    root.initViewList();\n  };\n  this.initViewDetails = function (options, ProductItem) {\n    debug('**call initViewDetails ');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .productForm';\n    if (root.Product.picture) {\n      console.log('*****//////////////////****************');\n      console.log(root.Product.picture);\n      console.log(CSSSelectorForm);\n      var picUrl = root.Product.picture.PublicUrl + '/' + root.Product.picture.filename;\n      console.log(picUrl);\n      console.log($(CSSSelectorForm + ' img.imageProduct'));\n      $(CSSSelectorForm + ' img.imageProduct').attr('src', picUrl);\n    }\n    if (root.Product.specification) {\n      console.log('*****//////////////////****************');\n      console.log(root.Product.specification);\n      var docUrl = root.Product.specification.PublicUrl + '/' + root.Product.specification.filename;\n      root.addAttachment(root.Product.specification);\n    }\n    var FormSaveButton = $(CSSSelectorForm + ' button.FormSaveButton');\n    FormSaveButton.off('click');\n    FormSaveButton.on('click', root.clickSaveButton);\n  };\n  this.addAttachment = function (attachmentData) {\n    console.log(attachmentData);\n    var CSSSelectorForm = Opts.containerCssSelector + ' .productForm';\n    //root.Supplier.attachment.push(attachmentData);\n    //attachmentData.rowNum=root.Supplier.attachment.length;\n    attachmentData.rowNum = 1;\n    var dateStr = new Date(attachmentData.updated_at);\n    dateStr = dateStr.toLocaleString('hu-HU', {});\n    attachmentData.date = dateStr;\n    attachmentData.link = attachmentData.PublicUrl + '/' + attachmentData.filename;\n    var template = $('template[data-name=\"productAttachmentTableRow\"]').html();\n    var render = Mustache.render(template, attachmentData);\n    $(CSSSelectorForm + ' .attachmentTable tbody').append(render);\n    //root.bindContactClickAction();\n    Toast.enableTimers(false);\n    Toast.create({\n      title: \"Fájl hozzáadva!\",\n      message: attachmentData.original_filename + \" fájl hozzáadva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.setVisibleFilters = function (type) {\n    console.log('setVisibleFilters');\n    console.log(Opts.filters[type]);\n    console.log(root.container);\n    $(root.container).find('div[class*=\"filter\"]').hide();\n    for (var typeIndex in Opts.filters[type]) {\n      var typeName = Opts.filters[type][typeIndex];\n      debug(typeName);\n      console.log($(root.container).find('.filter_' + typeName));\n      $(root.container).find('.filter_' + typeName).show();\n    }\n  };\n  this.c = function (CSSSelectorForm) {\n    console.log('c called');\n    console.log(CSSSelectorForm);\n    console.log(root.container);\n    console.log(root.container.find('form'));\n    console.log(root.container.find(CSSSelectorForm));\n  };\n  this.formDataToDataObjectAPICall = function (CSSSelectorForm) {\n    console.log(CSSSelectorForm);\n    console.log(root.container);\n    console.log(root.container.find(CSSSelectorForm));\n    console.log(root.container.find('form'));\n    console.log(root.container.find('form' + CSSSelectorForm)[0]);\n    //return;\n    var ajaxData = new FormData(root.container.find('form' + CSSSelectorForm)[0]);\n    $.each(ajaxData.getAll('supplier'), function (key, value) {\n      ajaxData.append('suppliers[]', value);\n    });\n    ajaxData[\"delete\"]('supplier');\n    $.each(ajaxData.getAll('profitCenter'), function (key, value) {\n      ajaxData.append('profitCenters[]', value);\n    });\n    ajaxData[\"delete\"]('profitCenter');\n    $.each(ajaxData.getAll('productGroup'), function (key, value) {\n      ajaxData.append('productGroups[]', value);\n    });\n    ajaxData[\"delete\"]('productGroup');\n    $.each(ajaxData.getAll('product'), function (key, value) {\n      ajaxData.append('products[]', value);\n    });\n    ajaxData[\"delete\"]('product');\n    $.each(ajaxData.getAll('producer'), function (key, value) {\n      ajaxData.append('producers[]', value);\n    });\n    ajaxData[\"delete\"]('producer');\n    $.each(ajaxData.getAll('hooreycaName'), function (key, value) {\n      ajaxData.append('hooreycaNames[]', value);\n    });\n    ajaxData[\"delete\"]('hooreycaName');\n\n    //ajaxData.append('_token', root.container.find('input[name=_token]').val());\n\n    /*\n                    $(CSSSelectorForm + ' input[data-inputmask]').each(function () {\n                        let indexKey = $(this).attr('name');\n                        if (ajaxData.get(indexKey)) {\n                            ajaxData.set(indexKey, ajaxData.get(indexKey).replace(/[_ ]+$/g, \"\"));\n                        }\n                    });\n    */\n    return ajaxData;\n  };\n  this.getAjaxDataJson = function () {\n    var ajaxData = root.formDataToDataObjectAPICall('.ProductListForm');\n    console.log('======================');\n    var _iterator = _createForOfIteratorHelper(ajaxData.entries()),\n      _step;\n    try {\n      for (_iterator.s(); !(_step = _iterator.n()).done;) {\n        var pair = _step.value;\n        console.log(pair[0] + ', ' + pair[1]);\n      }\n    } catch (err) {\n      _iterator.e(err);\n    } finally {\n      _iterator.f();\n    }\n    var object = {};\n    ajaxData.forEach(function (value, key) {\n      // Reflect.has in favor of: object.hasOwnProperty(key)\n      if (!Reflect.has(object, key)) {\n        object[key] = value;\n        return;\n      }\n      if (!Array.isArray(object[key])) {\n        object[key] = [object[key]];\n      }\n      object[key].push(value);\n    });\n    var ajaxDataJson = JSON.stringify(object);\n    return ajaxDataJson;\n  };\n  this.requestProducts = function () {\n    var ajaxUrl = Opts.URL.getDataTableContent;\n    var ajaxMethod = 'GET';\n    //token formdataba!\n    debug(ajaxUrl);\n    ajaxDataJson = root.getAjaxDataJson();\n    console.log(ajaxDataJson);\n\n    // Save filters to localStorage\n    var form = root.container.find('form.ProductListForm');\n    if (form.length > 0) {\n      var formData = new FormData(form[0]);\n      var filterData = {};\n      formData.forEach(function (value, key) {\n        if (!Reflect.has(filterData, key)) {\n          filterData[key] = value;\n          return;\n        }\n        if (!Array.isArray(filterData[key])) {\n          filterData[key] = [filterData[key]];\n        }\n        filterData[key].push(value);\n      });\n      localStorage.setItem('product_admin_filters', JSON.stringify(filterData));\n    }\n    dataTableCSSSelector = Opts.containerCssSelector + ' .dataTable'; //\n    console.log(dataTableCSSSelector);\n    var colNum = $(dataTableCSSSelector + ' thead th').length; //buttons insert position need\n    APP.setOpts({\n      datatableRowActionButtonClickCallBack: root.datatableRowActionButtonClick\n    });\n    var orderDirective = Opts.dataTable.orderDirective;\n    /*\n    if(typeof options['orderDirective']!='undefined'){\n        orderDirective=options['orderDirective'];\n    }\n    */\n\n    if (!root.dataTable) {\n      console.log('XXXXXXXXXXXXXXXXXXXX Nincs Datatable');\n      root.dataTable = $(dataTableCSSSelector).DataTable({\n        language: {\n          url: '//cdn.datatables.net/plug-ins/1.10.24/i18n/Hungarian.json'\n        },\n        //\"ajax\": \"{{asset('exapmle2.json')}}\",\n        \"ajax\": {\n          url: Opts.URL.getDataTableContent,\n          data: function data(d) {\n            console.log('---******----');\n            console.log(APP.ProductAdmin.getAjaxDataJson());\n            return $.extend({}, d, {\n              ajaxData: APP.ProductAdmin.getAjaxDataJson\n            });\n          },\n          type: ajaxMethod\n          /*\n                              data: ajaxData,\n          */\n        },\n        serverSide: true,\n        \"columnDefs\": [{\n          \"targets\": colNum - 1,\n          orderable: false,\n          \"render\": function render(data, type, row) {\n            var buttons = APP.datatableAddRowEditButton(0, arguments);\n            return buttons;\n          }\n        }, {\n          \"targets\": 1,\n          \"render\": function render(data, type, row) {\n            return type === \"sort\" ? data.latinise() : data;\n          }\n        }\n        //{ \"visible\": false,  \"targets\": [ 0 ] }\n        ],\n        buttons: {\n          buttons: ['excel', 'pdf', {\n            extend: 'print',\n            //text: 'Print current page',\n            'title': 'title custom text',\n            'messageTop': 'Message On Top',\n            autoPrint: true\n          }]\n        },\n        \"columns\": [{\n          \"data\": \"id\"\n        }, {\n          \"data\": \"name\"\n        }, {\n          \"data\": \"hooreycaId\"\n        }, {\n          \"data\": \"productGroup\"\n        }, {\n          \"data\": \"supplierName\"\n        }, {\n          \"data\": \"price\"\n        }, {\n          \"data\": \"created_at\"\n        }, null],\n        \"order\": orderDirective,\n        \"stateSave\": true,\n        \"drawCallback\": function drawCallback(settings) {\n          APP.datatableAddRowAction(dataTableCSSSelector);\n          root.showResultContainer();\n          console.log('drawCallback');\n        }\n      });\n    } else {\n      console.log('XXXXXXXXXXXXXXXXXXXX van Datatable');\n      //root.dataTable.ajax.reload();\n      root.dataTable.draw();\n    }\n  };\n  this.loadFiltersFromLocalStorage = function () {\n    var filters = localStorage.getItem('product_admin_filters');\n    if (filters) {\n      var filterData = JSON.parse(filters);\n      var form = root.container.find('form.ProductListForm');\n      if (form.length === 0) return false;\n      var _loop = function _loop() {\n        var value = filterData[key];\n        var fields = form.find('[name=\"' + key + '\"]');\n        if (fields.length) {\n          if (fields.is('select')) {\n            fields.val(value).trigger('change');\n          } else if (fields.is(':checkbox') || fields.is(':radio')) {\n            fields.each(function () {\n              if (Array.isArray(value)) {\n                $(this).prop('checked', value.includes($(this).val()));\n              } else {\n                $(this).prop('checked', $(this).val() == value);\n              }\n            });\n          } else {\n            fields.val(value);\n          }\n        }\n      };\n      for (var key in filterData) {\n        _loop();\n      }\n      return true;\n    }\n    return false;\n  };\n  this.processResponse = function () {};\n  this.clickSaveButton = function (event) {\n    debug('Save clicked');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .productForm';\n    event.preventDefault();\n    if ($(CSSSelectorForm)[0].checkValidity() === false) {\n      console.log('validaton false');\n      event.stopPropagation();\n      return;\n    } else {\n      console.log('validaton ok');\n      //do your ajax submition here\n    }\n    var ajaxData = root.formDataToDataObjectAPICall('.productForm');\n    var ajaxUrl = Opts.URL.store;\n    var ajaxMethod = \"POST\";\n    if (root.Product.id) {\n      ajaxUrl = Opts.URL.update.replace('%id%', root.Product.id);\n      //ajaxMethod=\"PUT\";\n      //ajaxData=new FormData($(CSSSelectorForm)[0]);\n      ajaxData.append('_method', 'PUT');\n    }\n    debug(ajaxMethod);\n    debug(ajaxData);\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      type: ajaxMethod,\n      contentType: false,\n      processData: false,\n      headers: {\n        //'X-CSRF-TOKEN': $('input[name=\"_token\"]').val()\n        'X-CSRF-TOKEN': Opts.token\n      },\n      success: function success(data) {\n        debug(data);\n        if (data.success == true) {\n          //Opts.onAfterInitViewDetails=root.autofillDetails;\n          Opts.dataTable.orderDirective = [0, 'desc'];\n          Toast.create({\n            title: \"Sikeres rögzítés!\",\n            message: ajaxData.get('name') + \" nevű termék elmentve\",\n            status: TOAST_STATUS.SUCCESS,\n            timeout: 5000\n          });\n          //                        APP.loadMainContent(Opts.URL.index+'?init=0',root.initViewList);\n        }\n      }\n    });\n  };\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 58856 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/product.js\n\n}");

/***/ },

/***/ "./resources/js/admin/profitCenter.js"
/*!********************************************!*\
  !*** ./resources/js/admin/profitCenter.js ***!
  \********************************************/
() {

eval("{function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nif (typeof DataModelProfitCenter === 'undefined') {\n  var _DataModelProfitCenter = /*#__PURE__*/function (_DataModel) {\n    /*\r\n     * Constructor\r\n     */\n    function _DataModelProfitCenter(data, options) {\n      var _this;\n      _classCallCheck(this, _DataModelProfitCenter);\n      _this = _callSuper(this, _DataModelProfitCenter, [data, options]);\n      if (typeof _this.contact === \"undefined\") {\n        _this.contact = [];\n      }\n      if (typeof _this.address === \"undefined\") {\n        _this.address = [];\n      }\n      console.log(_this.constructor.name + ' constructor called');\n      return _this;\n    }\n    _inherits(_DataModelProfitCenter, _DataModel);\n    return _createClass(_DataModelProfitCenter);\n  }(DataModel);\n  ;\n  window.DataModelProfitCenter = _DataModelProfitCenter;\n}\nwindow.ProfitCenterAdmin = function (options, ProfitCenterItem) {\n  /*\r\n   * Variables accessible\r\n   * in the class\r\n   */\n  var Opts = {\n    token: null,\n    containerCssSelector: '.containerProfitCenter',\n    testMode: false,\n    URL: {\n      getDataTableContent: '',\n      index: '',\n      show: '',\n      edit: '',\n      create: '',\n      store: '',\n      update: '',\n      destroy: ''\n    },\n    dataTable: {\n      orderDirective: [1, 'asc']\n    },\n    onAfterInitViewDetails: function onAfterInitViewDetails() {}\n  };\n  var ProfitCenter = {};\n  var root = this;\n  var contactPopupWorkflow = 'new';\n  var addressPopupWorkflow = 'new';\n  var CSSSelectorForm = '';\n  var dataTableCSSSelector = '';\n  /*\r\n   * Constructor\r\n   */\n  this.construct = function (options, ProfitCenterItem) {\n    console.log('ProfitCenterAdmin constructor called');\n    $.extend(Opts, options);\n    if (!ProfitCenterItem) {\n      console.log('ProfitCentert letre kellet hozni ');\n      if (!APP.ProfitCenter) {\n        APP.ProfitCenter = new window.DataModelProfitCenter();\n      }\n      root.ProfitCenter = APP.ProfitCenter;\n    }\n    CSSSelectorForm = Opts.containerCssSelector + ' .profitCenterForm';\n  };\n  this.getOpts = function () {\n    return Opts;\n  };\n  this.getData = function () {\n    return root.ProfitCenter;\n  };\n  this.init = function (options, ProfitCenterItem) {\n    $.extend(Opts, options);\n    if (Opts.testMode) {\n      return root.testMode();\n    }\n    if (ProfitCenterItem) {\n      root.ProfitCenter = ProfitCenterItem;\n    }\n    root.initViewList();\n  };\n  this.clickNew = function () {\n    debug('clickNew');\n    APP.loadMainContent(Opts.URL.create, root.clickNewCallBack);\n  };\n  this.clickNewCallBack = function () {\n    debug('callbackNew');\n    root.ProfitCenter = new window.DataModelProfitCenter();\n    root.initViewDetails();\n  };\n  this.initViewDetails = function (options, SupplierItem) {\n    debug('**call initViewDetails ');\n    /**\r\n     * Contact Popup setup\r\n     */\n    if (!APP.ContactPopUp) {\n      console.log('nincs APP.ContactPopUp');\n      APP.ContactPopUp = new window.ContactPopUp();\n    } else {\n      console.log('mar van  APP.ContactPopUp');\n    }\n    APP.ContactPopUp.init({\n      active: true,\n      onAfterSave: root.contactAction\n    });\n    root.renderContact();\n    $(CSSSelectorForm + ' .buttonNewContact').bind('click', function () {\n      APP.ProfitCenterAdmin.setContactPopupWorkflow('new');\n      APP.ContactPopUp.clearData();\n      APP.ContactPopUp.show();\n    });\n    /**\r\n     * Address Popup setup\r\n     */\n    if (!APP.AddressPopUp) {\n      console.log('nincs APP.AddressPopUp');\n      APP.AddressPopUp = new window.AddressPopUp();\n    } else {\n      console.log('mar van  APP.AddressPopUp');\n    }\n    APP.AddressPopUp.init({\n      active: true,\n      onAfterSave: root.addressAction\n    });\n    root.renderAddress();\n    $(CSSSelectorForm + ' .buttonNewAddress').bind('click', function () {\n      APP.ProfitCenterAdmin.setAddressPopupWorkflow('new');\n      APP.AddressPopUp.clearData();\n      APP.AddressPopUp.show();\n    });\n    /**\r\n     *\r\n     */\n\n    $('[data-toggle=\"tooltip\"]').tooltip();\n    initRadioButtons({\n      onChange: function onChange(value, node) {\n        debug(value);\n        debug(node);\n        /*\r\n                              if(node==='profitCenterMultiAddress'){\r\n                                if(value==1){\r\n                                    $('.containerMultiAddress').removeClass('d-none');\r\n                                }else{\r\n                                    $('.containerMultiAddress').addClass('d-none');\r\n                                }\r\n                            }\r\n          */\n        if (node === 'addressEqual') {\n          if (value == 1) {\n            $(CSSSelectorForm + ' .containerMultiAddress').addClass('d-none');\n            $(CSSSelectorForm + ' .containerMultiAddressSwitch').addClass('d-none');\n          } else {\n            $(CSSSelectorForm + ' .containerMultiAddress').removeClass('d-none');\n            $(CSSSelectorForm + ' .containerMultiAddressSwitch').removeClass('d-none');\n          }\n        }\n      }\n    });\n    $(CSSSelectorForm + \" :input\").inputmask({\n      \"onincomplete\": function onincomplete() {\n        console.log($(this).data('required'));\n        if ($(this).val().length > 0 || $(this).data('required') === true) {\n          $(this).addClass('is-invalid');\n        }\n      },\n      \"oncomplete\": function oncomplete() {\n        $(this).removeClass('is-invalid');\n        $(this).addClass('is-valid');\n      },\n      \"oncleared\": function oncleared() {\n        console.log('cleared');\n        $(this).removeClass('is-invalid');\n      }\n    });\n    $(CSSSelectorForm + ' button.FormSaveButton').off('click');\n    $(CSSSelectorForm + ' button.FormSaveButton').on('click', root.clickSaveButton);\n    /*\r\n            $(\"input[name=logoFile]\").change(function(){\r\n                setImageFromLocal(this,Opts.containerCssSelector+' .imageLogo');\r\n            });\r\n    */\n\n    //Opts.onAfterInitViewDetails();\n    debug('**end initViewDetails ');\n  };\n  this.setDetailsViewData = function () {\n    debug('setDetailsViewData');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .profitCenterForm';\n    var needToSet = ['name', 'hooreycaId', 'nameId', 'email', 'postCode', 'city', 'street', 'phone', 'mobil'];\n    $.each(needToSet, function () {\n      // debug(this); //alapadatok beallitasanak logolasa\n      if (typeof root.ProfitCenter[this] != 'undefined') {\n        /* //alapadatok beallitasanak logolasa\r\n                        debug(root.ProfitCenter[this]);\r\n                        debug(CSSSelectorForm+' input[name='+this+']');\r\n                        debug($(CSSSelectorForm+' input[name='+this+']'));\r\n        */\n        $(CSSSelectorForm + ' input[name=' + this + ']').val(root.ProfitCenter[this]);\n      }\n    });\n    if (typeof root.ProfitCenter['note'] != 'undefined') {\n      $(CSSSelectorForm + ' textarea[name=note]').val(root.ProfitCenter.note);\n    }\n    $(CSSSelectorForm + ' *[data-toggle=canSee][data-title=' + root.ProfitCenter.canSee + ']').click();\n    $(CSSSelectorForm + ' *[data-toggle=hooreycaDataActive][data-title=' + root.ProfitCenter.hooreycaDataActive + ']').click();\n    if (typeof root.ProfitCenter['logoFile'] != 'undefined' && root.ProfitCenter['logoFile']) {\n      $(CSSSelectorForm + ' img.imageLogo').attr('src', root.ProfitCenter['logoFile']);\n    }\n    $(CSSSelectorForm + ' *[data-toggle=addressEqual][data-title=' + root.ProfitCenter.addressEqual + ']').click();\n    $(CSSSelectorForm + ' *[data-toggle=multiAddress][data-title=' + root.ProfitCenter.multiAddress + ']').click();\n    /*debug(root.ProfitCenter.address.length);\r\n    if(root.ProfitCenter.address.length>0){\r\n        $(CSSSelectorForm+' *[data-toggle=addressEqual][data-title=0]').click();\r\n        if(root.ProfitCenter.address.length>1){\r\n            $(CSSSelectorForm+' *[data-toggle=multiAddress][data-title=1]').click();\r\n        }\r\n    }\r\n    */\n    var supplier = [];\n    $.each(root.ProfitCenter.suppliers, function () {\n      supplier.push(this.name);\n    });\n    //$(CSSSelectorForm+' .profitCenterSelect').val(profitCenter).change();\n    $.each(supplier, function () {\n      $('input[value=\"' + $.escapeSelector(this) + '\"]').prop(\"checked\", true);\n    });\n  };\n  this.resetContactTable = function () {\n    $(CSSSelectorForm + ' .contactTable tbody tr').remove();\n    root.renderContact();\n  };\n  this.renderContact = function () {\n    var rowNum = 1;\n    console.log('renderingContacts');\n    $.each(root.ProfitCenter.getData('contact'), function () {\n      var contactData = this;\n      contactData.rowNum = rowNum;\n      var template = $('template[data-name=\"profitCenterContactTableRow\"]').html();\n      var render = Mustache.render(template, contactData);\n      $('.contactTable tbody').append(render);\n      rowNum++;\n    });\n    root.bindContactClickAction();\n  };\n  this.bindContactClickAction = function () {\n    $('.contactTable .buttonDelete').unbind('click');\n    $('.contactTable .buttonDelete').bind('click', root.contactDeleteClick);\n    $('.contactTable .buttonEdit').unbind('click');\n    $('.contactTable .buttonEdit').bind('click', root.contactEditClick);\n  };\n  this.contactDeleteClick = function (event) {\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=contactId]').val();\n    console.log(id);\n    root.ProfitCenter.contact = root.ProfitCenter.contact.filter(function (value, index, arr) {\n      if (value.id !== id * 1) {\n        return true;\n      }\n      return false;\n    });\n    console.log(root.ProfitCenter.contact);\n    row.remove();\n    root.resetContactTable();\n  };\n  this.getContactPopupWorkflow = function () {\n    return contactPopupWorkflow;\n  };\n  this.setContactPopupWorkflow = function (status) {\n    contactPopupWorkflow = status;\n  };\n  this.contactEditClick = function (event) {\n    console.log(this);\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=contactId]').val();\n    console.log(id);\n    root.setContactPopupWorkflow('edit');\n    APP.ContactPopUp.loadData(id);\n  };\n  this.contactAction = function (contactData) {\n    console.log('nah most kellene meg valamit csinalni.');\n    if (root.getContactPopupWorkflow() == 'new') {\n      root.addContact(contactData);\n    } else if (root.getContactPopupWorkflow() == 'edit') {\n      root.editContact(contactData.id, contactData);\n    }\n  };\n  this.addContact = function (contactData) {\n    /*\r\n    fel kell venni a sorba\r\n     */\n    root.ProfitCenter.contact.push(contactData);\n    contactData.rowNum = root.ProfitCenter.contact.length;\n    var template = $('template[data-name=\"profitCenterContactTableRow\"]').html();\n    var render = Mustache.render(template, contactData);\n    $(CSSSelectorForm + ' .contactTable tbody').append(render);\n    root.bindContactClickAction();\n    Toast.enableTimers(false);\n    Toast.create({\n      title: \"Kapcsolat tartó hozzáadva!\",\n      message: contactData.name + \" nevű kapocsolattartó hozzáadva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.editContact = function (id, contactData) {\n    var newContacts = [];\n    $.each(root.ProfitCenter.getData('contact'), function (index) {\n      if (this.id == id) {\n        newContacts.push(contactData);\n      } else {\n        newContacts.push(this);\n      }\n    });\n    root.ProfitCenter.contact = newContacts;\n    root.resetContactTable();\n    Toast.create({\n      title: \"Kapcsolat adatai módosítva!\",\n      message: contactData.name + \" nevű kapocsolattartó módosítva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n\n  /***************\r\n   *\r\n   * Address function\r\n   *\r\n   */\n  this.resetAddressTable = function () {\n    $(CSSSelectorForm + ' .addressTable tbody tr').remove();\n    root.renderAddress();\n  };\n  this.renderAddress = function () {\n    var rowNum = 1;\n    console.log('renderingAddress');\n    $.each(root.ProfitCenter.getData('address'), function () {\n      var itemData = this;\n      itemData.rowNum = rowNum;\n      var template = $('template[data-name=\"profitCenterAddressTableRow\"]').html();\n      debug(itemData);\n      var render = Mustache.render(template, itemData);\n      $('.addressTable tbody').append(render);\n      rowNum++;\n    });\n    root.bindAddressClickAction();\n  };\n  this.bindAddressClickAction = function () {\n    $('.addressTable .buttonDelete').unbind('click');\n    $('.addressTable .buttonDelete').bind('click', root.addressDeleteClick);\n    $('.addressTable .buttonEdit').unbind('click');\n    $('.addressTable .buttonEdit').bind('click', root.addressEditClick);\n  };\n  this.addressDeleteClick = function (event) {\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=\"addressId[]\"]').val();\n    console.log(id);\n    root.ProfitCenter.address = root.ProfitCenter.address.filter(function (value, index, arr) {\n      if (value.id != id) return true;\n    });\n    console.log(root.ProfitCenter.address);\n    row.remove();\n    root.resetAddressTable();\n  };\n  this.getAddressPopupWorkflow = function () {\n    return addressPopupWorkflow;\n  };\n  this.setAddressPopupWorkflow = function (status) {\n    addressPopupWorkflow = status;\n  };\n  this.addressEditClick = function (event) {\n    console.log(this);\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=\"addressId[]\"]').val();\n    console.log(id);\n    root.setAddressPopupWorkflow('edit');\n    APP.AddressPopUp.loadData(id);\n  };\n  this.addressAction = function (itemData) {\n    console.log('nah most kellene meg valamit csinalni.');\n    if (root.getAddressPopupWorkflow() == 'new') {\n      root.addAddress(itemData);\n    } else if (root.getAddressPopupWorkflow() == 'edit') {\n      root.editAddress(itemData.id, itemData);\n    }\n  };\n  this.addAddress = function (ItemData) {\n    /*\r\n    fel kell venni a sorba\r\n     */\n    root.ProfitCenter.address.push(ItemData);\n    ItemData.rowNum = root.ProfitCenter.address.length;\n    var template = $('template[data-name=\"profitCenterAddressTableRow\"]').html();\n    var render = Mustache.render(template, ItemData);\n    $(CSSSelectorForm + ' .addressTable tbody').append(render);\n    root.bindAddressClickAction();\n    Toast.enableTimers(false);\n    Toast.create({\n      title: \"Cím hozzáadva!\",\n      message: ItemData.street + \" hozzáadva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.editAddress = function (id, itemData) {\n    var newItem = [];\n    $.each(root.ProfitCenter.getData('address'), function (index) {\n      if (this.id == id) {\n        newItem.push(itemData);\n      } else {\n        newItem.push(this);\n      }\n    });\n    root.ProfitCenter.address = newItem;\n    root.resetAddressTable();\n    Toast.create({\n      title: \"cím adatai módosítva!\",\n      message: itemData.street + \" módosítva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.initViewList = function () {\n    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    debug('listview inicialization');\n    dataTableCSSSelector = Opts.containerCssSelector + ' .dataTable'; //\n\n    var colNum = $(dataTableCSSSelector + ' thead th').length; //buttons insert position need\n    APP.setOpts({\n      datatableActionButtonClickCallBack: root.clickNew,\n      datatableRowActionButtonClickCallBack: root.datatableRowActionButtonClick\n    });\n    var orderDirective = Opts.dataTable.orderDirective;\n    if (typeof options['orderDirective'] != 'undefined') {\n      orderDirective = options['orderDirective'];\n    }\n    $(dataTableCSSSelector).DataTable({\n      language: {\n        url: '//cdn.datatables.net/plug-ins/1.10.24/i18n/Hungarian.json'\n      },\n      //\"ajax\": \"{{asset('exapmle2.json')}}\",\n      \"ajax\": Opts.URL.getDataTableContent,\n      \"columnDefs\": [{\n        \"targets\": colNum - 1,\n        \"render\": function render(data, type, row) {\n          var buttons = APP.datatableAddRowTrashButton(0, arguments);\n          buttons += APP.datatableAddRowEditButton(0, arguments);\n          return buttons;\n        }\n      }, {\n        \"targets\": 1,\n        \"render\": function render(data, type, row) {\n          return type === \"sort\" ? data.latinise() : data;\n        }\n      }\n      //{ \"visible\": false,  \"targets\": [ 0 ] }\n      ],\n      buttons: {\n        buttons: ['excel', 'pdf', {\n          extend: 'print',\n          //text: 'Print current page',\n          'title': 'title custom text',\n          'messageTop': 'Message On Top',\n          autoPrint: true\n        }, /**/\n\n        {\n          text: 'Új felvitele',\n          className: 'btn btn-success newItem',\n          attr: {\n            /*\r\n                                        data:{\r\n                                            a:1,\r\n                                            b:2\r\n                                          }\r\n            */\n            'data': 'newItem'\n          },\n          init: function init(api, node, config) {\n            $(node).removeClass('ui-button');\n          },\n          action: function action(e, dt, node, config) {\n            APP.datatableActionButtonClickCallBack(arguments);\n            /* console.log(e);\r\n             console.log(dt);\r\n             console.log(node);\r\n             console.log(config);*/\n          }\n        }]\n      },\n      \"columns\": [{\n        \"data\": \"id\"\n      }, {\n        \"data\": \"name\"\n      }, {\n        \"data\": \"hooreycaId\"\n      }, {\n        \"data\": \"nameId\"\n      }, {\n        \"data\": \"created_at\"\n      }, null],\n      \"order\": orderDirective,\n      //\"stateSave\": true,\n      \"drawCallback\": function drawCallback(settings) {\n        APP.datatableAddRowAction(dataTableCSSSelector);\n      }\n    });\n    debug('listview end');\n  };\n  this.datatableRowActionButtonClick = function (event) {\n    debug('datatableRowActionButtonClick');\n    var node = $(event[0].currentTarget);\n    var row = $(dataTableCSSSelector).DataTable().row(node.parents('tr'));\n    var rowData = row.data();\n    var actionName = 'datatableRowAction' + node.data('buttontype').capitalize();\n    if (typeof root[actionName] === \"function\") {\n      return root[actionName](rowData, node);\n    }\n  };\n  this.datatableRowActionEdit = function (rowData, node) {\n    console.log('datatableRowActionEdit Called');\n    //Opts.onAfterInitViewDetails=root.autofillDetails;\n    var ajaxUrl = Opts.URL.edit.replace('%id%', rowData.id);\n    /*\r\n            console.log(Opts.URL);\r\n            console.log(ajaxUrl);\r\n    */\n    APP.loadMainContent(ajaxUrl, root.initViewDetails);\n    console.log('datatableRowActionEdit End');\n  };\n  this.datatableRowActionDelete = function (rowData, node) {\n    console.log('datatableRowActionDelete Called');\n    var row = $(dataTableCSSSelector).DataTable().row(node.parents('tr'));\n    var ajaxData = {};\n    var ajaxUrl = Opts.URL.destroy.replace('%id%', rowData.id);\n    ajaxData._token = $('input[name=_token]').val();\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      method: \"DELETE\",\n      success: function success(data) {\n        if (data.success == true) {\n          row.remove().draw();\n        }\n      }\n    });\n  };\n  this.clickSaveButton = function (event) {\n    debug('Save clicked');\n    event.preventDefault();\n    debug(CSSSelectorForm);\n    debug($(CSSSelectorForm));\n    if ($(CSSSelectorForm)[0].checkValidity() === false) {\n      console.log('validaton false');\n      $(CSSSelectorForm).addClass('was-validated');\n      $(CSSSelectorForm)[0].reportValidity();\n      Toast.create({\n        title: \"Validációs hiba!\",\n        message: \"Kérjük, töltse ki a kötelező mezőket!\",\n        status: TOAST_STATUS.DANGER,\n        timeout: 5000\n      });\n      event.stopPropagation();\n      return;\n    } else {\n      console.log('validaton ok');\n      $(CSSSelectorForm).removeClass('was-validated');\n      //do your ajax submition here\n    }\n    var ajaxData = root.formDataToDataObjectAPICall(CSSSelectorForm);\n    var ajaxUrl = Opts.URL.store;\n    var ajaxMethod = \"POST\";\n    if (root.ProfitCenter.id) {\n      ajaxUrl = Opts.URL.update.replace('%id%', root.ProfitCenter.id);\n      //ajaxMethod=\"PUT\";\n      //ajaxData=new FormData($(CSSSelectorForm)[0]);\n      ajaxData.append('_method', 'PUT');\n    }\n    /*\r\n            debug(ajaxUrl);\r\n            debug(ajaxMethod);\r\n            debug(ajaxData.entries());\r\n            for (var pair of ajaxData.entries()) {\r\n                console.log(pair[0]+ ', ' + pair[1]);\r\n            }\r\n    */\n\n    console.table(Object.fromEntries(ajaxData));\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      type: ajaxMethod,\n      contentType: false,\n      processData: false,\n      headers: {\n        'X-CSRF-TOKEN': $('input[name=\"_token\"]').val()\n      },\n      success: function success(data) {\n        debug(data);\n        if (data.success == true) {\n          //Opts.onAfterInitViewDetails=root.autofillDetails;\n          Opts.dataTable.orderDirective = [0, 'desc'];\n          Toast.create({\n            title: \"Sikeres rögzítés!\",\n            message: ajaxData.get('name') + \" nevű profitcenter elmentve\",\n            status: TOAST_STATUS.SUCCESS,\n            timeout: 5000\n          });\n          APP.loadMainContent(Opts.URL.index + '?init=0', root.initViewList);\n        }\n      }\n    });\n  };\n  this.formDataToDataObjectAPICall = function (CSSSelectorForm) {\n    var ajaxData = new FormData($(CSSSelectorForm)[0]);\n    /*\r\n            $.each(ajaxData.getAll('productGroup'),function(key,value){\r\n                ajaxData.append('productGroup[]',value);\r\n            })\r\n    */\n    $.each(ajaxData.getAll('contactId'), function (key, value) {\n      ajaxData.append('contactId[]', value);\n    });\n    ajaxData.append('_token', $('input[name=_token]').val());\n    $(CSSSelectorForm + ' input[data-inputmask]').each(function () {\n      var indexKey = $(this).attr('name');\n      if (ajaxData.get(indexKey)) {\n        ajaxData.set(indexKey, ajaxData.get(indexKey).replace(/[_ ]+$/g, \"\"));\n      }\n    });\n    $.each(ajaxData.getAll('supplier'), function (key, value) {\n      ajaxData.append('supplier[]', value);\n    });\n    return ajaxData;\n  };\n  this.construct(options, ProfitCenterItem);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 66592 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/profitCenter.js\n\n}");

/***/ },

/***/ "./resources/js/admin/supplier.js"
/*!****************************************!*\
  !*** ./resources/js/admin/supplier.js ***!
  \****************************************/
() {

eval("{function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nif (typeof Supplier === 'undefined') {\n  var _Supplier = /*#__PURE__*/function (_DataModel) {\n    /*\n     * Constructor\n     */\n    function _Supplier(data, options) {\n      var _this;\n      _classCallCheck(this, _Supplier);\n      _this = _callSuper(this, _Supplier, [data, options]);\n      if (typeof _this.contact === \"undefined\") {\n        _this.contact = [];\n      }\n      if (typeof _this.canSee === \"undefined\") {\n        _this.canSee = 1;\n      }\n      if (typeof _this.canSeeInOrder === \"undefined\") {\n        _this.canSeeInOrder = 1;\n      }\n      if (typeof _this.hasDeliveryConstraint === \"undefined\") {\n        _this.hasDeliveryConstraint = 0;\n      }\n      if (typeof _this.orderCutOffTime === \"undefined\") {\n        _this.orderCutOffTime = 12;\n      }\n      if (typeof _this.deliveryLeadTime === \"undefined\") {\n        _this.deliveryLeadTime = 48;\n      }\n      console.log('Supplier constructor called');\n      return _this;\n    }\n    _inherits(_Supplier, _DataModel);\n    return _createClass(_Supplier);\n  }(DataModel);\n  ;\n  window.Supplier = _Supplier;\n}\nwindow.SupplierAdmin = function (options, SupplierItem) {\n  /*\n   * Variables accessible\n   * in the class\n   */\n  var Opts = {\n    token: null,\n    containerCssSelector: '.containerSupplier',\n    testMode: false,\n    URL: {\n      getDataTableContent: '',\n      index: '',\n      show: '',\n      edit: '',\n      create: '',\n      store: '',\n      update: '',\n      destroy: '',\n      attachFile: '',\n      detachFile: '',\n      createUser: ''\n    },\n    dataTable: {\n      orderDirective: [1, 'asc']\n    },\n    onAfterInitViewDetails: function onAfterInitViewDetails() {}\n  };\n  var Supplier = {};\n  var root = this;\n  var contactPopupWorkflow = 'new';\n  /*\n   * Constructor\n   */\n  this.construct = function (options, SupplierItem) {\n    console.log('SupplierAdmin constructor called');\n    $.extend(Opts, options);\n    if (!SupplierItem) {\n      console.log('supplier letre kellet hozni ');\n      if (!APP.Supplier) {\n        APP.Supplier = new window.Supplier();\n      }\n      root.Supplier = APP.Supplier;\n    }\n  };\n  this.getOpts = function () {\n    return Opts;\n  };\n  this.formDataToDataObjectAPICallOld = function (CSSSelector) {\n    var data = new FormData(document.querySelector(CSSSelector));\n    //let formJSON = Object.fromEntries(data.entries());\n    var formJSON = {};\n    data.forEach(function (value, key) {\n      // Reflect.has in favor of: formJSON.hasOwnProperty(key)\n      if (!Reflect.has(formJSON, key)) {\n        formJSON[key] = value;\n        return;\n      }\n      if (!Array.isArray(formJSON[key])) {\n        formJSON[key] = [formJSON[key]];\n      }\n      formJSON[key].push(value);\n    });\n    $(CSSSelector + ' input[data-inputmask]').each(function () {\n      if (formJSON[$(this).attr('name')]) {\n        formJSON[$(this).attr('name')] = formJSON[$(this).attr('name')].replace(/[_ ]+$/g, \"\");\n      }\n    });\n    //formJSON.productGroups=$(\".productCategorySelect\").select2().val();\n\n    /*Multiselect or checkbox to array:\n    ajaxData['productGroup']=$(\".productCategorySelect\").select2().val();\n     formJSON.multiselectName = data.getAll('multiselectName');\n    $.each(formJSON, function (item, value) {\n        formJSON[$.lcFirst(item.replace('contact', ''))] = value;\n        delete formJSON[item];\n    });\n    if(formJSON.phone){\n        formJSON.phone=formJSON.phone.replaceAll('_','');\n    }\n    if(formJSON.email){\n        formJSON.email=formJSON.email.replaceAll('_','');\n    }\n    */\n    return formJSON;\n  };\n  this.formDataToDataObjectAPICall = function (CSSSelectorForm) {\n    var ajaxData = new FormData($(CSSSelectorForm)[0]);\n    $.each(ajaxData.getAll('profitCenter'), function (key, value) {\n      ajaxData.append('profitCenter[]', value);\n    });\n    $.each(ajaxData.getAll('productGroup'), function (key, value) {\n      ajaxData.append('productGroup[]', value);\n    });\n    $.each(ajaxData.getAll('supplierService'), function (key, value) {\n      ajaxData.append('supplierService[]', value);\n    });\n    $.each(ajaxData.getAll('contactId'), function (key, value) {\n      ajaxData.append('contactId[]', value);\n    });\n    ajaxData.append('_token', $('input[name=_token]').val());\n    $(CSSSelectorForm + ' input[data-inputmask]').each(function () {\n      var indexKey = $(this).attr('name');\n      if (ajaxData.get(indexKey)) {\n        ajaxData.set(indexKey, ajaxData.get(indexKey).replace(/[_ ]+$/g, \"\"));\n      }\n    });\n    return ajaxData;\n  };\n  this.clickSaveButton = function (event) {\n    debug('Save clicked');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .supplierForm';\n    event.preventDefault();\n    if ($(CSSSelectorForm + ' input[name=\"canSeeInOrder\"]').val() == 1 && $(CSSSelectorForm)[0].checkValidity() === false) {\n      console.log('validaton false');\n      $(CSSSelectorForm).addClass('was-validated');\n      $(CSSSelectorForm)[0].reportValidity();\n      Toast.create({\n        title: \"Validációs hiba!\",\n        message: \"Kérjük, töltse ki a kötelező mezőket!\",\n        status: TOAST_STATUS.DANGER,\n        timeout: 5000\n      });\n      event.stopPropagation();\n      return;\n    } else {\n      console.log('validaton ok');\n      $(CSSSelectorForm).removeClass('was-validated');\n      //do your ajax submition here\n    }\n    var ajaxData = root.formDataToDataObjectAPICall(CSSSelectorForm);\n    var ajaxUrl = Opts.URL.store;\n    var ajaxMethod = \"POST\";\n    if (root.Supplier.id) {\n      ajaxUrl = Opts.URL.update.replace('%id%', root.Supplier.id);\n      //ajaxMethod=\"PUT\";\n      //ajaxData=new FormData($(CSSSelectorForm)[0]);\n      ajaxData.append('_method', 'PUT');\n    }\n    debug(ajaxMethod);\n    debug(ajaxData);\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      type: ajaxMethod,\n      contentType: false,\n      processData: false,\n      headers: {\n        'X-CSRF-TOKEN': $('input[name=\"_token\"]').val()\n      },\n      success: function success(data) {\n        debug('d1: Save success ');\n        debug(data);\n        if (data.success == true) {\n          //Opts.onAfterInitViewDetails=root.autofillDetails;\n          Opts.dataTable.orderDirective = [0, 'desc'];\n          Toast.create({\n            title: \"Sikeres rögzítés!\",\n            message: ajaxData.get('name') + \" nevű beszálllító elmentve\",\n            status: TOAST_STATUS.SUCCESS,\n            timeout: 5000\n          });\n          APP.loadMainContent(Opts.URL.index + '?init=0', root.initViewList);\n        }\n      }\n    });\n  };\n  this.setDetailsViewData = function () {\n    debug('setDetailsViewData');\n    console.log(Supplier);\n    var CSSSelectorForm = Opts.containerCssSelector + ' .supplierForm';\n    var needToSet = ['name', 'hooreycaId', 'nameId', 'orderEmail', 'orderEmail2', 'address', 'mailingAddress', 'phone', 'fax', 'customerServicePhone', 'name22', 'openHours', 'ordersDeadline', 'minOrderValue'];\n    $.each(needToSet, function () {\n      if (typeof root.Supplier[this] != 'undefined') {\n        $(CSSSelectorForm + ' input[name=' + this + ']').val(root.Supplier[this]);\n        $(CSSSelectorForm + ' textarea[name=' + this + ']').val(root.Supplier[this]);\n      }\n    });\n    if (typeof root.Supplier['note'] != 'undefined') {\n      $(CSSSelectorForm + ' textarea[name=note]').val(root.Supplier.note);\n    }\n    if (typeof root.Supplier['emailAttachmentType'] != 'undefined') {\n      $(CSSSelectorForm + ' input[name=emailAttachmentType][value=' + root.Supplier['emailAttachmentType'] + ']').prop('checked', true);\n    }\n    $(CSSSelectorForm + ' *[data-toggle=canSee][data-title=' + root.Supplier.canSee + ']').click();\n    $(CSSSelectorForm + ' *[data-toggle=canSeeInOrder][data-title=' + root.Supplier.canSeeInOrder + ']').click();\n    $(CSSSelectorForm + ' *[data-toggle=hooreycaDataActive][data-title=' + root.Supplier.hooreycaDataActive + ']').click();\n    $(CSSSelectorForm + ' *[data-toggle=hasDeliveryConstraint][data-title=' + root.Supplier.hasDeliveryConstraint + ']').click();\n    $(CSSSelectorForm + ' input[name=orderCutOffTime]').val(root.Supplier.orderCutOffTime);\n    $(CSSSelectorForm + ' select[name=deliveryLeadTime]').val(root.Supplier.deliveryLeadTime);\n    var productGroup = [];\n    $.each(root.Supplier.product_group, function () {\n      productGroup.push(this.name);\n    });\n    $(CSSSelectorForm + ' .productCategorySelect').val(productGroup).change();\n    var service = [];\n    $.each(root.Supplier.service, function () {\n      service.push(this.name);\n    });\n    $(CSSSelectorForm + ' .serviceSelect').val(service).change();\n    var profitCenter = [];\n    $.each(root.Supplier.profit_center, function () {\n      profitCenter.push(this.name);\n    });\n    //$(CSSSelectorForm+' .profitCenterSelect').val(profitCenter).change();\n    //debug(profitCenter);\n    $.each(profitCenter, function () {\n      $('input[value=\"' + $.escapeSelector(this) + '\"]').prop(\"checked\", true);\n    });\n    if (typeof root.Supplier['logoFile'] != 'undefined' && root.Supplier['logoFile']) {\n      $(CSSSelectorForm + ' img.imageLogo').attr('src', root.Supplier['logoFile']);\n    }\n    if (typeof root.Supplier.users !== 'undefined') {\n      root.resetUserTable();\n    }\n\n    //debug(APP.SupplierAdmin.formDataToDataObjectAPICall('.supplierForm')['productGroup']);\n    //$('[name=productGroup]').val(['Büféáru_édesipari_termékek','Tojás']).change();\n    //root.setDetailsViewData();\n  };\n  this.initViewDetails = function (options, SupplierItem) {\n    debug('**call initViewDetails ');\n    if (!APP.ContactPopUp) {\n      console.log('nincs APP.ContactPopUp');\n      APP.ContactPopUp = new window.ContactPopUp();\n    } else {\n      console.log('mar van  APP.ContactPopUp');\n    }\n    APP.ContactPopUp.init({\n      active: true,\n      onAfterSave: root.contactAction\n    });\n    root.renderContact();\n    $('.supplierForm .buttonNewContact').bind('click', function () {\n      APP.SupplierAdmin.setContactPopupWorkflow('new');\n      APP.ContactPopUp.clearData();\n      APP.ContactPopUp.show();\n    });\n    $('[data-toggle=\"tooltip\"]').tooltip();\n    initRadioButtons();\n    $(\":input\").inputmask({\n      \"onincomplete\": function onincomplete() {\n        console.log($(this).data('required'));\n        if ($(this).val().length > 0 || $(this).data('required') === true) {\n          $(this).addClass('is-invalid');\n        }\n      },\n      \"oncomplete\": function oncomplete() {\n        $(this).removeClass('is-invalid');\n        $(this).addClass('is-valid');\n      },\n      \"oncleared\": function oncleared() {\n        console.log('cleared');\n        $(this).removeClass('is-invalid');\n      }\n    });\n    $('form.supplierForm button.FormSaveButton').off('click');\n    $('form.supplierForm button.FormSaveButton').on('click', root.clickSaveButton);\n    root.setDetailsViewData();\n    root.initUserCreate();\n    $(\".productCategorySelect\").select2();\n    $(\".serviceSelect\").select2({\n      tags: true,\n      createTag: function createTag(params) {\n        var term = $.trim(params.term);\n        if (term === '') {\n          return null;\n        }\n        return {\n          id: term,\n          text: term,\n          newTag: true // add additional parameters\n        };\n      }\n    });\n\n    //$(\".profitCenterSelect\").select2();\n    $(\"input[name=logoFile]\").change(function () {\n      setImageFromLocal(this, Opts.containerCssSelector + ' .imageLogo');\n    });\n    $('form.supplierForm .profitCenterSelectCheckboxAll').off('click');\n    $('form.supplierForm .profitCenterSelectCheckboxAll').on('click', function () {\n      //console.log();\n      //let checked=$(this).is(\":checked\")\n      $('form.supplierForm input.profitCenterSelectCheckbox').prop('checked', $(this).is(\":checked\"));\n    });\n    root.renderAttachment();\n    //Opts.onAfterInitViewDetails();\n    root.initFileAttachmentFeature();\n    root.initDeliveryConstraintToggle();\n    debug('**end initViewDetails ');\n  };\n  this.initDeliveryConstraintToggle = function () {\n    var CSSSelectorForm = Opts.containerCssSelector + ' .supplierForm';\n    var toggleDeliveryFields = function toggleDeliveryFields() {\n      var val = $(CSSSelectorForm + ' input[name=\"hasDeliveryConstraint\"]').val();\n      if (val == 1) {\n        $(CSSSelectorForm + ' .deliveryConstraintFields').show();\n      } else {\n        $(CSSSelectorForm + ' .deliveryConstraintFields').hide();\n      }\n    };\n    $(CSSSelectorForm + ' a[data-toggle=\"hasDeliveryConstraint\"]').off('click.deliveryConstraint');\n    $(CSSSelectorForm + ' a[data-toggle=\"hasDeliveryConstraint\"]').on('click.deliveryConstraint', function () {\n      setTimeout(toggleDeliveryFields, 0);\n    });\n    toggleDeliveryFields();\n  };\n  this.selectedUploadFileToggle = function (fileInput) {\n    /*\n    console.log(fileInput.attr('name'));\n    console.log(fileInput[0].files[0]);\n    console.log(fileInput[0].files[0].name);\n    */\n    if (fileInput) {\n      $('.containerFileUpload').addClass('d-none');\n      if (fileInput[0].files[0]) {\n        $('.containerUploadedFileName').text(fileInput[0].files[0].name);\n      }\n      $('.containerFileUploadStarted').removeClass('d-none');\n      $('.containerUploadedSpinner').removeClass('d-none');\n    } else {\n      $('.containerUploadedFileName').text('');\n      $('.custom-file-label.selected').text('');\n      $('.containerFileUploadStarted').addClass('d-none');\n      $('.uploadStatusRow').addClass('d-none');\n      $('.containerFileUpload').removeClass('d-none');\n    }\n  };\n  this.initFileAttachmentFeature = function () {\n    console.log('-------initFileAttachmentFeature-----------');\n    if (root.Supplier.id) {\n      $('.containerFileUpload').removeClass('d-none');\n      $('.containerFileUploadNone').addClass('d-none');\n    }\n    $(Opts.containerCssSelector + ' .buttonUpload').off('click');\n    $(Opts.containerCssSelector + ' .buttonUpload').on('click', function () {\n      console.group('-------buttonUpload-----------');\n      var fileInput = $('#inputGroupAttacheFile');\n      if (fileInput[0].files.length < 1) {\n        Toast.create({\n          title: \"Hiba!\",\n          message: 'Vállaszon ki fájlt!',\n          status: TOAST_STATUS.DANGER,\n          timeout: 10000\n        });\n        return;\n      }\n      console.log($(Opts.containerCssSelector).find('form.supplierForm')[0]);\n      var data = new FormData($(Opts.containerCssSelector).find('form.supplierForm')[0]);\n      data.append(fileInput.attr('name'), fileInput[0].files[0]);\n      root.selectedUploadFileToggle(fileInput);\n      var ajaxUrl = Opts.URL.attachFile.replace('%id%', root.Supplier.id);\n      console.groupEnd();\n      $.ajax({\n        url: ajaxUrl,\n        data: data,\n        type: 'POST',\n        contentType: false,\n        processData: false,\n        beforeSend: function beforeSend() {},\n        success: function success(data) {\n          console.log(data);\n          if (data.success == true) {\n            root.addAttachment(data.data.attachment);\n            root.selectedUploadFileToggle();\n          }\n        },\n        error: function error(data) {\n          console.log(data.responseJSON);\n          root.selectedUploadFileToggle();\n          ajaxErrorFieldHandler(data.responseJSON.error);\n        }\n      });\n    });\n  };\n  this.clickNew = function () {\n    debug('clickNew');\n    APP.loadMainContent(Opts.URL.create, root.clickNewCallBack);\n  };\n  this.clickNewCallBack = function () {\n    debug('callbackNew');\n    root.Supplier = new window.Supplier();\n    root.initViewDetails();\n  };\n  this.datatableRowActionEdit = function (rowData, node) {\n    console.log('datatableRowActionEdit Called');\n    //Opts.onAfterInitViewDetails=root.autofillDetails;\n    var ajaxUrl = Opts.URL.edit.replace('%id%', rowData.id);\n    APP.loadMainContent(ajaxUrl, root.initViewDetails);\n    console.log('datatableRowActionEdit End');\n  };\n  this.clickOrderDeleteConfirmed = function (event) {\n    debug('clickSupplierDeleteConfirmed');\n    debug(event);\n    debug(event.data);\n    $('#dialogModal').modal('hide');\n    var ajaxData = {};\n    ajaxData._token = Opts.token;\n    var ajaxUrl = Opts.URL.destroy.replace('%id%', event.data.id);\n    ajaxData._token = $('input[name=_token]').val();\n    console.log(ajaxUrl);\n    console.log(ajaxData);\n    var row = $(dataTableCSSSelector).DataTable().row(root.dadatatableRowActionCallerNode.parents('tr'));\n    $.ajax({\n      url: ajaxUrl,\n      data: ajaxData,\n      method: \"DELETE\",\n      success: function success(data) {\n        if (data.success == true) {\n          row.remove().draw();\n          root.dadatatableRowActionCallerNode = false;\n        }\n      }\n    });\n  };\n  var datatableRowActionCallerNode = false;\n  this.datatableRowActionDelete = function (rowData, node) {\n    console.log('datatableRowActionDelete Called');\n    root.dadatatableRowActionCallerNode = node;\n    $('#dialogModal').on('show.bs.modal', function (event) {\n      // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).\n      // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.\n      var modal = $(this);\n      modal.find('.modal-title').text('Megerősítés ');\n      modal.find('.modal-body').text('Biztosan törli a beszállítót?');\n      modal.find('.buttonYes').off('click');\n      modal.find('.buttonYes').on('click', {\n        id: rowData.id\n      }, root.clickOrderDeleteConfirmed);\n    });\n    $('#dialogModal').modal('show');\n  };\n  this.datatableRowActionButtonClick = function (event) {\n    debug('datatableRowActionButtonClick');\n    var node = $(event[0].currentTarget);\n    var row = $(dataTableCSSSelector).DataTable().row(node.parents('tr'));\n    var rowData = row.data();\n    var actionName = 'datatableRowAction' + node.data('buttontype').capitalize();\n    if (typeof root[actionName] === \"function\") {\n      return root[actionName](rowData, node);\n    }\n  };\n  this.initViewList = function () {\n    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    debug('listview inicialization');\n    dataTableCSSSelector = Opts.containerCssSelector + ' .dataTable'; //\n\n    var colNum = $(dataTableCSSSelector + ' thead th').length; //buttons insert position need\n    APP.setOpts({\n      datatableActionButtonClickCallBack: root.clickNew,\n      datatableRowActionButtonClickCallBack: root.datatableRowActionButtonClick\n    });\n    var orderDirective = Opts.dataTable.orderDirective;\n    if (typeof options['orderDirective'] != 'undefined') {\n      orderDirective = options['orderDirective'];\n    }\n    $(dataTableCSSSelector).DataTable({\n      language: {\n        url: '//cdn.datatables.net/plug-ins/1.10.24/i18n/Hungarian.json'\n      },\n      //\"ajax\": \"{{asset('exapmle2.json')}}\",\n      \"ajax\": Opts.URL.getDataTableContent,\n      \"columnDefs\": [{\n        \"targets\": colNum - 1,\n        \"render\": function render(data, type, row) {\n          var buttons = APP.datatableAddRowTrashButton(0, arguments);\n          buttons += APP.datatableAddRowEditButton(0, arguments);\n          return buttons;\n        }\n      }, {\n        \"targets\": 1,\n        \"render\": function render(data, type, row) {\n          return type === \"sort\" ? data.latinise() : data;\n        }\n      }\n      //{ \"visible\": false,  \"targets\": [ 0 ] }\n      ],\n      buttons: {\n        buttons: ['excel', 'pdf', {\n          extend: 'print',\n          //text: 'Print current page',\n          'title': 'title custom text',\n          'messageTop': 'Message On Top',\n          autoPrint: true\n        }, /**/\n\n        {\n          text: 'Új felvitele',\n          className: 'btn btn-success newItem',\n          attr: {\n            /*\n                                        data:{\n                                            a:1,\n                                            b:2\n                                         }\n            */\n            'data': 'newItem'\n          },\n          init: function init(api, node, config) {\n            $(node).removeClass('ui-button');\n          },\n          action: function action(e, dt, node, config) {\n            APP.datatableActionButtonClickCallBack(arguments);\n            /* console.log(e);\n             console.log(dt);\n             console.log(node);\n             console.log(config);*/\n          }\n        }]\n      },\n      \"columns\": [{\n        \"data\": \"id\"\n      }, {\n        \"data\": \"name\"\n      }, {\n        \"data\": \"hooreycaId\"\n      }, {\n        \"data\": \"nameId\"\n      }, {\n        \"data\": \"created_at\"\n      }, null],\n      \"order\": orderDirective,\n      \"stateSave\": true,\n      \"drawCallback\": function drawCallback(settings) {\n        APP.datatableAddRowAction(dataTableCSSSelector);\n      }\n    });\n    debug('listview end');\n  };\n  this.autofillDetails = function () {\n    debug('nyeresre allunk');\n    var randomNumber = getRandomInt(9999);\n    $('input[name=name]').val('Beszalító' + randomNumber);\n    $('input[name=hooreycaId]').val('hb' + randomNumber);\n    $('input[name=nameId]').val('be' + randomNumber);\n    $('input[name=orderEmail]').val('kapcsolat' + randomNumber + '@beszallito.hu');\n    $('input[name=orderEmail2]').val('informacio' + randomNumber + '@beszallito.hu');\n    $('input[name=address]').val('8989 Supplier utca ' + randomNumber);\n    $('input[name=mailingAddress]').val('8989 Postai út' + randomNumber);\n    $('input[name=phone]').val('+36301234567');\n    $('input[name=fax]').val('36308889999');\n    $('input[name=customerServicePhone]').val('+36761234444');\n    $('textarea[name=note]').val('Megjegyzem ' + randomNumber);\n  };\n  this.testMode = function () {\n    console.debug('!!!!testmode !!!!');\n    root.Supplier = new window.Supplier({\n      'contact': [{\n        id: 2\n      }, {\n        id: 3\n      }\n      /*\n                      {\n                          id:3,\n                          name:'Kósa Veronika',\n                          email:'szamlazas4@funkcio.hu',\n                          phone:'{{formatterPhoneNumber(\"+36204589180\")}}'\n      }\n      */]\n    });\n    Opts.onAfterInitViewDetails = root.autofillDetails;\n    APP.loadMainContent(Opts.URL.create, root.initViewDetails);\n  };\n  this.init = function (options, SupplierItem) {\n    $.extend(Opts, options);\n    if (Opts.testMode) {\n      return root.testMode();\n    }\n    if (SupplierItem) {\n      root.Supplier = SupplierItem;\n    }\n    root.initViewList();\n  };\n  this.renderAttachment = function () {\n    var rowNum = 1;\n    console.log('renderingAttachment');\n    $.each(root.Supplier.getData('attachment'), function () {\n      var attachmentData = this;\n      attachmentData.rowNum = rowNum;\n      date = new Date(attachmentData.created_at);\n      attachmentData.date = date.toLocaleString();\n      attachmentData.link = attachmentData.PublicUrl + '/' + attachmentData.filename;\n      var template = $('template[data-name=\"supplierAttachmentTableRow\"]').html();\n      var render = Mustache.render(template, attachmentData);\n      $('.attachmentTable tbody').append(render);\n      rowNum++;\n    });\n    root.bindAttachmentClickAction();\n  };\n  this.addAttachment = function (attachmentData) {\n    console.log(attachmentData);\n    var CSSSelectorForm = Opts.containerCssSelector + ' .supplierForm';\n    root.Supplier.attachment.push(attachmentData);\n    attachmentData.rowNum = root.Supplier.attachment.length;\n    var template = $('template[data-name=\"supplierAttachmentTableRow\"]').html();\n    var render = Mustache.render(template, attachmentData);\n    $(CSSSelectorForm + ' .attachmentTable tbody').append(render);\n    root.bindContactClickAction();\n    Toast.enableTimers(false);\n    Toast.create({\n      title: \"Fájl hozzáadva!\",\n      message: attachmentData.original_filename + \" fájl hozzáadva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.resetContactTable = function () {\n    $('.contactTable tbody tr').remove();\n    root.renderContact();\n  };\n  this.renderContact = function () {\n    var rowNum = 1;\n    console.log('renderingContacts');\n    $.each(root.Supplier.getData('contact'), function () {\n      var contactData = this;\n      contactData.rowNum = rowNum;\n      //console.log(contactData);\n      var template = $('template[data-name=\"supplierContactTableRow\"]').html();\n      var render = Mustache.render(template, contactData);\n      $('.contactTable tbody').append(render);\n      rowNum++;\n    });\n    root.bindContactClickAction();\n  };\n  this.bindContactClickAction = function () {\n    var node = $('.contactTable .buttonDelete');\n    node.unbind('click');\n    node.bind('click', root.contactDeleteClick);\n    node = $('.contactTable .buttonEdit');\n    node.unbind('click');\n    node.bind('click', root.contactEditClick);\n  };\n  this.bindAttachmentClickAction = function () {\n    var node = $('.attachmentTable .buttonDelete');\n    node.unbind('click');\n    node.bind('click', root.attachmentDeleteClick);\n  };\n  var currentAttachmentRow = false;\n  this.attachmentDeleteClick = function (event) {\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=attachmentId]').val();\n    var ajaxUrl = Opts.URL.detachFile.replace('%id%', root.Supplier.id);\n    //let data= new FormData($(Opts.containerCssSelector).find('form.supplierForm')[0]);\n    //data.append(fileInput.attr('name'),fileInput[0].files[0]);\n    var data = {};\n    data._token = $('input[name=\"_token\"]').val();\n    data.attachemntId = id;\n    $.ajax({\n      url: ajaxUrl,\n      data: data,\n      type: 'POST',\n      //contentType:false,\n      //processData: false,\n      beforeSend: function beforeSend() {},\n      success: function success(data) {\n        console.log(data);\n        if (data.success == true) {\n          root.Supplier.attachment = root.Supplier.attachment.filter(function (value, index, arr) {\n            if (value.id !== data.data.attachment.id * 1) {\n              return true;\n            }\n            return false;\n          });\n          /*\n          */\n          //row.remove();\n          root.resetAttachmentTable();\n        }\n      },\n      error: function error(data) {\n        console.log(data.responseJSON);\n        root.selectedUploadFileToggle();\n        ajaxErrorFieldHandler(data.responseJSON.error);\n      }\n    });\n  };\n  this.resetAttachmentTable = function () {\n    $('.attachmentTable tbody tr').remove();\n    root.renderAttachment();\n  };\n  this.contactDeleteClick = function (event) {\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=contactId]').val();\n    root.Supplier.contact = root.Supplier.contact.filter(function (value, index, arr) {\n      if (value.id !== id * 1) {\n        return true;\n      }\n      return false;\n    });\n    row.remove();\n    root.resetContactTable();\n  };\n  root.getContactPopupWorkflow = function () {\n    return contactPopupWorkflow;\n  };\n  root.setContactPopupWorkflow = function (status) {\n    contactPopupWorkflow = status;\n  };\n  this.contactEditClick = function (event) {\n    //console.log(this);\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=contactId]').val();\n    root.setContactPopupWorkflow('edit');\n    APP.ContactPopUp.loadData(id);\n  };\n  this.getSupplier = function () {\n    return root.Supplier;\n  };\n  this.contactAction = function (contactData) {\n    console.log('nah most kellene meg valamit csinalni.');\n    if (root.getContactPopupWorkflow() == 'new') {\n      root.addContact(contactData);\n    } else if (root.getContactPopupWorkflow() == 'edit') {\n      root.editContact(contactData.id, contactData);\n    }\n  };\n  this.editContact = function (id, contactData) {\n    var newContacts = [];\n    $.each(root.Supplier.getData('contact'), function (index) {\n      if (this.id == id) {\n        newContacts.push(contactData);\n      } else {\n        newContacts.push(this);\n      }\n    });\n    root.Supplier.contact = newContacts;\n    root.resetContactTable();\n    Toast.create({\n      title: \"Kapcsolat adatai módosítva!\",\n      message: contactData.name + \" nevű kapcsolattartó módosítva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.addContact = function (contactData) {\n    /*\n    fel kell venni a sorba\n     */\n    root.Supplier.contact.push(contactData);\n    contactData.rowNum = root.Supplier.contact.length;\n    var template = $('template[data-name=\"supplierContactTableRow\"]').html();\n    var render = Mustache.render(template, contactData);\n    $('.contactTable tbody').append(render);\n    root.bindContactClickAction();\n    Toast.enableTimers(false);\n    Toast.create({\n      title: \"Kapcsolattartó hozzáadva!\",\n      message: contactData.name + \" nevű kapcsolattartó hozzáadva\",\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 5000\n    });\n  };\n  this.resetUserTable = function () {\n    $('.supplierUserTable tbody tr').remove();\n    root.renderUsers();\n  };\n  this.renderUsers = function () {\n    var rowNum = 1;\n    var users = root.Supplier.users || [];\n    $.each(users, function () {\n      var userData = $.extend({}, this);\n      userData.rowNum = rowNum;\n      var template = $('template[data-name=\"supplierUserTableRow\"]').html();\n      var render = Mustache.render(template, userData);\n      $('.supplierUserTable tbody').append(render);\n      rowNum++;\n    });\n    root.bindUserClickAction();\n  };\n  this.bindUserClickAction = function () {\n    var node = $('.supplierUserTable .buttonDelete');\n    node.unbind('click');\n    node.bind('click', root.userDeleteClick);\n  };\n  this.userDeleteClick = function () {\n    var row = $(this).closest('tr');\n    var id = row.find('input[name=userId]').val() * 1;\n    root.Supplier.users = root.Supplier.users.filter(function (value) {\n      return value.id !== id;\n    });\n    row.remove();\n    root.resetUserTable();\n  };\n  this.addUser = function (userData) {\n    if (!root.Supplier.users) {\n      root.Supplier.users = [];\n    }\n    var alreadyAdded = root.Supplier.users.some(function (u) {\n      return u.id === userData.id;\n    });\n    if (alreadyAdded) {\n      return;\n    }\n    root.Supplier.users.push(userData);\n    userData.rowNum = root.Supplier.users.length;\n    var template = $('template[data-name=\"supplierUserTableRow\"]').html();\n    var render = Mustache.render(template, userData);\n    $('.supplierUserTable tbody').append(render);\n    root.bindUserClickAction();\n    Toast.enableTimers(false);\n    Toast.create({\n      title: 'Felhasználó hozzáadva!',\n      message: userData.name + ' hozzárendelve',\n      status: TOAST_STATUS.SUCCESS,\n      timeout: 3000\n    });\n  };\n  this.initUserCreate = function () {\n    var createUrl = Opts.URL.createUser || '';\n    var container = $(Opts.containerCssSelector);\n    function clearForm() {\n      container.find('.supplierNewUserName').val('');\n      container.find('.supplierNewUserEmail').val('');\n      container.find('.supplierNewUserPassword').val('');\n      container.find('.supplierNewUserError').hide().text('');\n    }\n    container.find('.buttonCreateUser').off('click').on('click', function () {\n      var name = container.find('.supplierNewUserName').val().trim();\n      var email = container.find('.supplierNewUserEmail').val().trim();\n      var password = container.find('.supplierNewUserPassword').val();\n      var errorEl = container.find('.supplierNewUserError');\n      errorEl.hide().text('');\n      if (!name || !email || !password) {\n        errorEl.text('Minden mező kitöltése kötelező!').show();\n        return;\n      }\n      $.ajax({\n        url: createUrl,\n        type: 'POST',\n        data: {\n          name: name,\n          email: email,\n          password: password\n        },\n        headers: {\n          'X-CSRF-TOKEN': $('input[name=\"_token\"]').val()\n        },\n        success: function success(data) {\n          if (data.success) {\n            root.addUser(data.user);\n            clearForm();\n          } else {\n            errorEl.text('Hiba történt a felhasználó létrehozásakor!').show();\n          }\n        },\n        error: function error(xhr) {\n          var msg = 'Hiba történt!';\n          if (xhr.responseJSON && xhr.responseJSON.errors) {\n            var errors = xhr.responseJSON.errors;\n            var firstKey = Object.keys(errors)[0];\n            msg = errors[firstKey][0];\n          }\n          errorEl.text(msg).show();\n        }\n      });\n    });\n  };\n  this.construct(options, SupplierItem);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 97468 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/supplier.js\n\n}");

/***/ }

/******/ 	});
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval-source-map devtool is used.
/******/ 	__webpack_modules__["./resources/js/admin/dashboard.js"]();
/******/ 	__webpack_modules__["./resources/js/admin/priceList.js"]();
/******/ 	__webpack_modules__["./resources/js/admin/priceListProfitCenter.js"]();
/******/ 	__webpack_modules__["./resources/js/admin/product.js"]();
/******/ 	__webpack_modules__["./resources/js/admin/profitCenter.js"]();
/******/ 	var __webpack_exports__ = {};
/******/ 	__webpack_modules__["./resources/js/admin/supplier.js"]();
/******/ 	
/******/ })()
;