Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 376 | Revision 380 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
{extends file="index.tpl"}
2
{block name="maincontent"}
3
    <script type="text/javascript">
4
        $(function () {
370 lars 5
            $('#dataTableBackendUsers').dataTable({
6
                "lengthMenu": [[100, -1], [100, "Alle"]],
7
                "language": {
8
                    "url": "/js/DataTables-1.10.19/German.json"
9
                }
10
            });
2 lars 11
            $('button,input:submit,input:button,input:reset,#getnewPWD,#shownewPWD ').button();
12
            $('.locked').uibutton({
13
                "icons": {
14
                    "primary": "ui-icon-locked"
15
                }
16
            }).click(deactivate2fa);
17
            $('.unlocked').uibutton({
18
                "icons": {
19
                    "primary": "ui-icon-unlocked"
20
                }
21
            });
22
 
23
            $('#en2fa').click(activate2fa)
372 lars 24
            $('#editDlg').dialog({
25
                autoOpen:false,
26
                modal:true,
27
                resizable:false,
28
                width:900,
29
                height:400,
30
                buttons:[
31
                    {
32
                        text:"Speichern",
33
                        icon:"ui-icon-check",
34
                        click:function (){
35
                            let url="/bestellwesen/suppliers";
36
                            if($("#ID").val())
37
                            {
38
                                url+="/"+$("#ID").val()
39
                            }
40
                            /*$.post(url,$('#supplierForm').serializeArray(),function(){
41
                                $('#editDlg').dialog("close")
42
                                location.reload()
43
                            });*/
44
                            $.ajax({
45
                                type:"post",
46
                                url:url,
47
                                data:$('#supplierForm').serializeArray(),
48
                                dataType: 'json',
49
                                success:function ()
50
                                {
51
                                    $('#editDlg').dialog("close");
52
                                    location.reload();
53
                                },
54
                                error:function (response)
55
                                {
56
                                    $('#supplierError').html(response.responseJSON.message);
57
                                    let errors = response.responseJSON.errors
58
                                    if(errors.name)
59
                                    {
60
                                        $('#supplierNameError').html(errors.name)
61
                                    }
62
                                    if(errors.rank)
63
                                    {
64
                                        $('#supplierRankError').html(errors.rank)
65
                                    }
66
                                }
67
                            })
68
                        }
69
                    },
70
                    {
71
                        text:"Abbrechen",
72
                        icon:"ui-icon-cancel",
73
                        click:function (){
74
                            $('#editDlg').dialog("close");
75
                        }
76
                    }
77
                ]
78
            })
79
            $('#delDlg').dialog({
80
                autoOpen:false,
81
                modal:true,
82
                resizable:false,
83
                width:800,
84
                buttons:[
85
                    {
86
                        text:"Löschen",
87
                        icon:"ui-icon-trash",
88
                        click:function (){
373 lars 89
                            let url="/backend_users/"+$("#mId").html();
90
                            $.post(url,$('#userDelForm').serializeArray(),function(){
372 lars 91
                                $('#delDlg').dialog("close")
92
                                location.reload()
93
                            });
94
                        }
95
                    },
96
                    {
97
                        text:"Abbrechen",
98
                        icon:"ui-icon-cancel",
99
                        click:function (){
100
                            $('#delDlg').dialog("close");
101
                        }
102
                    }
103
                ]
104
            })
105
            $("#new").uibutton({
106
                icons:{
107
                    primary:"ui-icon-plus"
108
                }
109
            }).click(function()
110
            {
373 lars 111
                let url="/backend_users/create/";
372 lars 112
                $('#editDlg').load(url).dialog("open");
113
            });
114
            $(".edit").uibutton({
115
                icons:{
116
                    primary:"ui-icon-pencil"
117
                }
118
            }).click(function() {
373 lars 119
                let url="/backend_users/"+$(this).attr("data-id")+"/edit/";
372 lars 120
                $('#editDlg').load(url).dialog("open");
121
            });
122
            $(".del").uibutton({
123
                icons:{
124
                    primary:"ui-icon-trash"
125
                }
126
            }).click(function() {
127
                let mId=$(this).attr("data-id");
373 lars 128
                $.get("/backend_users/"+mId,function(name) {
129
                    $('#userName').html(name);
130
                    $('#uId').html(mId);
372 lars 131
                    $('#delDlg').dialog("open");
132
                })
133
            })
134
 
2 lars 135
        })
136
 
137
        function deactivate2fa() {
138
            let uId = $(this).attr("data-id");
139
            $.get("/toolbox/ga.php?mode=disable&id=" + uId, function () {
140
                document.location.reload();
141
            });
142
        }
143
 
144
        function activate2fa() {
145
            let uId = $(this).attr("data-id");
146
            document.location.href = "/toolbox/ga.php";
147
        }
148
 
149
        function randomPassword() {
150
            //$('#pwd').load("/generate_pwd.php");
151
            $.get("/generate_pwd.php", function (pwd) {
152
                $('#pwd').val(pwd);
153
                $('#pwdcheck').val($('#pwd').val());
154
            })
155
        }
156
 
157
        function deleteusersession() {
158
            $.get("../admin_user.php?action=delete_user_session&ID={$smarty.get.ID}", function (deletesessionuser) {
159
                alert(deletesessionuser);
160
            })
161
        }
162
 
163
        function showpass() {
164
            var x = document.getElementById("pwd");
165
            if (x.type === "password") {
166
                x.type = "text";
167
            } else {
168
                x.type = "password";
169
            }
170
        }
171
 
172
        function MM_swapImgRestore() { //v3.0
173
            var i, x, a = document.MM_sr;
174
            for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
175
        }
176
 
