Pārlūkot izejas kodu

Excel municipios

ElPoteito 9 mēneši atpakaļ
vecāks
revīzija
110b3fa705

+ 3 - 3
src/components/layouts/SimpleTableLayout.jsx

@@ -29,7 +29,7 @@ const SimpleTableLayout = ({
     <>
       {Boolean(onSearch) && !Boolean(customRender) && (
         <div style={styles.container}>
-          <Row gutter={10}>
+          <Row gutter={10} justify={'space-between'}>
             {titulo && (<Col span={24}>{titulo}</Col>)}
             <Col
               xs={24}
@@ -37,7 +37,7 @@ const SimpleTableLayout = ({
               md={11}
               lg={7}
               xxl={7}
-              style={styles.inputSearch}
+              style={{...styles.inputSearch, border: '1px solid red'}}
             >
               <Input.Search
                 enterButton
@@ -46,7 +46,7 @@ const SimpleTableLayout = ({
               />
             </Col>
             {Boolean(btnGroup) && (
-              <Col xs={24} sm={24} md={13} lg={17} xxl={17}>
+              <Col xs={24} sm={24} md={13} lg={17} xxl={17} style={{ border: '1px solid red'}}>
                 <ButtonGroup data={btnGroup} />
               </Col>
             )}

+ 50 - 20
src/views/catalogos/municipios/Formulario.jsx

@@ -10,6 +10,7 @@ import PropTypes from 'prop-types'
 const Formulario = ({
   form,
   onFinish,
+  botones = []
 }) => {
   return (
     <Form
@@ -21,28 +22,57 @@ const Formulario = ({
       onFinishFailed={() => { }}
     >
       <Row gutter={16}>
-        <Col span={6}>
-
-
-          <Form.Item
-            label="Búsqueda"
-            name="q"
-          >
-            <Input />
-          </Form.Item>
+        <Col span={12}>
+          <Row gutter={10}>
+            <Col span={12}>
+              <Form.Item
+                // label="Búsqueda"
+                name="q"
+              >
+                <Input />
+              </Form.Item>
+            </Col>
+            <Col span={4}>
+              <Form.Item>
+                <Button
+                  type="primary"
+                  htmlType="submit"
+                  // style={{ marginTop: "30px" }}
+                  block
+                >
+                  Buscar
+                </Button>
+              </Form.Item>
+            </Col>
+          </Row>
         </Col>
-        <Col span={6}>
-          <Form.Item>
-            <Button
-              type="primary"
-              htmlType="submit"
-              style={{ marginTop: "30px" }}
-            >
-              Buscar
-            </Button>
-          </Form.Item>
+        <Col span={12}>
+          <Row gutter={10} justify={'end'}>
+            {botones.map((i, index) => (
+              <Col>
+                {
+                  Boolean(i?.text) ? (
+                    <Button
+                      key={`btnGroup-${index}`}
+                      onClick={i.onClick}
+                      {...i.props}
+                    >
+                      {i.icon} {i.text}
+                    </Button>
+                  ) : (
+                    <Button
+                      key={`btnGroup-${index}`}
+                      onClick={i.onClick}
+                      icon={i.icon}
+                      {...i.props}
+                    />
+                  )
+                }
+              </Col>
+            ))}
+          </Row>
         </Col>
-      </Row>  
+      </Row>
     </Form>
   )
 }

+ 17 - 11
src/views/catalogos/municipios/Municipios.jsx

@@ -1,10 +1,10 @@
 import { useRef, useState } from "react";
 import { Form, Modal, Tooltip, notification } from "antd";
-import { DeleteOutlined, PlusOutlined } from "@ant-design/icons";
+import { DeleteOutlined, FileExcelOutlined, PlusOutlined } from "@ant-design/icons";
 import { Tabla } from "../../../components";
 import { SimpleTableLayout } from "../../../components/layouts";
 import { ActionsButton } from "../../../components";
-import { isEllipsis, eliminarRegistro } from "../../../utilities";
+import { isEllipsis, eliminarRegistro, openInNewTab } from "../../../utilities";
 import { Link, useNavigate } from "react-router-dom";
 import Formulario from "./Formulario";
 
@@ -25,7 +25,7 @@ const Municipios = () => {
       q: q ?? "",
       padre: true,
     };
-    setBuscarParams(params);    
+    setBuscarParams(params);
   };
 
   const botones = [
@@ -35,6 +35,12 @@ const Municipios = () => {
       text: "Nuevo",
       icon: <PlusOutlined />,
     },
+    {
+      onClick: () => openInNewTab('/excel/municipio'),
+      props: { disabled: false, block: false },
+      text: "Excel",
+      icon: <FileExcelOutlined />,
+    },
   ];
 
   const linkText = (value, row, key) => (
@@ -87,21 +93,21 @@ const Municipios = () => {
     {
       title: "Estado",
       key: "estado",
-      dataIndex: ["estado", "nombre"], 
+      dataIndex: ["estado", "nombre"],
       render: (value) => value,
     },
   ];
 
   return (
     <SimpleTableLayout
-      btnGroup={{
-        btnGroup: botones,
-      }}
+      customRender={
+        <Formulario
+          form={form}
+          onFinish={onFinish}
+          botones={botones}
+        />
+      }
     >
-      <Formulario
-        form={form}
-        onFinish={onFinish} 
-      />
       <Tabla
         columns={columns}
         nameURL={endPoint}