/*
 * 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  /*\n   * Constructor\n   */\n\n  this.construct = function (options) {\n    debug('Dashboard constructor called');\n    $.extend(Opts, options);\n  };\n\n  this.getOpts = function () {\n    return Opts;\n  };\n\n  this.init = function (options) {\n    console.log('Dashboard init called');\n    $.extend(Opts, options);\n    /*\n            APP.setOpts({\n                afterLoadMainContent:root.initEditor,\n            })\n    */\n\n    /*\n    Init list view\n    */\n\n    root.initEditorButtons();\n  };\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');\n      $('.btnGroupModify').toggleClass('d-none');\n      */\n      root.saveCustomContent(); //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\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(\"Siekeres mentés!\", 'Új tartalom elmentve.', TOAST_STATUS.INFO, 5000);\n      },\n      error: function error(data) {\n        console.log(data.responseJSON);\n        ajaxErrorFieldHandler(data.responseJSON.error);\n      }\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\n  this.removeEditor = function (options) {\n    if (typeof tinymce !== \"undefined\") {\n      tinymce.remove();\n    }\n  };\n\n  this.initEditor = function (options) {\n    if (typeof tinymce === \"undefined\") {\n      root.loadTinymce();\n      return;\n    }\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                  toolbar: 'customInsertButton | undo redo | formatselect| bold italic | alignleft aligncenter alignright | indent outdent | bullist numlist | code | table',\n                  setup: function (editor) {\n                      editor.ui.registry.addButton('customInsertButton', {\n                          text: 'My Button',\n                          onAction: function (_) {\n                              editor.insertContent('&nbsp;<strong>It\\'s my button!</strong>&nbsp;');\n                          }});\n                  }\n      */\n\n    });\n  };\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 10784 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/dashboard.js\n");

/***/ }),

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

eval("window.PriceListAdmin = function (options, ProfitCenterItem) {\n  /*\n   * Variables accessible\n   * in the class\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   * Constructor\n   */\n\n  this.construct = function (options) {\n    debug('PriceListAdmin constructor called');\n    $.extend(Opts, options);\n  };\n\n  var errorRowPointer = null;\n  var errorRowCount = 0;\n\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\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\n      $('.statusError').removeClass('highlightedErrorRow');\n      $('.priceListTableWrapper').scrollTop($($('.statusError')[errorRowPointer]).position().top);\n      $($('.statusError')[errorRowPointer]).addClass('highlightedErrorRow');\n    });\n  };\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\n      if (fileInput[0].files[0]) {\n        $('.containerUploadedFileName').text(fileInput[0].files[0].name);\n      }\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\n  this.clickNewPriceListCallBack = function () {\n    root.initViewDetails();\n  };\n\n  this.clickNewPriceList = function () {\n    APP.loadMainContent(Opts.URL.create, root.clickNewPriceListCallBack);\n  };\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(); //_token\n\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    */\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\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); //buttons+=APP.datatableAddRowEditButton(0,arguments);\n\n          return buttons;\n        }\n      } //{ \"visible\": false,  \"targets\": [ 0 ] }\n      ],\n      buttons: {\n        buttons: [//'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            /*\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\": \"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\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\n      if ($('.supplierSelect').val().length < 1) {\n        Toast.create(\"Hiba!\", 'Adjon meg beszállítót!', TOAST_STATUS.DANGER, 10000);\n        return;\n      }\n\n      var fileInput = $('#inputGroupPriceListFile');\n      console.log(fileInput[0].files.length < 1);\n      /* teszteles miatt kikapcsolva a fajl ellenorzes\n      */\n\n      if (!Opts.testFileMod) {\n        console.log(fileInput[0].files.length < 1);\n\n        if (fileInput[0].files.length < 1) {\n          Toast.create(\"Hiba!\", 'Vállaszon ki fájlt!', TOAST_STATUS.DANGER, 10000);\n          return;\n        }\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\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\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          /*\n          if(data.success==1){\n              root.processCheckedPriceListResponse(data);\n          }\n           */\n\n        },\n        error: function error(data) {\n          console.log(data.responseJSON);\n          ajaxErrorFieldHandler(data.responseJSON.error);\n        }\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    /*\n    Init list view\n    */\n\n    console.log('call list view Init');\n    root.initViewList(options);\n  };\n\n  this.getOpts = function () {\n    return Opts;\n  };\n\n  var priceListHasError = false;\n\n  this.processCheckedPriceListResponse = function (responseData) {\n    priceListHasError = false;\n    root.processCheckedPriceListResponseRows(responseData.rows);\n\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\n    $('.uploadStatusRow').removeClass('d-none');\n    $('.containerUploadedSpinner').addClass('d-none');\n  };\n\n  this.processCheckedPriceListResponseRows = function (responseRowsData) {\n    console.log('processingRows');\n\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\n      if (rowData.changed) {\n        root.processResponseRowChanged(rowData.changed, rowData.rowNum);\n      }\n    }\n  };\n\n  this.processResponseRowChanged = function (changedArray, rowNum) {\n    if (changedArray.length < 1) {\n      return;\n    }\n\n    console.log(changedArray); //fields error resz\n\n    var trNode = $('tr[data-rownum=' + rowNum + ']');\n\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\n  this.processResponseRowErrors = function (errorArray, rowNum) {\n    if (errorArray.length < 1) {\n      return;\n    } //general error resz\n\n\n    console.log(errorArray);\n    priceListHasError = true; //fields error resz\n\n    if (typeof errorArray.fields == 'undefined') {\n      return;\n    }\n\n    var trNode = $('tr[data-rownum=' + rowNum + ']');\n\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, 38780 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/priceList.js\n");

