diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..d2915f1 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,16 @@ + +body { + background-color: #F3F4F6; + font-family: 'Inter', sans-serif; +} + +.hero { + background: linear-gradient(to right, #3B82F6, #60A5FA); + color: white; +} + +.card { + background-color: #FFFFFF; + border-radius: 8px; + box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..3eeecdc --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,38 @@ + +document.addEventListener('DOMContentLoaded', function () { + const addVisitorBtn = document.getElementById('add-visitor'); + const visitorsContainer = document.getElementById('visitors-container'); + let visitorCount = 1; + + addVisitorBtn.addEventListener('click', function () { + visitorCount++; + const visitorTemplate = ` +
+

Visitor ${visitorCount}

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ `; + visitorsContainer.insertAdjacentHTML('beforeend', visitorTemplate); + }); +}); diff --git a/db/config.php b/db/config.php index 62ed3b7..b185d54 100644 --- a/db/config.php +++ b/db/config.php @@ -15,3 +15,12 @@ function db() { } return $pdo; } + +function run_migrations() { + $pdo = db(); + $migrations = glob(__DIR__ . '/migrations/*.sql'); + foreach ($migrations as $migration) { + $sql = file_get_contents($migration); + $pdo->exec($sql); + } +} \ No newline at end of file diff --git a/db/migrations/001_create_tables.sql b/db/migrations/001_create_tables.sql new file mode 100644 index 0000000..bde99c7 --- /dev/null +++ b/db/migrations/001_create_tables.sql @@ -0,0 +1,29 @@ +CREATE TABLE IF NOT EXISTS submissions ( + id INT AUTO_INCREMENT PRIMARY KEY, + full_name VARCHAR(255) NOT NULL, + id_or_passport VARCHAR(255) NOT NULL, + id_image_path VARCHAR(255) NOT NULL, + gender VARCHAR(50) NOT NULL, + birth_date DATE NOT NULL, + mobile_phone VARCHAR(50) NOT NULL, + mailing_address TEXT NOT NULL, + start_visit_date DATE NOT NULL, + end_visit_date DATE NOT NULL, + purpose_of_visit TEXT NOT NULL, + visit_category VARCHAR(255) NOT NULL, + visit_location_lat VARCHAR(255) NOT NULL, + visit_location_lon VARCHAR(255) NOT NULL, + official_letter_path VARCHAR(255), + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS visitors ( + id INT AUTO_INCREMENT PRIMARY KEY, + submission_id INT NOT NULL, + full_name VARCHAR(255) NOT NULL, + id_or_passport VARCHAR(255) NOT NULL, + id_image_path VARCHAR(255) NOT NULL, + mobile_phone VARCHAR(50) NOT NULL, + mailing_address TEXT NOT NULL, + FOREIGN KEY (submission_id) REFERENCES submissions(id) ON DELETE CASCADE +); diff --git a/index.php b/index.php index 6f7ffab..a982939 100644 --- a/index.php +++ b/index.php @@ -1,131 +1,160 @@ - - + - - - New Style - - - - + + + Security Clearance Application + + + + + -
-
-

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

+ +
+
+

Security Clearance Application

+

Republic of Indonesia

+
-
- + +
+
+ + + + + + + +
+ + +
+

Applicant Information

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

Visit Details

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

Visitor Details

+
+
+

Visitor 1

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+ +
+ +
+
+
+
+ + - + \ No newline at end of file diff --git a/submit.php b/submit.php new file mode 100644 index 0000000..1b29e9e --- /dev/null +++ b/submit.php @@ -0,0 +1,69 @@ +prepare(" + INSERT INTO submissions (full_name, id_or_passport, id_image_path, gender, birth_date, mobile_phone, mailing_address, start_visit_date, end_visit_date, purpose_of_visit, visit_category, visit_location_lat, visit_location_lon, official_letter_path) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + "); + $stmt->execute([ + $_POST['full_name'], + $_POST['id_or_passport'], + $id_image_path, + $_POST['gender'], + $_POST['birth_date'], + $_POST['mobile_phone'], + $_POST['mailing_address'], + $_POST['start_visit_date'], + $_POST['end_visit_date'], + $_POST['purpose_of_visit'], + $_POST['visit_category'], + $_POST['visit_location_lat'], + $_POST['visit_location_lon'], + $official_letter_path + ]); + + $submission_id = $pdo->lastInsertId(); + + // Insert into visitors table + if (isset($_POST['visitors'])) { + foreach ($_POST['visitors'] as $visitor) { + $visitor_id_image_path = 'uploads/' . basename($visitor['id_image']['name']); + move_uploaded_file($visitor['id_image']['tmp_name'], $visitor_id_image_path); + + $stmt = $pdo->prepare(" + INSERT INTO visitors (submission_id, full_name, id_or_passport, id_image_path, mobile_phone, mailing_address) + VALUES (?, ?, ?, ?, ?, ?) + "); + $stmt->execute([ + $submission_id, + $visitor['full_name'], + $visitor['id_or_passport'], + $visitor_id_image_path, + $visitor['mobile_phone'], + $visitor['mailing_address'] + ]); + } + } + + header('Location: /?success=true'); + } catch (Exception $e) { + error_log($e->getMessage()); + header('Location: /?success=false'); + } +}