Преглед изворни кода

[ADD] puestos full view page

amenpunk пре 3 година
родитељ
комит
13c7e7266b
2 измењених фајлова са 109 додато и 17 уклоњено
  1. 20 0
      psicoadmin/src/Components/Modal.js
  2. 89 17
      psicoadmin/src/Pages/Puestos.js

+ 20 - 0
psicoadmin/src/Components/Modal.js

@@ -0,0 +1,20 @@
1
+import { Modal } from 'react-bootstrap';
2
+
3
+export default function MyModal (props) {
4
+    let { Head, Body, visible, onClose } = props
5
+    return(
6
+        <Modal 
7
+            size="lg" 
8
+            aria-labelledby="contained-modal-title-vcenter" 
9
+            centered  
10
+            show={visible} 
11
+            onHide={onClose}>
12
+            <Modal.Header>
13
+                <Head/>
14
+            </Modal.Header>
15
+            <Modal.Body>
16
+                <Body/>
17
+            </Modal.Body>
18
+        </Modal>
19
+    )
20
+}

+ 89 - 17
psicoadmin/src/Pages/Puestos.js

@@ -1,5 +1,5 @@
1 1
 import * as React from 'react';
2
-import { Row, Col } from 'react-bootstrap'
2
+import { Row, Col, Modal } from 'react-bootstrap'
3 3
 
4 4
 import Box from '@mui/material/Box';
5 5
 import ToggleButton from '@mui/material/ToggleButton';