177
        function MM_preloadImages() { //v3.0
178
            var d = document;
179
            if (d.images) {
180
                if (!d.MM_p) d.MM_p = new Array();
181
                var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
182
                for (i = 0; i < a.length; i++) {
183
                    if (a[i].indexOf("#") != 0) {
184
                        d.MM_p[j] = new Image;
185
                        d.MM_p[j++].src = a[i];
186
                    }
187
                }
188
            }
189
        }
190
 
191
        function MM_swapImage() { //v3.0
192
            var i, j = 0, x, a = MM_swapImage.arguments;
193
            document.MM_sr = new Array;
194
            for (i = 0; i < (a.length - 2); i += 3) {
195
                if ((x = MM_findObj(a[i])) != null) {
196
                    document.MM_sr[j++] = x;
197
                    if (!x.oSrc) {
198
                        x.oSrc = x.src;
199
                    }
200
                    x.src = a[i + 2];
201
                }
202
            }
203
        }
204
 
205
        function MM_findObj(n, d) { //v4.01
206
            var p, i, x;
207
            if (!d) {
208
                d = document;
209
            }
210
            if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
211
                d = parent.frames[n.substring(p + 1)].document;
212
                n = n.substring(0, p);
213
            }
214
            if (!(x = d[n]) && d.all) {
215
                x = d.all[n];
216
            }
217
            for (i = 0; !x && i < d.forms.length; i++) {
218
                x = d.forms[i][n];
219
            }
220
            for (i = 0; !x && d.layers && i < d.layers.length; i++) {
221
                x = MM_findObj(n, d.layers[i].document);
222
            }
223
            if (!x && d.getElementById) {
224
                x = d.getElementById(n);
225
            }
226
            return x;
227
        }
228
    </script>
229
    <style type="text/css">
230
        #pwd {
231
            margin: auto;
232
        }
233
 
234
        i#hovereffekt {
235
            position: relative;
236
            z-index: 1;
237
        }
238
 
239
        i#hovereffekt:hover {
240
            z-index: 2;
241
        }
242
 
243
        i#hovereffekt p {
244
            display: none;
245
        }
246
 
247
        i#hovereffekt:hover p {
248
            display: block;
249
            position: absolute;
250
            top: 3em;
251
            left: 3em;
252
            width: 300px;
253
            border-style: solid;
254
            border-width: 1px;
255
            padding: 5px;
256
            font-size: 15px;
257
        }
258
 
259
        a:link {
260
            color: #000 !important;
261
        }
262
 
263
        span {
264
            text-decoration: none !important;
265
            color: unset;
266
        }
267
 
268
        .error {
269
            font-size: 50px;
270
            color: red;
271
            text-align: center;
272
        }
273
 
274
        .zuweisungTable {
275
            width: 100%;
276
            text-align: center;
277
            border-collapse: collapse;
278
            margin-bottom: 20px;
279
        }
280
 
281
        .zuweisungTable tr td:first-child {
282
            border-right: 1px solid #ccc;
283
        }
284
 
285
        .zuweisungTable tr:first-child td {
286
            border-bottom: 1px solid #ccc;
287
        }
288
 
289
        .zuweisungTable tr td label {
290
            clear: both;
291
            float: left;
292
 
293
        }
294
    </style>
372 lars 295
    <button id="new"></button>
296
    <br><br>
370 lars 297
    <table class="keinRand" width="100%" cellspacing="0" cellpadding="3" id="dataTableBackendUsers">
371 lars 298
        <thead>
2 lars 299
        <tr>
374 lars 300
            <td class="headline">Login</td>
301
            <td class="headline">2FA</td>
302
            <td class="headline">Letztes Login</td>
303
            <td class="headline">Aktionen</td>
2 lars 304
        </tr>
371 lars 305
        </thead>
306
        <tbody>
2 lars 307
        {foreach $users as $user}
308
            {cycle values=' ,gerade' assign='class'}
309
            <tr class="rechts {$class}">
310
                <td>
372 lars 311
                    {$user.email}
2 lars 312
                </td>
313
                <td>
314
                    {if $user["2fa"] == true}
315
                        <div class="locked" title="Zwei-Faktor-Authentifizierung aktiv"
316
                             data-id="{$users.id}"></div>
317
                    {else}
318
                        <div class="unlocked" title="Zwei-Faktor-Authentifizierung inaktiv"
319
                             {if $users.id==$smarty.session.admin.uid}data-id="{$user.id}"
320
                             id="en2fa"{/if}></div>
321
                    {/if}
322
                </td>
323
                <td>
324
                    {if !is_null($user.last_login)}
325
                        {$user.last_login|date_format:"%d.%m.%Y %H:%M"} |
326
                        <a href="#" id="ip_{$smarty.section.u_ind.index}_{$user.ip}"
320 lars 327
                           class="ipAddress">{$user.ip}</a>
2 lars 328
                    {/if}
329
                </td>
372 lars 330
                <td  style="text-align:left !important;">
331
                    <button class="edit" data-id="{$user.id}"></button>
332
                    <button class="del" data-id="{$user.id}"></button>
333
                </td>
2 lars 334
 
335
            </tr>
336
        {/foreach}
371 lars 337
        </tbody>
2 lars 338
    </table>
372 lars 339
    <div id="editDlg"></div>
373 lars 340
    <div id="delDlg" title="Benutzer löschen">
341
        Wollen Sie den Benutzer <span id="userName"></span> wirklich löschen?
372 lars 342
        <span id="mId" style="display: none"></span>
373 lars 343
        <form id="userDelForm">
372 lars 344
            <input type="hidden" name="_method" value="DELETE">
345
            <input type="hidden" name="_token" value="{csrf_token()}">
346
        </form>
347
    </div>
2 lars 348
{/block}