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

Revision

Revision 394 | Revision 396 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 394 Revision 395
Zeile 1... Zeile 1...
1
{extends file="index.tpl"}
1
{extends file="index.tpl"}
2
{block name="maincontent"}
2
{block name="maincontent"}
3
    <!-- $Id: index.tpl 87 2023-05-20 23:09:43Z lars $ BEGIN -->
3
    <!-- $Id: index.tpl 87 2023-05-20 23:09:43Z lars $ BEGIN -->
4
    <style>
-
 
5
        #artikeluebersicht{
-
 
6
            max-width:100%;
-
 
7
            width:100%;
-
 
8
        }
-
 
9
        .dt-button:hover{
-
 
10
            font-size: 0.88em!important;
-
 
11
        }
-
 
12
        div.export{ float:right; clear:both; padding-top:2%; }
-
 
13
        div.DTTT { margin-bottom: 0.5em; float: right; }
-
 
14
        div.dataTables_wrapper { clear: both; }
-
 
15
        .statusZahl{ float:left;padding-right:1%;margin-top:-1px; }
4
    <!-- $Id: vportale_artikel.tpl 3931 2022-12-06 15:16:21Z tiefland $ -->
16
    </style>
-
 
17
    <script>
5
    <script>
18
        $(function()
6
        $(function(){
19
        {
-
 
20
 
-
 
21
            $(".iconToggler").css("cursor", "pointer").on("click", function(e){
-
 
22
                e.preventDefault();
-
 
23
 
-
 
24
                // Get the column API object
-
 
25
                let columnValue = $(this).attr('data-column');
-
 
26
                columnValue = columnValue.split("_");
-
 
27
 
-
 
28
 
-
 
29
                for ( i = 0; i < columnValue.length; i++ ){
-
 
30
                    let column = table.column( columnValue[i] );
-
 
31
                    column.visible( !column.visible() );
-
 
32
                }
-
 
33
            } );
-
 
34
 
-
 
35
            let table = $('#artikeluebersicht').DataTable({
-
 
36
                "dom": 'lf<"export"B>rtip',
-
 
37
                "processing": true,
-
 
38
                "serverSide": true,
-
 
39
                "ajax": {
-
 
40
                    "type": "POST",
-
 
41
                    "url" : "vportale_artikel.php?action=getArtikel",
-
 
42
                    "data": function(d){
-
 
43
                        d.vp_id = {$vportal_id};
-
 
44
                        d.artikelAnzeige = $("#artikelAnzeigeSelect").val();
-
 
45
                        d.statusSelect = $("#statusSelect").val();
-
 
46
                    }
-
 
47
                },
-
 
48
                "drawCallback": function( settings ) {
-
 
49
                    styleButtons();
-
 
50
                    $(".tooltip").tooltipster({
-
 
51
                        animation: 'fade',
-
 
52
                        delay: 200,
-
 
53
                        theme: 'tooltipster-light',
-
 
54
                        contentAsHTML: true,
-
 
55
                        touchDevices: true,
-
 
56
                        trigger: 'hover'
-
 
57
                    });
-
 
58
                },
-
 
59
                "stateSave": true,
-
 
60
                "buttons": [
-
 
61
                    {
-
 
62
                        extend: 'colvis',
-
 
63
                        text: 'Spalten anzeigen'
-
 
64
                    },
-
 
65
                    {
-
 
66
                        extend: 'csv',
-
 
67
                        text: 'CSV',
-
 
68
                        exportOptions: {
-
 
69
                            modifier: {
-
 
70
                                order: 'current',
-
 
71
                                page: 'current'
-
 
72
                            },
-
 
73
                            columns: ':visible',
-
 
74
                            stripHtml: false,
-
 
75
                            stripNewLines: false
-
 
76
                        },
-
 
77
                        title: 'vPortalArtikel'
-
 
78
                    },
-
 
79
                    {
-
 
80
                        extend: 'excel',
-
 
81
                        text: 'Excel',
-
 
82
                        exportOptions: {
-
 
83
                            modifier: {
-
 
84
                                order: 'current',
-
 
85
                                page: 'current'
-
 
86
                            },
-
 
87
                            columns: ':visible'
-
 
88
                        },
-
 
89
                        title: 'vPortalArtikel',
-
 
90
                        extension: ".xlsx",
-
 
91
                        fnCellRender: function ( sValue, iColumn, nTr, iDataIndex ) {
-
 
92
                            return sValue.replace(/<br\s*\/?>/ig, "\r\n") ;
-
 
93
                        }
-
 
94
                    },
-
 
95
                    {
-
 
96
                        extend: 'pdf',
-
 
97
                        text: 'PDF',
-
 
98
                        exportOptions: {
-
 
99
                            modifier: {
-
 
100
                                order: 'current',
-
 
101
                                page: 'current'
-
 
102
                            },
-
 
103
                            columns: ':visible'
-
 
104
                        },
-
 
105
                        title: 'vPortalArtikel',
7
            $('#vportal_sel').change(list_artikel);
106
                    }
-
 
107
 
-
 
108
                ],
-
 
109
                "columns":[
-
 
110
                    { "data": "id" },
-
 
111
                    { "data": "sku" },
-
 
112
                    { "data": "fremdartikel_id" },
-
 
113
                    { "data": "fremdkatalogartikel_id" },
-
 
114
                    { "data": "artikel_id" },
-
 
115
                    { "data": "name" },
-
 
116
                    { "data": "artstammArtikel"},
-
 
117
                    { "data": "hersteller"},
-
 
118
                    { "data": "ean" },
-
 
119
                    { "data": "preis" },
-
 
120
                    { "data": "currency" },
-
 
121
                    { "data": "preisart" },
-
 
122
                    { "data": "menge" },
-
 
123
                    { "data": "status" },
-
 
124
                    { "data": null }
-
 
125
                ],
-
 
126
                "columnDefs": [
-
 
127
                    { "name": "id", "targets": 0 },
-
 
128
                    { "name": "sku", "targets": 1 },
-
 
129
                    { "name": "fremdartikel_id", "targets": 2 },
-
 
130
                    { "name": "fremdkatalogartikel_id", "targets": 3 },
-
 
131
                    { "name": "artikel_id", "targets": 4 },
-
 
132
                    { "name": "name", "targets": 5 },
-
 
133
                    {
-
 
134
                        "name": "artstammArtikel",
-
 
135
                        "targets": 6,
-
 
136
                        "render": function ( data, type, row ) {
-
 
137
                            let string = "";
-
 
138
                            if(data != null){
-
 
139
                                string += "<table>";
-
 
140
                                for( let i = 0; i < data.length; i++){
-
 
141
                                    string += "<tr><td>" + data[i]["ID"] + "</td><td>" + data[i]["kurzbezeichnung"] + "</td><td>" + data[i]["menge"] + "</td></tr>";
-
 
142
                                }
-
 
143
                                string += "</table>";
-
 
144
                            }
-
 
145
                            return string;
-
 
146
                        },
-
 
147
                    },
-
 
148
                    { "name": "hersteller", "targets": 7 },
-
 
149
                    { "name": "ean", "targets": 8 },
-
 
150
                    { "name": "preis", "targets": 9 },
-
 
151
                    { "name": "currency", "targets": 10 },
-
 
152
                    { "name": "preisart", "targets": 11 },
-
 
153
                    { "name": "menge", "targets": 12 },
-
 
154
                    {
-
 
155
                        "name": "status",
-
 
156
                        "targets": 13,
-
 
157
                        "render": function ( data, type, row ) {
-
 
158
                            console.log(data);
-
 
159
                            let string = "";
-
 
160
                            string = "<span class='statusZahl'>"+ data["status"] + "</span><span class='ui-icon ui-icon-info tooltip' title='"+data["feedback"]+"'></span>";
-
 
161
 
-
 
162
                            return string;
-
 
163
                        }
-
 
164
                    },
-
 
165
                    {
-
 
166
                        "name": "aktionen",
-
 
167
                        "targets": 14,
-
 
168
                        "render": function ( data, type, row ) {
-
 
169
                            let string = "";
-
 
170
                            string += data["aktionen"];
-
 
171
 
-
 
172
                            return string;
-
 
173
                        }
-
 
174
                    },
-
 
175
                    { "orderable": false, "targets": [ 7, 14 ] },
-
 
176
                    { "searchable": false, "targets": [ 6, 14 ] }
-
 
177
                ],
-
 
178
                "lengthMenu": [[100, 150, -1], [100, 150, "Alle"]],
-
 
179
                "language": {
-
 
180
                    "url": "../js/DataTables-1.10.9/German.json"
-
 
181
                }
-
 
182
            });
8
        })
183
            jQuery.fn.dataTableExt.oSort['currency-asc'] = function(a,b) {
-
 
184
                /* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */
-
 
185
                let x = a == "-" ? 0 : a.replace( /,/g, "" );
-
 
186
                let y = b == "-" ? 0 : b.replace( /,/g, "" );
-
 
187
 
-
 
188
                x = x.replace(/\./g, "");
-
 
189
                y = y.replace(/\./g, "");
-
 
190
 
-
 
191
                /* Parse and return */
-
 
192
                x = parseFloat( x );
-
 
193
                y = parseFloat( y );
-
 
194
                return x - y;
-
 
195
            };
-
 
196
 
-
 
197
            jQuery.fn.dataTableExt.oSort['currency-desc'] = function(a,b) {
-
 
198
                /* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */
-
 
199
                let x = a == "-" ? 0 : a.replace( /,/g, "" );
-
 
200
                let y = b == "-" ? 0 : b.replace( /,/g, "" );
-
 
201
 
-
 
202
                x = x.replace(/\./g, "");
-
 
203
                y = y.replace(/\./g, "");
-
 
204
 
-
 
205
                /* Parse and return */
-
 
206
                x = parseFloat( x );
-
 
207
                y = parseFloat( y );
-
 
208
                return y - x;
-
 
209
            };
-
 
210
 
-
 
211
            jQuery.fn.dataTableExt.oSort['num-html-asc'] = function(a,b) {
-
 
212
                let x = a.replace( /<.*?>/g, "" );
-
 
213
                let y = b.replace( /<.*?>/g, "" );
-
 
214
                x = parseFloat( x );
-
 
215
                y = parseFloat( y );
-
 
216
                return ((x < y || isNaN(y) ) ? -1 : ((x > y || isNaN(x)) ? 1 : 0));
-
 
217
            };
-
 
218
            jQuery.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) {
-
 
219
                let x = a.replace( /<.*?>/g, "" );
-
 
220
                let y = b.replace( /<.*?>/g, "" );
-
 
221
                x = parseFloat( x );
-
 
222
                y = parseFloat( y );
-
 
223
                return ((x < y || isNaN(x)) ? 1 : ((x > y || isNaN(y) ) ? -1 : 0));
-
 
224
            };
-
 
225
 
-
 
226
            $("#artikeluebersicht").delegate( "button.assign","click", assign_artikel);
-
 
227
            $("#artikeluebersicht").delegate( "button.edit","click", edit_artikel);
-
 
228
            $("#artikeluebersicht").delegate( "button.del","click", del_artikel);
-
 
229
            $("#artikeluebersicht").delegate( "button.lock","click", lock_artikel);
-
 
230
            $("#artikeluebersicht").delegate( "button.bestandsUpdate","click", bestandsUpdate);
-
 
231
 
-
 
232
            $('#artikelAnzeigeSelect, #statusSelect').change( function() {
-
 
233
                table.draw();
-
 
234
            } );
-
 
235
 
-
 
Zeile 236... Zeile 9...
236
 
9
 
-
 
10
        function list_artikel()
237
            table.on( 'column-visibility.dt', function ( e, settings, column, state ) {
11
        {
238
                if( column == 14 && state == true ){
12
            let vp_id = $('#vportal_sel').val();
-
 
13
            $(".loading").dialog( "open" );
239
                    styleButtons();
14
            $('#vportale_artikel_content').load("vportale_artikel.php?action=list&vp_id="+vp_id, function(){
240
                }
15
                $(".loading").dialog( "close" );
Zeile 241... Zeile -...
241
            });
-
 
242
 
-
 
243
            function styleButtons(){
-
 
244
 
-
 
245
                $('.edit').button({
-
 
246
                    icons: {
-
 
247
                        primary: "ui-icon-pencil"
-
 
248
                    }
-
 
249
                })
-
 
250
 
-
 
251
                $('.del').button({
-
 
252
                    icons: {
-
 
253
                        primary: "ui-icon-trash"
-
 
254
                    }
-
 
255
                })
-
 
256
 
-
 
257
                $('.lock').button({
-
 
258
                    icons: {
-
 
259
                        primary: "ui-icon-locked"
-
 
260
                    }
-
 
261
                })
-
 
262
 
-
 
263
                $('.assign').button({
-
 
264
                    icons: {
-
 
265
                        primary: "ui-icon-transfer-e-w"
-
 
266
                    }
-
 
267
                })
-
 
268
 
-
 
269
                $('.bestandsUpdate').button({
-
 
270
                    icons: {
-
 
271
                        primary: "ui-icon-arrowrefresh-1-e"
-
 
272
                    }
16
            });
273
                })
-
 
274
            }
-
 
275
 
17
 
276
 
-
 
277
            $('#vportale_artikel_dlg').dialog({
-
 
278
                autoOpen: false,
-
 
279
                resizable: false,
-
 
280
                modal: true,
-
 
281
                width: "80%",
-
 
282
                height:600,
-
 
283
                maxHeight:670,
-
 
284
                minWidth:600,
-
 
285
                buttons: {
18
        }
286
                    "speichern": function()
19
        function list_artikel_page(start)
287
                    {
-
 
288
                        let valid = $('#vportale_artikel_form').validate()//.form();
-
 
289
 
-
 
290
                        if (valid)
20
        {
291
                        {
-
 
292
                            $('#vportale_artikel_content').load("vportale_artikel.php",$('#vportale_artikel_form').serializeArray(),function(html){
-
 
293
                                //alert(html);
-
 
294
                            });
-
 
295
                            $('#vportale_artikel_dlg').empty().dialog("close");
-
 
296
                        }
-
 
297
                    },
-
 
298
                    "abbrechen": function()
21
            let vp_id = $('#vportal_sel').val();
299
                    {
-
 
300
                        $('#vportale_artikel_dlg').empty().dialog("close");
-
 
301
                    }
-
 
302
                }
-
 
303
 
22
            $('#vportale_artikel_content').load("vportale_artikel.php?action=list&vp_id="+vp_id+"&"+start, function(){
Zeile 304... Zeile -...
304
 
-
 
305
            });
-
 
306
 
-
 
307
            function lock_artikel()
-
 
308
            {
-
 
309
                let a_id = this.id;
-
 
310
                a_id = a_id.split("_");
-
 
311
                a_id = a_id[1];
-
 
312
                let url="vportale_artikel.php?action=lock&id=" + a_id;
-
 
313
                $('#vportale_artikel_content').load(url,{
-
 
314
                    vp_id:{$vportal_id}
-
 
315
                });
-
 
316
            }
-
 
317
 
-
 
318
            function edit_artikel()
-
 
319
            {
-
 
320
 
-
 
321
                let a_id = this.id;
-
 
322
                a_id = a_id.split("_");
-
 
323
                a_id = a_id[1];
-
 
324
 
-
 
325
                $('#vportale_artikel_dlg').html("<div style='margin-top:20%'><center><img src='/images/loading.gif'><br>Lade. Bite warten...</center></div>")
-
 
326
                    .load("vportale_artikel.php?action=edit&id=" + a_id+"&vp_id={$vportal_id}")
-
 
327
                    .dialog("open");
-
 
328
 
-
 
329
            }
-
 
330
 
-
 
331
            function assign_artikel(e)
-
 
332
            {
-
 
333
 
-
 
334
                let fremdartikel_id = this.id;
-
 
335
                fremdartikel_id = fremdartikel_id.split("_");
-
 
336
                fremdartikel_id = fremdartikel_id[1];
-
 
337
 
-
 
338
                let vportal_id = $("#vportal_id").val();
-
 
339
 
-
 
340
                $('<div id="vportalAssignDialog">').dialog({
-
 
341
                    resizable: false,
-
 
342
                    modal: true,
-
 
343
                    width:"80%",
-
 
344
                    open: function(){
-
 
345
                        vportal_id = $("#vportal_id").val();
-
 
346
                        $(this).load("vportale_artikel.php?action=assign&fremdartikel_id=" + fremdartikel_id + "&vportal_id=" + vportal_id, function(){
-
 
347
                            $("#bezeichnung", this).trigger("keyup");
-
 
348
                        });
-
 
349
                    },
-
 
350
                    close: function() {
-
 
351
                        $('#vportalAssignDialog').empty().remove();
-
 
352
                    },
-
 
353
                    buttons: {
-
 
354
                        "speichern": function()
-
 
355
                        {
-
 
356
                            /*let valid = $('#vportale_artikel_form').validate({
-
 
357
                                debug: false,
-
 
358
                                errorClass: "error_upd"
-
 
359
                            }).form();*/
-
 
360
 
-
 
361
                            //if (valid)
-
 
362
                            {
-
 
363
                                $('#vportale_artikel_content').load("vportale_artikel.php",$('#vportale_artikel_form').serializeArray());
-
 
364
                                $('#vportalAssignDialog').empty().remove();
-
 
365
                            }
-
 
366
                        },
-
 
367
                        "abbrechen": function()
-
 
368
                        {
-
 
369
                            $("#vportalAssignDialog").empty().remove();
-
 
370
                        }
-
 
371
                    }
-
 
372
                });
-
 
373
                //e.stopPropagation();
-
 
374
            }
-
 
375
 
-
 
376
            function del_artikel()
-
 
377
            {
-
 
378
                let vpa_id = this.id;
-
 
379
                vpa_id = vpa_id.split("_");
-
 
380
                let vpa_name = vpa_id[2];
-
 
381
                vpa_id = vpa_id[1];
-
 
382
                $('#vportale_artikel_del_dlg').dialog(
-
 
383
                    {
-
 
384
                        modal: true,
-
 
385
                        width: 400,
-
 
386
                        resizable: false,
-
 
387
                        title: "Verkaufsportal-Artikel " + vpa_name + " löschen",
-
 
388
                        buttons: {
-
 
389
                            "Nein": function()
-
 
390
                            {
-
 
391
                                $(this).dialog("close");
-
 
392
                            },
-
 
393
                            "Ja": function()
-
 
394
                            {
-
 
395
                                let url="/vportale/vportale_artikel.php?action=del&id=" + vpa_id
-
 
396
                                $.get(url,function() {
-
 
397
                                    url="/vportale/vportale_artikel.php?action=list"+"&vp_id={$vportal_id}";
-
 
398
                                    $('#vportale_artikel_content').load(url);
-
 
399
                                    $("#vportale_artikel_del_dlg").dialog("close");
-
 
400
                                });
-
 
401
                            }
-
 
402
                        }
-
 
403
                    })
-
 
404
            }
-
 
405
 
-
 
406
            function bestandsUpdate(){
-
 
407
                let fremdartikel_id = this.id;
-
 
408
                fremdartikel_id = fremdartikel_id.split("_");
-
 
409
                let vportal_id = fremdartikel_id[2];
-
 
410
                fremdartikel_id = fremdartikel_id[1];
-
 
411
                $('<div id="vportalAssignDialog">').dialog({
-
 
412
                    "modal"  : true,
-
 
413
                    "width"  : "300",
-
 
414
                    "height" : "300",
-
 
415
                    "open"   : function(){
-
 
416
                        $(this).load("bestandsUpdate.php?fremdartikel_id="+fremdartikel_id);
-
 
417
                    },
-
 
418
                    "close"  : function() {
-
 
419
                        $(this).empty().remove();
-
 
420
                    },
-
 
421
                    "buttons": {
-
 
422
                        "Beenden": function()
-
 
423
                        {
-
 
424
                            $(this).empty().remove();
-
 
425
                            $('#vportale_artikel_content').load("vportale_artikel.php?action=list"+"&vp_id="+vportal_id);
-
 
426
                        }
-
 
427
                    }
23
                $(".loading").dialog( "close" );
428
                });
24
            });
429
            }
25
 
430
        })
