source: extensions/MyPiwiShop/admin/template/js/batchmanagerunit.js @ 27568

Last change on this file since 27568 was 27568, checked in by Miklfe, 10 years ago
File size: 2.5 KB
Line 
1(function($) {
2        $(document).ready(function(){
3                table();
4               
5                function table(){
6                        $oTable = $('.product_list').dataTable({
7                                "bStateSave": true,
8                                "bAutoWidth":   false,
9                                "aoColumns" : [
10                                                        { sWidth: '2%','sClass': 'center', 'bSortable': false, },
11                                                        { sWidth: '40%','sClass': 'product_row'  },
12                                                        { sWidth: '40%'},
13                                                        { sWidth: '7%' },
14                                                        ],
15                                "oLanguage": {
16                                        "sProcessing"           : sProcessing,
17                                        "sSearch"                       : '<span class="icon-search"></span>' + sSearch,
18                                        "sLengthMenu"           : sLengthMenu,
19                                        "sInfo"                         : sInfo,
20                                        "sInfoEmpty"            : sInfoEmpty,
21                                        "sInfoFiltered"         : sInfoFiltered,
22                                        "sInfoPostFix"          : "",
23                                        "sLoadingRecords"       : sLoadingRecords,
24                                        "sZeroRecords"          : sZeroRecords,
25                                        "oPaginate": {
26                                                "sFirst"                : sFirst,
27                                                "sPrevious"             : '&larr;' + sPrevious,
28                                                "sNext"                 : sNext+' &rarr;',
29                                                "sLast"                 : sLast,
30                                        },
31                                },
32                        });
33                }
34               
35                $(document).on('click','.submitchange', function() {
36                                var $form       = $(this).parent(),
37                                        $formCl = $form.attr('class'),
38                                        $sData  = $('input', $form).serialize();
39                                $.ajax({
40                                        type    : 'post',
41                                        data    : $sData,
42                                        success : function(){
43                                                var $info = $($form).find('.infos');
44                                                $info.show();
45                                                setTimeout(function() {
46                                                        $($info).hide()
47                                                }, 3000);
48                                        }
49                                })     
50                        return false;
51                } ); 
52               
53                $(document).on('click', '.prodSelectAll', function () {
54                        var $parent = $(this).parents('.MyPiwiShopBatchUnit');
55                        $('.product_list input[type=checkbox]', $parent).prop('checked', true);
56                        delet_button()
57                        return false;
58                });
59
60                $(document).on('click', '.prodSelectNone', function () {
61                        var $parent = $(this).parents('.MyPiwiShopBatchUnit');
62                        $('.product_list input[type=checkbox]', $parent).prop('checked', false);
63                        delet_button()
64
65                        return false;
66                });
67
68                $(document).on('click', '.prodSelectInvert', function () {
69                        var $parent = $(this).parents('.MyPiwiShopBatchUnit');
70                        $('.product_list input[type=checkbox]', $parent).each(function(){
71                                if($(this).is (':checked')){
72                                        $(this).prop('checked', false);
73                                }else{
74                                        $(this).prop('checked', true);
75                                }
76                        delet_button()
77                        });
78                        return false;
79                });
80               
81                $(document).on('click', '.showProd', function(){
82                        $(this).next('div').toggle();
83                        return false;
84                })
85               
86                $(document).on('change', '.product_list input[type=checkbox]', function () {
87                        delet_button()
88                });
89                               
90                function delet_button(){
91                        $('.submitchange').css('display','block');
92                };
93
94        });
95})(jQuery);
Note: See TracBrowser for help on using the repository browser.