HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall_new/buyercall/buyercall/static/js/pages/readyInbox.js
/*
 *  Document   : readyInbox.js
 *  Author     : pixelcave
 *  Description: Custom javascript code used in Inbox page
 */

var ReadyInbox = function() {

    return {
        init: function() {
            // Choose one of the highlight classes for the message list rows: 'active', 'success', 'warning', 'danger'
            var rowHighlightClass = 'warning';

            /* Add/Remove row highlighting on checkbox click */
            $('tbody input:checkbox').click(function() {
                var checkedStatus   = $(this).prop('checked');
                var tableRow        = $(this).closest('tr');

                if (checkedStatus) {
                    tableRow.addClass(rowHighlightClass);
                } else {
                    tableRow.removeClass(rowHighlightClass);
                }
            });

            /* Toggle on/off star buttons */
            $('.msg-fav-btn').click(function(){
                $(this).toggleClass('text-muted text-warning');
                $('i', this).toggleClass('fa-star-o fa-star');

                // You could give the star buttons unique ids related with each message
                // and use it - $(this).prop('id') - to update with your back end :-)
            });

            /* Show/Hide Message view - Just for preview */
            var inboxList = $('#message-list');
            var inboxView = $('#message-view');

            inboxList.find('h4 > a').on('click', function(){
                inboxList
                    .removeClass('animation-fadeInQuick')
                    .addClass('display-none');

                inboxView
                    .removeClass('display-none')
                    .addClass('animation-fadeInQuick');
            });

            inboxView.find('#message-view-back').on('click', function(){
                inboxView
                    .removeClass('animation-fadeInQuick')
                    .addClass('display-none');

                inboxList
                    .removeClass('display-none')
                    .addClass('animation-fadeInQuick');
            });
        }
    };
}();