/***/ }),

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

eval("window.PriceListProfitCenterAdmin = function (options) {\n  /*\n   * Variables accessible\n   * in the class\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  /*\n   * Constructor\n   */\n\n  this.construct = function (options, SupplierItem) {\n    console.log('PriceListProfitCenterAdmin constructor called');\n    $.extend(Opts, options);\n  };\n\n  this.getOpts = function () {\n    return Opts;\n  };\n\n  var changeParameter = {\n    supplier: '',\n    profitCenter: '',\n    deliveryDate: ''\n    /*\n    supplier:26,\n    profitCenter:49,\n    deliveryDate:'2023-09-10',\n    */\n\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\n    if (needRefresh) {\n      root.refreshDatatable();\n      root.refreshProductGroup();\n      root.setDatatableHeaderText('');\n    }\n  };\n\n  this.setDatatableHeaderText = function (text) {\n    $('.tableHeaderText').text(text);\n  };\n\n  this.getTreePathName = function (node) {\n    var res = '';\n    var items = $(node).parents('li').toArray();\n    items.shift();\n    items.reverse();\n\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\n    res += $(node).text();\n    return res;\n  };\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      /*\n      console.log(groupId);\n      console.log(root.getTreePathName(this));\n      */\n\n      root.refreshDatatable();\n    });\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\n  this.refreshDatatable = function () {\n    $('.dataTableOrderProductSelect').DataTable().ajax.reload();\n  };\n\n  this.changePriceListProfitCenterParameter = function (e, obj) {\n    if (typeof obj == 'undefined') {\n      obj = $(this);\n    }\n\n    var objName = obj.attr(\"name\");\n\n    if (objName == 'supplier') {\n      selectedProductGroup = null;\n    }\n\n    var data = '';\n\n    if (obj.get(0).nodeName == 'SELECT') {\n      if (obj.select2('data').length > 0) {\n        data = obj.select2('data')[0].id;\n      }\n\n      ;\n    } else {\n      data = obj.val();\n    }\n\n    if (changeParameter[objName] != data) {\n      changeParameter[objName] = data;\n      root.checkRefreshPossible();\n    }\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); //$('input[name=\"deliveryDate\"]').on('change',changePriceListProfitCenterParameter);\n\n    $(\".supplierSelect\").select2({\n      maximumSelectionLength: 1\n    });\n    /*\n    */\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    }); //root.initViewList();\n\n    var table = root.getDatatables('');\n    $('.dataTableOrderProductSelect').on('draw.dt', root.productSelectDataTableDrawDT).dataTable();\n    /*\n      /!*\n      ----------------------------------------------------------\n       Add event listener for opening and closing details\n       *!/\n       $('.dataTableOrderProductSelect tbody').on('click', 'td.details-control', function () {\n          let tr = $(this).closest('tr');\n          let row = table.row( tr );\n           if ( row.child.isShown() ) {\n              // This row is already open - close it\n              row.child.hide();\n              tr.removeClass('shown');\n          }\n          else {\n              // Open this row\n              row.child( root.productSelectDatatablesRowFormatter(row.data()) ).show();\n              tr.addClass('shown');\n              root.bindProductDetailsAction();\n          }\n      } );*/\n  };\n\n  this.productSelectDataTableDrawDT = function (e) {\n    //debug( 'Table draw complete: '+new Date().getTime() );\n    $('td:contains(\"*\")').html('<i class=\"bi bi-check-circle-fill\"></i>');\n    $('td.details-control').removeClass('details-control');\n  };\n\n  var selectedProductGroup = null;\n\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          /*\n                                  data.searchStr=dataTableSearchStr;\n                                  data.krel=dataTableSearchKrel;\n                                  data.groupId=selectedProductGroup;\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, 21736 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/priceListProfitCenter.js\n");

