import { jsxs as o, Fragment as s, jsx as t } from "react/jsx-runtime";
import { useState as C } from "react";
import { u as x } from "../../index.esm-BQxOvVZs.js";
import e from "../../components/AlertDialog/index.js";
import m from "../../components/Buttons/index.js";
import { T as g } from "../../index-UEnzNNJg.js";
import { useModalContext as y } from "../../context/generalContext/index.js";
const h = [
  {
    cellParam: "a",
    cellType: "text",
    columnName: "",
    cellComponent: {
      componentKey: "InputRadio",
      targetId: "id",
      oneTarget: !0
    },
    isAction: !0
  },
  {
    cellParam: "actividad_id",
    cellType: "text",
    columnName: "Cód. Mun",
    thClassName: "w-[20px]",
    canSort: !0,
    filter: {
      param: "actividad_id",
      type: "text"
    }
  },
  {
    cellParam: "actividad_decripcion",
    cellType: "longText",
    columnName: "Actividad Económica",
    thClassName: "w-full",
    filter: {
      param: "actividad_decripcion",
      type: "text"
    }
  },
  {
    cellParam: "actividad_tarifa",
    cellType: "text",
    columnName: "Tarifa",
    thClassName: "w-[40px]",
    customCellComponent: (a) => /* @__PURE__ */ o(s, { children: [
      a == null ? void 0 : a.actividad_tarifa,
      " * 1000"
    ] })
    // filter: {
    //     param: "actividad_tarifa",
    //     type: "text"
    // }
  },
  {
    cellParam: "actividad_codigo_ciiu",
    cellType: "text",
    columnName: "Cód. CIIU",
    canSort: !0,
    filter: {
      param: "actividad_codigo_ciiu",
      type: "text"
    }
  },
  {
    cellParam: "actividad_descripcion_ciiu",
    cellType: "longText",
    columnName: "Actividad CIIU Relacionada",
    filter: {
      param: "actividad_descripcion_ciiu",
      type: "text"
    }
  }
], A = {
  newPropertyName: "id",
  targetItems: ["actividad_id", "actividad_codigo_ciiu"],
  targetIdProperty: "items"
}, k = () => {
  const { setValue: a } = x(), [i, u] = C(), { modalInfo: r, setModal: p } = y(), { index: v } = r.content, c = () => {
    r.type && p(void 0);
  }, _ = () => {
    i && (a(
      `activities.${v}`,
      {
        activityCode: i.actividad_codigo_ciiu || i.actividad_id,
        tarifa: i.actividad_tarifa,
        activityDescription: i.actividad_descripcion_ciiu || i.actividad_decripcion,
        taxableIncome: "",
        taxValue: ""
      },
      {
        shouldValidate: !0
      }
    ), c());
  }, l = (d) => {
    const f = Object.keys(d), n = d[f[0]];
    n && u(n);
  };
  return /* @__PURE__ */ o(s, { children: [
    /* @__PURE__ */ t(e.AlertDialogHeader, { variants: { variant: "govco" }, closeModal: c, children: "Seleccionar Actividad Principal" }),
    /* @__PURE__ */ t("div", { className: "_w-full _h-full _max-w-[90%] _min-h-[400px] _mx-auto", children: /* @__PURE__ */ t(
      g,
      {
        data: [],
        tableConfig: h,
        wrapperClassName: "_min-h-[220px] _max-h-[400px]",
        url: "https://nodejs.softwaretributario.com:7001/actividad_ciiu/findAllActividadesCiu/ICAT/2023",
        pagination: {
          page: "1",
          limit: "10"
        },
        mutateDataConfig: A,
        setItems: l,
        setterDataConfig: {
          setterFn: l,
          targetDataId: "checkedData"
        }
      }
    ) }),
    /* @__PURE__ */ o(e.AlertDialogFooter, { variants: { variant: "govco" }, children: [
      /* @__PURE__ */ t(e.AlertDialogCancel, { asChild: !0, onClick: c, children: /* @__PURE__ */ t(m.Button, { variant: "bordered-error", children: "Cancelar" }) }),
      /* @__PURE__ */ t(e.AlertDialogAction, { asChild: !0, children: /* @__PURE__ */ t(m.Button, { onClick: _, children: "Continue" }) })
    ] })
  ] });
};
export {
  k as default
};
