CREATE TABLE consignments ( id INT AUTO_INCREMENT PRIMARY KEY, consignment_number VARCHAR(50) NOT NULL UNIQUE, sender_name VARCHAR(100) NOT NULL, receiver_name VARCHAR(100) NOT NULL, receiver_address TEXT NOT NULL, item_image VARCHAR(255), -- URL or file path receiver_photo VARCHAR(255), -- URL or file path origin VARCHAR(100) NOT NULL, destination VARCHAR(100) NOT NULL, current_location VARCHAR(100), gps_lat DECIMAL(10, 7), -- Latitude precision gps_lng DECIMAL(10, 7), -- Longitude precision status ENUM('pending','in_transit','out_for_delivery','delivered','returned','failed') DEFAULT 'pending', last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ); INSERT INTO consignments ( consignment_number, sender_name, receiver_name, receiver_address, item_image, receiver_photo, origin, destination, current_location, gps_lat, gps_lng, status ) VALUES ( 'CNX123456789', -- Example consignment number 'John Peterson', -- Sender 'Emily Watson', -- Receiver '742 Evergreen Terrace, Houston TX', -- Receiver address 'https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8cmVkJTIwc2hvZXxlbnwwfHwwfHx8MA%3D%3D', -- Item image 'https://images.unsplash.com/photo-1620064881980-1023851173f3?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTV8fG1hbiUyMGluJTIwc3VpdHxlbnwwfHwwfHx8MA%3D%3D', -- Receiver photo 'Texas, USA', -- Origin 'Lagos, Nigeria', -- Destination 'Texas, USA', -- Current scanned location 31.529910, -- GPS latitude -99.300648, -- GPS longitude 'in_transit' -- Status ); very good, am done with the design, now this is how will do it, first, we start with the rendering, we will write out php code directly in frontend file, just for the rendering of the shipments card ok and the sidebar for each, this is want i hard coded,
CNS-001
In Transit
Sender
John Smith
Receiver
Sarah Johnson
Origin
New York, NY
Destination
Los Angeles, CA
Current Location
Denver, CO
Phone
+1 (555) 123-4567
Email
sarah@email.com
VIN
VN123456789
Receiver Address
123 Sunset Boulevard, Los Angeles, CA 90028
Item
with this you know what to do right?, after fetch it from the db, you will now render it using echo <<{$planName} Plan hope you are getting me, and you know how to do the id right, let the unique id of the cards be the consignment number it self, ok? this is the db CREATE TABLE `consignments` ( `id` int NOT NULL, `consignment_number` varchar(50) NOT NULL, `vin` varchar(50) DEFAULT NULL, `sender_name` varchar(100) NOT NULL, `receiver_name` varchar(100) NOT NULL, `phone_number` varchar(20) DEFAULT NULL, `email` varchar(150) DEFAULT NULL, `receiver_address` text NOT NULL, `item_image` varchar(255) DEFAULT NULL, `receiver_photo` varchar(255) DEFAULT NULL, `origin` varchar(100) NOT NULL, `destination` varchar(100) NOT NULL, `current_location` varchar(100) DEFAULT NULL, `gps_lat` decimal(10,7) DEFAULT NULL, `gps_lng` decimal(10,7) DEFAULT NULL, `status` enum('pending','in_transit','out_for_delivery','delivered','returned','failed') DEFAULT 'pending', `last_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; start