@@ -49,9 +49,9 @@ function ListMode() {
49 49
 
50 50
                         {
51 51
                             data.length ? 
52
-                                data.map( plaza => {
52
+                                data.map( (plaza, i) => {
53 53
                                     return (
54
-                                        <tr>
54
+                                        <tr key={i}>
55 55
                                             <td>{ plaza.nombre }</td>
56 56
                                             <td>{ plaza.description }</td>
57 57
                                             <td>{ plaza.salario }</td>
@@ -81,17 +81,17 @@ function GridMode () {
81 81
 
82 82
     let buttons = [
83 83
         <div className="botones_interactivos">
84
-            <a href="#" tooltip-location="top" tooltip-animate tooltip="Ver plaza" data-toggle="modal" data-target="#verProducto">
84
+            <a href="#" tooltip-location="top" tooltip="Ver plaza" data-toggle="modal" data-target="#verProducto">
85 85
                 <RemoveRedEyeIcon className="grid_btn"/>
86 86
             </a>
87 87
         </div>,
88 88
         <div className="botones_interactivos">
89
-            <a href="#" tooltip-location="top" tooltip-animate tooltip="Editar plaza" data-toggle="modal" data-target="#editarProducto">
89
+            <a href="#" tooltip-location="top" tooltip="Editar plaza" data-toggle="modal" data-target="#editarProducto">
90 90
                 <EditIcon className="grid_btn"/>
91 91
             </a>
92 92
         </div>,
93 93
         <div className="botones_interactivos">
94
-            <a href="#" tooltip-location="top" tooltip-animate tooltip="Eliminar plaza" data-toggle="modal" data-target="#deleteProducto">
94
+            <a href="#" tooltip-location="top" tooltip="Eliminar plaza" data-toggle="modal" data-target="#deleteProducto">
95 95
                 <HighlightOffIcon className="grid_btn"/>
96 96
             </a>
97 97
         </div>
@@ -101,10 +101,9 @@ function GridMode () {
101 101
         <React.Fragment> 
102 102
             {
103 103
                 data.length ? 
104
-                data.map( plaza => {
105
-
104
+                data.map( ( plaza, i ) => {
106 105
                     return(
107
-                        <Col md="3">
106
+                        <Col key={i} md="3">
108 107
                             <div className="panel">
109 108
                                 <Row>
110 109
                                     <Col md="4">
@@ -130,9 +129,78 @@ function GridMode () {
130 129
     )
131 130
 }
132 131
 
132
+function Manual ( props ) {
133
+
134
+    let { visible, onClose } = props
135
+
136
+    return (
137
+        <Modal size="lg" aria-labelledby="contained-modal-title-vcenter" centered  show={visible} onHide={onClose}>
138
+            <Modal.Header>
139
+                <button onClick={onClose}  type="button" className="close" data-dismiss="modal">&times;</button>
140
+                <h4 className="modal-title">Agregar plaza</h4>
141
+            </Modal.Header>
142
+            <Modal.Body className="modal-body">
143
+                <Row>
144
+                    <Col md="4">
145
+                        <div className="img-container">
146
+                            <img src="images/not_found.png"/>
147
+                        </div>
148
+                    </Col>
149
+                    <Col md="8">
150
+                        <div className="custom-file-upload">
151
+                            <input type="file" id="file" name="myfiles[]" multiple />
152
+                        </div>
153
+                    </Col>
154
+                </Row>
155
+                <div className="data_product">
156
+                    <Row>
157
+                        <Col md="12">
158
+                            <input type="text" name="nombre" placeholder="Nombre de la plaza"/>
159
+                            <textarea placeholder="Descripción general de la plaza"></textarea>
160
+                            <input type="number" name="salario" placeholder="Salario"/>
161
+                        </Col>
162
+                        <div className="add_producto_confirm">
163
+                            <div className="btn_add_producto_confirm">
164
+                                <a href="#" type="submit">Agregar plaza</a>
165
+                            </div>
166
+                        </div>
167
+                    </Row>
168
+                </div>
169
+            </Modal.Body>
170
+        </Modal>
171
+    )
172
+}
173
+
174
+function Express (props) {
175
+    let { visible, onClose } = props
176
+    return (
177
+        <Modal size="lg" aria-labelledby="contained-modal-title-vcenter" centered  show={visible} onHide={onClose}>
178
+            <Modal.Header>
179
+                <button onClick={onClose} type="button" className="close" data-dismiss="modal">&times;</button>
180
+                <h4 className="modal-title">Agregar plaza express</h4>
181
+            </Modal.Header>
182
+            <Modal.Body>
183
+                <div className="data_product">
184
+                    <div className="row">
185
+                        <div className="col-md-12">
186
+                            <input type="link" name="link" placeholder="Link de la plaza"/>
187
+                        </div>
188
+                        <div className="add_producto_confirm">
189
+                            <div className="btn_add_producto_confirm">
190
+                                <a href="#" type="submit">Agregar plaza</a>
191
+                            </div>
192
+                        </div>
193
+                    </div>
194
+                </div>
195
+            </Modal.Body>
196
+        </Modal>
197
+    )
198
+}
199
+
200
+
133 201
 export function Puestos() {
134 202
 
135
-    const [alignment, setAlignment] = React.useState('left');
203
+    const [alignment, setAlignment] = React.useState('list');
136 204
 
137 205
     const handleChange = (event, newAlignment) => setAlignment(newAlignment);
138 206
 
@@ -151,6 +219,12 @@ export function Puestos() {
151 219
         exclusive: true,
152 220
     };
153 221
 
222
+
223
+    let [manual, setManual] = React.useState(false);
224
+    let [expres, setExpress] = React.useState(false);
225
+
226
+    const showExpress = () => setExpress(true)
227
+
154 228
     return (
155 229
         <div className="content-section">
156 230
             <div className="main">
@@ -166,14 +240,10 @@ export function Puestos() {
166 240
                     </Col>
167 241
                     <Col md="6">
168 242
                         <div className="add_producto">
169
-                            <div className="btn_add_producto">
170
-                                <a href="#" data-toggle="modal" data-target="#addProducto">Agregar manual</a>
171
-                            </div>
243
+                            <div onClick={() => {console.log('show manual') ; setManual(true) }} className="btn_add_producto"> <a>Agregar manual</a> </div>
172 244
                         </div>
173
-                        <div className="add_producto">
174
-                            <div className="btn_add_producto">
175
-                                <a href="#" data-toggle="modal" data-target="#addProductoExpress">Agregar express</a>
176
-                            </div>
245
+                        <div onClick={showExpress} className="add_producto">
246
+                            <div className="btn_add_producto"> <a>Agregar express</a> </div>
177 247
                         </div>
178 248
                     </Col>
179 249
                 </Row>
@@ -188,6 +258,8 @@ export function Puestos() {
188 258
                     </Row>
189 259
                 </div>
190 260
             </div>
261
+            <Express visible={expres} onClose={ () => setExpress(false) } />
262
+            <Manual visible={manual}  onClose={ () => setManual(false) } />
191 263
         </div>
192 264
     )
193 265
 }