qb-inventory

Supports qb-inventory 2.0.0+

  1. Replace generateTooltipContent function in qb-inventory/html/app.js with the following:


generateTooltipContent(item) {
            if (!item) {
                return "";
            }
        
            const itemLabel = item.info && item.info.label ? item.info.label : item.label;
        
            let content = `<div class="custom-tooltip"><div class="tooltip-header">${itemLabel}</div><hr class="tooltip-divider">`;
            const description = item.info && item.info.description 
                ? item.info.description.replace(/\n/g, "<br>") 
                : item.description 
                ? item.description.replace(/\n/g, "<br>") 
                : "No description available.";
        

        

            if (item.info && Object.keys(item.info).length > 0) {
                for (const [key, value] of Object.entries(item.info)) {
                    
                    if (item.name === "5g_adapter" && (key === "assignedSim" || key === "usageCount" || key === "label")) {
                        continue; 
                    }
        
                    if (item.name === "written_sim" && (key === "payoutValue" || key === "name_registered" || key === "label")) {
                        continue;
                    }
        
                    if (item.name === "written_card" && (key === 'label')) {
                        continue;
                    }

                    if (typeof value === "object") {
                        continue;
                    }
        
                    let valueStr = value;
        
                    // Special handling for "attachments" field
                    if (key === "attachments") {
                        valueStr = Object.keys(value).length > 0 ? "true" : "false";
                    }
        
                    content += `<div class="tooltip-info"><span class="tooltip-info-key">${this.formatKey(key)}:</span> ${valueStr}</div>`;
                }
            }
        
            content += `<div class="tooltip-description">${description}</div>`;
            content += `<div class="tooltip-weight"><i class="fas fa-weight-hanging"></i> ${item.weight !== undefined && item.weight !== null ? (item.weight / 1000).toFixed(1) : "N/A"}kg</div>`;
        
            content += `</div>`;
            return content;
        },
        
  1. Install the following items into qb-core/shared/items.lua

  1. Drag all the images from item_images into qb-inventory/html/images

Last updated