diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..b179ee3 --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1 @@ +/* Custom Styles */ \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..8c84b99 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1 @@ +// Custom Scripts \ No newline at end of file diff --git a/database/demo.sql b/database/demo.sql new file mode 100644 index 0000000..0cae11f --- /dev/null +++ b/database/demo.sql @@ -0,0 +1,89 @@ +CREATE DATABASE IF NOT EXISTS `service_portal_db`; +USE `service_portal_db`; + +CREATE TABLE IF NOT EXISTS `settings` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `company_name` varchar(255) DEFAULT 'Your Company', + `company_email` varchar(255) DEFAULT 'contact@example.com', + `company_whatsapp` varchar(255) DEFAULT '1234567890', + `upi_id` varchar(255) DEFAULT 'your-upi@ok', + `terms_conditions` text, + `footer_text` varchar(255) DEFAULT '© 2025 Your Company. All Rights Reserved.', + `smtp_host` varchar(255) DEFAULT NULL, + `smtp_port` int(11) DEFAULT NULL, + `smtp_user` varchar(255) DEFAULT NULL, + `smtp_pass` varchar(255) DEFAULT NULL, + `logo_path` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT INTO `settings` (`id`, `company_name`, `company_email`, `company_whatsapp`, `upi_id`, `terms_conditions`, `footer_text`) VALUES +(1, 'Service Portal', 'contact@serviceportal.com', '9876543210', 'upi@okaxis', '1. All services are subject to our terms and conditions. +2. Warranty is applicable only on parts replaced. +3. No warranty on software-related issues.', '© 2025 Service Portal. All Rights Reserved.'); + +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `role` enum('admin','technician') DEFAULT 'admin', + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT INTO `users` (`id`, `email`, `password`, `role`) VALUES +(1, 'admin@example.com', '$2y$10$g.pA/P1v2RFAzZkC.3r.A.tclHl8tXpr./3v5b2dD2a.i5.Myw0jS', 'admin'); -- password is admin123 + +CREATE TABLE IF NOT EXISTS `bookings` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `booking_id` varchar(10) NOT NULL, + `customer_name` varchar(255) NOT NULL, + `customer_mobile` varchar(20) NOT NULL, + `customer_email` varchar(255) DEFAULT NULL, + `device_type` varchar(100) NOT NULL, + `service_type` enum('Normal','Revisit','Warranty') NOT NULL, + `problem_details` text, + `photo_path` varchar(255) DEFAULT NULL, + `status` enum('Booked','Pending','In Progress','Waiting for Parts','On Testing','Completed','Payment','Cancelled') DEFAULT 'Booked', + `parts_cost` decimal(10,2) DEFAULT '0.00', + `labour_cost` decimal(10,2) DEFAULT '0.00', + `total_cost` decimal(10,2) GENERATED ALWAYS AS (`parts_cost` + `labour_cost`) STORED, + `invoice_pdf_path` varchar(255) DEFAULT NULL, + `proof_photos_path` text, + `assigned_to` int(11) DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `booking_id` (`booking_id`), + KEY `assigned_to` (`assigned_to`), + CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT INTO `bookings` (`booking_id`, `customer_name`, `customer_mobile`, `customer_email`, `device_type`, `service_type`, `problem_details`, `status`) VALUES +('BK-1001', 'John Doe', '1234567890', 'john.doe@example.com', 'Laptop', 'Normal', 'Screen flickering issue.', 'Booked'), +('BK-1002', 'Jane Smith', '0987654321', 'jane.smith@example.com', 'Smartphone', 'Revisit', 'Battery draining too fast after last service.', 'In Progress'); + +CREATE TABLE IF NOT EXISTS `device_types` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT INTO `device_types` (`name`) VALUES +('Laptop'), +('Smartphone'), +('Tablet'), +('Desktop PC'); + +CREATE TABLE IF NOT EXISTS `invoices` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `booking_id` int(11) NOT NULL, + `invoice_data` text, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `booking_id` (`booking_id`), + CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +INSERT INTO `invoices` (`booking_id`, `invoice_data`) VALUES +(2, 'Some sample invoice data for booking BK-1002'); diff --git a/index.php b/index.php index 7205f3d..a944018 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,78 @@ - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + + Service Portal - Your One-Stop Repair Solution + + + + + + + + + + + + + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+
+

Welcome to the Service Portal

+

Your application is almost ready. The first step is to set up your database.

+ Go to Installer
-
- + + + - + \ No newline at end of file diff --git a/installer/install.php b/installer/install.php new file mode 100644 index 0000000..843b858 --- /dev/null +++ b/installer/install.php @@ -0,0 +1,152 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + // 2. Read SQL file + $sql = file_get_contents($sql_file); + if ($sql === false) { + throw new Exception("Cannot read SQL file: $sql_file"); + } + + // 3. Execute SQL commands + $pdo->exec($sql); + + $message = 'Installation successful! Database and tables created, and demo data imported.'; + $error = false; + + } catch (PDOException $e) { + $message = "Database error: " . $e->getMessage(); + $error = true; + } catch (Exception $e) { + $message = "General error: " . $e->getMessage(); + $error = true; + } +} + +$extensions = [ + 'pdo_mysql' => 'PDO MySQL for database connection', + 'gd' => 'GD for image processing', + 'mbstring' => 'MBString for multibyte strings', + 'openssl' => 'OpenSSL for security', + 'json' => 'JSON for data interchange', + 'fileinfo' => 'FileInfo for file type detection', + 'zip' => 'Zip for archive handling', + 'dom' => 'DOM for XML/HTML processing', + 'ctype' => 'Ctype for character type checking', +]; + +$php_version = phpversion(); +?> + + + + + + Service Portal Installer + + + + + +
+

Service Portal Installer

+ +
+

1. System Requirements

+
+
    +
  • + PHP Version (>= 8.0) + =')): ?> + ✅ () + + ❌ () + +
  • + $desc): ?> +
  • + () + + ✅ Installed + + ❌ Not Installed + +
  • + +
+
+
+ +
+

2. Database Installation

+
+

This will create the `` database and import the necessary tables and demo data.

+

Warning: This may overwrite existing data if tables with the same name exist.

+
+ +
+
+
+
+ + + + + +