-
 
431
    </script>
-
 
432
    <table style="float: left;">
-
 
433
        <tbody>
-
 
434
        <tr>
-
 
435
            <td class="links">
-
 
436
                <label for="artikelAnzeigeSelect">Artikelart</label>
-
 
437
            </td>
-
 
438
            <td class="rechts">
-
 
439
                <select id="artikelAnzeigeSelect">
-
 
440
                    <option value="-1" {if $smarty.session.artikelAnzeigeSelect == -1}selected{/if} >- alle -</option>,
-
 
441
                    <option value="1" {if $smarty.session.artikelAnzeigeSelect == 1}selected{/if}>zugewiesen</option>
-
 
442
                    <option value="2" {if $smarty.session.artikelAnzeigeSelect == 2}selected{/if}>nicht zugewiesen</option>
-
 
443
                </select>
-
 
444
            </td>
-
 
445
        </tr>
-
 
446
        <tr>
-
 
447
            <td class="links">
-
 
448
                <label for="statusSelect">Status</label>
-
 
449
            </td>
-
 
450
            <td class="rechts">
-
 
451
                <select id="statusSelect" name="status">
-
 
452
                    {html_options options=$statusSelect}
-
 
453
                </select>
-
 
454
            </td>
-
 
455
        </tr>
-
 
