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

Revision

Revision 311 | 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}
309 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
                            $.ajax({
66
                                type:"post",
67
                                url:url,
68
                                data:$('#shippingForm').serializeArray(),
292 lars 69
                                dataType: 'json',
291 lars 70
                                success:function ()
71
                                {
72
                                    $('#editShippingDlg').dialog("close")
73
                                },
293 lars 74
                                error:function (response)
291 lars 75
                                {
299 lars 76
                                    $('#shippingError').html(response.responseJSON.message);
300 lars 77
                                    let errors = response.responseJSON.errors
78
                                    if(errors.name)
79
                                    {
80
                                        $('#shippingNameError').html(errors.name)
81
                                    }
82
                                    if(errors.rank)
83
                                    {
84
                                        $('#shippingRankError').html(errors.rank)
85
                                    }
86
                                    if(errors.price)
87
                                    {
88
                                        $('#shippingPriceError').html(errors.price)
89
                                    }
291 lars 90
                                }
91
                            })
227 lars 92
                        }
93
                    },
94
                    {
95
                        text:"Abbrechen",
96
                        icon:"ui-icon-cancel",
97
                        click:function (){
230 lars 98
                            $('#editShippingDlg').dialog("close");
227 lars 99
                        }
100
                    }
101
                ]
102
            })
230 lars 103
            $('#delShippingDlg').dialog({
227 lars 104
                autoOpen:false,
105
                modal:true,
106
                resizable:false,
107
                width:800,
108
                buttons:[
109
                    {
110
                        text:"Löschen",
111
                        icon:"ui-icon-trash",
112
                        click:function (){
268 lars 113
                            let url;
114
                            {if $supplier->id}
273 lars 115
                            url="/bestellwesen/suppliers/{$supplier->id}/shipping/"+$("#mId").html();
268 lars 116
                            {else}
273 lars 117
                            url="/Online-Shop/shippings/"+$("#mId").html();
268 lars 118
                            {/if}
233 lars 119
                            $.post(url,$('#delShippingForm').serializeArray(),function(){
228 lars 120
                                $('#delShippingDlg').dialog("close")
227 lars 121
                            });
122
                        }
123
                    },
124
                    {
125
                        text:"Abbrechen",
126
                        icon:"ui-icon-cancel",
127
                        click:function (){
228 lars 128
                            $('#delShippingDlg').dialog("close");
227 lars 129
                        }
130
                    }
131
                ]
132
            })
228 lars 133
            $("#newShipping").uibutton({
227 lars 134
                icons:{
135
                    primary:"ui-icon-plus"
136
                }
137
            }).click(function()
138
            {
310 lars 139
                let url;
140
                {if $supplier->id}
141
                url="/bestellwesen/suppliers/{$supplier->id}/shipping/create/";
142
                {else}
311 lars 143
                url="/Online-Shop/shippings/create/";
310 lars 144
                {/if}
232 lars 145
                $('#editShippingDlg').load(url).dialog("open");
227 lars 146
            });
229 lars 147
            $(".editShipping").uibutton({
227 lars 148
                icons:{
149
                    primary:"ui-icon-pencil"
150
                }
151
            }).click(function() {
229 lars 152
 
153
                let url;
154
                {if $supplier->id}
155
                    url="/bestellwesen/suppliers/{$supplier->id}/shipping/"+$(this).attr("data-id")+"/edit/";
156
                {else}
259 lars 157
                    url="/Online-Shop/shippings/"+$(this).attr("data-id")+"/edit";
229 lars 158
                {/if}
228 lars 159
                $('#editShippingDlg').load(url).dialog("open");
227 lars 160
            });
231 lars 161
            $(".delShipping").uibutton({
227 lars 162
                icons:{
163
                    primary:"ui-icon-trash"
164
                }
165
            }).click(function() {
166
                let mId=$(this).attr("data-id");
231 lars 167
                let url;
168
                {if $supplier->id}
169
                url="/bestellwesen/suppliers/{$supplier->id}/shipping/"+$(this).attr("data-id");
170
                {else}
260 lars 171
                url="/Online-Shop/shippings/"+$(this).attr("data-id");
231 lars 172
                {/if}
173
                $.get(url,function(name) {
256 lars 174
                    $('#shippingName').html(name);
227 lars 175
                    $('#mId').html(mId);
232 lars 176
                    $('#delShippingDlg').dialog("open");
227 lars 177
                })
178
            })
179
 
180
        })
181
    </script>
228 lars 182
    <div id="editShippingDlg"></div>
183
    <div id="delShippingDlg" title="Lieferant löschen">
256 lars 184
        Wollen Sie <span id="shippingName"></span> wirklich löschen?
227 lars 185
        <span id="mId" style="display: none"></span>
233 lars 186
        <form id="delShippingForm">
227 lars 187
            <input type="hidden" name="_method" value="DELETE">
188
            <input type="hidden" name="_token" value="{csrf_token()}">
189
        </form>
190
    </div>
224 lars 191
    <!-- $Id: shipping.tpl 1678 2023-05-13 23:45:07Z lars $ END -->