import { s as sectionsData, a as _sfc_main$9, b as _sfc_main$a, c as _sfc_main$c, d as _sfc_main$d, e as _sfc_main$e, _ as _sfc_main$f, f as _sfc_main$g } from "./index.5d881b98.js";
import { _ as __unplugin_components_1 } from "./VControl.87ec9af6.js";
import { p as provideApi, b as _sfc_main$6, u as useUserSession, e as __unplugin_components_4 } from "./index.33831081.js";
import { _ as _sfc_main$7 } from "./VModal.5c485a91.js";
import { d as defineComponent, X as reactive, a3 as watch, A as resolveComponent, o as openBlock, E as createBlock, y as withCtx, m as createBaseVNode, t as withDirectives, ag as vModelText, q as unref, s as createVNode, z as createTextVNode, r as ref, b as createElementBlock, F as Fragment, Y as renderList, B as toDisplayString, n as normalizeClass, Z as createCommentVNode, h as computed, C as renderSlot, W as Transition, a5 as onMounted, v as vModelCheckbox, N as Notyf, a6 as onUnmounted, ah as vModelSelect, D as useHead } from "./vendor.4b7a2e6c.js";
import { b as useMesaSession, d as MESA_SHAPES, D as DEFAULT_ENVIRONMENT, e as MESA_SHAPES_CIRCLE, f as MESA_NO_DISPONIBLE, g as MESA_DISPONIBLE, u as useCompanySession, a as use, M as MesaService } from "./mesaService.51000732.js";
import { _ as _sfc_main$8 } from "./VIcon.a5f7aa28.js";
import { _ as __unplugin_components_5 } from "./VPlaceloadWrap.9e9678b9.js";
import { _ as _sfc_main$b } from "./VField.afaabb17.js";
import { u as useProductSession } from "./masterService.1efb8c53.js";
import { p as pageTitle } from "./sidebarLayoutState.037b92f3.js";
import "./VIconButton.1ffac9fc.js";
import "./VLoader.b763de9d.js";
import "./VButtons.80a94f5a.js";
const _hoisted_1$5 = { class: "modal-form" };
const _hoisted_2$4 = { class: "field" };
const _hoisted_3$4 = /* @__PURE__ */ createBaseVNode("label", null, "Nombre *", -1);
const _hoisted_4$4 = { class: "control" };
const _hoisted_5$3 = { class: "field" };
const _hoisted_6$2 = /* @__PURE__ */ createBaseVNode("label", null, "Forma *", -1);
const _hoisted_7$2 = /* @__PURE__ */ createBaseVNode("br", null, null, -1);
const _hoisted_8$2 = /* @__PURE__ */ createTextVNode("Guardar");
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  props: {
    open: { type: Boolean, required: true },
    model: { type: null, required: true }
  },
  emits: ["close", "save"],
  setup(__props, { emit }) {
    const props = __props;
    const mesasSession = reactive(useMesaSession());
    let stateFormMesa = reactive({
      id: props.model.id,
      label: props.model.label,
      shape: props.model.shape,
      environment: props.model.environment
    });
    const save = () => {
      const { id, label, shape, environment } = stateFormMesa;
      mesasSession.setFormLabelMesa(id, label, shape, environment ? environment : DEFAULT_ENVIRONMENT);
      saveLabelMesa();
      emit("close");
    };
    const saveLabelMesa = async () => {
      const payload = {
        id: stateFormMesa.id,
        label: stateFormMesa.label,
        shape: stateFormMesa.shape,
        enviroment: stateFormMesa
      };
      try {
        const response = await provideApi().post("restaurant/label-table/save", payload);
        const data = response.data;
        if (data.success) {
        }
      } catch (error) {
        console.error("Error data:", error);
      }
    };
    watch(() => props.open, (newValue, oldValue) => {
      if (newValue) {
        const { id, label, shape, environment } = props.model;
        stateFormMesa.id = id;
        stateFormMesa.label = label;
        stateFormMesa.shape = shape;
        stateFormMesa.environment = environment;
      }
    });
    return (_ctx, _cache) => {
      const _component_Multiselect = resolveComponent("Multiselect");
      const _component_VControl = __unplugin_components_1;
      const _component_VButton = _sfc_main$6;
      const _component_VModal = _sfc_main$7;
      return openBlock(), createBlock(_component_VModal, {
        open: props.open,
        title: "Editar Mesa",
        size: "small",
        actions: "right",
        onClose: _cache[3] || (_cache[3] = ($event) => emit("close"))
      }, {
        content: withCtx(() => [
          createBaseVNode("form", _hoisted_1$5, [
            createBaseVNode("div", _hoisted_2$4, [
              _hoisted_3$4,
              createBaseVNode("div", _hoisted_4$4, [
                withDirectives(createBaseVNode("input", {
                  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(stateFormMesa).label = $event),
                  type: "text",
                  class: "input",
                  placeholder: "Nombre"
                }, null, 512), [
                  [vModelText, unref(stateFormMesa).label]
                ])
              ])
            ]),
            createBaseVNode("div", _hoisted_5$3, [
              _hoisted_6$2,
              createVNode(_component_VControl, null, {
                default: withCtx(() => [
                  createVNode(_component_Multiselect, {
                    modelValue: unref(stateFormMesa).shape,
                    "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(stateFormMesa).shape = $event),
                    placeholder: "Forma",
                    options: unref(MESA_SHAPES)
                  }, null, 8, ["modelValue", "options"])
                ]),
                _: 1
              })
            ]),
            _hoisted_7$2
          ])
        ]),
        action: withCtx(() => [
          createVNode(_component_VButton, {
            color: "primary",
            raised: "",
            onClick: _cache[2] || (_cache[2] = ($event) => save())
          }, {
            default: withCtx(() => [
              _hoisted_8$2
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["open"]);
    };
  }
});
const _hoisted_1$4 = { class: "container" };
const _hoisted_2$3 = ["onClick"];
const _hoisted_3$3 = ["onClick"];
const _hoisted_4$3 = {
  key: 0,
  class: "is-size-7 has-text-weight-normal"
};
const _hoisted_5$2 = {
  key: 1,
  class: "is-size-7"
};
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  props: {
    mesas: { type: Array, required: true, default: () => [] },
    selected: { type: null, required: true },
    modeEdit: { type: Boolean, required: true }
  },
  emits: ["select", "edit"],
  setup(__props, { emit }) {
    const props = __props;
    const mesasSession = useMesaSession();
    const mesaSelected = ref(mesasSession.mesaSelected);
    const select = (item) => {
      emit("select", item);
    };
    const edit = (item) => {
      emit("edit", item);
    };
    const ordersServed = (products) => {
      let served = false;
      for (let prod of products) {
        if (prod.statusBar == 4 || prod.statusKitchen == 4) {
          served = true;
          break;
        }
      }
      return served;
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$4, [
        __props.modeEdit ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.mesas, (item) => {
          return openBlock(), createElementBlock("div", {
            key: item.id + "M",
            class: "mesa mesa-parent-edit"
          }, [
            createBaseVNode("div", {
              class: normalizeClass(["mesa-child edit", {
                circle: item.shape == unref(MESA_SHAPES_CIRCLE)
              }]),
              onClick: ($event) => edit(item)
            }, toDisplayString(item.label), 11, _hoisted_2$3)
          ]);
        }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(props.mesas, (item) => {
          return openBlock(), createElementBlock("div", {
            key: item.id + "M",
            ref: (_value, _refs) => {
              _refs["mesaElement"] = _value;
            },
            class: "mesa"
          }, [
            createBaseVNode("div", {
              class: normalizeClass(["mesa-child", {
                notavailableandorderserved: item.status == unref(MESA_NO_DISPONIBLE) && ordersServed(item.products),
                notavailable: item.status == unref(MESA_NO_DISPONIBLE),
                available: item.status == unref(MESA_DISPONIBLE),
                circle: item.shape == unref(MESA_SHAPES_CIRCLE),
                selected: mesaSelected.value && mesaSelected.value.id == item.id
              }]),
              onClick: ($event) => select(item)
            }, [
              createTextVNode(toDisplayString(item.label) + " ", 1),
              item.quantityOrders > 0 ? (openBlock(), createElementBlock("div", _hoisted_4$3, toDisplayString(item.quantityOrders) + " Pedidos ", 1)) : createCommentVNode("", true),
              item.timeOpening ? (openBlock(), createElementBlock("div", _hoisted_5$2, toDisplayString(item.timeOpening), 1)) : createCommentVNode("", true)
            ], 10, _hoisted_3$3)
          ], 512);
        }), 128))
      ]);
    };
  }
});
const _hoisted_1$3 = { class: "tabs-inner" };
const _hoisted_2$2 = ["onClick"];
const _hoisted_3$2 = {
  key: 0,
  class: "tab-naver"
};
const _hoisted_4$2 = { class: "tab-content is-active" };
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  props: {
    tabs: { type: Array, required: true },
    selected: { type: String, required: false, default: void 0 },
    type: { type: String, required: false, default: void 0 },
    align: { type: String, required: false, default: void 0 },
    slider: { type: Boolean, required: false },
    slow: { type: Boolean, required: false }
  },
  setup(__props) {
    const props = __props;
    const activeValue = ref(props.selected);
    const sliderClass = computed(() => {
      if (!props.slider) {
        return "";
      }
      if (props.type === "rounded") {
        if (props.tabs.length === 3) {
          return "is-triple-slider";
        }
        if (props.tabs.length === 2) {
          return "is-slider";
        }
        return "";
      }
      if (!props.type) {
        if (props.tabs.length === 3) {
          return "is-squared is-triple-slider";
        }
        if (props.tabs.length === 2) {
          return "is-squared is-slider";
        }
      }
      return "";
    });
    return (_ctx, _cache) => {
      const _component_VIcon = _sfc_main$8;
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["tabs-wrapper", [unref(sliderClass)]])
      }, [
        createBaseVNode("div", _hoisted_1$3, [
          createBaseVNode("div", {
            class: normalizeClass(["tabs", [
              props.align === "centered" && "is-centered",
              props.align === "right" && "is-right",
              props.type === "rounded" && !props.slider && "is-toggle is-toggle-rounded",
              props.type === "toggle" && "is-toggle",
              props.type === "boxed" && "is-boxed"
            ]])
          }, [
            createBaseVNode("ul", null, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(__props.tabs, (tab, key) => {
                return openBlock(), createElementBlock("li", {
                  key,
                  class: normalizeClass([activeValue.value === tab.value && "is-active"])
                }, [
                  createBaseVNode("a", {
                    onClick: ($event) => activeValue.value = tab.value
                  }, [
                    tab.icon ? (openBlock(), createBlock(_component_VIcon, {
                      key: 0,
                      icon: tab.icon
                    }, null, 8, ["icon"])) : createCommentVNode("", true),
                    createBaseVNode("span", null, toDisplayString(tab.label), 1)
                  ], 8, _hoisted_2$2)
                ], 2);
              }), 128)),
              unref(sliderClass) ? (openBlock(), createElementBlock("li", _hoisted_3$2)) : createCommentVNode("", true)
            ])
          ], 2)
        ]),
        createBaseVNode("div", _hoisted_4$2, [
          createVNode(Transition, {
            name: props.slow ? "fade-slow" : "fade-fast",
            mode: "out-in"
          }, {
            default: withCtx(() => [
              renderSlot(_ctx.$slots, "tab", { activeValue: activeValue.value })
            ]),
            _: 3
          }, 8, ["name"])
        ])
      ], 2);
    };
  }
});
var MesaRestaurantPos_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$2 = { class: "food-delivery-dashboard" };
const _hoisted_2$1 = { class: "left" };
const _hoisted_3$1 = { class: "left-body" };
const _hoisted_4$1 = { class: "restaurants" };
const _hoisted_5$1 = { class: "pt-5" };
const _hoisted_6$1 = { class: "form-checkbox" };
const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" Buscar por c\xF3digo de barras ");
const _hoisted_8$1 = { class: "restaurants-list" };
const _hoisted_9$1 = { class: "columns is-mobile is-multiline" };
const _hoisted_10$1 = /* @__PURE__ */ createBaseVNode("div", {
  class: "is-hidden-desktop",
  style: { "min-height": "150px" }
}, null, -1);
const _hoisted_11$1 = { class: "is-hidden-desktop cart-bottom-fixed h-hidden-tablet-l" };
const _hoisted_12$1 = { class: "columns is-mobile is-centered m-custom" };
const _hoisted_13$1 = { class: "column is-11" };
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  props: {
    mesaid: { type: Number, required: false, default: void 0 }
  },
  emits: ["viewMesas"],
  setup(__props, { emit }) {
    const userSession = useUserSession();
    ref("cart");
    const textSearch = ref("");
    const searchByBarcode = ref(false);
    ref(0);
    const mesasSession = useMesaSession();
    const productSession = useProductSession();
    mesasSession.getMesasNotAvailable();
    ref(false);
    reactive({
      description: ""
    });
    const mesaSelected = ref(mesasSession.mesaSelected);
    const posBag = reactive({
      products: mesaSelected.value.products,
      total: mesaSelected.value.total,
      barman: userSession.name,
      waiter: mesaSelected.value.waiter,
      enterAmount: 0
    });
    const state = reactive({
      products: productSession.products,
      products_filter: productSession.products,
      openDialogDocument: false,
      loading: false,
      generatedDocument: false,
      sections: sectionsData,
      categories: productSession.categories
    });
    const clickAddProduct = (item) => {
      mesasSession.addProduct(item);
    };
    const openDialogDocument = () => {
      if (mesaSelected.value.total > 0) {
        posBag.total = mesaSelected.value.total;
        state.openDialogDocument = true;
      }
    };
    const closeDialogDocument = () => {
      mesasSession.setAvailableMesa();
      state.openDialogDocument = false;
      emit("viewMesas");
    };
    const changeToMesas = () => {
      emit("viewMesas");
    };
    const back = () => {
      state.openDialogDocument = false;
    };
    const selectMesa = (id) => {
      mesasSession.setMesaSelected(id);
    };
    const products_filter = computed(() => {
      if (textSearch.value.length > 0) {
        if (searchByBarcode.value) {
          let itemFound = state.products.find((item) => item.barcode == textSearch.value);
          if (itemFound) {
            mesasSession.addProduct(itemFound);
          }
          textSearch.value = "";
          return itemFound ? [itemFound] : [];
        } else {
          return state.products.filter((item) => item.name.toLowerCase().includes(textSearch.value.toLowerCase()));
        }
      } else {
        return state.products;
      }
    });
    const selectCategory = (id) => {
      if (id === 0) {
        state.products = state.products_filter;
      } else {
        state.products = state.products_filter.filter((x) => x.categoryId === id);
      }
    };
    const cancelTable = () => {
      closeDialogDocument();
    };
    const changeSearchByBarcode = () => {
      let byBarcode = searchByBarcode.value ? 1 : 0;
      userSession.setSearchByBarcode(byBarcode);
    };
    onMounted(() => {
      searchByBarcode.value = userSession.searchByBarcode ? true : false;
    });
    return (_ctx, _cache) => {
      const _component_DocumentDialog = _sfc_main$9;
      const _component_CategoriesNavBar = _sfc_main$a;
      const _component_VControl = __unplugin_components_1;
      const _component_VField = _sfc_main$b;
      const _component_ProductPos = _sfc_main$c;
      const _component_CartMobile = _sfc_main$d;
      const _component_Bag = _sfc_main$e;
      return openBlock(), createElementBlock(Fragment, null, [
        createVNode(_component_DocumentDialog, {
          "pos-bag": unref(posBag),
          open: unref(state).openDialogDocument,
          onClose: closeDialogDocument,
          onBack: back
        }, null, 8, ["pos-bag", "open"]),
        createBaseVNode("div", _hoisted_1$2, [
          createBaseVNode("div", _hoisted_2$1, [
            createBaseVNode("div", _hoisted_3$1, [
              createBaseVNode("div", _hoisted_4$1, [
                createVNode(_component_CategoriesNavBar, { onSelectcategory: selectCategory }),
                createBaseVNode("div", _hoisted_5$1, [
                  createVNode(_component_VField, null, {
                    default: withCtx(() => [
                      createVNode(_component_VControl, { icon: "feather:search" }, {
                        default: withCtx(() => [
                          withDirectives(createBaseVNode("input", {
                            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => textSearch.value = $event),
                            type: "text",
                            class: "input is-rounded",
                            placeholder: "Busca un producto ..."
                          }, null, 512), [
                            [vModelText, textSearch.value]
                          ])
                        ]),
                        _: 1
                      }),
                      createBaseVNode("div", _hoisted_6$1, [
                        createBaseVNode("label", null, [
                          withDirectives(createBaseVNode("input", {
                            type: "checkbox",
                            "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchByBarcode.value = $event),
                            onChange: changeSearchByBarcode
                          }, null, 544), [
                            [vModelCheckbox, searchByBarcode.value]
                          ]),
                          _hoisted_7$1
                        ])
                      ])
                    ]),
                    _: 1
                  })
                ]),
                createBaseVNode("div", _hoisted_8$1, [
                  createBaseVNode("div", _hoisted_9$1, [
                    (openBlock(true), createElementBlock(Fragment, null, renderList(unref(products_filter), (product) => {
                      return openBlock(), createElementBlock("div", {
                        key: product.id,
                        class: "column is-6-mobile is-4-tablet is-3-desktop"
                      }, [
                        createVNode(_component_ProductPos, {
                          product,
                          onClickAddProduct: clickAddProduct
                        }, null, 8, ["product"])
                      ]);
                    }), 128))
                  ])
                ])
              ])
            ]),
            _hoisted_10$1
          ]),
          createBaseVNode("div", _hoisted_11$1, [
            createBaseVNode("div", _hoisted_12$1, [
              createBaseVNode("div", _hoisted_13$1, [
                createVNode(_component_CartMobile, {
                  parent: "mesas",
                  onSelectMesa: selectMesa,
                  onFinalizeSale: openDialogDocument,
                  onCancelTable: cancelTable,
                  onChangeToMesas: changeToMesas
                })
              ])
            ])
          ]),
          createVNode(_component_Bag, {
            parent: "mesas",
            onSelectMesa: selectMesa,
            onFinalizeSale: openDialogDocument,
            onCancelTable: cancelTable,
            onChangeToMesas: changeToMesas
          })
        ])
      ], 64);
    };
  }
});
var MesaRestaurant_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$1 = {
  key: 0,
  class: "ecommerce-dashboard ecommerce-dashboard-v1"
};
const _hoisted_2 = { class: "columns is-multiline" };
const _hoisted_3 = { class: "column is-9" };
const _hoisted_4 = { class: "stat-widget line-stats-widget is-straight" };
const _hoisted_5 = /* @__PURE__ */ createTextVNode(" Actualizar Mesas ");
const _hoisted_6 = /* @__PURE__ */ createTextVNode(" Editar mesas ");
const _hoisted_7 = /* @__PURE__ */ createTextVNode(" Finalizar ");
const _hoisted_8 = { class: "column is-3" };
const _hoisted_9 = {
  key: 0,
  class: "stat-widget area-stats-widget is-straight"
};
const _hoisted_10 = { class: "fieldset-heading pb-4" };
const _hoisted_11 = { style: { "font-size": "13px" } };
const _hoisted_12 = { class: "columns is-multiline" };
const _hoisted_13 = { class: "column is-12" };
const _hoisted_14 = /* @__PURE__ */ createBaseVNode("label", null, "Personas en la mesa", -1);
const _hoisted_15 = { class: "column is-12" };
const _hoisted_16 = /* @__PURE__ */ createBaseVNode("label", null, "Cliente", -1);
const _hoisted_17 = { class: "column is-12" };
const _hoisted_18 = /* @__PURE__ */ createBaseVNode("label", null, "Mozo", -1);
const _hoisted_19 = {
  class: "select",
  placeholder: "Seleccione mozo"
};
const _hoisted_20 = ["value"];
const _hoisted_21 = { class: "column is-12" };
const _hoisted_22 = /* @__PURE__ */ createBaseVNode("label", null, "Comentarios", -1);
const _hoisted_23 = { class: "column is-12" };
const _hoisted_24 = /* @__PURE__ */ createTextVNode(" Abrir mesa ");
const _hoisted_25 = {
  key: 1,
  class: "stat-widget area-stats-widget is-straight"
};
const _hoisted_26 = /* @__PURE__ */ createBaseVNode("h3", null, "SELECCIONE UNA MESA", -1);
const _hoisted_27 = [
  _hoisted_26
];
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  setup(__props) {
    const notyf = new Notyf();
    const mesasSession = reactive(useMesaSession());
    const companySession = reactive(useCompanySession());
    const mesaSelected = ref(mesasSession.mesaSelected);
    let mesas = ref([]);
    const userSession = useUserSession();
    const userRole = userSession.getRole();
    let viewPos = ref(false);
    let canUpdate = ref(false);
    let openModalEditMesa = ref(false);
    let loadingRefresh = ref(false);
    let intervalId = void 0;
    const environments = mesasSession.environments;
    let stateFormMesa = reactive({
      id: 0,
      label: "",
      shape: "",
      environment: DEFAULT_ENVIRONMENT
    });
    let modeEditMesas = ref(false);
    const customerDefault = companySession.getCustomerDefault();
    const selectMesa = (item) => {
      if (item.status == MESA_DISPONIBLE) {
        mesasSession.setMesaSelected(item.id, customerDefault.apellidos_y_nombres_o_razon_social);
        canUpdate.value = true;
      } else {
        mesasSession.setMesaSelected(item.id);
        viewPos.value = true;
      }
    };
    const openMesa = () => {
      if (mesaSelected.value) {
        mesasSession.openMesa(mesaSelected.value);
        viewPos.value = true;
      }
    };
    const viewMesas = () => {
      viewPos.value = false;
    };
    const editMesaForm = (item) => {
      const { id, label, shape, environment } = item;
      stateFormMesa.id = id;
      stateFormMesa.label = label;
      stateFormMesa.shape = shape;
      stateFormMesa.environment = environment;
      openModalEditMesa.value = true;
    };
    const editMesas = () => {
      modeEditMesas.value = true;
      if (intervalId !== void 0) {
        clearInterval(intervalId);
      }
    };
    const finishEditMesas = () => {
      modeEditMesas.value = false;
      intervalId = window.setInterval(syncMesasEnviroments, 5e3);
    };
    const setMesas = () => {
      mesas.value = mesasSession.mesas;
    };
    const closeFormMesa = () => {
      openModalEditMesa.value = false;
    };
    const refresh = async () => {
      loadingRefresh.value = true;
      use.connect();
      use.sendCompany();
      await MesaService.syncMesasAndEnvironments();
      loadingRefresh.value = false;
      notyf.success("Se actualizaron las mesas y ambientes correctamente.");
    };
    const syncMesasEnviroments = async () => {
      await MesaService.syncMesasAndEnvironments();
      setMesas();
    };
    watch(() => [...mesasSession.mesas], () => {
      setMesas();
    });
    onMounted(() => {
      setMesas();
      syncMesasEnviroments();
      intervalId = window.setInterval(syncMesasEnviroments, 5e3);
    });
    onUnmounted(() => {
      if (intervalId !== void 0) {
        clearInterval(intervalId);
      }
    });
    return (_ctx, _cache) => {
      const _component_MesaForm = _sfc_main$5;
      const _component_CashDialog = _sfc_main$f;
      const _component_MesaEnvironment = _sfc_main$4;
      const _component_VTabs = _sfc_main$3;
      const _component_VPlaceload = __unplugin_components_4;
      const _component_VPlaceloadWrap = __unplugin_components_5;
      const _component_VButton = _sfc_main$6;
      const _component_VControl = __unplugin_components_1;
      const _component_VField = _sfc_main$b;
      const _component_MesaRestaurantPos = _sfc_main$2;
      return openBlock(), createElementBlock(Fragment, null, [
        createVNode(_component_MesaForm, {
          open: unref(openModalEditMesa),
          model: unref(stateFormMesa),
          onClose: closeFormMesa
        }, null, 8, ["open", "model"]),
        createVNode(_component_CashDialog),
        !unref(viewPos) ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
          createBaseVNode("div", _hoisted_2, [
            createBaseVNode("div", _hoisted_3, [
              createBaseVNode("div", _hoisted_4, [
                createVNode(_component_VTabs, {
                  selected: unref(environments)[0].name,
                  tabs: unref(environments).filter((item) => item.active === true).map((item) => {
                    return { label: item.name, value: item.name };
                  })
                }, {
                  tab: withCtx(({ activeValue }) => [
                    activeValue === "Ambiente 1" ? (openBlock(), createBlock(_component_MesaEnvironment, {
                      key: 0,
                      mesas: unref(mesas).filter((x) => x.environment == "Ambiente 1"),
                      selected: mesaSelected.value,
                      "mode-edit": unref(modeEditMesas),
                      onSelect: selectMesa,
                      onEdit: editMesaForm
                    }, null, 8, ["mesas", "selected", "mode-edit"])) : activeValue === "Ambiente 2" ? (openBlock(), createBlock(_component_MesaEnvironment, {
                      key: 1,
                      mesas: unref(mesas).filter((x) => x.environment == "Ambiente 2"),
                      selected: mesaSelected.value,
                      "mode-edit": unref(modeEditMesas),
                      onSelect: selectMesa,
                      onEdit: editMesaForm
                    }, null, 8, ["mesas", "selected", "mode-edit"])) : activeValue === "Ambiente 3" ? (openBlock(), createBlock(_component_MesaEnvironment, {
                      key: 2,
                      mesas: unref(mesas).filter((x) => x.environment == "Ambiente 3"),
                      selected: mesaSelected.value,
                      "mode-edit": unref(modeEditMesas),
                      onSelect: selectMesa,
                      onEdit: editMesaForm
                    }, null, 8, ["mesas", "selected", "mode-edit"])) : activeValue === "Ambiente 4" ? (openBlock(), createBlock(_component_MesaEnvironment, {
                      key: 3,
                      mesas: unref(mesas).filter((x) => x.environment == "Ambiente 4"),
                      selected: mesaSelected.value,
                      "mode-edit": unref(modeEditMesas),
                      onSelect: selectMesa,
                      onEdit: editMesaForm
                    }, null, 8, ["mesas", "selected", "mode-edit"])) : createCommentVNode("", true)
                  ]),
                  _: 1
                }, 8, ["selected", "tabs"]),
                unref(loadingRefresh) ? (openBlock(), createBlock(_component_VPlaceloadWrap, { key: 0 }, {
                  default: withCtx(() => [
                    createVNode(_component_VPlaceload, {
                      height: "25px",
                      width: "20%",
                      class: "mx-2"
                    })
                  ]),
                  _: 1
                })) : (openBlock(), createBlock(_component_VButton, {
                  key: 1,
                  color: "primary",
                  raised: "",
                  class: "mt-3 mr-5",
                  onClick: refresh
                }, {
                  default: withCtx(() => [
                    _hoisted_5
                  ]),
                  _: 1
                })),
                !unref(modeEditMesas) && unref(userRole) != "MOZO" ? (openBlock(), createBlock(_component_VButton, {
                  key: 2,
                  class: "mt-3",
                  onClick: editMesas
                }, {
                  default: withCtx(() => [
                    _hoisted_6
                  ]),
                  _: 1
                })) : createCommentVNode("", true),
                unref(modeEditMesas) && unref(userRole) != "MOZO" ? (openBlock(), createBlock(_component_VButton, {
                  key: 3,
                  class: "mt-3",
                  onClick: finishEditMesas
                }, {
                  default: withCtx(() => [
                    _hoisted_7
                  ]),
                  _: 1
                })) : createCommentVNode("", true)
              ])
            ]),
            createBaseVNode("div", _hoisted_8, [
              mesaSelected.value && mesaSelected.value.id !== 0 ? (openBlock(), createElementBlock("div", _hoisted_9, [
                createBaseVNode("div", _hoisted_10, [
                  createBaseVNode("h4", null, [
                    createTextVNode(" MESA " + toDisplayString(mesaSelected.value.label) + " ", 1),
                    createBaseVNode("span", _hoisted_11, toDisplayString(mesaSelected.value.environment), 1)
                  ])
                ]),
                createBaseVNode("div", _hoisted_12, [
                  createBaseVNode("div", _hoisted_13, [
                    createVNode(_component_VField, null, {
                      default: withCtx(() => [
                        _hoisted_14,
                        createVNode(_component_VControl, { icon: "feather:hash" }, {
                          default: withCtx(() => [
                            withDirectives(createBaseVNode("input", {
                              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => mesaSelected.value.personas = $event),
                              type: "number",
                              class: "input",
                              placeholder: "",
                              autocomplete: "given-name"
                            }, null, 512), [
                              [vModelText, mesaSelected.value.personas]
                            ])
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  createBaseVNode("div", _hoisted_15, [
                    createVNode(_component_VField, null, {
                      default: withCtx(() => [
                        _hoisted_16,
                        createVNode(_component_VControl, { icon: "feather:user" }, {
                          default: withCtx(() => [
                            withDirectives(createBaseVNode("input", {
                              "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => mesaSelected.value.cliente = $event),
                              type: "text",
                              class: "input",
                              placeholder: "",
                              autocomplete: "family-name"
                            }, null, 512), [
                              [vModelText, mesaSelected.value.cliente]
                            ])
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  createBaseVNode("div", _hoisted_17, [
                    createVNode(_component_VField, null, {
                      default: withCtx(() => [
                        _hoisted_18,
                        createVNode(_component_VControl, { icon: "feather:user-check" }, {
                          default: withCtx(() => [
                            createBaseVNode("div", _hoisted_19, [
                              withDirectives(createBaseVNode("select", {
                                "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => mesaSelected.value.waiter = $event)
                              }, [
                                (openBlock(true), createElementBlock(Fragment, null, renderList(unref(companySession).waiters, (item, index) => {
                                  return openBlock(), createElementBlock("option", {
                                    key: index + "Wa",
                                    value: `${item.name}`
                                  }, toDisplayString(`${item.name}`), 9, _hoisted_20);
                                }), 128))
                              ], 512), [
                                [vModelSelect, mesaSelected.value.waiter]
                              ])
                            ])
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  createBaseVNode("div", _hoisted_21, [
                    createVNode(_component_VField, null, {
                      default: withCtx(() => [
                        _hoisted_22,
                        createVNode(_component_VControl, null, {
                          default: withCtx(() => [
                            withDirectives(createBaseVNode("textarea", {
                              "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => mesaSelected.value.comentarios = $event),
                              class: "textarea",
                              rows: "4",
                              placeholder: "",
                              autocomplete: "off",
                              autocapitalize: "off",
                              spellcheck: "true"
                            }, null, 512), [
                              [vModelText, mesaSelected.value.comentarios]
                            ])
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  createBaseVNode("div", _hoisted_23, [
                    createVNode(_component_VButton, {
                      color: "primary",
                      raised: "",
                      class: "is-fullwidth",
                      onClick: openMesa
                    }, {
                      default: withCtx(() => [
                        _hoisted_24
                      ]),
                      _: 1
                    })
                  ])
                ])
              ])) : createCommentVNode("", true),
              mesaSelected.value.id == 0 ? (openBlock(), createElementBlock("div", _hoisted_25, _hoisted_27)) : createCommentVNode("", true)
            ])
          ])
        ])) : createCommentVNode("", true),
        unref(viewPos) ? (openBlock(), createBlock(_component_MesaRestaurantPos, {
          key: 1,
          onViewMesas: viewMesas
        })) : createCommentVNode("", true)
      ], 64);
    };
  }
});
const _hoisted_1 = { class: "page-content-inner" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  setup(__props) {
    pageTitle.value = "Mesas";
    useHead({
      title: "Main Mesas"
    });
    return (_ctx, _cache) => {
      const _component_LockedScreen = _sfc_main$g;
      const _component_MesaRestaurant = _sfc_main$1;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(_component_LockedScreen),
        createVNode(_component_MesaRestaurant)
      ]);
    };
  }
});
export { _sfc_main as default };
