Implement ultra-friendly selection wizard and 15-category hierarchal catalog

This commit is contained in:
lucio committed 2026-05-21 02:31:23 -07:00
1 parent 3d7c232b94
commit 92ebb0f65a
6 files changed
+1446 -115

No files matched your search

+613
View File
@@ -0,0 +1,613 @@
// ==============================================================================
// SOLIS CATALOG CONFIGURATION FILE
// ==============================================================================
// This file contains a hierarchical catalog of categories, items, and popular brands
// designed to make the asset creation process incredibly fast and user-friendly.
//
// STRUCTURE:
// The catalog is a JSON array of Category objects.
// Each Category has:
// - "id": A unique string key for the category (e.g. "tech")
// - "name": A human-readable name of the category (e.g. "Tech & Electronics")
// - "color": A tailored accent color hex/hsl for premium visual button rendering
// - "items": An array of Item objects.
//
// Each Item has:
// - "name": The singular/plural name of the item type (e.g. "Smartphones")
// - "brands": An array of at least 8 popular brands for that item.
//
// HOW AGENTS AND USERS CAN EDIT THIS FILE:
// 1. To add a Category: Append an object to the top-level array with a unique "id", "name", "color", and list of "items".
// 2. To add an Item: Append an object to the "items" array under a category. Ensure it has a "name" and at least 8 "brands".
// 3. To add a Brand: Append a brand string to the "brands" array under an item.
//
// Keep this structure human-readable. Lines starting with '//' are comments and will
// be stripped dynamically during app startup before decoding standard JSON.
// ==============================================================================
[
{
"id": "tech",
"name": "Tech & Electronics",
"color": "#3b82f6",
"items": [
{
"name": "Smartphones",
"brands": ["Apple", "Samsung", "Google", "OnePlus", "Xiaomi", "Sony", "Motorola", "Oppo"]
},
{
"name": "Laptops",
"brands": ["Dell", "HP", "Lenovo", "Apple", "ASUS", "Acer", "Microsoft", "MSI"]
},
{
"name": "Tablets",
"brands": ["Apple", "Samsung", "Lenovo", "Microsoft", "Amazon", "Huawei", "Xiaomi", "OnePlus"]
},
{
"name": "Smartwatches",
"brands": ["Apple", "Samsung", "Garmin", "Fitbit", "Fossil", "Amazfit", "Huawei", "Google"]
},
{
"name": "Desktop Computers",
"brands": ["Dell", "HP", "Lenovo", "Apple", "ASUS", "Acer", "Corsair", "CyberPowerPC"]
},
{
"name": "Computer Monitors",
"brands": ["Dell", "LG", "Samsung", "ASUS", "Acer", "BenQ", "HP", "MSI"]
},
{
"name": "Keyboards",
"brands": ["Logitech", "SteelSeries", "Razer", "Corsair", "Keychron", "Ducky", "HyperX", "Redragon"]
},
{
"name": "Computer Mice",
"brands": ["Logitech", "Razer", "Corsair", "SteelSeries", "HyperX", "Glorious", "ASUS", "Roccat"]
}
]
},
{
"id": "kitchen",
"name": "Kitchen Appliances",
"color": "#ec4899",
"items": [
{
"name": "Coffee Makers",
"brands": ["Keurig", "Nespresso", "Breville", "De'Longhi", "Cuisinart", "Mr. Coffee", "Philips", "Krups"]
},
{
"name": "Blenders",
"brands": ["Vitamix", "Ninja", "Blendtec", "KitchenAid", "NutriBullet", "Oster", "Breville", "Cuisinart"]
},
{
"name": "Toasters",
"brands": ["Breville", "Cuisinart", "KitchenAid", "Black+Decker", "Hamilton Beach", "SMEG", "Zojirushi", "Oster"]
},
{
"name": "Microwaves",
"brands": ["Panasonic", "Toshiba", "Samsung", "LG", "GE", "Sharp", "Whirlpool", "Farberware"]
},
{
"name": "Air Fryers",
"brands": ["Ninja", "Instant Pot", "Cosori", "Philips", "Chefman", "Tefal", "Breville", "GoWISE"]
},
{
"name": "Food Processors",
"brands": ["Cuisinart", "Breville", "KitchenAid", "Ninja", "Hamilton Beach", "Braun", "Magimix", "Kenwood"]
},
{
"name": "Juicers",
"brands": ["Breville", "Omega", "Hurom", "Hamilton Beach", "Cuisinart", "Nama", "Tribest", "Mueller"]
},
{
"name": "Rice Cookers",
"brands": ["Zojirushi", "Tiger", "Instant Pot", "Cuckoo", "Hamilton Beach", "Aroma", "Panasonic", "Toshiba"]
}
]
},
{
"id": "furniture",
"name": "Furniture",
"color": "#8b5cf6",
"items": [
{
"name": "Office Chairs",
"brands": ["Herman Miller", "Steelcase", "Ergohuman", "Autonomous", "Secretlab", "Branch", "Haworth", "Hon"]
},
{
"name": "Desks",
"brands": ["IKEA", "Uplift", "Jarvis", "FlexiSpot", "Branch", "Fully", "Sauder", "Bush Furniture"]
},
{
"name": "Sofas",
"brands": ["West Elm", "Article", "Joybird", "IKEA", "Pottery Barn", "Wayfair", "La-Z-Boy", "Crate & Barrel"]
},
{
"name": "Dining Tables",
"brands": ["West Elm", "Pottery Barn", "IKEA", "Wayfair", "Crate & Barrel", "Floyd", "Castlery", "Rove Concepts"]
},
{
"name": "Mattresses",
"brands": ["Casper", "Purple", "Tempur-Pedic", "Nectar", "Saatva", "Helix", "Tuft & Needle", "Sealy"]
},
{
"name": "Bookshelves",
"brands": ["IKEA", "West Elm", "Wayfair", "CB2", "Crate & Barrel", "Pottery Barn", "Target", "Sauder"]
},
{
"name": "Coffee Tables",
"brands": ["West Elm", "IKEA", "Wayfair", "CB2", "Article", "Pottery Barn", "Target", "Floyd"]
},
{
"name": "Bed Frames",
"brands": ["Zinus", "Thuma", "IKEA", "West Elm", "Tuft & Needle", "Wayfair", "Casper", "Floyd"]
}
]
},
{
"id": "office",
"name": "Office Supplies",
"color": "#06b6d4",
"items": [
{
"name": "Paper Shredders",
"brands": ["Fellowes", "AmazonBasics", "Aurora", "Bonsaii", "Swingline", "Royal", "Sentinel", "GBC"]
},
{
"name": "Label Printers",
"brands": ["Dymo", "Brother", "Rollo", "Munbyn", "Phomemo", "Zebra", "Epson", "Arkscan"]
},
{
"name": "Staplers",
"brands": ["Swingline", "Bostitch", "Paper Mate", "Rapid", "Rexel", "Maped", "Officemate", "AmazonBasics"]
},
{
"name": "Notebooks",
"brands": ["Moleskine", "Leuchtturm1917", "Rhodia", "Field Notes", "Rocketbook", "Clairefontaine", "Paperchase", "Oxford"]
},
{
"name": "Pens",
"brands": ["Pilot", "Uni-ball", "Pentel", "Zebra", "Parker", "Lamy", "Montblanc", "Sharpie"]
},
{
"name": "Whiteboards",
"brands": ["Quartet", "UBrands", "Maxtek", "Viz-Pro", "Audio-Visual Direct", "BoardGeeks", "Lockways", "AmazonBasics"]
},
{
"name": "Desk Organizers",
"brands": ["Rolodex", "Jerry & Maggie", "Simple Trending", "Mind Reader", "DecoBros", "AmazonBasics", "Safco", "Deli"]
},
{
"name": "Calculators",
"brands": ["Texas Instruments", "Casio", "HP", "Sharp", "Canon", "Citizen", "Victor", "Datexx"]
}
]
},
{
"id": "tools",
"name": "Tools & Hardware",
"color": "#f97316",
"items": [
{
"name": "Power Drills",
"brands": ["DeWalt", "Milwaukee", "Makita", "Bosch", "Ryobi", "Black+Decker", "Porter-Cable", "Craftsman"]
},
{
"name": "Screwdriver Sets",
"brands": ["Wera", "Wiha", "Klein Tools", "Craftsman", "Stanley", "DeWalt", "Milwaukee", "Gearwrench"]
},
{
"name": "Hand Tool Sets",
"brands": ["Stanley", "Craftsman", "DeWalt", "Workpro", "Crescent", "Husky", "Kobalt", "Gearwrench"]
},
{
"name": "Tape Measures",
"brands": ["Stanley", "Lufkin", "Milwaukee", "Komelon", "Craftsman", "DeWalt", "Tajima", "Starrett"]
},
{
"name": "Hammers",
"brands": ["Estwing", "Stanley", "Stiletto", "Vaughan", "Milwaukee", "DeWalt", "Craftsman", "IRWIN"]
},
{
"name": "Wrenches",
"brands": ["Gearwrench", "Crescent", "Tekton", "Craftsman", "Milwaukee", "DeWalt", "Stanley", "Proto"]
},
{
"name": "Pliers",
"brands": ["Knipex", "Channellock", "Klein Tools", "IRWIN", "Milwaukee", "DeWalt", "Stanley", "Crescent"]
},
{
"name": "Utility Knives",
"brands": ["Stanley", "OLFA", "Milwaukee", "DeWalt", "Gerber", "Fiskars", "Workpro", "ToughBuilt"]
}
]
},
{
"id": "fitness",
"name": "Fitness & Sports",
"color": "#10b981",
"items": [
{
"name": "Treadmills",
"brands": ["Peloton", "NordicTrack", "Sole Fitness", "ProForm", "Horizon Fitness", "Bowflex", "Life Fitness", "Sunny Health"]
},
{
"name": "Exercise Bikes",
"brands": ["Peloton", "Schwinn", "Bowflex", "NordicTrack", "Keiser", "Sunny Health", "Echelon", "Stages"]
},
{
"name": "Dumbbells",
"brands": ["Bowflex", "PowerBlock", "Rogue Fitness", "CAP Barbell", "Yes4All", "AmazonBasics", "Titan Fitness", "Rep Fitness"]
},
{
"name": "Yoga Mats",
"brands": ["Lululemon", "Manduka", "Gaiam", "Jade Yoga", "Alo Yoga", "Jade", "Hugger Mugger", "Retrospec"]
},
{
"name": "Resistance Bands",
"brands": ["Theraband", "Fit Simplify", "Rogue Fitness", "Black Mountain", "WODFitters", "Serious Steel", "Undersun", "Peach Bands"]
},
{
"name": "Fitness Trackers",
"brands": ["Fitbit", "Garmin", "Apple", "Whoop", "Polar", "Coros", "Withings", "Amazfit"]
},
{
"name": "Kettlebells",
"brands": ["Rogue Fitness", "Kettlebell Kings", "CAP Barbell", "Rep Fitness", "Titan Fitness", "Yes4All", "Bowflex", "Eleiko"]
},
{
"name": "Foam Rollers",
"brands": ["TriggerPoint", "OPTP", "LuxFit", "AmazonBasics", "Hyperice", "Grid", "RumbleRoller", "Gaiam"]
}
]
},
{
"id": "entertainment",
"name": "Home Entertainment",
"color": "#eab308",
"items": [
{
"name": "Televisions",
"brands": ["LG", "Samsung", "Sony", "TCL", "Hisense", "Vizio", "Philips", "Panasonic"]
},
{
"name": "Soundbars",
"brands": ["Sonos", "Bose", "Sony", "Samsung", "JBL", "Vizio", "Yamaha", "Sennheiser"]
},
{
"name": "Streaming Devices",
"brands": ["Roku", "Apple", "Amazon", "Google", "Nvidia", "Xiaomi", "Chromecast", "Fire TV"]
},
{
"name": "Projectors",
"brands": ["Epson", "BenQ", "Optoma", "Anker", "Sony", "ViewSonic", "LG", "XGIMI"]
},
{
"name": "VR Headsets",
"brands": ["Meta", "HTC", "Sony", "Valve", "HP", "Pimax", "Apple", "Pico"]
},
{
"name": "Game Consoles",
"brands": ["Sony", "Microsoft", "Nintendo", "Valve", "ASUS", "Lenovo", "NVIDIA", "Sega"]
},
{
"name": "DVD/Blu-ray Players",
"brands": ["Sony", "Panasonic", "LG", "Samsung", "Pioneer", "Yamaha", "Denon", "Philips"]
},
{
"name": "Remote Controls",
"brands": ["Logitech", "SofaBaton", "Inteset", "GE", "Philips", "RCA", "One For All", "Broadlink"]
}
]
},
{
"id": "outdoor",
"name": "Gardening & Outdoor",
"color": "#14b8a6",
"items": [
{
"name": "Lawn Mowers",
"brands": ["Greenworks", "EGO Power+", "Ryobi", "Honda", "Toro", "John Deere", "Husqvarna", "Worx"]
},
{
"name": "Leaf Blowers",
"brands": ["EGO Power+", "Ryobi", "Greenworks", "DeWalt", "Makita", "Milwaukee", "Husqvarna", "Black+Decker"]
},
{
"name": "Pruning Shears",
"brands": ["Felco", "Fiskars", "Corona", "Okatsune", "ARS", "Gardena", "Gonicc", "Spear & Jackson"]
},
{
"name": "Garden Hoses",
"brands": ["Flexzilla", "Gilmour", "Teknor Apex", "Bionic Steel", "Zero-G", "GrowGreen", "Briggs & Stratton", "Gardena"]
},
{
"name": "Watering Cans",
"brands": ["Haws", "Union Products", "Bosmere", "Bloem", "Gardena", "Novelty", "Behrens", "Fiskars"]
},
{
"name": "Wheelbarrows",
"brands": ["Worx", "Gorilla Carts", "Marathon", "True Temper", "Jackson", "Polar Trailer", "Ames", "Rubbermaid"]
},
{
"name": "Weed Eaters",
"brands": ["Ryobi", "EGO Power+", "Greenworks", "DeWalt", "Makita", "Milwaukee", "Husqvarna", "Black+Decker"]
},
{
"name": "Patio Heaters",
"brands": ["Hampton Bay", "Fire Sense", "AZ Patio Heaters", "Sunjoy", "Hiland", "Pamapic", "Dr. Infrared", "Bromic"]
}
]
},
{
"id": "lighting",
"name": "Lighting & Lamps",
"color": "#f59e0b",
"items": [
{
"name": "Desk Lamps",
"brands": ["BenQ", "TaoTronics", "Philips", "Lightblade", "IKEA", "Dyson", "Lepro", "Globe Electric"]
},
{
"name": "Floor Lamps",
"brands": ["Brightech", "IKEA", "Adesso", "Globe Electric", "Kenroy Home", "Safavieh", "Target", "West Elm"]
},
{
"name": "Smart Bulbs",
"brands": ["Philips Hue", "LIFX", "TP-Link Kasa", "Nanoleaf", "Wyze", "Sengled", "Govee", "Yeelight"]
},
{
"name": "String Lights",
"brands": ["Brightech", "Addlon", "XMCOSY+", "Govee", "Philips", "Feit Electric", "Hampton Bay", "Pottery Barn"]
},
{
"name": "Flashlights",
"brands": ["Olight", "Fenix", "Anker", "Streamlight", "SureFire", "Maglite", "Coast", "ThruNite"]
},
{
"name": "Night Lights",
"brands": ["Eufy", "GE", "VAVA", "Hatch", "Casper", "Philips", "Lumos", "Xiaomi"]
},
{
"name": "Ceiling Fans",
"brands": ["Hunter", "Casablanca", "Minka-Aire", "Honeywell", "Prominence Home", "Westinghouse", "Big Ass Fans", "Harbor Breeze"]
},
{
"name": "Grow Lights",
"brands": ["Spider Farmer", "Mars Hydro", "VIPARSPECTRA", "Sansi", "Feit Electric", "GE", "Roleadro", "Vivosun"]
}
]
},
{
"id": "cleaning",
"name": "Cleaning & Laundry",
"color": "#6366f1",
"items": [
{
"name": "Vacuum Cleaners",
"brands": ["Dyson", "Shark", "Miele", "Bissell", "Hoover", "iRobot", "Roborock", "Eufy"]
},
{
"name": "Steam Mops",
"brands": ["Bissell", "Shark", "PurSteam", "Black+Decker", "O-Cedar", "Dupray", "Reliable", "Euroflex"]
},
{
"name": "Air Purifiers",
"brands": ["Coway", "Levoit", "Blueair", "Dyson", "Honeywell", "Winix", "Alen", "Rabbit Air"]
},
{
"name": "Washing Machines",
"brands": ["LG", "Samsung", "Whirlpool", "Maytag", "GE", "Electrolux", "Bosch", "Speed Queen"]
},
{
"name": "Clothes Dryers",
"brands": ["LG", "Samsung", "Whirlpool", "Maytag", "GE", "Electrolux", "Bosch", "Speed Queen"]
},
{
"name": "Ironing Boards",
"brands": ["Brabantia", "Joseph Joseph", "Minky", "Household Essentials", "Bartnelli", "Reliable", "Whitmor", "Homz"]
},
{
"name": "Steam Irons",
"brands": ["Rowenta", "Chi", "Black+Decker", "Singer", "Panasonic", "Sunbeam", "Hamilton Beach", "Tefal"]
},
{
"name": "Robot Mops",
"brands": ["iRobot", "Roborock", "ECOVACS", "Narwal", "Shark", "Eufy", "Bissell", "Yeedi"]
}
]
},
{
"id": "smarthome",
"name": "Smart Home Devices",
"color": "#059669",
"items": [
{
"name": "Smart Speakers",
"brands": ["Amazon", "Google", "Apple", "Sonos", "Bose", "JBL", "Harman Kardon", "Lenovo"]
},
{
"name": "Smart Thermostats",
"brands": ["Nest", "Ecobee", "Honeywell", "Emerson", "Wyze", "Mysa", "Bosch", "Lux"]
},
{
"name": "Security Cameras",
"brands": ["Ring", "Nest", "Arlo", "Eufy", "Wyze", "Blink", "Reolink", "TP-Link Tapo"]
},
{
"name": "Smart Doorlocks",
"brands": ["August", "Schlage", "Yale", "Kwikset", "Ultraloq", "Eufy", "Wyze", "Aqara"]
},
{
"name": "Video Doorbells",
"brands": ["Ring", "Nest", "Eufy", "Arlo", "Blink", "Logitech", "Wyze", "Amcrest"]
},
{
"name": "Smart Plugs",
"brands": ["TP-Link Kasa", "Wemo", "Wyze", "Meross", "Eve", "Philips Hue", "Sonoff", "Aqara"]
},
{
"name": "Robot Vacuums",
"brands": ["iRobot", "Roborock", "Eufy", "Shark", "ECOVACS", "Dreametech", "Neato", "Wyze"]
},
{
"name": "Smart Displays",
"brands": ["Amazon", "Google", "Facebook Portal", "Lenovo", "Apple", "Xiaomi", "Nest", "Harman Kardon"]
}
]
},
{
"id": "stationery",
"name": "Books & Stationery",
"color": "#a855f7",
"items": [
{
"name": "Notebooks",
"brands": ["Moleskine", "Leuchtturm1917", "Rhodia", "Field Notes", "Rocketbook", "Clairefontaine", "Midori", "Hobonichi"]
},
{
"name": "Planners",
"brands": ["Erin Condren", "Happy Planner", "Passion Planner", "Panda Planner", "Hobonichi", "Filofax", "Moleskine", "FranklinPlanner"]
},
{
"name": "Sketchbooks",
"brands": ["Strathmore", "Canson", "Moleskine", "Leda Art Supply", "Arteza", "Derwent", "Hahnemühle", "Archer & Olive"]
},
{
"name": "Colored Pencils",
"brands": ["Prismacolor", "Faber-Castell", "Derwent", "Arteza", "Staedtler", "Caran d'Ache", "Castle Art", "Crayola"]
},
{
"name": "Fountain Pens",
"brands": ["Lamy", "Pilot", "Sailor", "TWSBI", "Platinum", "Kaweco", "Parker", "Pelikan"]
},
{
"name": "Highlighters",
"brands": ["Stabilo", "Zebra", "Sharpie", "Pilot", "Faber-Castell", "Bic", "Pentel", "Kokuyo"]
},
{
"name": "Sticky Notes",
"brands": ["Post-it", "AmazonBasics", "Scotch", "Mead", "3M", "Staples", "Muji", "Milan"]
},
{
"name": "Pencil Cases",
"brands": ["Eastpak", "Lihit Lab", "Kipling", "Muji", "Homecube", "Vaschy", "ZIPIT", "Kokuyo"]
}
]
},
{
"id": "security",
"name": "Security & Safety",
"color": "#ef4444",
"items": [
{
"name": "Smoke Detectors",
"brands": ["Kidde", "First Alert", "Nest", "X-Sense", "Google", "Honeywell", "Onelink", "Firex"]
},
{
"name": "Fire Extinguishers",
"brands": ["Kidde", "First Alert", "Amerex", "Buckeye", "Badger", "Shield", "H3R Performance", "Fireade"]
},
{
"name": "Safes",
"brands": ["SentrySafe", "Honeywell", "AmazonBasics", "Tigerking", "Verifi", "Stealth", "Barska", "Yale"]
},
{
"name": "First Aid Kits",
"brands": ["Johnson & Johnson", "Coleman", "Swiss Safe", "Be Smart Get Prepared", "Adventure Medical", "Protect Life", "M2 Basics", "First Aid Only"]
},
{
"name": "Safety Flashlights",
"brands": ["Maglite", "Streamlight", "Pelican", "Olight", "Fenix", "SureFire", "Black Diamond", "Petzl"]
},
{
"name": "Door Barricades",
"brands": ["Nightlock", "Buddybar", "Haven", "U-Bar", "Master Lock", "Securityman", "Sabre", "Defender Security"]
},
{
"name": "CO Detectors",
"brands": ["Kidde", "First Alert", "Nest", "X-Sense", "Honeywell", "Onelink", "Nighthawk", "Universal Security"]
},
{
"name": "Motion Sensors",
"brands": ["Ring", "Nest", "Philips Hue", "Eve", "Aqara", "Wyze", "Bosch", "Ecolink"]
}
]
},
{
"id": "storage",
"name": "Storage & Organization",
"color": "#22c55e",
"items": [
{
"name": "Plastic Bins",
"brands": ["Sterilite", "Rubbermaid", "IRIS USA", "Homz", "Akro-Mils", "ClearStyle", "Hefty", "Bella Storage"]
},
{
"name": "Storage Racks",
"brands": ["Gladiator", "Muscle Rack", "Seville Classics", "AmazonBasics", "FLEXIMOUNTS", "DeWalt", "Husky", "Trinity"]
},
{
"name": "Shoe Racks",
"brands": ["Seville Classics", "IKEA", "Songmics", "Simple Houseware", "Whitmor", "Honey-Can-Do", "AmazonBasics", "ClosetMaid"]
},
{
"name": "Closet Organizers",
"brands": ["Rubbermaid", "ClosetMaid", "Elfa", "IKEA", "Seville Classics", "Easy Track", "Songmics", "Honey-Can-Do"]
},
{
"name": "Food Containers",
"brands": ["Rubbermaid", "Tupperware", "Pyrex", "Glasslock", "OXO", "LocknLock", "Snapware", "Joseph Joseph"]
},
{
"name": "Hangers",
"brands": ["AmazonBasics", "Zober", "Songmics", "Velvet", "Whitmor", "Honey-Can-Do", "Mainstays", "Utopia Home"]
},
{
"name": "Cable Organizers",
"brands": ["J Channel", "D-Line", "Cordmate", "OHILL", "SOULWIT", "Baskiss", "Command", "Cable Clip"]
},
{
"name": "Toolboxes",
"brands": ["Stanley", "DeWalt", "Milwaukee", "Craftsman", "Husky", "Keter", "Ridgid", "Toyo"]
}
]
},
{
"id": "audio",
"name": "Audio & Instruments",
"color": "#4f46e5",
"items": [
{
"name": "Headphones",
"brands": ["Sony", "Bose", "Sennheiser", "Audio-Technica", "Apple", "Beyerdynamic", "JBL", "Shure"]
},
{
"name": "Microphones",
"brands": ["Blue", "Shure", "Audio-Technica", "Rode", "Sennheiser", "Elgato", "HyperX", "Neumann"]
},
{
"name": "Bluetooth Speakers",
"brands": ["JBL", "Ultimate Ears", "Bose", "Sony", "Anker", "Marshall", "Sonos", "Bang & Olufsen"]
},
{
"name": "Keyboards & Pianos",
"brands": ["Yamaha", "Roland", "Casio", "Korg", "Nord", "Alesis", "Kawai", "Akai"]
},
{
"name": "Guitars",
"brands": ["Fender", "Gibson", "Taylor", "Martin", "Ibanez", "PRS", "Yamaha", "Epiphone"]
},
{
"name": "Audio Interfaces",
"brands": ["Focusrite", "Universal Audio", "PreSonus", "MOTU", "Audient", "Behringer", "SSL", "Mackie"]
},
{
"name": "Studio Monitors",
"brands": ["KRK", "Yamaha", "JBL", "PreSonus", "Genelec", "Adam Audio", "Kali Audio", "Mackie"]
},
{
"name": "Turntables",
"brands": ["Audio-Technica", "Pro-Ject", "Sony", "Denon", "Technics", "Pioneer", "Victrola", "Crosley"]
}
]
}
]
+56
View File
@@ -0,0 +1,56 @@
package config
import (
"bufio"
"encoding/json"
"os"
"strings"
)
// CatalogCategory represents a high-level inventory category (e.g. Tech, Kitchen)
type CatalogCategory struct {
ID string `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
Items []CatalogItem `json:"items"`
}
// CatalogItem represents a popular item type and its associated popular brands
type CatalogItem struct {
Name string `json:"name"`
Brands []string `json:"brands"`
}
// LoadCatalog reads a catalog.json file, dynamically strips comments starting with '//' or '#',
// and decodes the cleaned JSON contents into memory.
func LoadCatalog(path string) ([]CatalogCategory, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer file.Close()
var sb strings.Builder
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
trimmed := strings.TrimSpace(line)
// Ignore comment lines starting with '//' or '#'
if strings.HasPrefix(trimmed, "//") || strings.HasPrefix(trimmed, "#") {
continue
}
sb.WriteString(line)
sb.WriteRune('\n')
}
if err := scanner.Err(); err != nil {
return nil, err
}
var catalog []CatalogCategory
if err := json.Unmarshal([]byte(sb.String()), &catalog); err != nil {
return nil, err
}
return catalog, nil
}
+14
View File
@@ -363,3 +363,17 @@ func (d *DB) arrangeTags(roomName string, tags []Tag) []Tag {
// Prepend roomTag
return append([]Tag{*roomTag}, otherTags...)
}
// GetLastUsedLocationID returns the location ID of the most recently created/added item.
// If no items exist or none have a location assigned, it defaults to 1 (Default Room).
func (d *DB) GetLastUsedLocationID() (int64, error) {
var locID int64
err := d.Conn.QueryRow("SELECT location_id FROM items WHERE location_id IS NOT NULL ORDER BY id DESC LIMIT 1").Scan(&locID)
if err != nil {
if err == sql.ErrNoRows {
return 1, nil // Fallback to Default Room
}
return 0, err
}
return locID, nil
}
+87 -5
View File
@@ -43,6 +43,7 @@ type PageData struct {
SearchQuery string
SelectedStatus string
SelectedLocation int64
CatalogJSON string
}
// ==========================================
@@ -248,12 +249,18 @@ func (s *Server) handleItemNew(w http.ResponseWriter, r *http.Request) {
locations, _ := s.db.ListLocations()
tags, _ := s.db.ListTags()
catalogJSON, err := json.Marshal(s.catalog)
if err != nil {
catalogJSON = []byte("[]")
}
data := PageData{
CSRFToken: csrfToken(w, r),
ActiveNav: "items",
Locations: locations,
Tags: tags,
FormMode: true,
CSRFToken: csrfToken(w, r),
ActiveNav: "items",
Locations: locations,
Tags: tags,
FormMode: true,
CatalogJSON: string(catalogJSON),
}
renderTemplate(w, "items.html", data)
}
@@ -266,6 +273,81 @@ func (s *Server) handleItemCreate(w http.ResponseWriter, r *http.Request) {
return
}
if r.FormValue("wizard_flow") == "true" {
category := r.FormValue("category")
itemVal := r.FormValue("item")
brand := r.FormValue("brand")
// 1. Determine the last used location ID
lastLocID, err := s.db.GetLastUsedLocationID()
if err != nil {
lastLocID = 1 // Default Room
}
locID := sql.NullInt64{Int64: lastLocID, Valid: true}
// 2. Format a beautiful name
var name string
if brand != "" && brand != "Other" && itemVal != "" && itemVal != "Other" {
name = brand + " " + itemVal
} else if itemVal != "" && itemVal != "Other" {
name = itemVal
} else if category != "" && category != "Other" {
// Find category name from ID
catName := category
for _, cat := range s.catalog {
if cat.ID == category {
catName = cat.Name
break
}
}
name = catName + " Asset"
} else {
name = "New Asset"
}
// 3. Resolve the room tag automatically
var tagIDs []int64
tagIDs = s.resolveRoomTag(lastLocID, tagIDs)
// 4. Construct category description
var desc string
catLabel := category
for _, cat := range s.catalog {
if cat.ID == category {
catLabel = cat.Name
break
}
}
desc = fmt.Sprintf("Automatically cataloged via Wizard: %s > %s > %s", catLabel, itemVal, brand)
item := &db.Item{
Name: name,
Description: desc,
Quantity: 1,
Status: "In Storage",
LocationID: locID,
}
// 5. Create the item record
createdItem, err := s.db.CreateItem(item, tagIDs)
if err != nil {
log.Printf("Error creating wizard item: %v", err)
http.Error(w, "Failed to create item", http.StatusInternalServerError)
return
}
// 6. Generate collision-resistant short slug (using Glimmer SHA-256 slug engine)
slugVal, err := slug.GenerateItemSlug(createdItem.ID, s.cfg.Slugs.Length, s.db.Conn)
if err == nil && slugVal != "" {
targetURL := fmt.Sprintf("/admin?view=%d", createdItem.ID)
_, _ = s.db.CreateLink(slugVal, targetURL, "admin", sql.NullInt64{Int64: createdItem.ID, Valid: true})
}
// 7. Redirect straight to the Edit page so the user can modify any further details
http.Redirect(w, r, fmt.Sprintf("/admin/items/edit/%d?toast=Asset+created+successfully!+You+can+refine+its+details+below.&toast_type=success", createdItem.ID), http.StatusSeeOther)
return
}
name := r.FormValue("name")
qty, _ := strconv.Atoi(r.FormValue("quantity"))
desc := r.FormValue("description")
+7
View File
@@ -20,15 +20,22 @@ type Server struct {
db *db.DB
sessions *sessionStore
limiter *rateLimiter
catalog []config.CatalogCategory
}
func New(cfg *config.Config, database *db.DB) *Server {
ttl := time.Duration(cfg.Admin.SessionHours) * time.Hour
cat, err := config.LoadCatalog("catalog.json")
if err != nil {
log.Printf("Warning: failed to load catalog.json: %v. Using empty catalog.", err)
cat = []config.CatalogCategory{}
}
return &Server{
cfg: cfg,
db: database,
sessions: newSessionStore(ttl),
limiter: newRateLimiter(2 * time.Second), // 2 seconds between login attempts
catalog: cat,
}
}
+669 -110
View File
@@ -3,138 +3,697 @@
{{define "content"}}
{{if .FormMode}}
<!-- ================== ASSET EDIT / CREATE FORM ================== -->
<div class="page-header">
<div class="page-title">
<h1>{{if .EditingItem}}Edit Asset: {{.EditingItem.Name}}{{else}}Add New Asset{{end}}</h1>
<p>Define inventory items, upload documentation, and generate automated QR codes.</p>
{{if .EditingItem}}
<!-- ================== ASSET EDIT / CREATE FORM ================== -->
<div class="page-header">
<div class="page-title">
<h1>Edit Asset: {{.EditingItem.Name}}</h1>
<p>Define inventory items, upload documentation, and generate automated QR codes.</p>
</div>
<div>
<a href="/admin" class="btn btn-secondary">Cancel</a>
</div>
</div>
<div>
<a href="/admin" class="btn btn-secondary">Cancel</a>
</div>
</div>
<div class="card">
<form action="{{if .EditingItem}}/admin/items/edit/{{.EditingItem.ID}}{{else}}/admin/items/new{{end}}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<h3 style="font-weight: 700; margin-bottom: 1.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem;">Basic Information</h3>
<div style="display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="name" class="form-label">Asset Name</label>
<input type="text" id="name" name="name" class="form-control" placeholder="e.g. Cordless Hammer Drill" value="{{if .EditingItem}}{{.EditingItem.Name}}{{end}}" required>
<div class="card">
<form action="/admin/items/edit/{{.EditingItem.ID}}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<h3 style="font-weight: 700; margin-bottom: 1.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem;">Basic Information</h3>
<div style="display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="name" class="form-label">Asset Name</label>
<input type="text" id="name" name="name" class="form-control" placeholder="e.g. Cordless Hammer Drill" value="{{.EditingItem.Name}}" required>
</div>
<div class="form-group">
<label for="quantity" class="form-label">Quantity</label>
<input type="number" id="quantity" name="quantity" class="form-control" min="1" value="{{.EditingItem.Quantity}}" required>
</div>
</div>
<div class="form-group">
<label for="quantity" class="form-label">Quantity</label>
<input type="number" id="quantity" name="quantity" class="form-control" min="1" value="{{if .EditingItem}}{{.EditingItem.Quantity}}{{else}}1{{end}}" required>
</div>
</div>
<div class="form-group">
<label for="description" class="form-label">Description</label>
<textarea id="description" name="description" class="form-control" rows="3" placeholder="e.g. Brushless motor hammer drill, includes two 18V Li-ion batteries">{{if .EditingItem}}{{.EditingItem.Description}}{{end}}</textarea>
</div>
<div class="form-group">
<label for="description" class="form-label">Description</label>
<textarea id="description" name="description" class="form-control" rows="3" placeholder="e.g. Brushless motor hammer drill, includes two 18V Li-ion batteries">{{.EditingItem.Description}}</textarea>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="model_number" class="form-label">Model Number</label>
<input type="text" id="model_number" name="model_number" class="form-control" placeholder="e.g. DCD796" value="{{if .EditingItem}}{{.EditingItem.ModelNumber}}{{end}}">
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="model_number" class="form-label">Model Number</label>
<input type="text" id="model_number" name="model_number" class="form-control" placeholder="e.g. DCD796" value="{{.EditingItem.ModelNumber}}">
</div>
<div class="form-group">
<label for="serial_number" class="form-label">Serial Number</label>
<input type="text" id="serial_number" name="serial_number" class="form-control" placeholder="e.g. 2018-W42-9988" value="{{.EditingItem.SerialNumber}}">
</div>
<div class="form-group">
<label for="status" class="form-label">Status</label>
<select id="status" name="status" class="form-control">
<option value="In Use" {{if eq .EditingItem.Status "In Use"}}selected{{end}}>In Use</option>
<option value="In Storage" {{if eq .EditingItem.Status "In Storage"}}selected{{end}}>In Storage</option>
<option value="Borrowed" {{if eq .EditingItem.Status "Borrowed"}}selected{{end}}>Borrowed</option>
<option value="Lost" {{if eq .EditingItem.Status "Lost"}}selected{{end}}>Lost</option>
<option value="Disposed" {{if eq .EditingItem.Status "Disposed"}}selected{{end}}>Disposed</option>
</select>
</div>
</div>
<div class="form-group">
<label for="serial_number" class="form-label">Serial Number</label>
<input type="text" id="serial_number" name="serial_number" class="form-control" placeholder="e.g. 2018-W42-9988" value="{{if .EditingItem}}{{.EditingItem.SerialNumber}}{{end}}">
</div>
<div class="form-group">
<label for="status" class="form-label">Status</label>
<select id="status" name="status" class="form-control">
<option value="In Use" {{if .EditingItem}}{{if eq .EditingItem.Status "In Use"}}selected{{end}}{{end}}>In Use</option>
<option value="In Storage" {{if .EditingItem}}{{if eq .EditingItem.Status "In Storage"}}selected{{end}}{{end}}>In Storage</option>
<option value="Borrowed" {{if .EditingItem}}{{if eq .EditingItem.Status "Borrowed"}}selected{{end}}{{end}}>Borrowed</option>
<option value="Lost" {{if .EditingItem}}{{if eq .EditingItem.Status "Lost"}}selected{{end}}{{end}}>Lost</option>
<option value="Disposed" {{if .EditingItem}}{{if eq .EditingItem.Status "Disposed"}}selected{{end}}{{end}}>Disposed</option>
</select>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem;">
<div class="form-group">
<label for="location_id" class="form-label">Location</label>
<select id="location_id" name="location_id" class="form-control" required>
{{range .Locations}}
<option value="{{.ID}}" {{if $.EditingItem}}{{if $.EditingItem.LocationID.Valid}}{{if eq .ID $.EditingItem.LocationID.Int64}}selected{{end}}{{end}}{{else}}{{if eq .ID 1}}selected{{end}}{{end}}>
{{.Name}}
</option>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem;">
<div class="form-group">
<label for="location_id" class="form-label">Location</label>
<select id="location_id" name="location_id" class="form-control" required>
{{range .Locations}}
<option value="{{.ID}}" {{if $.EditingItem.LocationID.Valid}}{{if eq .ID $.EditingItem.LocationID.Int64}}selected{{end}}{{end}}>
{{.Name}}
</option>
{{end}}
</select>
</div>
<div class="form-group">
<label class="form-label">Tags / Categories</label>
<div style="display: flex; flex-wrap: wrap; gap: 0.75rem; border: 1px solid var(--color-border); padding: 0.625rem; border-radius: var(--radius-sm); background-color: var(--color-bg-base); max-height: 110px; overflow-y: auto;">
{{range .Tags}}
<label style="display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 500; cursor: pointer;">
<input type="checkbox" name="tag_ids" value="{{.ID}}" data-tag-name="{{.Name}}" {{if hasTag $.EditingItem.Tags .ID}}checked{{end}}>
<span class="tag-pill" style="background-color: {{.Color}};">{{.Name}}</span>
</label>
{{end}}
</div>
</div>
</div>
<h3 style="font-weight: 700; margin-bottom: 1.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 2rem;">Purchase & Warranty</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="purchase_price" class="form-label">Purchase Price ($)</label>
<input type="number" id="purchase_price" name="purchase_price" class="form-control" step="0.01" min="0" placeholder="e.g. 149.99" value="{{if .EditingItem.PurchasePrice.Valid}}{{.EditingItem.PurchasePrice.Float64}}{{end}}">
</div>
<div class="form-group">
<label for="purchase_date" class="form-label">Purchase Date</label>
<input type="date" id="purchase_date" name="purchase_date" class="form-control" value="{{if .EditingItem.PurchaseDate.Valid}}{{.EditingItem.PurchaseDate.String}}{{end}}">
</div>
<div class="form-group">
<label for="warranty_months" class="form-label">Warranty (Months)</label>
<input type="number" id="warranty_months" name="warranty_months" class="form-control" min="0" placeholder="e.g. 24" value="{{if .EditingItem.WarrantyMonths.Valid}}{{.EditingItem.WarrantyMonths.Int64}}{{end}}">
</div>
<div class="form-group">
<label for="supplier" class="form-label">Supplier / Store</label>
<input type="text" id="supplier" name="supplier" class="form-control" placeholder="e.g. Home Depot" value="{{.EditingItem.Supplier}}">
</div>
</div>
<h3 style="font-weight: 700; margin-bottom: 1.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 2rem;">Documentation & Visuals</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="image" class="form-label">Item Photo</label>
<input type="file" id="image" name="image" class="form-control" accept="image/*">
{{if .EditingItem.ImagePath}}
<span style="font-size: 0.8rem; color: var(--color-brand-primary); margin-top: 0.25rem; display: block;">Active Image: {{.EditingItem.ImagePath}}</span>
{{end}}
</select>
</div>
<div class="form-group">
<label class="form-label">Tags / Categories</label>
<div style="display: flex; flex-wrap: wrap; gap: 0.75rem; border: 1px solid var(--color-border); padding: 0.625rem; border-radius: var(--radius-sm); background-color: var(--color-bg-base); max-height: 110px; overflow-y: auto;">
{{range .Tags}}
<label style="display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 500; cursor: pointer;">
<input type="checkbox" name="tag_ids" value="{{.ID}}" data-tag-name="{{.Name}}" {{if $.EditingItem}}{{if hasTag $.EditingItem.Tags .ID}}checked{{end}}{{end}}>
<span class="tag-pill" style="background-color: {{.Color}};">{{.Name}}</span>
</label>
</div>
<div class="form-group">
<label for="receipt" class="form-label">Receipt / Invoice Document</label>
<input type="file" id="receipt" name="receipt" class="form-control" accept="image/*,application/pdf">
{{if .EditingItem.ReceiptPath}}
<span style="font-size: 0.8rem; color: var(--color-brand-primary); margin-top: 0.25rem; display: block;">Active Receipt: {{.EditingItem.ReceiptPath}}</span>
{{end}}
</div>
</div>
<h3 style="font-weight: 700; margin-bottom: 0.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 2rem;">Custom Fields</h3>
<p style="font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 1rem;">Enter custom parameters one per line as <code>Key: Value</code> (e.g. <code>Battery: 18v Lithium</code>). These will be parsed into indexed SQLite JSON dynamically.</p>
<div class="form-group" style="margin-bottom: 2.5rem;">
<label for="custom_fields" class="form-label">Custom Fields Editor</label>
<textarea id="custom_fields" name="custom_fields" class="form-control" rows="4" placeholder="Battery: 18v&#10;MotorType: Brushless">{{.CustomFieldsRaw}}</textarea>
</div>
<button type="submit" class="btn btn-primary" style="padding: 0.75rem 2rem; font-size: 1rem;">
Save Changes
</button>
</form>
</div>
{{else}}
<!-- ================== PREMIUM ADD ASSET WIZARD ================== -->
<div class="page-header">
<div class="page-title">
<h1>Add New Asset</h1>
<p>Catalog any device, appliance, or item in seconds using our intuitive selection wizard.</p>
</div>
<div>
<a href="/admin" class="btn btn-secondary">Cancel</a>
</div>
</div>
<!-- Progress Steps -->
<div class="wizard-progress-bar">
<div class="wizard-step active" id="progress-step-1">
<span class="step-num">1</span>
<span class="step-label">Category</span>
</div>
<div class="wizard-line" id="progress-line-1"></div>
<div class="wizard-step" id="progress-step-2">
<span class="step-num">2</span>
<span class="step-label">Item</span>
</div>
<div class="wizard-line" id="progress-line-2"></div>
<div class="wizard-step" id="progress-step-3">
<span class="step-num">3</span>
<span class="step-label">Brand</span>
</div>
</div>
<!-- Wizard Card Box -->
<div class="card" style="padding: 2.25rem;">
<!-- Hidden Form to submit the selection -->
<form id="wizard-form" action="/admin/items/new" method="POST">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="wizard_flow" value="true">
<input type="hidden" id="input-category" name="category" value="">
<input type="hidden" id="input-item" name="item" value="">
<input type="hidden" id="input-brand" name="brand" value="">
</form>
<!-- Back Button Navigation -->
<div style="margin-bottom: 2rem; display: none;" id="wizard-back-wrapper">
<button type="button" class="btn btn-secondary" id="btn-wizard-back" style="padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: var(--radius-sm);">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor" style="width: 14px; height: 14px;">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" />
</svg>
Back to previous step
</button>
</div>
<h3 style="font-weight: 700; margin-bottom: 1.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 2rem;">Purchase & Warranty</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="purchase_price" class="form-label">Purchase Price ($)</label>
<input type="number" id="purchase_price" name="purchase_price" class="form-control" step="0.01" min="0" placeholder="e.g. 149.99" value="{{if .EditingItem}}{{if .EditingItem.PurchasePrice.Valid}}{{.EditingItem.PurchasePrice.Float64}}{{end}}{{end}}">
</div>
<div class="form-group">
<label for="purchase_date" class="form-label">Purchase Date</label>
<input type="date" id="purchase_date" name="purchase_date" class="form-control" value="{{if .EditingItem}}{{if .EditingItem.PurchaseDate.Valid}}{{.EditingItem.PurchaseDate.String}}{{end}}{{end}}">
</div>
<div class="form-group">
<label for="warranty_months" class="form-label">Warranty (Months)</label>
<input type="number" id="warranty_months" name="warranty_months" class="form-control" min="0" placeholder="e.g. 24" value="{{if .EditingItem}}{{if .EditingItem.WarrantyMonths.Valid}}{{.EditingItem.WarrantyMonths.Int64}}{{end}}{{end}}">
</div>
<div class="form-group">
<label for="supplier" class="form-label">Supplier / Store</label>
<input type="text" id="supplier" name="supplier" class="form-control" placeholder="e.g. Home Depot" value="{{if .EditingItem}}{{.EditingItem.Supplier}}{{end}}">
<!-- Step 1: Category Screen -->
<div class="wizard-screen active" id="screen-category">
<h3 class="wizard-screen-title">Which category of item do you want to add?</h3>
<div class="category-grid" id="category-grid-container">
<!-- Loaded dynamically via JS -->
</div>
</div>
<h3 style="font-weight: 700; margin-bottom: 1.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 2rem;">Documentation & Visuals</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;">
<div class="form-group">
<label for="image" class="form-label">Item Photo</label>
<input type="file" id="image" name="image" class="form-control" accept="image/*">
{{if .EditingItem}}{{if .EditingItem.ImagePath}}
<span style="font-size: 0.8rem; color: var(--color-brand-primary); margin-top: 0.25rem; display: block;">Active Image: {{.EditingItem.ImagePath}}</span>
{{end}}{{end}}
</div>
<div class="form-group">
<label for="receipt" class="form-label">Receipt / Invoice Document</label>
<input type="file" id="receipt" name="receipt" class="form-control" accept="image/*,application/pdf">
{{if .EditingItem}}{{if .EditingItem.ReceiptPath}}
<span style="font-size: 0.8rem; color: var(--color-brand-primary); margin-top: 0.25rem; display: block;">Active Receipt: {{.EditingItem.ReceiptPath}}</span>
{{end}}{{end}}
<!-- Step 2: Item Screen -->
<div class="wizard-screen" id="screen-item">
<h3 class="wizard-screen-title" id="item-screen-heading">What kind of item is it?</h3>
<div class="pills-grid" id="item-grid-container">
<!-- Loaded dynamically via JS -->
</div>
</div>
<h3 style="font-weight: 700; margin-bottom: 0.5rem; color: var(--color-brand-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; margin-top: 2rem;">Custom Fields</h3>
<p style="font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 1rem;">Enter custom parameters one per line as <code>Key: Value</code> (e.g. <code>Battery: 18v Lithium</code>). These will be parsed into indexed SQLite JSON dynamically.</p>
<div class="form-group" style="margin-bottom: 2.5rem;">
<label for="custom_fields" class="form-label">Custom Fields Editor</label>
<textarea id="custom_fields" name="custom_fields" class="form-control" rows="4" placeholder="Battery: 18v&#10;MotorType: Brushless">{{.CustomFieldsRaw}}</textarea>
<!-- Step 3: Brand Screen -->
<div class="wizard-screen" id="screen-brand">
<h3 class="wizard-screen-title" id="brand-screen-heading">What brand is the item?</h3>
<div class="pills-grid" id="brand-grid-container">
<!-- Loaded dynamically via JS -->
</div>
</div>
</div>
<button type="submit" class="btn btn-primary" style="padding: 0.75rem 2rem; font-size: 1rem;">
{{if .EditingItem}}Save Changes{{else}}Create Asset{{end}}
</button>
</form>
</div>
<!-- Styles specific to the Wizard to avoid polluting main theme -->
<style>
.wizard-progress-bar {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 2.5rem;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
.wizard-step {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
position: relative;
z-index: 10;
transition: all 0.3s ease;
}
.wizard-step .step-num {
width: 36px;
height: 36px;
border-radius: 50%;
background-color: var(--color-bg-base);
border: 2px solid var(--color-border);
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
color: var(--color-text-light);
font-size: 0.95rem;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.wizard-step .step-label {
font-size: 0.85rem;
font-weight: 600;
color: var(--color-text-light);
transition: all 0.3s ease;
}
.wizard-step.active .step-num {
background-color: var(--color-brand-primary);
border-color: var(--color-brand-primary);
color: white;
box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}
.wizard-step.active .step-label {
color: var(--color-brand-primary);
font-weight: 700;
}
.wizard-step.completed .step-num {
background-color: #10b981;
border-color: #10b981;
color: white;
box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}
.wizard-step.completed .step-label {
color: #10b981;
}
.wizard-line {
flex-grow: 1;
height: 3px;
background-color: var(--color-border);
margin: 0 -0.5rem;
transform: translateY(-13px);
transition: background-color 0.3s ease;
}
.wizard-line.completed {
background-color: #10b981;
}
.wizard-line.active {
background-color: var(--color-brand-primary);
}
.wizard-screen {
display: none;
animation: wizardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.wizard-screen.active {
display: block;
}
@keyframes wizardFadeIn {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.wizard-screen-title {
font-size: 1.35rem;
font-weight: 700;
margin-bottom: 2rem;
color: var(--color-text-main);
text-align: center;
}
/* Categories Grid of big square cards */
.category-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 1.25rem;
}
.category-card {
aspect-ratio: 1/1;
background-color: var(--color-bg-surface);
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1.5rem 1rem;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: var(--shadow-sm);
text-align: center;
}
.category-card:hover {
transform: translateY(-4px);
box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08);
border-color: var(--cat-color);
background-color: var(--cat-color-bg);
}
.category-badge {
width: 48px;
height: 48px;
border-radius: 12px;
background-color: var(--cat-color-badge-bg);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.4rem;
font-weight: 700;
color: var(--cat-color);
margin-bottom: 1rem;
transition: transform 0.2s ease;
}
.category-card:hover .category-badge {
transform: scale(1.1);
}
.category-name {
font-size: 0.95rem;
font-weight: 600;
color: var(--color-text-main);
}
/* Sub-screen pill grid */
.pills-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1rem;
}
.pill-button {
background-color: var(--color-bg-surface);
border: 1.5px solid var(--color-border);
border-radius: var(--radius-sm);
padding: 1rem 1.25rem;
font-size: 1rem;
font-weight: 600;
color: var(--color-text-main);
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: var(--shadow-sm);
}
.pill-button:hover {
border-color: var(--color-brand-primary);
background-color: #fefaf0;
color: var(--color-brand-primary);
transform: translateX(2px);
}
.pill-button svg {
width: 16px;
height: 16px;
color: var(--color-text-light);
transition: transform 0.2s ease, color 0.2s ease;
}
.pill-button:hover svg {
transform: translateX(3px);
color: var(--color-brand-primary);
}
.pill-button.other-pill {
border-style: dashed;
border-width: 2px;
background-color: var(--color-bg-base);
color: var(--color-text-muted);
}
.pill-button.other-pill:hover {
border-color: var(--color-text-muted);
background-color: var(--color-border);
color: var(--color-text-main);
}
</style>
<script>
// Parse catalog JSON data dynamically injected by handler
const catalog = {{.CatalogJSON}};
let currentStep = 1;
let selectedCategory = null;
let selectedItem = null;
let selectedBrand = null;
// DOM Elements
const screenCategory = document.getElementById('screen-category');
const screenItem = document.getElementById('screen-item');
const screenBrand = document.getElementById('screen-brand');
const categoryGrid = document.getElementById('category-grid-container');
const itemGrid = document.getElementById('item-grid-container');
const brandGrid = document.getElementById('brand-grid-container');
const inputCategory = document.getElementById('input-category');
const inputItem = document.getElementById('input-item');
const inputBrand = document.getElementById('input-brand');
const wizardForm = document.getElementById('wizard-form');
const backBtnWrapper = document.getElementById('wizard-back-wrapper');
const backBtn = document.getElementById('btn-wizard-back');
// Set up steps DOM markers
const step1 = document.getElementById('progress-step-1');
const step2 = document.getElementById('progress-step-2');
const step3 = document.getElementById('progress-step-3');
const line1 = document.getElementById('progress-line-1');
const line2 = document.getElementById('progress-line-2');
// 1. Initial render of Categories screen
function initWizard() {
categoryGrid.innerHTML = '';
catalog.forEach(cat => {
// Create beautiful HSL tints using the custom category color
const color = cat.color || '#d97706';
// Simple helper to convert HEX to RGBA / transparent tint
const r = parseInt(color.slice(1, 3), 16);
const g = parseInt(color.slice(3, 5), 16);
const b = parseInt(color.slice(5, 7), 16);
const card = document.createElement('div');
card.className = 'category-card';
card.style.setProperty('--cat-color', color);
card.style.setProperty('--cat-color-bg', `rgba(${r}, ${g}, ${b}, 0.04)`);
card.style.setProperty('--cat-color-badge-bg', `rgba(${r}, ${g}, ${b}, 0.1)`);
// Pick beautiful stylized icon or stylized letter badge
const initial = cat.name.charAt(0);
card.innerHTML = `
<div class="category-badge">${initial}</div>
<div class="category-name">${cat.name}</div>
`;
card.addEventListener('click', () => {
selectCategory(cat);
});
categoryGrid.appendChild(card);
});
// Add "Other" selection Card at first layer
const otherCard = document.createElement('div');
otherCard.className = 'category-card';
otherCard.style.setProperty('--cat-color', 'var(--color-text-muted)');
otherCard.style.setProperty('--cat-color-bg', 'var(--color-bg-base)');
otherCard.style.setProperty('--cat-color-badge-bg', 'var(--color-border)');
otherCard.style.borderStyle = 'dashed';
otherCard.style.borderWidth = '2px';
otherCard.innerHTML = `
<div class="category-badge" style="font-weight: 500;">+</div>
<div class="category-name">Other / Unlisted</div>
`;
otherCard.addEventListener('click', () => {
selectCategory({ id: 'Other', name: 'Other', items: [] });
});
categoryGrid.appendChild(otherCard);
}
// 2. Category selection logic
function selectCategory(cat) {
selectedCategory = cat.id;
inputCategory.value = cat.id;
if (cat.id === 'Other') {
// Instantly submit with Other fallback
inputItem.value = 'Other';
inputBrand.value = 'Other';
wizardForm.submit();
return;
}
renderItems(cat);
goToStep(2);
}
// 3. Render Items Screen
function renderItems(cat) {
const heading = document.getElementById('item-screen-heading');
heading.textContent = `What kind of ${cat.name.toLowerCase()} is it?`;
itemGrid.innerHTML = '';
cat.items.forEach(item => {
const btn = document.createElement('button');
btn.type = 'button';
btn.className = 'pill-button';
btn.innerHTML = `
<span>${item.name}</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
</svg>
`;
btn.addEventListener('click', () => {
selectItem(cat, item);
});
itemGrid.appendChild(btn);
});
// Add "Other" option in Layer 2
const otherBtn = document.createElement('button');
otherBtn.type = 'button';
otherBtn.className = 'pill-button other-pill';
otherBtn.innerHTML = `
<span>Other Item</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg>
`;
otherBtn.addEventListener('click', () => {
selectItem(cat, { name: 'Other', brands: [] });
});
itemGrid.appendChild(otherBtn);
}
// 4. Item selection logic
function selectItem(cat, item) {
selectedItem = item.name;
inputItem.value = item.name;
if (item.name === 'Other') {
// Instantly submit with Other fallback
inputBrand.value = 'Other';
wizardForm.submit();
return;
}
renderBrands(item);
goToStep(3);
}
// 5. Render Brands Screen
function renderBrands(item) {
const heading = document.getElementById('brand-screen-heading');
heading.textContent = `What brand is the ${item.name.toLowerCase()}?`;
brandGrid.innerHTML = '';
item.brands.forEach(brand => {
const btn = document.createElement('button');
btn.type = 'button';
btn.className = 'pill-button';
btn.innerHTML = `
<span>${brand}</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
`;
btn.addEventListener('click', () => {
selectBrand(brand);
});
brandGrid.appendChild(btn);
});
// Add "Other" option in Layer 3
const otherBtn = document.createElement('button');
otherBtn.type = 'button';
otherBtn.className = 'pill-button other-pill';
otherBtn.innerHTML = `
<span>Other Brand</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg>
`;
otherBtn.addEventListener('click', () => {
selectBrand('Other');
});
brandGrid.appendChild(otherBtn);
}
// 6. Brand selection logic (final layer)
function selectBrand(brand) {
selectedBrand = brand;
inputBrand.value = brand;
// Submit the form immediately to complete creation
wizardForm.submit();
}
// 7. Navigation Step Controller
function goToStep(step) {
currentStep = step;
// Hide all screens
screenCategory.classList.remove('active');
screenItem.classList.remove('active');
screenBrand.classList.remove('active');
// Update steps indicator class
step1.className = 'wizard-step';
step2.className = 'wizard-step';
step3.className = 'wizard-step';
line1.className = 'wizard-line';
line2.className = 'wizard-line';
if (step === 1) {
screenCategory.classList.add('active');
step1.classList.add('active');
backBtnWrapper.style.display = 'none';
} else if (step === 2) {
screenItem.classList.add('active');
step1.classList.add('completed');
step2.classList.add('active');
line1.classList.add('completed');
backBtnWrapper.style.display = 'block';
} else if (step === 3) {
screenBrand.classList.add('active');
step1.classList.add('completed');
step2.classList.add('completed');
step3.classList.add('active');
line1.classList.add('completed');
line2.classList.add('completed');
backBtnWrapper.style.display = 'block';
}
}
// Back button hook
backBtn.addEventListener('click', () => {
if (currentStep > 1) {
goToStep(currentStep - 1);
}
});
// Run initialization
window.addEventListener('DOMContentLoaded', () => {
initWizard();
});
</script>
{{end}}
{{else if .ViewMode}}
<!-- ================== ASSET VIEW DETAILS MODE ================== -->
<div class="page-header">