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

Revision

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