summaryrefslogtreecommitdiffstats
path: root/data/templates/users/entry.html
blob: b1477c74949450a9a9db663a48c1c9e0e6845735 (plain)
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
<h2>Personal Data</h2>

{{{MESSAGE}}}

<form method="POST" enctype="multipart/form-data" action="#">
	<table class="table table-bordered table-nonfluid user-entry">
		<tr><th>ID</th><td>{{{UID}}}</td></tr>
		<tr>
			<th>Barcode</th>
			<td>
				<canvas id="barcode"></canvas><br>
				<a href="#" onclick="window.open(code39_url());">Download</a>
				<br>
				<a href="https://barcode.tec-it.com/barcode.ashx?translate-esc=off&data=USER%20{{{UID}}}&code=Code39FullASCII&multiplebarcodes=false&unit=Fit&dpi=96&imagetype=png&rotation=0&color=%23000000&bgcolor=%23ffffff&qunit=Mm&quiet=0" target="_blank">Get HighRes Version (external)</a>
			</td>
		</tr>
		<tr><th>Firstname</th><td>{{{FIRSTNAME}}}</td></tr>
		<tr><th>Lastname</th><td>{{{LASTNAME}}}</td></tr>
		<tr><th>E-Mail</th><td>{{{EMAIL}}}</td></tr>
		<tr><th>PGP Key ID</th><td>{{{PGPKEYID}}}</td></tr>
		<tr><th>Gender</th><td>{{{GENDER}}}</td></tr>
		<tr><th>Street</th><td>{{{STREET}}}</td></tr>
		<tr><th>PLZ</th><td>{{{POSTALCODE}}}</td></tr>
		<tr><th>City</th><td>{{{CITY}}}</td></tr>
		<tr><th>RFID</th><td>{{{RFID}}}</td></tr>
		<tr><th colspan="2">Settings</th></tr>
		<tr><th>Sound theme</th>
		<td>
			<form method="POST" enctype="multipart/form-data" action="#">
			<select class="form-control" name="soundTheme">
				<option value="##random">~ random ~</option>
				{{{SOUND_THEMES}}}
			</select>
			<input type="submit" class="btn btn-default" value="Update">
			</form>
			<br>
			<a href="https://github.com/ktt-ol/serial-barcode-scanner/tree/master/sounds/user" target="_blank">See Preview</a>
		</td>
		</tr>
	</table>
</form>
<form method="POST" enctype="multipart/form-data" action="#">
	<table class="table table-bordered table-nonfluid user-entry">
		<tr><th colspan="2">Status Information</th></tr>
		<tr><th>Disabled</th><td>{{{DISABLED}}}</td></tr>
		<tr><th>Hidden</th><td>{{{HIDDEN}}}</td></tr>
		<tr><th colspan="2">Administrative Information</th></tr>
		<tr><th>Superuser</th><td>{{{ISSUPERUSER}}}</td></tr>
		<tr><th>Auth Products</th><td><button id="authproductsbutton" type="button" class="btn {{{BTN_AUTH_PRODUCTS}}}" {{{ISADMIN2}}}>{{{HAS_AUTH_PRODUCTS}}}</button></td></tr>
		<tr><th>Auth Cashbox</th><td><button id="authcashboxbutton" type="button" class="btn {{{BTN_AUTH_CASHBOX}}}" {{{ISADMIN2}}}>{{{HAS_AUTH_CASHBOX}}}</button></td></tr>
		<tr><th>Auth Users</th><td><button id="authusersbutton" type="button" class="btn {{{BTN_AUTH_USERS}}}" {{{ISADMIN2}}}>{{{HAS_AUTH_USERS}}}</button></td></tr>
		<tr><th>Invoices</th><td><a href="./{{{UID}}}/invoice">Show</a></td></tr>
		<tr><th rowspan="3">Password</th><td><input name="password1" placeholder="New Password" type="password" /></td></tr>
		<tr><td><input name="password2" placeholder="New Password (again)" type="password" /></td></tr>
		<tr><td><input type="submit" value="Change Password" /></td></tr>
	</table>
</form>

<script language="JavaScript">
code39_init();
code39_draw("USER {{{UID}}}", true);


$('#authproductsbutton').on('click', function (e) {
	var req = $.getJSON(
		"/users/{{{UID}}}/toggle_auth_products",
		function( data ) {
			if(data["products"] == "false") {
				$('#authproductsbutton').html("No")
				$('#authproductsbutton').addClass("btn-danger")
				$('#authproductsbutton').removeClass("btn-success")
			} else if(data["products"] == "true") {
				$('#authproductsbutton').html("Yes")
				$('#authproductsbutton').addClass("btn-success")
				$('#authproductsbutton').removeClass("btn-danger")
			} else {
				console.error("unknown state")
				console.info(data)
			}
		}
	);
});

$('#authcashboxbutton').on('click', function (e) {
	var req = $.getJSON(
		"/users/{{{UID}}}/toggle_auth_cashbox",
		function( data ) {
			if(data["cashbox"] == "false") {
				$('#authcashboxbutton').html("No")
				$('#authcashboxbutton').addClass("btn-danger")
				$('#authcashboxbutton').removeClass("btn-success")
			} else if(data["cashbox"] == "true") {
				$('#authcashboxbutton').html("Yes")
				$('#authcashboxbutton').addClass("btn-success")
				$('#authcashboxbutton').removeClass("btn-danger")
			} else {
				console.error("unknown state")
				console.info(data)
			}
		}
	);
});

$('#authusersbutton').on('click', function (e) {
	var req = $.getJSON(
		"/users/{{{UID}}}/toggle_auth_users",
		function( data ) {
			if(data["users"] == "false") {
				$('#authusersbutton').html("No")
				$('#authusersbutton').addClass("btn-danger")
				$('#authusersbutton').removeClass("btn-success")
			} else if(data["users"] == "true") {
				$('#authusersbutton').html("Yes")
				$('#authusersbutton').addClass("btn-success")
				$('#authusersbutton').removeClass("btn-danger")
			} else {
				console.error("unknown state")
				console.info(data)
			}
		}
	);
});
</script>