11<!DOCTYPE html>
2- < html lang =" es " xmlns:th =" http://www.thymeleaf.org " >
2+ < html >
33
44< head >
55 < meta charset ="UTF-8 ">
66 < title > Spring - Crud Empleats</ title >
77
8- <!--Libreria Jquery carcada des de CDN-->
9- < script src ="https://code.jquery.com/jquery-3.6.0.min.js "> </ script >
8+ <!-- JQUERY -->
9+ < script src ="https://code.jquery.com/jquery-3.6.0.min.js "
10+ integrity ="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4= " crossorigin ="anonymous "> </ script >
11+
12+ <!-- BOOTSTRAP -->
13+ < link rel ="stylesheet " href ="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css "
14+ integrity ="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T " crossorigin ="anonymous ">
15+
16+ < link rel ="stylesheet " type ="text/css "
17+ href ="index.css ">
18+ </ link >
19+ < script src ="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js "
20+ integrity ="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM "
21+ crossorigin ="anonymous "> </ script >
1022
1123 <!-- Data table -->
12- < script src ="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js "> </ script >
13- < script src ="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js "> </ script >
14- < link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css ">
15- < link rel ="stylesheet " href ="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css ">
16- < script type ="text/javascript ">
17- $ ( document ) . ready ( function ( ) {
18- //Asegurate que el id que le diste a la tabla sea igual al texto despues del simbolo #
19- $ ( '#employeeTable' ) . DataTable ( ) ;
20- } ) ;
24+ < script src ="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js "> </ script >
25+ < script src ="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js "> </ script >
26+ < link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css ">
27+ < link rel ="stylesheet " href ="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css ">
28+
29+ <!-- Convertir table en Data table -->
30+ < script type ="text/javascript ">
31+ $ ( document ) . ready ( function ( ) {
32+ //Asegurate que el id que le diste a la tabla sea igual al texto despues del simbolo #
33+ $ ( '#employeeTable' ) . DataTable ( ) ;
34+ } ) ;
2135 </ script >
2236</ head >
2337
2438< body >
25- < div class ="container "> </ div >
26- < div >
27- < H4 > Empleats</ H4 > < button type ="submit "> Nou Empleat</ button >
28- </ div >
29- < div >
30- < table id ="employeeTable " border ="1 ">
31- < thead >
32- < tr >
33- < th > #</ th >
34- < th > Nom</ th >
35- < th > Càrreg</ th >
36- < th > Salari</ th >
37- < th > Accions</ th >
38- </ tr >
39- </ thead >
40- < tbody > </ tbody >
41- </ table >
42- </ div >
43- < div class ="container "> </ div >
44- < div >
45- < H4 > Crear Empleat</ H4 >
46- </ div >
47- < div >
48- < div class ="container ">
49- < div > </ div >
50- < form id ="EmployeeForm ">
51- < div >
52- < input type ="text " id ="idEmployee " hidden ="true ">
39+ < div class ="container ">
40+ < div class ="main-section ">
41+ < div class ="col-sm-12 ">
42+ < div class ="row Header ">
43+ < div class ="col-sm-10 ">
44+ < H4 class ="headertitle "> CRUD Empleats</ H4 >
45+ < h6 > Exercici realitzat utilitzant: Spring Api Rest, Javascript, jquery i Bootstrap.</ h6 >
46+ </ div >
47+ < div class ="col-sm-2 my-auto ">
48+ < button type ="button " class ="btn btn-light add " data-toggle ="modal " data-target ="#modal " onclick ="newEmplyee(); ">
49+ Nou Empleat</ button >
50+ </ div >
5351 </ div >
54- < div >
55- Nom: < input type ="text " id ="name ">
52+ < div class ="col-sm-12 tableBody ">
53+ < table id ="employeeTable " class ="table table-bordered table-hover table-striped ">
54+ < thead >
55+ < tr >
56+ < th style ="width:5% "> #</ th >
57+ < th style ="width:25% "> Nom</ th >
58+ < th style ="width:25% "> Càrreg</ th >
59+ < th style ="width:25% "> Salari</ th >
60+ < th style ="width:20% "> Accions</ th >
61+ </ tr >
62+ </ thead >
63+ < tbody >
64+ < td > id </ td >
65+ < td > employee.name </ td >
66+ < td > employee.job </ td >
67+ < td > employee.salary </ td >
68+ < td >
69+ < button type ='button ' class ="btn btn-light " data-toggle ="modal " data-target ="#modal " onclick ='editEmployee(" + employee.id + ") '> Modificar</ button >
70+ < button type ='button ' class ="btn btn-danger " onclick ='deleteEmployee(" + employee.id + ") '> Eliminar</ button >
71+ </ td >
72+ </ tbody >
73+ </ table >
5674 </ div >
57- < div >
58- Càrreg:
59- < select id ="job ">
60- < option value ="Default "> Escull un càrreg</ option >
61- < option value ="Director_Projectes "> Director de projectes</ option >
62- < option value ="Programador_Senior "> Programador Senior</ option >
63- < option value ="Programador_Mid "> Programador Mid-Level</ option >
64- < option value ="Programador_Junior "> Programador Junior</ option >
65- < option value ="Administratiu "> Administratiu</ option >
66- </ select >
75+ </ div >
76+ </ div >
77+ </ div >
78+
79+ <!-- Modal -->
80+ < div class ="modal fade " id ="modal " tabindex ="-1 " role ="dialog " aria-labelledby ="#modaltitle " aria-hidden ="true ">
81+ < div class ="modal-dialog modal-dialog-centered " role ="document ">
82+ < div class ="modal-content ">
83+ < div class ="modal-header Header ">
84+ < h5 class ="modal-title " id ="modaltitle "> < span id =formType > Afegir nou</ span > empleat
85+ </ h5 >
86+ < button type ="button " class ="close " data-dismiss ="modal " aria-label ="Close ">
87+ < span aria-hidden ="true "> ×</ span >
88+ </ button >
89+ </ div >
90+ < div class ="modal-body ">
91+ < form id ="EmployeeForm ">
92+ < div >
93+ < input type ="text " id ="idEmployee " hidden ="true ">
94+ </ div >
95+ < div class ="input-group mt-3 mb-3 ">
96+ < div class ="input-group-prepend w-25 ">
97+ < span class ="input-group-text w-100 "> Nom</ span >
98+ </ div >
99+ < input class ="form-control " type ="text " id ="name " placeholder ="Indrodueix el nom de l'empleat. ">
100+ </ div >
101+
102+ < div >
103+ < input type ="text " id ="idEmployee " hidden ="true ">
104+ </ div >
105+ < div class ="input-group mb-3 ">
106+ < div class ="input-group-prepend w-25 ">
107+ < span class ="input-group-text w-100 " > Càrreg</ span >
108+ </ div >
109+ < select class ="form-control " id ="job ">
110+ < option value ="Default "> Escull un càrreg</ option >
111+ < option value ="Director_Projectes "> Director de projectes</ option >
112+ < option value ="Programador_Senior "> Programador Senior</ option >
113+ < option value ="Programador_Mid "> Programador Mid-Level</ option >
114+ < option value ="Programador_Junior "> Programador Junior</ option >
115+ < option value ="Administratiu "> Administratiu</ option >
116+ </ select >
117+ </ div >
118+ </ form >
67119 </ div >
68- < div >
69- < br > < br >
70- < input type ="submit " value ="Afegir " id ="action " onclick =" sendEmployee(); " >
71- < button type =" reset " > Cancel·lar </ button >
120+ < div class =" modal-footer " >
121+ < button type =" reset " class =" btn btn-secondary cancel " > Cancel·lar </ button >
122+ < input type ="submit " class =" btn btn-info save " value ="Afegir " id ="action "
123+ onclick =" sendEmployee(); " >
72124 </ div >
73- </ form >
125+ </ div >
74126 </ div >
75127 </ div >
128+
76129 < script type ="text/javascript " src ="index.js "> </ script >
130+
77131</ body >
78132
79133</ html >
0 commit comments