Subversion Repositories SmartDukaan

Rev

Rev 30601 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30601 Rev 37282
Line 43... Line 43...
43
        </div>
43
        </div>
44
        <div class="col-lg-1">
44
        <div class="col-lg-1">
45
            <div>&nbsp;</div>
45
            <div>&nbsp;</div>
46
            <button type="button" class="btn btn-primary mk_pause_button">Active/Pause</button>
46
            <button type="button" class="btn btn-primary mk_pause_button">Active/Pause</button>
47
        </div>
47
        </div>
48
 
-
 
49
        <div class="col-lg-4">
-
 
50
            <div>&nbsp;</div>
-
 
51
            <button type="button" class="btn btn-primary mk_hotdeal_button">Add/Remove
-
 
52
                Hotdeals
-
 
53
            </button>
-
 
54
        </div>
-
 
55
    </div>
48
    </div>
56
</section>
49
</section>
57
<script type="text/javascript">
50
<script type="text/javascript">
58
    $(document).ready(function () {
51
    $(document).ready(function () {
59
        var start = moment().subtract(29, 'days');
52
        var start = moment().subtract(29, 'days');
Line 84... Line 77...
84
                    function (response) {
77
                    function (response) {
85
                        $('.mk_pause_button').data("id",
78
                        $('.mk_pause_button').data("id",
86
                                currentItem.catalogId);
79
                                currentItem.catalogId);
87
                        $('.mk_pause_button').data("description",
80
                        $('.mk_pause_button').data("description",
88
                                currentItem.itemDescription);
81
                                currentItem.itemDescription);
89
                        $('.mk_hotdeal_button').data("id",
-
 
90
                                currentItem.catalogId);
-
 
91
                        $('.mk_hotdeal_button').data("description",
-
 
92
                                currentItem.itemDescription);
-
 
93
 
-
 
94
                        response = JSON.parse(response);
82
                        response = JSON.parse(response);
95
                        $("#mop").val(response.mop);
83
                        $("#mop").val(response.mop);
96
                        $("#mrp").val(response.mrp);
84
                        $("#mrp").val(response.mrp);
97
                        $("#dp").val(response.dp);
85
                        $("#dp").val(response.dp);
98
                        $("#tp").val(response.tp);
86
                        $("#tp").val(response.tp);
Line 110... Line 98...
110
        $("#addPriceModal").on('hidden.bs.modal', function () {
98
        $("#addPriceModal").on('hidden.bs.modal', function () {
111
            $("#pdForm1").trigger("reset");
99
            $("#pdForm1").trigger("reset");
112
        });
100
        });
113
    });
101
    });
114
 
102
 
115
    $(document).on('click', 'button.mk_hotdeal_button', function () {
-
 
116
        let clickedButton = $(this);
-
 
117
        let description = clickedButton.data("description");
-
 
118
        let catalogId = clickedButton.data("id");
-
 
119
        getHotdealsForItems(catalogId, 0, `Add/Remove ${description}`, function (catalogIds) {
-
 
120
            console.log(catalogIds);
-
 
121
            if (catalogIds != null) {
-
 
122
                bootbox.confirm(`Confirm Update ${clickedButton.data("description")}?`, function (result) {
-
 
123
                    if (result) {
-
 
124
                        coloredItems.forEach(function (item) {
-
 
125
                            item.hotDeals = catalogIds.indexOf(item.id + "") >= 0;
-
 
126
                        });
-
 
127
                        doPostAjaxRequestWithJsonHandler(`${context}/indent/confirm-hotdeals-pause/`, JSON.stringify(coloredItems), function (response) {
-
 
128
                            if (response) {
-
 
129
                                bootbox.alert("Item/s  Updated Successfully");
-
 
130
                            } else {
-
 
131
                                bootbox.alert("Could not pause item");
-
 
132
                            }
-
 
133
                        });
-
 
134
                    }
-
 
135
                });
-
 
136
            }
-
 
137
        });
-
 
138
    });
-
 
139
</script>
103
</script>
140
104