-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
236 lines (227 loc) · 9 KB
/
Copy pathindex.html
File metadata and controls
236 lines (227 loc) · 9 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Obiadożercy</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="js/lib/angular.min.js"></script>
<script src="js/app.js"></script>
<style>
label, form {
display: block;
width: 100%;
}
table table tr:first-child td {
border: none;
padding-top: 0;
}
table table tr td:first-child {
padding-left: 0;
width: 25%;
}
table table tr td:nth-first-child(2) {
width: 40;
}
table table tr td:last-child {
padding-right: 0;
text-align: right;
width: 15%;
}
table table tr td:nth-last-child(2) {
width: 20%;
}
em {
color: red;
}
.btn-margin-top {
margin-top: 26px;
}
.form-invalid-info {
display: none;
color: red;
}
form.ng-invalid .form-invalid-info {
display: block;
}
.payment-status {
text-decoration: line-through;
}
</style>
</head>
<body>
<div class="container-fluid" ng-app="app">
<br>
<h1>
Obiadożercy
</h1>
<nav class="nav flex-column">
<a href="#payments" title="Płatności" class="nav-link">Płatności</a>
<a href="#users" title="Użytkownicy" class="nav-link">Użytkownicy</a>
</nav>
<div ng-controller="BaseController">
<table id="payments" class="table table-main">
<thead>
<tr>
<th>#</th>
<th>Kiedy?</th>
<th>Akcje</th>
<th>Skąd?</th>
<th>Kto płacił?</th>
<th>Kto jest winien komu, za co i ile?</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in orders">
<td>
{{ $index + 1 }}
</td>
<td>
{{ order.date_time }}
</td>
<td>
<button type="button" class="btn btn-sm btn-danger" ng-click="removeOrder(order.id)">
Usuń
</button>
</td>
<td>
{{ order.order_from }}
</td>
<td>
{{ getUserById(order.user_id) }}
</td>
<td>
<table class="table">
<tr ng-repeat="payment in order.payments" ng-class="getPaymentCssClass(payment.status)">
<td>{{ getUserById(payment.user_id) }}</td>
<td>{{ payment.what }}</td>
<td>{{ payment.cost }} zł</td>
<td>
<input
type="checkbox"
ng-true-value="1"
ng-false-value="0"
ng-model="payment.status"
ng-change="updatePayment(payment)">
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<form name="orderForm" ng-submit="addOrder(orderForm)" class="row">
<div class="col-md-12">
<div class="form-invalid-info btn-margin-top">
Uzupełnij wszystkie pola po lewej i po prawej stronie!
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>
Kiedy?<em>*</em>
<input type="date" name="date_time" ng-model="newOrder.date_time" required class="form-control">
</label>
</div>
<div class="form-group">
<label>
Skąd?<em>*</em>
<input type="text" name="order_from" ng-model="newOrder.order_from" required class="form-control">
</label>
</div>
<div class="form-group">
<label>
Kto płacił?<em>*</em>
<select ng-model="newOrder.user_id" required
ng-options="user.id as user.name for user in users track by user.id"
class="form-control">
<option value>Użytkownik</option>
</select>
</label>
</div>
<div class="form-group">
<h3>Podgląd dłużników</h3>
<ul>
<li ng-repeat="paymentPreview in newOrder.payments" class="btn-margin-top">
{{ getUserById(paymentPreview.user_id) }}: {{ paymentPreview.cost }} zł
<button type="button" ng-click="deleteTempPayment($index)" class="btn btn-sm btn-danger">Usuń</button>
</li>
</ul>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>
Kto wisi kasę?
<select ng-model="newPayment.user_id"
ng-options="user.id as user.name for user in users track by user.id"
class="form-control">
<option value>Użytkownik</option>
</select>
</label>
</div>
<div class="form-group">
<label>
Za co?
<input type="text" ng-model="newPayment.what" class="form-control">
</label>
</div>
<div class="form-group">
<label>
Ile?
<input type="number" ng-model="newPayment.cost" class="form-control">
</label>
</div>
<div class="form-group">
<button type="button" ng-click="addPayment()" class="btn btn-success btn-margin-top">
Dodaj dłużnika-nikczemnika & kolejny
</button>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-margin-top">
Dodaj zamówienie
</button>
</div>
</div>
</form>
<div id="users" class="row">
<div class="col-md-12">
<h3>Użytkownicy</h3>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Nazwa</th>
<th>Konto</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in users">
<td>
{{ $index + 1 }}
</td>
<td>
{{ user.name }}
</td>
<td>
{{ user.account }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br><br>
<footer>
Created by
<a href="mailto:antonowicz.bartosz@gmail.com" title="Bartosz Antonowicz">
Bartosz Antonowicz
</a>
</footer>
</div>
</div>
</body>
</html>