-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
124 lines (108 loc) · 4.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!doctype html>
<html lang="es">
<head>
<title>TODO - Project Manager</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta charset="UTF-8">
<meta name="theme-color" content="#000">
<meta http-equiv="Cache-control" content="public">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/fa-all.css">
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/custom.js"></script>
<script src="js/update.js"></script>
</head>
<body class="bg-light my-2">
<div class="container">
<div class="row justify-content-center">
<div class="col-12 col-md-6 text-center mb-3">
<img src="logo.png" class="logo-app">
</div>
<div class="col-12 col-md-6">
<div class="card shadow-sm border-0">
<a class="btn btn-white text-dark btn-collapse-formagregar" data-bs-toggle="collapse" href="#collapseExample"
role="button" aria-expanded="false" aria-controls="collapseExample">
Añadir nuevo proyecto <i class="float-end pt-1 fa fa-plus"></i>
</a>
<div class="collapse" id="collapseExample">
<div class="card-body">
<form id="nuevo">
<input type="Titulo" class="form-control input-titulos" placeholder="Título del proyecto*" required>
<div class="row">
<div class="col-6"> Desde
<input type="date" class="form-control input-desde">
</div>
<div class="col-6"> Hasta
<input type="date" class="form-control input-hasta">
</div>
<div class="col-12">
<div id="agregar_itemlista" class="small text-secondary my-2"><i class="fas fa-tasks"></i> Agregar
item</div>
<div id="mostrar_itemlista">
</div>
</div>
</div>
<div class="d-grid gap-2">
<button id="btn_agregar" class="btn btn-primary mt-5 mb-3 border-0 btn-block fw-bold">Añadir</button>
</div>
</form>
</div>
</div>
</div>
<h6 class="mt-3">PROYECTOS</h6>
<div id="lista-proyectos" class="mb-3"></div>
</div>
</div>
</div>
<div id="template-lista" style="display: none;">
<div class="card card-body shadow-sm border-0 mb-2 item-proyecto">
<div class="row">
<div class="col-9">
<h6 id="titulo" data-bs-toggle="collapse" role="button" aria-expanded="false"></h6>
</div>
<div class="col-3 text-end">
<span class="item-porcentaje text-primary">90%</span> <span class="item-borrar"><i
class="fas fa-trash-alt text-danger"></i></span>
</div>
<div class="detalles control-group"></div>
</div>
</div>
</div>
<script>
getProjects();
document.getElementById('nuevo').addEventListener('submit', function (e) {
e.preventDefault();
var input_titulo = document.querySelector('.input-titulos').value;
if (input_titulo.trim().lenght == 0) {
} else {
var inputs_itemlista = document.querySelectorAll('input[name="lista[]"]'),
itemlista = []
for (var i = 0; i < inputs_itemlista.length; i++) {
itemlista.push({ "title": inputs_itemlista[i].value, "estado": 0 })
}
var inputs = {
id: Date.now(),
titulo: document.querySelector('.input-titulos').value,
desde: document.querySelector('.input-desde').value,
hasta: document.querySelector('.input-hasta').value,
lista: itemlista
}
mostrar_itemlista.innerHTML = '';
//console.log(JSON.stringify(inputs))
createProject(inputs);
getProjects()
}
})
document.querySelector('#nuevo #agregar_itemlista').addEventListener('click', function (e) {
const div_lista = document.getElementById('mostrar_itemlista');
var container = document.createElement("div");
container.innerHTML += '<div style="display:flex;" id="itemlista_' + Date.now() + '"><input type="text" class="form-control" name="lista[]" placeholder="Descripción de tarea"><i class="fas fa-trash-alt p-3 text-secondary pointer" data-toggle="tooltip" title="Quitar" onclick="eliminarItemlista(' + Date.now() + ')"></i></div>';
div_lista.appendChild(container);
})
</script>
</body>
</html>
</body>
</html>