456
        <tr>
-
 
457
            <td colspan="2">&nbsp;</td>
-
 
458
        </tr>
-
 
459
        <tr>
-
 
460
            {if isset($leistungsdatum)}
-
 
461
                <td>Leistungsdatum:</td>
-
 
462
                <td>{html_options options=$zeitraum name="leistungsdatum" id="leistungsdatumSelect" selected=0}</td>
-
 
463
            {/if}
-
 
464
        </tr>
-
 
465
        </tbody>
-
 
466
    </table>
-
 
467
 
-
 
468
    <table id="artikeluebersicht" class="table-striped table-bordered display" style="margin-top:10px;float:left;">
-
 
469
        <thead>
-
 
470
        <tr>
-
 
471
            <th>ID</th>
-
 
472
            <th>SKU</th>
-
 
473
            <th>fremde<br>Art.-Nr.</th>
-
 
474
            <th>fremde Katalog-Art.-Nr.</th>
-
 
475
            <th>Artikel-ID</th>
-
 
476
            <th>Name</th>
-
 
477
            <th>Artikelstamm-Artikel</th>
-
 
478
            <th>Hersteller</th>
-
 
479
            <th>EAN</th>
-
 
480
            <th>Preis</th>
-
 
481
            <th>Währung</th>
-
 
482
            <th>Preisart</th>
-
 
483
            <th>Menge</th>
-
 
484
            <th>Status</th>
-
 
485
            <th>Aktionen</th>
-
 
486
        </tr>
-
 
487
        </thead>
-
 
488
    </table>
26
        }
489
    <input type="hidden" id="vportal_id" value="{$vportal_id}" />
-
 
490
 
-
 
491
    <div id="vportale_artikel_dlg" title="Artikel anlegen / ändern">
-
 
Zeile 492... Zeile -...
492
    </div>
-
 
493
    <div id="link_cat_dlg" title="Kategorie auswählen">
-
 
494
    </div>
27
    </script>
495
 
28
    {include file="vportale_list.tpl"}
496
    <div id="vportale_artikel_del_dlg" style="display:none">
29
    <div id="vportale_artikel_content" style="min-height:500px;">
497
        Wollen Sie diesen Artikel wirklich löschen?
30