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

Revision

Revision 293 | Revision 300 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
224 lars 1
    <!-- $Id: shipping.tpl 1678 2023-05-13 23:45:07Z lars $ BEGIN -->
2
 
228 lars 3
    <button id="newShipping"></button>
227 lars 4
    <br><br>
251 lars 5
    <table style="width:100%" id="dataTableShipping">
224 lars 6
        <thead>
7
            <tr>
8
                <td>Rang</td>
9
                <td>Name</td>
10
                <td>Versandgruppe</td>
11
                <td></td>
12
                <td>Preis</td>
13
                <td>Gewichtsbereich</td>
14
                <td>Preisbereich</td>
15
                <td>Aktionen</td>
16
            </tr>
17
        </thead>
18
        <tbody>
19
        {foreach $shipping as $versand}
20
            <tr>
21
                <td>{$versand->rank}</td>
22
                <td>{$versand->name}</td>
23
                <td>{$versand->shipping_group->name}</td>
24
                <td></td>
25
                <td>{$versand->price|money_format}</td>
26
                <td>{$versand->calc_weight_from|number_format:2:",":"."} kG - {$versand->calc_weight_to|number_format:2:",":"."} kG</td>
27
                <td>{$versand->calc_price_from|money_format} - {$versand->calc_price_to|money_format}</td>
227 lars 28
                <td  style="text-align:left !important;">
230 lars 29
                    <button class="editShipping" data-id="{$versand.id}"></button>
30
                    <button class="delShipping" data-id="{$versand.id}"></button>
227 lars 31
                </td>
224 lars 32
            </tr>
33
        {/foreach}
34
        </tbody>
35
    </table>
227 lars 36
    <script>
37
        $(function (){
38
            $("#dataTableShipping").dataTable({
39
                "lengthMenu": [[100, -1], [100, "Alle"]],
40
                "language": {
41
                    "url": "/js/DataTables-1.10.19/German.json"
42
                }
43
            });
228 lars 44
            $('#editShippingDlg').dialog({
227 lars 45
                autoOpen:false,
46
                modal:true,
47
                resizable:false,
48
                width:900,
49
                height:400,
50
                buttons:[
51
                    {
52
                        text:"Speichern",
53
                        icon:"ui-icon-check",
54
                        click:function (){
232 lars 55
                            let url;
56
                            {if $supplier->id}
57
                            url="/bestellwesen/suppliers/{$supplier->id}/shipping";
274 lars 58
                            {else}
258 lars 59
                            url="Online-Shop/shippings"
232 lars 60
                            {/if}
278 lars 61
                            if($("#shippingID").val())
227 lars 62
                            {
278 lars 63
                                url+="/"+$("#shippingID").val()
227 lars 64
                            }
291 lars 65
                            /*$.post(url,$('#shippingForm').serializeArray(),function(){
282 lars 66
                                $('#editShippingDlg').dialog("close")
67
                            }).fail(function(json)
68
                            {
290 lars 69
                                console.log(json.response);
291 lars 70
                            });*/
71
                            $.ajax({
72
                                type:"post",
73
                                url:url,
74
                                data:$('#shippingForm').serializeArray(),
292 lars 75
                                dataType: 'json',
291 lars 76
                                success:function ()
77
                                {
78
                                    $('#editShippingDlg').dialog("close")
79
                                },
293 lars 80
                                error:function (response)
291 lars 81
                                {
299 lars 82
                                    $('#shippingError').html(response.responseJSON.message);
291 lars 83
                                    console.log(response.responseJSON);
84
                                }
85
                            })
227 lars 86
                        }
87
                    },
88
                    {
89
                        text:"Abbrechen",
90
                        icon:"ui-icon-cancel",
91
                        click:function (){
230 lars 92
                            $('#editShippingDlg').dialog("close");
227 lars 93
                        }
94
                    }
95
                ]
96
            })
230 lars 97
            $('#delShippingDlg').dialog({
227 lars 98
                autoOpen:false,
99
                modal:true,
100
                resizable:false,
101
                width:800,
102
                buttons:[
103
                    {
104
                        text:"Löschen",
105
                        icon:"ui-icon-trash",
106
                        click:function (){
268 lars 107
                            let url;
108
                            {if $supplier->id}
273 lars 109
                            url="/bestellwesen/suppliers/{$supplier->id}/shipping/"+$("#mId").html();
268 lars 110
                            {else}
273 lars 111
                            url="/Online-Shop/shippings/"+$("#mId").html();
268 lars 112
                            {/if}
233 lars 113
                            $.post(url,$('#delShippingForm').serializeArray(),function(){
228 lars 114
                                $('#delShippingDlg').dialog("close")
227 lars 115
                            });
116
                        }
117
                    },
118
                    {
119
                        text:"Abbrechen",
120
                        icon:"ui-icon-cancel",
121
                        click:function (){
228 lars 122
                            $('#delShippingDlg').dialog("close");
227 lars 123
                        }
124
                    }
125
                ]
126
            })
228 lars 127
            $("#newShipping").uibutton({
227 lars 128
                icons:{
129
                    primary:"ui-icon-plus"
130
                }
131
            }).click(function()
132
            {
240 lars 133
                let url="/bestellwesen/suppliers/{$supplier->id}/shipping/create/";
232 lars 134
                $('#editShippingDlg').load(url).dialog("open");
227 lars 135
            });
229 lars 136
            $(".editShipping").uibutton({
227 lars 137
                icons:{
138
                    primary:"ui-icon-pencil"
139
                }
140
            }).click(function() {
229 lars 141
 
142
                let url;
143
                {if $supplier->id}
144
                    url="/bestellwesen/suppliers/{$supplier->id}/shipping/"+$(this).attr("data-id")+"/edit/";
145
                {else}
259 lars 146
                    url="/Online-Shop/shippings/"+$(this).attr("data-id")+"/edit";
229 lars 147
                {/if}
228 lars 148
                $('#editShippingDlg').load(url).dialog("open");
227 lars 149
            });
231 lars 150
            $(".delShipping").uibutton({
227 lars 151
                icons:{
152
                    primary:"ui-icon-trash"
153
                }
154
            }).click(function() {
155
                let mId=$(this).attr("data-id");
231 lars 156
                let url;
157
                {if $supplier->id}
158
                url="/bestellwesen/suppliers/{$supplier->id}/shipping/"+$(this).attr("data-id");
159
                {else}
260 lars 160
                url="/Online-Shop/shippings/"+$(this).attr("data-id");
231 lars 161
                {/if}
162
                $.get(url,function(name) {
256 lars 163
                    $('#shippingName').html(name);
227 lars 164
                    $('#mId').html(mId);
232 lars 165
                    $('#delShippingDlg').dialog("open");
227 lars 166
                })
167
            })
168
 
169
        })
170
    </script>
228 lars 171
    <div id="editShippingDlg"></div>
172
    <div id="delShippingDlg" title="Lieferant löschen">
256 lars 173
        Wollen Sie <span id="shippingName"></span> wirklich löschen?
227 lars 174
        <span id="mId" style="display: none"></span>
233 lars 175
        <form id="delShippingForm">
227 lars 176
            <input type="hidden" name="_method" value="DELETE">
177
            <input type="hidden" name="_token" value="{csrf_token()}">
178
        </form>
179
    </div>
224 lars 180
    <!-- $Id: shipping.tpl 1678 2023-05-13 23:45:07Z lars $ END -->