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

Revision

Revision 413 | Revision 416 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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