(self["webpackChunk"] = self["webpackChunk"] || []).push([["resources_js_Pages_Groups_vue"],{

/***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/Pages/Groups.vue?vue&type=script&lang=js&":
/*!********************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/Pages/Groups.vue?vue&type=script&lang=js& ***!
  \********************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _data_group_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/data/group-columns */ "./resources/js/data/group-columns.json");
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  props: ["groups", "type"],
  metaInfo: function metaInfo() {
    return {
      title: this.trans("Archives")
    };
  },
  data: function data() {
    return {
      locale: this.$page.props.locale || "tm",
      visible: false,
      selectedGroup: undefined,
      selectedType: this.type || "import",
      form: this.$inertia.form({
        title: {
          tm: undefined,
          ru: undefined,
          en: undefined
        },
        type: "import",
        is_default: false
      })
    };
  },
  computed: {
    columns: function columns() {
      var _this = this;

      return _data_group_columns__WEBPACK_IMPORTED_MODULE_0__.map(function (column) {
        column.title = _this.trans(column.title);
        return column;
      });
    }
  },
  watch: {
    selectedType: function selectedType(value) {
      this.$inertia.get(this.route("groups", {
        type: value
      }), {}, {
        preserveState: true
      });
      this.form.type = value;
    },
    visible: function visible(value) {
      if (value && this.selectedGroup) {
        this.form.title = this.selectedGroup.title;
        this.form.type = this.selectedGroup.type;
        this.form.is_default = !!this.selectedGroup.is_default;
      } else {
        this.selectedGroup = undefined;
      }

      if (this.selectedType !== this.form.type) {
        this.form.type = this.selectedType;
      }
    }
  },
  methods: {
    submit: function submit() {
      this.selectedGroup ? this.update() : this.create();
    },
    create: function create() {
      var _this2 = this;

      this.form.post(this.route("groups.store"), {
        onSuccess: function onSuccess() {
          _this2.visible = false;

          _this2.$message.success(_this2.trans("Success message"));

          _this2.form.reset();
        }
      });
    },
    update: function update() {
      var _this3 = this;

      this.form.put(this.route("groups.update", {
        group: this.selectedGroup.id
      }), {
        onSuccess: function onSuccess() {
          _this3.visible = false;

          _this3.$message.success(_this3.trans("Success message"));

          _this3.form.reset();
        }
      });
    },
    makeDefault: function makeDefault(group) {
      var _this4 = this;

      this.$inertia.put(this.route("groups.update", {
        group: group
      }), {
        is_default: true,
        type: this.selectedType
      }, {
        onSuccess: function onSuccess() {
          _this4.$message.success(_this4.trans("Success message"));
        }
      });
    }
  }
});

/***/ }),

/***/ "./resources/js/Pages/Groups.vue":
/*!***************************************!*\
  !*** ./resources/js/Pages/Groups.vue ***!
  \***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _Groups_vue_vue_type_template_id_90073286___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Groups.vue?vue&type=template&id=90073286& */ "./resources/js/Pages/Groups.vue?vue&type=template&id=90073286&");
/* harmony import */ var _Groups_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Groups.vue?vue&type=script&lang=js& */ "./resources/js/Pages/Groups.vue?vue&type=script&lang=js&");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__.default)(
  _Groups_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__.default,
  _Groups_vue_vue_type_template_id_90073286___WEBPACK_IMPORTED_MODULE_0__.render,
  _Groups_vue_vue_type_template_id_90073286___WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/Pages/Groups.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./resources/js/Pages/Groups.vue?vue&type=script&lang=js&":
/*!****************************************************************!*\
  !*** ./resources/js/Pages/Groups.vue?vue&type=script&lang=js& ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_0_rules_0_use_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Groups_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Groups.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/Pages/Groups.vue?vue&type=script&lang=js&");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_babel_loader_lib_index_js_clonedRuleSet_5_0_rules_0_use_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Groups_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__.default); 

/***/ }),

