Subversion-Projekte lars-tiefland.webanos.zeldi.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
4 lars 1
<script src="/js/jstree/dist/jstree.js?{$smarty.now}"></script>
2
<script>
3
    $(document).ready(function(){
4
 
5
 
6
        $("#artikelListe").delegate(".setUp","click",function(){
7
            let setUpID = $(this).attr("id");
8
            let id = setUpID.split("_");
9
            let type = id[1];
10
            let artikelID = id[2];
11
            let aktionsID = $("#aktionsID").val();
12
            $.ajax({
13
                type: "POST",
14
                url: "artikel_2_Aktionen_v2.php",
15
                data: { scroll_up: artikelID, aktionsID: aktionsID, type: type }
16
            }).done(function(html){
17
                $("#artikelListe").html(html);
18
            });
19
        }).delegate(".setDown","click",function(){
20
            let setDownID = $(this).attr("id");
21
            let id = setDownID.split("_");
22
            let type = id[1];
23
            let artikelID = id[2];
24
            let aktionsID = $("#aktionsID").val();
25
            $.ajax({
26
                type: "POST",
27
                url: "artikel_2_Aktionen_v2.php",
28
                data: { scroll_down: artikelID, aktionsID: aktionsID, type: type }
29
            }).done(function(html){
30
                $("#artikelListe").html(html);
31
            });
32
        }).delegate(".delete","click",function(){
33
            let deleteID = $(this).attr("id");
34
            let id = deleteID.split("_");
35
            let type = id[1];
36
            let artikelID = id[2];
37
            let aktionsID = $("#aktionsID").val();
38
            $.ajax({
39
                type: "POST",
40
                url: "artikel_2_Aktionen_v2.php",
41
                data: { deleted: artikelID, aktionsID: aktionsID, type: type }
42
            }).done(function(html){
43
                $("#artikelListe").html(html);
44
            });
45
        });
46
 
47
        let nodeID = 0;
48
        let idArray;
49
        let daten;
50
        $("#directroyTree").jstree({
51
            "plugins": ["themes", "ui", "search", "contextmenu"],
52
            'core' : {
53
                'data' : {
54
                     'type': 'POST',
55
                     'url' : "aktions_tree_v2.php",
56
                     'data' :  function (node) {
57
                        if( node.id === '#'){
58
                            nodeID = -1;
59
                        }else{
60
                            idArray = node.id.split("_");
61
                            nodeID = idArray[1];
62
                        }
63
                        console.log(nodeID)
64
                        daten = {
65
                            "nodeID" : nodeID
66
                        }
67
                        return daten;
68
                     },
69
                    'dataType': 'json',
70
                    'async': true
71
                },
72
                'check_callback': true
73
            },
74
            "search": {
75
                "show_only_matches": true,
76
                "case_sensitive": false,
77
                "ajax": {
78
                    'type': 'POST',
79
                    "url" : "aktions_tree_v2.php",
80
                    'dataType': 'json',
81
                    'async': true
82
                }
83
            },
84
        })
85
 
86
        let to = false;
87
        $('#searchTree').keyup(function () {
88
            if( to ) {
89
                clearTimeout(to);
90
            }
91
            to = setTimeout(function () {
92
                let v = $('#searchTree').val();
93
                if( v.length > 2 || v.length === 0){
94
                    $('#directroyTree').jstree(true).search(v);
95
                }
96
            },300);
97
        });
98
 
99
 
100
        $('#directroyTree').on("select_node.jstree", function (e, data) {
101
            let addArtikelID = data.node.id
102
            let id = addArtikelID.split("_");
103
            let artikelID = id[1];
104
            let aktionsID = $("#aktionsID").val();
105
 
106
            if( id[0] === "artikel" ){
107
                $.ajax({
108
                    type: "POST",
109
                    url: "artikel_2_Aktionen_v2.php",
110
                    data: { id: artikelID, add: "Artikel", aktionsID: aktionsID }
111
                }).done(function(html){
112
                    $("#artikelListe").html(html);
113
                });
114
            }
115
 
116
            {if isset($user_rechte["online_shop"]["aktion"]["ordner_aktionen_zuweisen"])}
117
            if( id[0] === "artikel" ){
118
                $.ajax({
119
                    type: "POST",
120
                    url: "artikel_2_Aktionen_v2.php",
121
                    data: { id: artikelID, add: "Ordner", aktionsID: aktionsID }
122
                }).done(function(html){
123
                    $("#artikelListe").html(html);
124
                });
125
            }
126
            {/if}
127
        });
128
 
129
    });
130
    function strstr(haystack, needle, bool) {
131
        let pos;
132
 
133
        haystack += "";
134
        pos = haystack.indexOf(needle); if (pos === -1) {
135
            return false;
136
        } else {
137
            if (bool) {
138
                return haystack.substr(0, pos);
139
            } else {
140
                return haystack.slice(pos);
141
            }
142
        }
143
    }
144
</script>
145
<style>
146
    .tabelle div {
147
        padding: 1px 2px!important;
148
    }
149
</style>
150
<div>
151
    <div style="border-bottom: 1px solid #333;padding: 4px 2px;">{$webs["kunde_bezeichnung"]}</div>
152
    <label for="searchTree">Suche</label>
153
    <input id="searchTree" placeholder="Suche..."/>
154
    <div id="directroyTree"></div>
155
</div>