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

Revision

Revision 223 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
131 lars 1
{extends file="index.tpl"}
2
{block name="maincontent"}
3
    <!-- $Id: supplierList.tpl 317 2023-08-12 19:58:02Z lars $ BEGIN -->
143 lars 4
    <button id="new"></button>
5
    <br><br>
6
    <table class="keinRand" width="100%" cellspacing="0" cellpadding="3" id="dataTable">
144 lars 7
        <thead>
139 lars 8
        <tr class="links">
9
            <td>Lieferanten</td>
143 lars 10
            <td>Aktionen</td>
139 lars 11
        </tr>
144 lars 12
        </thead>
13
        <tbody>
157 lars 14
        {foreach $lieferanten as $lieferant}
139 lars 15
            {cycle values="ungerade, gerade" assign="class"}
16
            <tr class="rechts {$class}">
156 lars 17
                <td  style="text-align:left !important;">{$lieferant.name}</td>
143 lars 18
                <td  style="text-align:left !important;">
156 lars 19
                    <button class="edit" data-id="{$lieferant.id}"></button>
20
                    <button class="del" data-id="{$lieferant.id}"></button>
143 lars 21
                </td>
139 lars 22
            </tr>
156 lars 23
            {foreachelse}
24
        {/foreach}
139 lars 25
        {if $webs.bgcolor_seite != 'FFFFFF'}
26
            <tr class="links">
27
                <td>&nbsp;</td>
28
            </tr>
29
        {/if}
144 lars 30
        </tbody>
139 lars 31
    </table>
32
    <script>
33
        $(".keinRand tr").not(':first').hover(
34
            function () {
35
                $(this).css("background-color","#ccc");
36
            },
37
            function () {
38
                $(this).css("background-color","");
39
            }
40
        );
41
    </script>
42
 
43
    <style>
44
        a:hover{
45
            color: #000 !important;
46
        }
47
    </style>
143 lars 48
    <script>
49
        $(function (){
50
            $("#dataTable").dataTable({
51
                "lengthMenu": [[100, -1], [100, "Alle"]],
52
                "language": {
53
                    "url": "/js/DataTables-1.10.19/German.json"
54
                }
55
            });
56
            $('#editDlg').dialog({
57
                autoOpen:false,
58
                modal:true,
59
                resizable:false,
223 lars 60
                width:900,
164 lars 61
                height:400,
143 lars 62
                buttons:[
63
                    {
64
                        text:"Speichern",
65
                        icon:"ui-icon-check",
66
                        click:function (){
67
                            let url="/bestellwesen/suppliers";
68
                            if($("#ID").val())
69
                            {
70
                                url+="/"+$("#ID").val()
71
                            }
317 lars 72
                            /*$.post(url,$('#supplierForm').serializeArray(),function(){
143 lars 73
                                $('#editDlg').dialog("close")
74
                                location.reload()
317 lars 75
                            });*/
76
                            $.ajax({
77
                                type:"post",
78
                                url:url,
79
                                data:$('#supplierForm').serializeArray(),
80
                                dataType: 'json',
81
                                success:function ()
82
                                {
83
                                    $('#editDlg').dialog("close");
84
                                    location.reload();
85
                                },
86
                                error:function (response)
87
                                {
88
                                    $('#supplierError').html(response.responseJSON.message);
89
                                    let errors = response.responseJSON.errors
90
                                    if(errors.name)
91
                                    {
92
                                        $('#supplierNameError').html(errors.name)
93
                                    }
94
                                    if(errors.rank)
95
                                    {
96
                                        $('#supplierRankError').html(errors.rank)
97
                                    }
98
                                }
99
                            })
143 lars 100
                        }
101
                    },
102
                    {
103
                        text:"Abbrechen",
104
                        icon:"ui-icon-cancel",
105
                        click:function (){
106
                            $('#editDlg').dialog("close");
107
                        }
108
                    }
109
                ]
110
            })
111
            $('#delDlg').dialog({
112
                autoOpen:false,
113
                modal:true,
114
                resizable:false,
115
                width:800,
116
                buttons:[
117
                    {
118
                        text:"Löschen",
119
                        icon:"ui-icon-trash",
120
                        click:function (){
121
                            let url="/bestellwesen/suppliers/"+$("#mId").html();
122
                            $.post(url,$('#supplierDelForm').serializeArray(),function(){
123
                                $('#delDlg').dialog("close")
124
                                location.reload()
125
                            });
126
                        }
127
                    },
128
                    {
129
                        text:"Abbrechen",
130
                        icon:"ui-icon-cancel",
131
                        click:function (){
132
                            $('#delDlg').dialog("close");
133
                        }
134
                    }
135
                ]
136
            })
137
            $("#new").uibutton({
138
                icons:{
139
                    primary:"ui-icon-plus"
140
                }
141
            }).click(function()
142
            {
143
                let url="/bestellwesen/suppliers/create/";
144
                $('#editDlg').load(url).dialog("open");
145
            });
146
            $(".edit").uibutton({
147
                icons:{
148
                    primary:"ui-icon-pencil"
149
                }
150
            }).click(function() {
151
                let url="/bestellwesen/suppliers/"+$(this).attr("data-id")+"/edit/";
152
                $('#editDlg').load(url).dialog("open");
153
            });
154
            $(".del").uibutton({
155
                icons:{
156
                    primary:"ui-icon-trash"
157
                }
158
            }).click(function() {
159
                let mId=$(this).attr("data-id");
160
                $.get("/bestellwesen/suppliers/"+mId,function(name) {
147 lars 161
                    $('#supplierName').html(name);
143 lars 162
                    $('#mId').html(mId);
163
                    $('#delDlg').dialog("open");
164
                })
165
            })
166
 
167
        })
168
    </script>
169
    <div id="editDlg"></div>
146 lars 170
    <div id="delDlg" title="Lieferant löschen">
171
        Wollen Sie den Lieferanten <span id="supplierName"></span> wirklich löschen?
143 lars 172
        <span id="mId" style="display: none"></span>
173
        <form id="supplierDelForm">
174
            <input type="hidden" name="_method" value="DELETE">
175
            <input type="hidden" name="_token" value="{csrf_token()}">
176
        </form>
177
    </div>
131 lars 178
    <!-- $id$ END -->
179
{/block}