Selaa lähdekoodia

crud full modal fixes

amenpunk 3 vuotta sitten
vanhempi
commit
9eb9d6868b

+ 31 - 3
psicoadmin/src/Components/Modal/EditPlaza.js

@@ -1,5 +1,6 @@
1 1
 import React from 'react';
2 2
 import { Modal } from 'react-bootstrap'
3
+import NotFound from '../../Images/not_found.png';
3 4
 
4 5
 export default function Edit(props) {
5 6
 
@@ -8,11 +9,38 @@ export default function Edit(props) {
8 9
     return(
9 10
         <Modal size="lg" aria-labelledby="contained-modal-title-vcenter" centered  show={visible} onHide={onClose}>
10 11
             <Modal.Header>
11
-                <button onClick={onClose}  type="button" className="close" data-dismiss="modal">&times;</button>
12
+                <button onClick={onClose} type="button" className="close" data-dismiss="modal">&times;</button>
12 13
                 <h4 className="modal-title">Editar plaza</h4>
13 14
             </Modal.Header>
14
-            <Modal.Body className="modal-body">
15
-                <h1>Editar Plaza </h1>
15
+            <Modal.Body classNameName="modal-body">
16
+
17
+                <div className="row">
18
+                    <div className="col-md-4">
19
+                        <div className="img-container">
20
+                            <img alt='not found version' src={NotFound} />
21
+                        </div>
22
+                    </div>
23
+                    <div className="col-md-8">
24
+                        <div className="custom-file-upload">
25
+                            <input type="file" id="file" name="myfiles[]" multiple disabled />
26
+                        </div>
27
+                    </div>
28
+                </div>
29
+                <div className="data_product">
30
+                    <div className="row">
31
+                        <div className="col-md-12">
32
+                            <input type="text" name="nombre" placeholder="Nombre de la plaza"/>
33
+                            <textarea placeholder="Descripción"></textarea>
34
+                            <input type="number" name="sku" placeholder="3500"/>
35
+                        </div>
36
+                    </div>
37
+                    <div className="add_producto_confirm">
38
+                        <div className="btn_add_producto_confirm">
39
+                            <a href="/" type="submit">Actualizar plaza</a>
40
+                        </div>
41
+                    </div> 
42
+                </div>
43
+
16 44
             </Modal.Body>
17 45
         </Modal>
18 46
     )

+ 22 - 4
psicoadmin/src/Components/Modal/EliminarPlaza.js

@@ -1,5 +1,5 @@
1 1
 import React from 'react';
2
-import { Modal } from 'react-bootstrap'
2
+import { Modal, Row, Col } from 'react-bootstrap'
3 3
 
4 4
 export default function Eliminar(props) {
5 5
 
@@ -8,11 +8,29 @@ export default function Eliminar(props) {
8 8
     return(
9 9
         <Modal size="lg" aria-labelledby="contained-modal-title-vcenter" centered  show={visible} onHide={onClose}>
10 10
             <Modal.Header>
11
-                <button onClick={onClose}  type="button" className="close" data-dismiss="modal">&times;</button>
12
-                <h4 className="modal-title">Eliminar plaza</h4>
11
+                <button onClick={onClose} type="button" class="close" data-dismiss="modal">&times;</button>
12
+                <h4 class="modal-title">¡Atención!</h4>
13 13
             </Modal.Header>
14 14
             <Modal.Body className="modal-body">
15
-                <h1>Eliminar Plaza </h1>
15
+
16
+                <h1 class="alert">¿Estás seguro que deseas eliminar esta plaza?</h1>
17
+                <p class="text-alert">Una vez eliminado no será posible recuperarla</p>
18
+                <Row>
19
+                    <Col md="6">
20
+                        <div class="cancel_producto_confirm">
21
+                            <div class="btn_cancelar">
22
+                                <a href="/" type="submit">Cancelar</a>
23
+                            </div>
24
+                        </div>
25
+                    </Col>
26
+                    <Col md="6">
27
+                        <div class="delet_producto_confirm">
28
+                            <div class="btn_delete_producto_confirm">
29
+                                <a href="/" type="submit">Eliminar</a>
30
+                            </div>
31
+                        </div>
32
+                    </Col>
33
+                </Row>
16 34
             </Modal.Body>
17 35
         </Modal>
18 36
     )

+ 18 - 2
psicoadmin/src/Components/Modal/MostrarPlaza.js

@@ -1,5 +1,6 @@
1 1
 import React from 'react';
2 2
 import { Modal } from 'react-bootstrap'
3
+import NotFound from '../../Images/not_found.png';
3 4
 
4 5
 export default function Mostrar(props) {
5 6
 
@@ -8,11 +9,26 @@ export default function Mostrar(props) {
8 9
     return(
9 10
         <Modal size="lg" aria-labelledby="contained-modal-title-vcenter" centered  show={visible} onHide={onClose}>
10 11
             <Modal.Header>
11
-                <button onClick={onClose}  type="button" className="close" data-dismiss="modal">&times;</button>
12
+                <button  onClick={onClose} type="button" className="close" data-dismiss="modal">&times;</button>
12 13
                 <h4 className="modal-title">Mostrar plaza</h4>
13 14
             </Modal.Header>
14 15
             <Modal.Body className="modal-body">
15
-                <h1>Mostrar Plaza </h1>
16
+
17
+                <div class="data_product">
18
+                    <div class="row">
19
+                        <div class="col-md-4">
20
+                            <div class="img-container">
21
+                                <img alt='not found cooo' src={NotFound}/>
22
+                            </div>
23
+                        </div>
24
+                        <div class="col-md-8">
25
+                            <input type="text" name="nombre" placeholder="Nombre de la plaza" readOnly/>
26
+                            <input type="text" name="descript" placeholder="Descripción" readOnly/>
27
+                            <input type="number" name="sku" placeholder="3500" readOnly/>
28
+                        </div>
29
+                    </div>
30
+                </div>
31
+
16 32
             </Modal.Body>
17 33
         </Modal>
18 34
     )

+ 33 - 9
psicoadmin/src/Pages/Puestos.js

@@ -43,13 +43,7 @@ for ( var _ of new Array(46) ){
43 43
 
44 44
 function ListMode(props) {
45 45
     
46
-    let { setEdit, setDelete, setShow } = props;
47
-
48
-    let actions = [
49
-        <Button onClick={ ()  => setShow(true)} className="ver_producto">Ver</Button>,
50
-        <Button onClick={() => setEdit(true)} className="editar_producto">Editar</Button>,
51
-        <Button onClick={ ()  => setDelete(true) } className="eliminar_producto">Eliminar</Button>,
52
-    ]
46
+    let { setEdit, setDelete, setShow, setPuesto } = props;
53 47
 
54 48
     return(
55 49
         <Col md="12">
@@ -70,10 +64,33 @@ function ListMode(props) {
70 64
                                 data.slice( 0,23 ).map( (plaza, i) => {
71 65
                                     return (
72 66
                                         <tr key={plaza.id}>
73
-                                            <td className="text-center">{ plaza.nombre }</td>
67
+                                            <td className="text-center">{  plaza.id +  " - " + plaza.nombre }</td>
74 68
                                             <td className="text-center">{ plaza.description }</td>
75 69
                                             <td className="text-center">{ plaza.salario }</td>
76
-                                            <td className="actions_butons_plaza"> { actions } </td>
70
+                                            <td className="actions_butons_plaza"> 
71
+                                                <Button 
72
+                                                    onClick={() => {
73
+                                                        setPuesto(plaza) 
74
+                                                        setShow(true)
75
+                                                    }} 
76
+                                                    className="ver_producto">Ver
77
+                                                </Button>
78
+
79
+                                                <Button 
80
+                                                    onClick={() => {
81
+                                                        setPuesto(plaza) 
82
+                                                        setEdit(true)
83
+                                                    }} 
84
+                                                    className="editar_producto">Editar
85
+                                                </Button>
86
+                                                <Button 
87
+                                                    onClick={() => {
88
+                                                        setPuesto(plaza) 
89
+                                                        setDelete(true) 
90
+                                                    }} 
91
+                                                    className="eliminar_producto">Eliminar
92
+                                                </Button>
93
+                                            </td>
77 94
                                         </tr>
78 95
                                     )
79 96
                                 }) : undefined
@@ -172,6 +189,8 @@ export function Puestos() {
172 189
         exclusive: true,
173 190
     };
174 191
 
192
+    let [puesto, setPuesto] = React.useState(false);
193
+
175 194
     let [manual, setManual] = React.useState(false);
176 195
     let [expres, setExpress] = React.useState(false);
177 196
 
@@ -179,6 +198,10 @@ export function Puestos() {
179 198
     let [del, setDelete] = React.useState(false);
180 199
     let [show, setShow] = React.useState(false);
181 200
 
201
+    React.useEffect(() => {
202
+        console.log('puesto >>>', puesto.id)
203
+    }, [puesto])
204
+
182 205
     return (
183 206
         <div className="content-section">
184 207
 
@@ -214,6 +237,7 @@ export function Puestos() {
214 237
                 <div className={`main_list_products ${alignment === 'list' ?  'activar_vista' : 'desactivar_vista'}`} id="list_view_products">
215 238
                     <Row>
216 239
                         <ListMode 
240
+                            setPuesto={setPuesto}
217 241
                             setEdit={setEdit}
218 242
                             setDelete={setDelete}
219 243
                             setShow={setShow}