/***/ }),

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

eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nif (typeof Product === 'undefined') {\n  var _Product = /*#__PURE__*/function (_DataModel) {\n    _inherits(_Product, _DataModel);\n\n    var _super = _createSuper(_Product);\n\n    /*\n     * Constructor\n     */\n    function _Product(data, options) {\n      var _this;\n\n      _classCallCheck(this, _Product);\n\n      _this = _super.call(this, data, options);\n\n      if (typeof _this.contact === \"undefined\") {\n        _this.contact = [];\n      }\n\n      console.log('Product constructor called');\n      return _this;\n    }\n\n    return _Product;\n  }(DataModel);\n\n  ;\n  window.Product = _Product;\n}\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\n  this.construct = function (options, ProductItem) {\n    console.log('ProductAdmin constructor called');\n    $.extend(Opts, options);\n\n    if (!ProductItem) {\n      console.log('Product letre kellet hozni ');\n\n      if (!APP.Product) {\n        APP.Product = new window.Product();\n      }\n\n      root.Product = APP.Product;\n    }\n  };\n\n  this.getOpts = function () {\n    return Opts;\n  };\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\n    if (typeof root[actionName] === \"function\") {\n      return root[actionName](rowData, node);\n    }\n  };\n\n  this.datatableRowActionEdit = function (rowData, node) {\n    console.log('datatableRowActionEdit Called'); //Opts.onAfterInitViewDetails=root.autofillDetails;\n\n    var ajaxUrl = Opts.URL.edit.replace('%id%', rowData.id);\n    APP.loadMainContent(ajaxUrl, root.initViewDetails);\n    console.log('datatableRowActionEdit End');\n  };\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\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    $(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      } //{ \"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\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').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          };\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    debug('initViewSearch end');\n  };\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\n  this.hideResultContainer = function () {\n    debug('hide containerResult');\n    debug(root.resultContainer);\n    root.resultContainer.hide();\n  };\n\n  this.showResultContainer = function () {\n    root.container.find('.containerLoading').hide();\n    root.resultContainer.show();\n  };\n\n  this.init = function (options, ProductItem) {\n    console.log('ProductAdmin init');\n    $.extend(Opts, options);\n\n    if (Opts.testMode) {\n      return root.testMode();\n    }\n\n    if (ProductItem) {\n      root.Product = ProductItem;\n    }\n\n    root.dataTable = null;\n    root.container = $(Opts.containerCssSelector);\n    root.resultContainer = $(Opts.resultContainerSelector);\n    root.initViewList();\n  };\n\n  this.initViewDetails = function (options, ProductItem) {\n    debug('**call initViewDetails ');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .productForm';\n\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\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\n    var FormSaveButton = $(CSSSelectorForm + ' button.FormSaveButton');\n    FormSaveButton.off('click');\n    FormSaveButton.on('click', root.clickSaveButton);\n  };\n\n  this.addAttachment = function (attachmentData) {\n    console.log(attachmentData);\n    var CSSSelectorForm = Opts.containerCssSelector + ' .productForm'; //root.Supplier.attachment.push(attachmentData);\n    //attachmentData.rowNum=root.Supplier.attachment.length;\n\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); //root.bindContactClickAction();\n\n    Toast.enableTimers(false);\n    Toast.create(\"Fájl hozzáadva!\", attachmentData.original_filename + \" fájl hozzáadva\", TOAST_STATUS.SUCCESS, 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\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\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\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]); //return;\n\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'); //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\n    return ajaxData;\n  };\n\n  this.getAjaxDataJson = function () {\n    var ajaxData = root.formDataToDataObjectAPICall('.ProductListForm');\n    console.log('======================');\n\n    var _iterator = _createForOfIteratorHelper(ajaxData.entries()),\n        _step;\n\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\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\n      if (!Array.isArray(object[key])) {\n        object[key] = [object[key]];\n      }\n\n      object[key].push(value);\n    });\n    var ajaxDataJson = JSON.stringify(object);\n    return ajaxDataJson;\n  };\n\n  this.requestProducts = function () {\n    var ajaxUrl = Opts.URL.getDataTableContent;\n    var ajaxMethod = 'GET'; //token formdataba!\n\n    debug(ajaxUrl);\n    ajaxDataJson = root.getAjaxDataJson();\n    console.log(ajaxDataJson);\n    dataTableCSSSelector = Opts.containerCssSelector + ' .dataTable'; //\n\n    console.log(dataTableCSSSelector);\n    var colNum = $(dataTableCSSSelector + ' thead th').length; //buttons insert position need\n\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        },\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        } //{ \"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'); //root.dataTable.ajax.reload();\n\n      root.dataTable.draw();\n    }\n  };\n\n  this.processResponse = function () {};\n\n  this.clickSaveButton = function (event) {\n    debug('Save clicked');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .productForm';\n    event.preventDefault();\n\n    if ($(CSSSelectorForm)[0].checkValidity() === false) {\n      console.log('validaton false');\n      event.stopPropagation();\n      return;\n    } else {\n      console.log('validaton ok'); //do your ajax submition here\n    }\n\n    var ajaxData = root.formDataToDataObjectAPICall('.productForm');\n    var ajaxUrl = Opts.URL.store;\n    var ajaxMethod = \"POST\";\n\n    if (root.Product.id) {\n      ajaxUrl = Opts.URL.update.replace('%id%', root.Product.id); //ajaxMethod=\"PUT\";\n      //ajaxData=new FormData($(CSSSelectorForm)[0]);\n\n      ajaxData.append('_method', 'PUT');\n    }\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\n        if (data.success == true) {\n          //Opts.onAfterInitViewDetails=root.autofillDetails;\n          Opts.dataTable.orderDirective = [0, 'desc'];\n          Toast.create(\"Sikeres rögzítés!\", ajaxData.get('name') + \" nevű termék elmentve\", TOAST_STATUS.SUCCESS, 5000); //                        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, 52188 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/product.js\n");

/***/ }),

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

eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nif (typeof DataModelProfitCenter === 'undefined') {\n  var _DataModelProfitCenter = /*#__PURE__*/function (_DataModel) {\n    _inherits(_DataModelProfitCenter, _DataModel);\n\n    var _super = _createSuper(_DataModelProfitCenter);\n\n    /*\n     * Constructor\n     */\n    function _DataModelProfitCenter(data, options) {\n      var _this;\n\n      _classCallCheck(this, _DataModelProfitCenter);\n\n      _this = _super.call(this, data, options);\n\n      if (typeof _this.contact === \"undefined\") {\n        _this.contact = [];\n      }\n\n      if (typeof _this.address === \"undefined\") {\n        _this.address = [];\n      }\n\n      console.log(_this.constructor.name + ' constructor called');\n      return _this;\n    }\n\n    return _DataModelProfitCenter;\n  }(DataModel);\n\n  ;\n  window.DataModelProfitCenter = _DataModelProfitCenter;\n}\n\nwindow.ProfitCenterAdmin = function (options, ProfitCenterItem) {\n  /*\n   * Variables accessible\n   * in the class\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  /*\n   * Constructor\n   */\n\n  this.construct = function (options, ProfitCenterItem) {\n    console.log('ProfitCenterAdmin constructor called');\n    $.extend(Opts, options);\n\n    if (!ProfitCenterItem) {\n      console.log('ProfitCentert letre kellet hozni ');\n\n      if (!APP.ProfitCenter) {\n        APP.ProfitCenter = new window.DataModelProfitCenter();\n      }\n\n      root.ProfitCenter = APP.ProfitCenter;\n    }\n\n    CSSSelectorForm = Opts.containerCssSelector + ' .profitCenterForm';\n  };\n\n  this.getOpts = function () {\n    return Opts;\n  };\n\n  this.getData = function () {\n    return root.ProfitCenter;\n  };\n\n  this.init = function (options, ProfitCenterItem) {\n    $.extend(Opts, options);\n\n    if (Opts.testMode) {\n      return root.testMode();\n    }\n\n    if (ProfitCenterItem) {\n      root.ProfitCenter = ProfitCenterItem;\n    }\n\n    root.initViewList();\n  };\n\n  this.clickNew = function () {\n    debug('clickNew');\n    APP.loadMainContent(Opts.URL.create, root.clickNewCallBack);\n  };\n\n  this.clickNewCallBack = function () {\n    debug('callbackNew');\n    root.ProfitCenter = new window.DataModelProfitCenter();\n    root.initViewDetails();\n  };\n\n  this.initViewDetails = function (options, SupplierItem) {\n    debug('**call initViewDetails ');\n    /**\n     * Contact Popup setup\n     */\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\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    /**\n     * Address Popup setup\n     */\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\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    /**\n     *\n     */\n\n    $('[data-toggle=\"tooltip\"]').tooltip();\n    initRadioButtons({\n      onChange: function onChange(value, node) {\n        debug(value);\n        debug(node);\n        /*\n                             if(node==='profitCenterMultiAddress'){\n                                if(value==1){\n                                    $('.containerMultiAddress').removeClass('d-none');\n                                }else{\n                                    $('.containerMultiAddress').addClass('d-none');\n                                }\n                            }\n         */\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\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    /*\n            $(\"input[name=logoFile]\").change(function(){\n                setImageFromLocal(this,Opts.containerCssSelector+' .imageLogo');\n            });\n    */\n    //Opts.onAfterInitViewDetails();\n\n    debug('**end initViewDetails ');\n  };\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\n                        debug(root.ProfitCenter[this]);\n                        debug(CSSSelectorForm+' input[name='+this+']');\n                        debug($(CSSSelectorForm+' input[name='+this+']'));\n        */\n        $(CSSSelectorForm + ' input[name=' + this + ']').val(root.ProfitCenter[this]);\n      }\n    });\n\n    if (typeof root.ProfitCenter['note'] != 'undefined') {\n      $(CSSSelectorForm + ' textarea[name=note]').val(root.ProfitCenter.note);\n    }\n\n    $(CSSSelectorForm + ' *[data-toggle=canSee][data-title=' + root.ProfitCenter.canSee + ']').click();\n    $(CSSSelectorForm + ' *[data-toggle=hooreycaDataActive][data-title=' + root.ProfitCenter.hooreycaDataActive + ']').click();\n\n    if (typeof root.ProfitCenter['logoFile'] != 'undefined' && root.ProfitCenter['logoFile']) {\n      $(CSSSelectorForm + ' img.imageLogo').attr('src', root.ProfitCenter['logoFile']);\n    }\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);\n    if(root.ProfitCenter.address.length>0){\n        $(CSSSelectorForm+' *[data-toggle=addressEqual][data-title=0]').click();\n        if(root.ProfitCenter.address.length>1){\n            $(CSSSelectorForm+' *[data-toggle=multiAddress][data-title=1]').click();\n        }\n    }\n    */\n\n    var supplier = [];\n    $.each(root.ProfitCenter.suppliers, function () {\n      supplier.push(this.name);\n    }); //$(CSSSelectorForm+' .profitCenterSelect').val(profitCenter).change();\n\n    $.each(supplier, function () {\n      $('input[value=\"' + $.escapeSelector(this) + '\"]').prop(\"checked\", true);\n    });\n  };\n\n  this.resetContactTable = function () {\n    $(CSSSelectorForm + ' .contactTable tbody tr').remove();\n    root.renderContact();\n  };\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\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\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\n      return false;\n    });\n    console.log(root.ProfitCenter.contact);\n    row.remove();\n    root.resetContactTable();\n  };\n\n  this.getContactPopupWorkflow = function () {\n    return contactPopupWorkflow;\n  };\n\n  this.setContactPopupWorkflow = function (status) {\n    contactPopupWorkflow = status;\n  };\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\n  this.contactAction = function (contactData) {\n    console.log('nah most kellene meg valamit csinalni.');\n\n    if (root.getContactPopupWorkflow() == 'new') {\n      root.addContact(contactData);\n    } else if (root.getContactPopupWorkflow() == 'edit') {\n      root.editContact(contactData.id, contactData);\n    }\n  };\n\n  this.addContact = function (contactData) {\n    /*\n    fel kell venni a sorba\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(\"Kapcsolat tartó hozzáadva!\", contactData.name + \" nevű kapocsolattartó hozzáadva\", TOAST_STATUS.SUCCESS, 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(\"Kapcsolat adatai módosítva!\", contactData.name + \" nevű kapocsolattartó módosítva\", TOAST_STATUS.SUCCESS, 5000);\n  };\n  /***************\n   *\n   * Address function\n   *\n   */\n\n\n  this.resetAddressTable = function () {\n    $(CSSSelectorForm + ' .addressTable tbody tr').remove();\n    root.renderAddress();\n  };\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\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\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\n  this.getAddressPopupWorkflow = function () {\n    return addressPopupWorkflow;\n  };\n\n  this.setAddressPopupWorkflow = function (status) {\n    addressPopupWorkflow = status;\n  };\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\n  this.addressAction = function (itemData) {\n    console.log('nah most kellene meg valamit csinalni.');\n\n    if (root.getAddressPopupWorkflow() == 'new') {\n      root.addAddress(itemData);\n    } else if (root.getAddressPopupWorkflow() == 'edit') {\n      root.editAddress(itemData.id, itemData);\n    }\n  };\n\n  this.addAddress = function (ItemData) {\n    /*\n    fel kell venni a sorba\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(\"Cím hozzáadva!\", ItemData.street + \" hozzáadva\", TOAST_STATUS.SUCCESS, 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(\"cím adatai módosítva!\", itemData.street + \" módosítva\", TOAST_STATUS.SUCCESS, 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\n    APP.setOpts({\n      datatableActionButtonClickCallBack: root.clickNew,\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    $(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      } //{ \"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\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\n    if (typeof root[actionName] === \"function\") {\n      return root[actionName](rowData, node);\n    }\n  };\n\n  this.datatableRowActionEdit = function (rowData, node) {\n    console.log('datatableRowActionEdit Called'); //Opts.onAfterInitViewDetails=root.autofillDetails;\n\n    var ajaxUrl = Opts.URL.edit.replace('%id%', rowData.id);\n    /*\n            console.log(Opts.URL);\n            console.log(ajaxUrl);\n    */\n\n    APP.loadMainContent(ajaxUrl, root.initViewDetails);\n    console.log('datatableRowActionEdit End');\n  };\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\n  this.clickSaveButton = function (event) {\n    debug('Save clicked');\n    event.preventDefault();\n    debug(CSSSelectorForm);\n    debug($(CSSSelectorForm));\n\n    if ($(CSSSelectorForm)[0].checkValidity() === false) {\n      console.log('validaton false');\n      event.stopPropagation();\n      return;\n    } else {\n      console.log('validaton ok'); //do your ajax submition here\n    }\n\n    var ajaxData = root.formDataToDataObjectAPICall(CSSSelectorForm);\n    var ajaxUrl = Opts.URL.store;\n    var ajaxMethod = \"POST\";\n\n    if (root.ProfitCenter.id) {\n      ajaxUrl = Opts.URL.update.replace('%id%', root.ProfitCenter.id); //ajaxMethod=\"PUT\";\n      //ajaxData=new FormData($(CSSSelectorForm)[0]);\n\n      ajaxData.append('_method', 'PUT');\n    }\n    /*\n            debug(ajaxUrl);\n            debug(ajaxMethod);\n            debug(ajaxData.entries());\n            for (var pair of ajaxData.entries()) {\n                console.log(pair[0]+ ', ' + pair[1]);\n            }\n    */\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\n        if (data.success == true) {\n          //Opts.onAfterInitViewDetails=root.autofillDetails;\n          Opts.dataTable.orderDirective = [0, 'desc'];\n          Toast.create(\"Sikeres rögzítés!\", ajaxData.get('name') + \" nevű beszálllító elmentve\", TOAST_STATUS.SUCCESS, 5000);\n          APP.loadMainContent(Opts.URL.index + '?init=0', root.initViewList);\n        }\n      }\n    });\n  };\n\n  this.formDataToDataObjectAPICall = function (CSSSelectorForm) {\n    var ajaxData = new FormData($(CSSSelectorForm)[0]);\n    /*\n            $.each(ajaxData.getAll('productGroup'),function(key,value){\n                ajaxData.append('productGroup[]',value);\n            })\n    */\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\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\n  this.construct(options, ProfitCenterItem);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 63220 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/profitCenter.js\n");

/***/ }),

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

eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nif (typeof Supplier === 'undefined') {\n  var _Supplier = /*#__PURE__*/function (_DataModel) {\n    _inherits(_Supplier, _DataModel);\n\n    var _super = _createSuper(_Supplier);\n\n    /*\n     * Constructor\n     */\n    function _Supplier(data, options) {\n      var _this;\n\n      _classCallCheck(this, _Supplier);\n\n      _this = _super.call(this, data, options);\n\n      if (typeof _this.contact === \"undefined\") {\n        _this.contact = [];\n      }\n\n      console.log('Supplier constructor called');\n      return _this;\n    }\n\n    return _Supplier;\n  }(DataModel);\n\n  ;\n  window.Supplier = _Supplier;\n}\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    },\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\n  this.construct = function (options, SupplierItem) {\n    console.log('SupplierAdmin constructor called');\n    $.extend(Opts, options);\n\n    if (!SupplierItem) {\n      console.log('supplier letre kellet hozni ');\n\n      if (!APP.Supplier) {\n        APP.Supplier = new window.Supplier();\n      }\n\n      root.Supplier = APP.Supplier;\n    }\n  };\n\n  this.getOpts = function () {\n    return Opts;\n  };\n\n  this.formDataToDataObjectAPICallOld = function (CSSSelector) {\n    var data = new FormData(document.querySelector(CSSSelector)); //let formJSON = Object.fromEntries(data.entries());\n\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\n      if (!Array.isArray(formJSON[key])) {\n        formJSON[key] = [formJSON[key]];\n      }\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    }); //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\n    return formJSON;\n  };\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\n      if (ajaxData.get(indexKey)) {\n        ajaxData.set(indexKey, ajaxData.get(indexKey).replace(/[_ ]+$/g, \"\"));\n      }\n    });\n    return ajaxData;\n  };\n\n  this.clickSaveButton = function (event) {\n    debug('Save clicked');\n    var CSSSelectorForm = Opts.containerCssSelector + ' .supplierForm';\n    event.preventDefault();\n\n    if ($(CSSSelectorForm + ' input[name=\"canSeeInOrder\"]').val() == 1 && $(CSSSelectorForm)[0].checkValidity() === false) {\n      console.log('validaton false');\n      event.stopPropagation();\n      return;\n    } else {\n      console.log('validaton ok'); //do your ajax submition here\n    }\n\n    var ajaxData = root.formDataToDataObjectAPICall(CSSSelectorForm);\n    var ajaxUrl = Opts.URL.store;\n    var ajaxMethod = \"POST\";\n\n    if (root.Supplier.id) {\n      ajaxUrl = Opts.URL.update.replace('%id%', root.Supplier.id); //ajaxMethod=\"PUT\";\n      //ajaxData=new FormData($(CSSSelectorForm)[0]);\n\n      ajaxData.append('_method', 'PUT');\n    }\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(data);\n\n        if (data.success == true) {\n          //Opts.onAfterInitViewDetails=root.autofillDetails;\n          Opts.dataTable.orderDirective = [0, 'desc'];\n          Toast.create(\"Sikeres rögzítés!\", ajaxData.get('name') + \" nevű beszálllító elmentve\", TOAST_STATUS.SUCCESS, 5000);\n          APP.loadMainContent(Opts.URL.index + '?init=0', root.initViewList);\n        }\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\n    if (typeof root.Supplier['note'] != 'undefined') {\n      $(CSSSelectorForm + ' textarea[name=note]').val(root.Supplier.note);\n    }\n\n    if (typeof root.Supplier['emailAttachmentType'] != 'undefined') {\n      $(CSSSelectorForm + ' input[name=emailAttachmentType][value=' + root.Supplier['emailAttachmentType'] + ']').prop('checked', true);\n    }\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    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    }); //$(CSSSelectorForm+' .profitCenterSelect').val(profitCenter).change();\n    //debug(profitCenter);\n\n    $.each(profitCenter, function () {\n      $('input[value=\"' + $.escapeSelector(this) + '\"]').prop(\"checked\", true);\n    });\n\n    if (typeof root.Supplier['logoFile'] != 'undefined' && root.Supplier['logoFile']) {\n      $(CSSSelectorForm + ' img.imageLogo').attr('src', root.Supplier['logoFile']);\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  };\n\n  this.initViewDetails = function (options, SupplierItem) {\n    debug('**call initViewDetails ');\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\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\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    $(\".productCategorySelect\").select2();\n    $(\".serviceSelect\").select2({\n      tags: true,\n      createTag: function createTag(params) {\n        var term = $.trim(params.term);\n\n        if (term === '') {\n          return null;\n        }\n\n        return {\n          id: term,\n          text: term,\n          newTag: true // add additional parameters\n\n        };\n      }\n    }); //$(\".profitCenterSelect\").select2();\n\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(); //Opts.onAfterInitViewDetails();\n\n    root.initFileAttachmentFeature();\n    debug('**end initViewDetails ');\n  };\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\n      if (fileInput[0].files[0]) {\n        $('.containerUploadedFileName').text(fileInput[0].files[0].name);\n      }\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\n  this.initFileAttachmentFeature = function () {\n    console.log('-------initFileAttachmentFeature-----------');\n\n    if (root.Supplier.id) {\n      $('.containerFileUpload').removeClass('d-none');\n      $('.containerFileUploadNone').addClass('d-none');\n    }\n\n    $(Opts.containerCssSelector + ' .buttonUpload').off('click');\n    $(Opts.containerCssSelector + ' .buttonUpload').on('click', function () {\n      console.group('-------buttonUpload-----------');\n      var fileInput = $('#inputGroupAttacheFile');\n\n      if (fileInput[0].files.length < 1) {\n        Toast.create(\"Hiba!\", 'Vállaszon ki fájlt!', TOAST_STATUS.DANGER, 10000);\n        return;\n      }\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\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\n  this.clickNew = function () {\n    debug('clickNew');\n    APP.loadMainContent(Opts.URL.create, root.clickNewCallBack);\n  };\n\n  this.clickNewCallBack = function () {\n    debug('callbackNew');\n    root.Supplier = new window.Supplier();\n    root.initViewDetails();\n  };\n\n  this.datatableRowActionEdit = function (rowData, node) {\n    console.log('datatableRowActionEdit Called'); //Opts.onAfterInitViewDetails=root.autofillDetails;\n\n    var ajaxUrl = Opts.URL.edit.replace('%id%', rowData.id);\n    APP.loadMainContent(ajaxUrl, root.initViewDetails);\n    console.log('datatableRowActionEdit End');\n  };\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\n  var datatableRowActionCallerNode = false;\n\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\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\n    if (typeof root[actionName] === \"function\") {\n      return root[actionName](rowData, node);\n    }\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\n    APP.setOpts({\n      datatableActionButtonClickCallBack: root.clickNew,\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    $(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      } //{ \"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\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\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    });\n    Opts.onAfterInitViewDetails = root.autofillDetails;\n    APP.loadMainContent(Opts.URL.create, root.initViewDetails);\n  };\n\n  this.init = function (options, SupplierItem) {\n    $.extend(Opts, options);\n\n    if (Opts.testMode) {\n      return root.testMode();\n    }\n\n    if (SupplierItem) {\n      root.Supplier = SupplierItem;\n    }\n\n    root.initViewList();\n  };\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\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(\"Fájl hozzáadva!\", attachmentData.original_filename + \" fájl hozzáadva\", TOAST_STATUS.SUCCESS, 5000);\n  };\n\n  this.resetContactTable = function () {\n    $('.contactTable tbody tr').remove();\n    root.renderContact();\n  };\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; //console.log(contactData);\n\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\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\n  this.bindAttachmentClickAction = function () {\n    var node = $('.attachmentTable .buttonDelete');\n    node.unbind('click');\n    node.bind('click', root.attachmentDeleteClick);\n  };\n\n  var currentAttachmentRow = false;\n\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); //let data= new FormData($(Opts.containerCssSelector).find('form.supplierForm')[0]);\n    //data.append(fileInput.attr('name'),fileInput[0].files[0]);\n\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\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\n            return false;\n          });\n          /*\n          */\n          //row.remove();\n\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\n  this.resetAttachmentTable = function () {\n    $('.attachmentTable tbody tr').remove();\n    root.renderAttachment();\n  };\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\n      return false;\n    });\n    row.remove();\n    root.resetContactTable();\n  };\n\n  root.getContactPopupWorkflow = function () {\n    return contactPopupWorkflow;\n  };\n\n  root.setContactPopupWorkflow = function (status) {\n    contactPopupWorkflow = status;\n  };\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\n  this.getSupplier = function () {\n    return root.Supplier;\n  };\n\n  this.contactAction = function (contactData) {\n    console.log('nah most kellene meg valamit csinalni.');\n\n    if (root.getContactPopupWorkflow() == 'new') {\n      root.addContact(contactData);\n    } else if (root.getContactPopupWorkflow() == 'edit') {\n      root.editContact(contactData.id, contactData);\n    }\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(\"Kapcsolat adatai módosítva!\", contactData.name + \" nevű kapocsolattartó módosítva\", TOAST_STATUS.SUCCESS, 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(\"Kapcsolat tartó hozzáadva!\", contactData.name + \" nevű kapocsolattartó hozzáadva\", TOAST_STATUS.SUCCESS, 5000);\n  };\n\n  this.construct(options, SupplierItem);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 79904 characters]\n//# sourceURL=webpack-internal:///./resources/js/admin/supplier.js\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"]();
/******/ 	
/******/ })()
;