Subversion Repositories SmartDukaan

Rev

Rev 37194 | Rev 37458 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37194 Rev 37282
Line 785... Line 785...
785
                checkbox.checked = coloredItems[index].active;
785
                checkbox.checked = coloredItems[index].active;
786
            });
786
            });
787
    });
787
    });
788
}
788
}
789
 
789
 
790
function getHotdealsForItems(catalogId, itemId, description, callback) {
-
 
791
    bootBoxObj = {
-
 
792
        size: "small",
-
 
793
        className: "item-wrapper",
-
 
794
        title: description,
-
 
795
        callback: callback,
-
 
796
        inputType: 'checkbox',
-
 
797
    }
-
 
798
    doGetAjaxRequestHandler(context + "/hotdealsitemsByCatalogId?catalogId="
-
 
799
        + catalogId + "&itemId=" + itemId, function (response) {
-
 
800
        coloredItems = JSON.parse(response);
-
 
801
        inputOptions = [{
-
 
802
            text: "All",
-
 
803
            value: "0",
-
 
804
            onclick: "toggleAll('itemIds')"
-
 
805
        }];
-
 
806
        coloredItems.forEach(function (item) {
-
 
807
            inputOptions.push({
-
 
808
                text: item.color,
-
 
809
                value: item.id,
-
 
810
                selected: item.hotDeals
-
 
811
            });
-
 
812
        });
-
 
813
        bootBoxObj['inputOptions'] = inputOptions;
-
 
814
        promptObj = bootbox.prompt(bootBoxObj);
-
 
815
        promptObj.modal('show')
-
 
816
        $('.item-wrapper').find("input[type='checkbox']").slice(1).each(
-
 
817
            function (index, checkbox) {
-
 
818
                checkbox.checked = coloredItems[index].hotDeals;
-
 
819
            });
-
 
820
    });
-
 
821
}
-
 
822
 
-
 
823
$(document).on('change', ".item-wrapper input[type='checkbox']:first",
790
$(document).on('change', ".item-wrapper input[type='checkbox']:first",
824
    function () {
791
    function () {
825
        if (this.value == "0") {
792
        if (this.value == "0") {
826
            $(this).closest('.item-wrapper').find("input[type='checkbox']")
793
            $(this).closest('.item-wrapper').find("input[type='checkbox']")
827
                .slice(1).prop('checked', $(this).prop('checked'));
794
                .slice(1).prop('checked', $(this).prop('checked'));