/***/ "./resources/js/Pages/Groups.vue?vue&type=template&id=90073286&":
/*!**********************************************************************!*\
  !*** ./resources/js/Pages/Groups.vue?vue&type=template&id=90073286& ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "render": () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Groups_vue_vue_type_template_id_90073286___WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   "staticRenderFns": () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Groups_vue_vue_type_template_id_90073286___WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Groups_vue_vue_type_template_id_90073286___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Groups.vue?vue&type=template&id=90073286& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/Pages/Groups.vue?vue&type=template&id=90073286&");


/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/Pages/Groups.vue?vue&type=template&id=90073286&":
/*!*************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/Pages/Groups.vue?vue&type=template&id=90073286& ***!
  \*************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "render": () => (/* binding */ render),
/* harmony export */   "staticRenderFns": () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function() {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    [
      _c(
        "div",
        {
          staticClass:
            "flex bg-white p-4 text-lg border-b border-gray-300 h-20 items-center"
        },
        [
          _c("div", { staticClass: "flex-1 font-semibold" }, [
            _vm._v(_vm._s(_vm.trans("Archives")))
          ]),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "space-x-3" },
            [
              _c(
                "a-radio-group",
                {
                  attrs: { "button-style": "solid" },
                  model: {
                    value: _vm.selectedType,
                    callback: function($$v) {
                      _vm.selectedType = $$v
                    },
                    expression: "selectedType"
                  }
                },
                [
                  _c("a-radio-button", { attrs: { value: "import" } }, [
                    _vm._v(
                      "\n          " +
                        _vm._s(_vm.trans("Import")) +
                        "\n        "
                    )
                  ]),
                  _vm._v(" "),
                  _c("a-radio-button", { attrs: { value: "export" } }, [
                    _vm._v(
                      "\n          " +
                        _vm._s(_vm.trans("Export")) +
                        "\n        "
                    )
                  ])
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "a-button",
                {
                  attrs: { type: "primary" },
                  on: {
                    click: function($event) {
                      _vm.visible = true
                    }
                  }
                },
                [_vm._v(_vm._s(_vm.trans("Create")))]
              )
            ],
            1
          )
        ]
      ),
      _vm._v(" "),
      _c("a-table", {
        attrs: {
          dataSource: _vm.groups,
          columns: _vm.columns,
          pagination: false,
          rowKey: "id"
        },
        scopedSlots: _vm._u([
          {
            key: "locale",
            fn: function(title) {
              return _c("span", {}, [
                _vm._v(
                  "\n      " +
                    _vm._s(title[_vm.$page.props.locale || "tm"]) +
                    "\n    "
                )
              ])
            }
          },
          {
            key: "count",
            fn: function(_, row) {
              return _c("span", {}, [
                _vm.selectedType === "export"
                  ? _c("span", [_vm._v(_vm._s(row.exports_count))])
                  : _c("span", [_vm._v(_vm._s(row.imports_count))])
              ])
            }
          },
          {
            key: "is_default",
            fn: function(is_default) {
              return _c("span", {}, [
                is_default
                  ? _c(
                      "span",
                      {
                        staticClass:
                          "px-2 py-1 rounded-md bg-primary uppercase font-semibold text-xs text-white"
                      },
                      [_vm._v(_vm._s(_vm.trans("Selected")))]
                    )
                  : _vm._e()
              ])
            }
          },
          {
            key: "actions",
            fn: function(_, row) {
              return _c(
                "span",
                {},
                [
                  row.file
                    ? _c(
                        "a-tooltip",
                        { attrs: { title: _vm.trans("Download excel") } },
                        [
                          _c("a-button", {
                            attrs: { icon: "file-excel" },
                            on: {
                              click: function() {
                                return _vm.download(row.hashid)
                              }
                            }
                          })
                        ],
                        1
                      )
                    : _vm._e(),
                  _vm._v(" "),
                  _c(
                    "a-tooltip",
                    { attrs: { title: _vm.trans("Edit") } },
                    [
                      _c("a-button", {
                        attrs: { icon: "edit" },
                        on: {
                          click: function() {
                            _vm.visible = true
                            _vm.selectedGroup = row
                          }
                        }
                      })
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c(
                    "a-tooltip",
                    { attrs: { title: _vm.trans("Delete") } },
                    [
                      _c("a-button", {
                        attrs: { type: "danger", ghost: "", icon: "delete" },
                        on: {
                          click: function() {
                            return _vm.destroy("groups", row.id)
                          }
                        }
                      })
                    ],
                    1
                  )
                ],
                1
              )
            }
          }
        ])
      }),
      _vm._v(" "),
      _c(
        "a-modal",
        {
          attrs: {
            title: _vm.trans("Create"),
            "confirm-loading": _vm.form.processing,
            "ok-text": _vm.trans("OK"),
            "cancel-text": _vm.trans("Close"),
            "destroy-on-close": true
          },
          on: { ok: _vm.submit },
          model: {
            value: _vm.visible,
            callback: function($$v) {
              _vm.visible = $$v
            },
            expression: "visible"
          }
        },
        [
          _c(
            "a-form",
            {
              nativeOn: {
                keypress: function($event) {
                  if (
                    !$event.type.indexOf("key") &&
                    _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
                  ) {
                    return null
                  }
                  return _vm.submit($event)
                }
              }
            },
            [
              _c(
                "a-form-item",
                {
                  attrs: {
                    label: _vm.trans("Title"),
                    validateStatus:
                      _vm.formStatus("title") ||
                      _vm.formStatus("title.tm") ||
                      _vm.formStatus("title.ru") ||
                      _vm.formStatus("title.en"),
                    help:
                      _vm.formHelp("title") ||
                      _vm.formHelp("title.tm") ||
                      _vm.formHelp("title.ru") ||
                      _vm.formHelp("title.en")
                  }
                },
                [
                  _c(
                    "a-input-group",
                    { staticClass: "flex", attrs: { compact: "" } },
                    [
                      _c("a-input", {
                        attrs: { placeholder: _vm.trans("Title") },
                        model: {
                          value: _vm.form.title[_vm.locale],
                          callback: function($$v) {
                            _vm.$set(_vm.form.title, _vm.locale, $$v)
                          },
                          expression: "form.title[locale]"
                        }
                      }),
                      _vm._v(" "),
                      _c(
                        "a-select",
                        {
                          staticClass: "w-44",
                          model: {
                            value: _vm.locale,
                            callback: function($$v) {
                              _vm.locale = $$v
                            },
                            expression: "locale"
                          }
                        },
                        [
                          _c("a-select-option", { attrs: { value: "tm" } }, [
                            _vm._v("Türkmençe")
                          ]),
                          _vm._v(" "),
                          _c("a-select-option", { attrs: { value: "ru" } }, [
                            _vm._v("Русский")
                          ]),
                          _vm._v(" "),
                          _c("a-select-option", { attrs: { value: "en" } }, [
                            _vm._v("English")
                          ])
                        ],
                        1
                      )
                    ],
                    1
                  )
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "a-form-item",
                {
                  attrs: {
                    label: "",
                    validateStatus: _vm.formStatus("is_default"),
                    help: _vm.formHelp("is_default")
                  }
                },
                [
                  _c(
                    "a-checkbox",
                    {
                      model: {
                        value: _vm.form.is_default,
                        callback: function($$v) {
                          _vm.$set(_vm.form, "is_default", $$v)
                        },
                        expression: "form.is_default"
                      }
                    },
                    [_vm._v(_vm._s(_vm.trans("Selected")) + "?")]
                  )
                ],
                1
              )
            ],
            1
          )
        ],
        1
      )
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./resources/js/data/group-columns.json":
/*!**********************************************!*\
  !*** ./resources/js/data/group-columns.json ***!
  \**********************************************/
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('[{"dataIndex":"title","key":"title","title":"Title","scopedSlots":{"customRender":"locale"}},{"key":"count","title":"Count","scopedSlots":{"customRender":"count"},"width":140},{"dataIndex":"is_default","key":"is_default","scopedSlots":{"customRender":"is_default"},"width":140},{"key":"actions","width":180,"align":"right","scopedSlots":{"customRender":"actions"}}]');

/***/ })

}]);