package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class AddCustomer extends JFrame implements ActionListener {

    JTextField t1, t2, t3, countryField, checkInField, checkOutField;
    JComboBox<String> c1, c2;
    JButton b1, b2;

    AddCustomer() {

        JLabel l1 = new JLabel("Add New Customer");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(150, 20, 300, 30);
        add(l1);

        // Full Name
        JLabel name = new JLabel("Full Name");
        name.setBounds(50, 80, 100, 30);
        add(name);

        t1 = new JTextField();
        t1.setBounds(160, 80, 150, 30);
        add(t1);

        // Phone Number
        JLabel phone = new JLabel("Phone Number");
        phone.setBounds(50, 130, 100, 30);
        add(phone);

        t2 = new JTextField();
        t2.setBounds(160, 130, 150, 30);
        add(t2);

        // Email
        JLabel email = new JLabel("Email");
        email.setBounds(50, 180, 100, 30);
        add(email);

        t3 = new JTextField();
        t3.setBounds(160, 180, 150, 30);
        add(t3);

        // Gender
        JLabel gender = new JLabel("Gender");
        gender.setBounds(50, 230, 100, 30);
        add(gender);

        String genders[] = {"Male", "Female", "Other"};
        c1 = new JComboBox<>(genders);
        c1.setBounds(160, 230, 150, 30);
        add(c1);

        // Country
        JLabel country = new JLabel("Country");
        country.setBounds(50, 280, 100, 30);
        add(country);

        countryField = new JTextField();
        countryField.setBounds(160, 280, 150, 30);
        add(countryField);

        // Check-in Date
        JLabel checkIn = new JLabel("Check-in Date (YYYY-MM-DD)");
        checkIn.setBounds(50, 330, 200, 30);
        add(checkIn);

        checkInField = new JTextField();
        checkInField.setBounds(250, 330, 150, 30);
        add(checkInField);

        // Check-out Date
        JLabel checkOut = new JLabel("Check-out Date (YYYY-MM-DD)");
        checkOut.setBounds(50, 380, 200, 30);
        add(checkOut);

        checkOutField = new JTextField();
        checkOutField.setBounds(250, 380, 150, 30);
        add(checkOutField);

        // Select Room
        JLabel roomLabel = new JLabel("Select Room");
        roomLabel.setBounds(50, 430, 100, 30);
        add(roomLabel);

        c2 = new JComboBox<>();
        try {
            ConnectMySQL c = new ConnectMySQL();
            String query = "SELECT room_number FROM Rooms WHERE available = TRUE";
            ResultSet rs = c.s.executeQuery(query);
            while (rs.next()) {
                c2.addItem(rs.getString("room_number"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        c2.setBounds(160, 430, 150, 30);
        add(c2);

        // Add Customer Button
        b1 = new JButton("Add Customer");
        b1.setBounds(80, 500, 150, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Back Button
        b2 = new JButton("Back");
        b2.setBounds(250, 500, 150, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/customer.png"));
        Image i2 = i1.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l2 = new JLabel(i3);
        l2.setBounds(400, 80, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 200, 750, 600);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Add Customer Button
            String fullName = t1.getText();
            String phone = t2.getText();
            String email = t3.getText();
            String gender = (String) c1.getSelectedItem();
            String country = countryField.getText();
            String checkIn = checkInField.getText();
            String checkOut = checkOutField.getText();
            String room = (String) c2.getSelectedItem();

            // Input Validation
            if(fullName.isEmpty() || phone.isEmpty() || checkIn.isEmpty() || checkOut.isEmpty() || room == null) {
                JOptionPane.showMessageDialog(null, "Please fill all required fields");
                return;
            }

            ConnectMySQL c = new ConnectMySQL();

            try {
                // Insert into Customers
                String customerQuery = "INSERT INTO Customers (full_name, phone, email, gender, country, created_at, updated_at) "
                        + "VALUES (?, ?, ?, ?, ?, NOW(), NOW())";
                PreparedStatement pstmtCustomer = c.c.prepareStatement(customerQuery, Statement.RETURN_GENERATED_KEYS);
                pstmtCustomer.setString(1, fullName);
                pstmtCustomer.setString(2, phone);
                pstmtCustomer.setString(3, email.isEmpty() ? null : email);
                pstmtCustomer.setString(4, gender);
                pstmtCustomer.setString(5, country.isEmpty() ? null : country);
                pstmtCustomer.executeUpdate();

                ResultSet rs = pstmtCustomer.getGeneratedKeys();
                int customerId = 0;
                if (rs.next()) {
                    customerId = rs.getInt(1);
                }

                // Get room_id and price
                String roomQuery = "SELECT room_id, price FROM Rooms WHERE room_number = ?";
                PreparedStatement pstmtRoom = c.c.prepareStatement(roomQuery);
                pstmtRoom.setInt(1, Integer.parseInt(room));
                ResultSet rsRoom = pstmtRoom.executeQuery();
                int roomId = 0;
                double price = 0.0;
                if (rsRoom.next()) {
                    roomId = rsRoom.getInt("room_id");
                    price = rsRoom.getDouble("price");
                }

                // Calculate deposit (e.g., 20% of total amount)
                double deposit = price * 0.2;

                // Insert into Reservations
                String reservationQuery = "INSERT INTO Reservations (customer_id, room_id, check_in, check_out, status, total_amount, deposit, created_at, updated_at) "
                        + "VALUES (?, ?, ?, ?, 'Booked', ?, ?, NOW(), NOW())";
                PreparedStatement pstmtReservation = c.c.prepareStatement(reservationQuery);
                pstmtReservation.setInt(1, customerId);
                pstmtReservation.setInt(2, roomId);
                pstmtReservation.setDate(3, java.sql.Date.valueOf(checkIn));
                pstmtReservation.setDate(4, java.sql.Date.valueOf(checkOut));
                pstmtReservation.setDouble(5, price);
                pstmtReservation.setDouble(6, deposit);
                pstmtReservation.executeUpdate();

                // Update Room Status
                String updateRoom = "UPDATE Rooms SET available = FALSE, status = 'Occupied' WHERE room_id = ?";
                PreparedStatement pstmtUpdateRoom = c.c.prepareStatement(updateRoom);
                pstmtUpdateRoom.setInt(1, roomId);
                pstmtUpdateRoom.executeUpdate();

                JOptionPane.showMessageDialog(null, "Customer and Reservation Added Successfully");

                // Clear Fields
                t1.setText("");
                t2.setText("");
                t3.setText("");
                c1.setSelectedIndex(0);
                countryField.setText("");
                checkInField.setText("");
                checkOutField.setText("");
                c2.setSelectedIndex(0);

            } catch (SQLIntegrityConstraintViolationException e) {
                JOptionPane.showMessageDialog(null, "Phone number or Email already exists!");
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Back Button
            new Reception().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new AddCustomer().setVisible(true);
    }
}






// src/hotel/management/system/AddEmployee.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class AddEmployee extends JFrame implements ActionListener {

    JTextField t1, t2, t3, t4, t5, t6;
    JComboBox<String> c1;
    JButton b1, b2;

    AddEmployee() {

        JLabel l1 = new JLabel("Add New Employee");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(150, 20, 300, 30);
        add(l1);

        // Full Name
        JLabel name = new JLabel("Full Name");
        name.setBounds(50, 80, 100, 30);
        add(name);

        t1 = new JTextField();
        t1.setBounds(160, 80, 150, 30);
        add(t1);

        // Age
        JLabel age = new JLabel("Age");
        age.setBounds(50, 130, 100, 30);
        add(age);

        t2 = new JTextField();
        t2.setBounds(160, 130, 150, 30);
        add(t2);

        // Gender
        JLabel gender = new JLabel("Gender");
        gender.setBounds(50, 180, 100, 30);
        add(gender);

        String genders[] = {"Male", "Female", "Other"};
        c1 = new JComboBox<>(genders);
        c1.setBounds(160, 180, 150, 30);
        add(c1);

        // Job Title
        JLabel job = new JLabel("Job Title");
        job.setBounds(50, 230, 100, 30);
        add(job);

        t3 = new JTextField();
        t3.setBounds(160, 230, 150, 30);
        add(t3);

        // Salary
        JLabel salary = new JLabel("Salary");
        salary.setBounds(50, 280, 100, 30);
        add(salary);

        t4 = new JTextField();
        t4.setBounds(160, 280, 150, 30);
        add(t4);

        // Phone Number
        JLabel phone = new JLabel("Phone Number");
        phone.setBounds(50, 330, 100, 30);
        add(phone);

        t5 = new JTextField();
        t5.setBounds(160, 330, 150, 30);
        add(t5);

        // National ID
        JLabel nid = new JLabel("National ID");
        nid.setBounds(50, 380, 100, 30);
        add(nid);

        t6 = new JTextField();
        t6.setBounds(160, 380, 150, 30);
        add(t6);

        // Submit Button
        b1 = new JButton("Add");
        b1.setBounds(80, 450, 100, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Cancel Button
        b2 = new JButton("Cancel");
        b2.setBounds(220, 450, 100, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/addemployee.png"));
        Image i2 = i1.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l2 = new JLabel(i3);
        l2.setBounds(350, 80, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 200, 700, 550);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Add Button
            String fullName = t1.getText();
            String ageStr = t2.getText();
            String gender = (String) c1.getSelectedItem();
            String jobTitle = t3.getText();
            String salaryStr = t4.getText();
            String phone = t5.getText();
            String nid = t6.getText();

            // Input validation can be added here
            try {
                int age = Integer.parseInt(ageStr);
                double salary = Double.parseDouble(salaryStr);

                ConnectMySQL c = new ConnectMySQL();

                String query = "INSERT INTO Employees (full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at) "
                        + "VALUES ('" + fullName + "', " + age + ", '" + gender + "', '" + jobTitle + "', " + salary + ", '" + phone + "', '" + nid + "', '" + phone + "', NOW(), NOW())";

                c.s.executeUpdate(query);
                JOptionPane.showMessageDialog(null, "Employee Added Successfully");

                // Clear Fields
                t1.setText("");
                t2.setText("");
                t3.setText("");
                t4.setText("");
                t5.setText("");
                t6.setText("");

            } catch (NumberFormatException e) {
                JOptionPane.showMessageDialog(null, "Please enter valid Age and Salary");
            } catch (SQLIntegrityConstraintViolationException e) {
                JOptionPane.showMessageDialog(null, "Phone Number or National ID already exists!");
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Cancel Button
            new DropDown().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new AddEmployee().setVisible(true);
    }
}












// src/hotel/management/system/AddReceptionist.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class AddReceptionist extends JFrame implements ActionListener {

    JTextField t1, t2, t3, t4, t5;
    JPasswordField t6;
    JButton b1, b2;

    AddReceptionist() {

        JLabel l1 = new JLabel("Add Receptionist");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(150, 20, 200, 30);
        add(l1);

        // Full Name
        JLabel name = new JLabel("Full Name");
        name.setBounds(50, 80, 100, 30);
        add(name);

        t1 = new JTextField();
        t1.setBounds(160, 80, 150, 30);
        add(t1);

        // Phone Number
        JLabel phone = new JLabel("Phone Number");
        phone.setBounds(50, 130, 100, 30);
        add(phone);

        t2 = new JTextField();
        t2.setBounds(160, 130, 150, 30);
        add(t2);

        // Email
        JLabel email = new JLabel("Email");
        email.setBounds(50, 180, 100, 30);
        add(email);

        t3 = new JTextField();
        t3.setBounds(160, 180, 150, 30);
        add(t3);

        // Login
        JLabel login = new JLabel("Login (Username)");
        login.setBounds(50, 230, 100, 30);
        add(login);

        t4 = new JTextField();
        t4.setBounds(160, 230, 150, 30);
        add(t4);

        // Password
        JLabel password = new JLabel("Password");
        password.setBounds(50, 280, 100, 30);
        add(password);

        t5 = new JTextField();
        t5.setBounds(160, 280, 150, 30);
        add(t5);

        // Submit Button
        b1 = new JButton("Add");
        b1.setBounds(80, 340, 100, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Cancel Button
        b2 = new JButton("Cancel");
        b2.setBounds(220, 340, 100, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/receptionist.png"));
        Image i2 = i1.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l2 = new JLabel(i3);
        l2.setBounds(350, 50, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 200, 700, 450);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Add Button
            String fullName = t1.getText();
            String phone = t2.getText();
            String email = t3.getText();
            String login = t4.getText();
            String password = t5.getText();

            ConnectMySQL c = new ConnectMySQL();

            String query = "INSERT INTO Receptionists (full_name, phone_number, email, login, password, created_at, updated_at) "
                    + "VALUES ('" + fullName + "', '" + phone + "', '" + email + "', '" + login + "', '" + password + "', NOW(), NOW())";

            try {
                c.s.executeUpdate(query);
                JOptionPane.showMessageDialog(null, "Receptionist Added Successfully");
                new DropDown().setVisible(true);
                this.setVisible(false);
            } catch (SQLIntegrityConstraintViolationException e) {
                JOptionPane.showMessageDialog(null, "Username, Phone Number, or Email already exists!");
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Cancel Button
            new DropDown().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new AddReceptionist().setVisible(true);
    }
}








// src/hotel/management/system/AddRooms.java
package h;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;

public class AddRooms extends JFrame implements ActionListener {

    JTextField t1, t2, t3;
    JComboBox<String> c1, c2, c3;
    JButton b1, b2;

    AddRooms() {

        JLabel l1 = new JLabel("Add New Room");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(150, 20, 200, 30);
        add(l1);

        // Room Number
        JLabel roomNumber = new JLabel("Room Number");
        roomNumber.setBounds(50, 80, 100, 30);
        add(roomNumber);

        t1 = new JTextField();
        t1.setBounds(160, 80, 150, 30);
        add(t1);

        // Bed Type
        JLabel bedType = new JLabel("Bed Type");
        bedType.setBounds(50, 130, 100, 30);
        add(bedType);

        c1 = new JComboBox<>(new String[]{"Single Bed", "Double Bed", "Queen", "King", "Twin"});
        c1.setBounds(160, 130, 150, 30);
        add(c1);

        // Room Type
        JLabel roomType = new JLabel("Room Type");
        roomType.setBounds(50, 180, 100, 30);
        add(roomType);

        c2 = new JComboBox<>(new String[]{"Standard", "Deluxe", "Suite"});
        c2.setBounds(160, 180, 150, 30);
        add(c2);

        // Price
        JLabel price = new JLabel("Price");
        price.setBounds(50, 230, 100, 30);
        add(price);

        t2 = new JTextField();
        t2.setBounds(160, 230, 150, 30);
        add(t2);

        // Status
        JLabel status = new JLabel("Status");
        status.setBounds(50, 280, 100, 30);
        add(status);

        c3 = new JComboBox<>(new String[]{"Available", "Occupied", "Maintenance"});
        c3.setBounds(160, 280, 150, 30);
        add(c3);

        // Submit Button
        b1 = new JButton("Add Room");
        b1.setBounds(80, 340, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Cancel Button
        b2 = new JButton("Cancel");
        b2.setBounds(220, 340, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/addroom.png"));
        Image i2 = i1.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l2 = new JLabel(i3);
        l2.setBounds(350, 80, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 200, 700, 450);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Add Room Button
            String roomNumber = t1.getText();
            String bedType = (String) c1.getSelectedItem();
            String roomType = (String) c2.getSelectedItem();
            String priceStr = t2.getText();
            String status = (String) c3.getSelectedItem();

            try {
                int roomNum = Integer.parseInt(roomNumber);
                double price = Double.parseDouble(priceStr);

                ConnectMySQL c = new ConnectMySQL();

                String query = "INSERT INTO Rooms (room_number, bed_type, room_type, price, available, status, created_at, updated_at) "
                        + "VALUES (" + roomNum + ", '" + bedType + "', '" + roomType + "', " + price + ", TRUE, '" + status + "', NOW(), NOW())";

                c.s.executeUpdate(query);
                JOptionPane.showMessageDialog(null, "Room Added Successfully");

                // Clear Fields
                t1.setText("");
                t2.setText("");
                c1.setSelectedIndex(0);
                c2.setSelectedIndex(0);
                c3.setSelectedIndex(0);

            } catch (NumberFormatException e) {
                JOptionPane.showMessageDialog(null, "Please enter valid Room Number and Price");
            } catch (SQLIntegrityConstraintViolationException e) {
                JOptionPane.showMessageDialog(null, "Room Number already exists!");
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Cancel Button
            new DropDown().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new AddRooms().setVisible(true);
    }
}














// src/hotel/management/system/CheckOut.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class CheckOut extends JFrame implements ActionListener {

    JComboBox<String> c1;
    JTextField t1;
    JButton b1, b2;

    CheckOut() {

        JLabel l1 = new JLabel("Check Out");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(400, 20, 200, 30);
        add(l1);

        // Номер телефона клиента
        JLabel l2 = new JLabel("Customer Phone No.");
        l2.setBounds(100, 80, 150, 30);
        add(l2);

        c1 = new JComboBox<>();
        try {
            ConnectMySQL c = new ConnectMySQL();
            String query = "SELECT phone FROM Customers";
            ResultSet rs = c.s.executeQuery(query);
            while (rs.next()) {
                c1.addItem(rs.getString("phone"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        c1.setBounds(300, 80, 150, 30);
        add(c1);

        // Номер комнаты
        JLabel l3 = new JLabel("Room Number");
        l3.setBounds(100, 140, 150, 30);
        add(l3);

        t1 = new JTextField();
        t1.setBounds(300, 140, 150, 30);
        add(t1);

        // Кнопка "Checkout"
        b1 = new JButton("Check Out");
        b1.setBounds(150, 220, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Кнопка "Back"
        b2 = new JButton("Back");
        b2.setBounds(300, 220, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Логотип/изображение
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/tick.png"));
        JLabel l4 = new JLabel(i1);
        l4.setBounds(500, 80, 400, 250);
        add(l4);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(450, 200, 1000, 300);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Кнопка "Check Out"
            String phone = (String) c1.getSelectedItem();
            String room = t1.getText();

            ConnectMySQL c = new ConnectMySQL();

            try {
                // Обновление статуса бронирования
                String updateReservation = "UPDATE Reservations r "
                        + "JOIN Customers c ON r.customer_id = c.customer_id "
                        + "SET r.status = 'Checked-out' "
                        + "WHERE c.phone = '" + phone + "' AND r.room_id = (SELECT room_id FROM Rooms WHERE room_number = " + room + ") AND r.status = 'Checked-in'";
                c.s.executeUpdate(updateReservation);

                // Обновление доступности комнаты
                String updateRoom = "UPDATE Rooms SET available = TRUE, status = 'Available', updated_at = NOW() WHERE room_number = " + room + "";
                c.s.executeUpdate(updateRoom);

                JOptionPane.showMessageDialog(null, "Check Out Successful");

                // Очистка полей
                t1.setText("");
                c1.setSelectedIndex(0);

            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Кнопка "Back"
            new Reception().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new CheckOut().setVisible(true);
    }
}










package h;


import java.sql.*;

public class ConnectMySQL {
    Connection c;
    Statement s;

    public ConnectMySQL() {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            c = DriverManager.getConnection("jdbc:mysql://localhost:1369/hotellsk", "root", "1369sukAnigghaD1ck");
            s = c.createStatement();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}












// src/hotel/management/system/CustomerInfo.java
package h;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import net.proteanit.sql.DbUtils;

public class CustomerInfo extends JFrame implements ActionListener {

    JTable t1;
    JButton b1, b2;
    JComboBox<String> c1, c2;

    CustomerInfo() {

        // Table to display customer information
        t1 = new JTable();
        t1.setBounds(0, 40, 1000, 300);
        add(t1);

        // Filter by Country/Region
        c1 = new JComboBox<>(new String[]{"All", "Local (Bangladesh)", "Foreigner"});
        c1.setBounds(160, 400, 150, 25);
        c1.setBackground(Color.WHITE);
        c1.addActionListener(this);
        add(c1);

        // Sort By Room
        c2 = new JComboBox<>(new String[]{"Sort By", "Room Number"});
        c2.setBounds(440, 400, 150, 25);
        c2.setBackground(Color.WHITE);
        c2.addActionListener(this);
        add(c2);

        // Column Headers (Optional since JTable can handle headers automatically)
        // You can customize the table model if needed

        // Load Data Button
        b1 = new JButton("Load Data");
        b1.setBounds(350, 450, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Back Button
        b2 = new JButton("Back");
        b2.setBounds(530, 450, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(450, 200, 1000, 530);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {

        if (ae.getSource() == b1) { // Load Data Button
            try {
                ConnectMySQL c = new ConnectMySQL();
                String query = "SELECT c.full_name, c.phone, c.email, c.gender, c.country, r.room_number, r.check_in, r.check_out, r.status, r.total_amount, r.deposit "
                        + "FROM Customers c "
                        + "JOIN Reservations r ON c.customer_id = r.customer_id";
                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Back Button
            new Reception().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == c1) { // Country/Region Filter
            try {
                ConnectMySQL c = new ConnectMySQL();
                String selection = (String) c1.getSelectedItem();
                String query;

                if (selection.equals("Local (Bangladesh)")) {
                    query = "SELECT c.full_name, c.phone, c.email, c.gender, c.country, r.room_number, r.check_in, r.check_out, r.status, r.total_amount, r.deposit "
                            + "FROM Customers c "
                            + "JOIN Reservations r ON c.customer_id = r.customer_id "
                            + "WHERE c.country = 'Bangladesh'";
                } else if (selection.equals("Foreigner")) {
                    query = "SELECT c.full_name, c.phone, c.email, c.gender, c.country, r.room_number, r.check_in, r.check_out, r.status, r.total_amount, r.deposit "
                            + "FROM Customers c "
                            + "JOIN Reservations r ON c.customer_id = r.customer_id "
                            + "WHERE c.country != 'Bangladesh'";
                } else {
                    query = "SELECT c.full_name, c.phone, c.email, c.gender, c.country, r.room_number, r.check_in, r.check_out, r.status, r.total_amount, r.deposit "
                            + "FROM Customers c "
                            + "JOIN Reservations r ON c.customer_id = r.customer_id";
                }

                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));

            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == c2) { // Sort By Room Number
            try {
                ConnectMySQL c = new ConnectMySQL();
                String selection = (String) c2.getSelectedItem();
                String query;

                if (selection.equals("Room Number")) {
                    query = "SELECT c.full_name, c.phone, c.email, c.gender, c.country, r.room_number, r.check_in, r.check_out, r.status, r.total_amount, r.deposit "
                            + "FROM Customers c "
                            + "JOIN Reservations r ON c.customer_id = r.customer_id "
                            + "ORDER BY r.room_number ASC";
                } else {
                    query = "SELECT c.full_name, c.phone, c.email, c.gender, c.country, r.room_number, r.check_in, r.check_out, r.status, r.total_amount, r.deposit "
                            + "FROM Customers c "
                            + "JOIN Reservations r ON c.customer_id = r.customer_id";
                }

                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        new CustomerInfo().setVisible(true);
    }
}













// src/hotel/management/system/Dashboard.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Dashboard extends JFrame implements ActionListener {

    JButton logoutButton;

    Dashboard() {

        // Background Image
        ImageIcon backgroundIcon = new ImageIcon(ClassLoader.getSystemResource("h/images/luxury.jpg"));
        Image backgroundImage = backgroundIcon.getImage().getScaledInstance(1720, 1000, Image.SCALE_DEFAULT);
        ImageIcon scaledBackground = new ImageIcon(backgroundImage);
        JLabel backgroundLabel = new JLabel(scaledBackground);
        backgroundLabel.setBounds(230, 0, 1720, 1000);
        add(backgroundLabel);

        // Logout Button
        logoutButton = new JButton("Logout");
        logoutButton.setFont(new Font("Tahoma", Font.BOLD, 26));
        logoutButton.addActionListener(this);
        logoutButton.setBounds(20, 640, 190, 60);
        backgroundLabel.add(logoutButton);

        // Additional Admin Features Buttons (Optional)
        // Example: Managing Employees
        // JButton manageEmployees = new JButton("Manage Employees");
        // manageEmployees.setFont(new Font("Tahoma", Font.BOLD, 18));
        // manageEmployees.addActionListener(this);
        // manageEmployees.setBounds(20, 300, 190, 60);
        // backgroundLabel.add(manageEmployees);

        getContentPane().setBackground(Color.decode("#6e5853"));

        setLayout(null);
        setBounds(0, 0, 1950, 1020);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == logoutButton) { // Logout Button
            new Login().setVisible(true);
            this.setVisible(false);
        }

        // Handle additional admin buttons here
        // Example:
        // if (ae.getSource() == manageEmployees) {
        //     new ManageEmployees().setVisible(true);
        //     this.setVisible(false);
        // }
    }

    public static void main(String[] args) {
        new Dashboard().setVisible(true);
    }
}












// src/hotel/management/system/DropDown.java
package h;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class DropDown extends JFrame implements ActionListener {

    JButton b1, b2, b3, b4;

    DropDown() {

        // Кнопка "Add Employee"
        b1 = new JButton("Add Employee");
        b1.setFont(new Font("Tahoma", Font.BOLD, 16));
        b1.addActionListener(this);
        b1.setBounds(10, 30, 160, 40);
        add(b1);

        // Кнопка "Add Room"
        b2 = new JButton("Add Room");
        b2.setFont(new Font("Tahoma", Font.BOLD, 16));
        b2.addActionListener(this);
        b2.setBounds(10, 100, 160, 40);
        add(b2);

        // Кнопка "Add Receptionist"
        b3 = new JButton("Add Receptionist");
        b3.setFont(new Font("Tahoma", Font.BOLD, 16));
        b3.addActionListener(this);
        b3.setBounds(10, 170, 160, 40);
        add(b3);

        // Кнопка "Back"
        b4 = new JButton("Back");
        b4.setFont(new Font("Tahoma", Font.BOLD, 16));
        b4.addActionListener(this);
        b4.setBounds(10, 240, 160, 40);
        add(b4);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(230, 337, 190, 290);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Добавить сотрудника
            new AddEmployee().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b2) { // Добавить комнату
            new AddRooms().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b3) { // Добавить приемного
            new AddReceptionist().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b4) { // Кнопка "Back"
            new Dashboard().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new DropDown().setVisible(true);
    }
}









// src/hotel/management/system/EmployeeInfo.java
package h;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import net.proteanit.sql.DbUtils;

public class EmployeeInfo extends JFrame implements ActionListener {

    JTable t1;
    JButton b1, b2;
    JComboBox<String> c1, c2;

    EmployeeInfo() {

        JLabel l1 = new JLabel("Employee Information");
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(350, 20, 300, 30);
        add(l1);

        // Таблица для отображения информации о сотрудниках
        t1 = new JTable();
        t1.setBounds(0, 70, 1000, 300);
        add(t1);

        // Кнопка "Load Data"
        b1 = new JButton("Load Data");
        b1.setBounds(80, 400, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Фильтр по должности
        c1 = new JComboBox<>(new String[]{"All Jobs", "Front Desk Clerks", "Porters", "Housekeeping", "Kitchen Staff", "Room Service", "Waiter", "Manager", "Accountant", "Chef"});
        c1.setBounds(250, 400, 150, 25);
        c1.setBackground(Color.WHITE);
        c1.addActionListener(this);
        add(c1);

        // Сортировка по зарплате
        c2 = new JComboBox<>(new String[]{"Sort By Salary", "Ascending", "Descending"});
        c2.setBounds(430, 400, 150, 25);
        c2.setBackground(Color.WHITE);
        c2.addActionListener(this);
        add(c2);

        // Кнопка "Back"
        b2 = new JButton("Back");
        b2.setBounds(600, 400, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Логотип/Изображение
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/employeeinfo.png"));
        JLabel l2 = new JLabel(i1);
        l2.setBounds(350, 80, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 150, 1020, 500);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        ConnectMySQL c = new ConnectMySQL();

        if (ae.getSource() == b1) { // Кнопка "Load Data"
            try {
                String query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees";
                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == c1) { // Фильтр по должности
            try {
                String selection = (String) c1.getSelectedItem();
                String query;

                if (!selection.equals("All Jobs")) {
                    query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees WHERE job_title = '" + selection + "'";
                } else {
                    query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees";
                }

                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));

            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == c2) { // Сортировка по зарплате
            try {
                String sortOrder = (String) c2.getSelectedItem();
                String query;

                if (sortOrder.equals("Ascending")) {
                    query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees ORDER BY salary ASC";
                } else if (sortOrder.equals("Descending")) {
                    query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees ORDER BY salary DESC";
                } else {
                    query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees";
                }

                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));

            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (ae.getSource() == b2) { // Кнопка "Back"
            new DropDown().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new EmployeeInfo().setVisible(true);
    }
}











// src/hotel/management/system/HotelManagementSystem.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class HotelManagementSystem extends JFrame implements ActionListener {

    JButton b1;

    HotelManagementSystem() {

        // Установка размеров и расположения окна
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        setLayout(null);

        // Фоновое изображение
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/hotel.jpg"));
        Image i2 = i1.getImage().getScaledInstance(1366, 768, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l1 = new JLabel(i3);
        l1.setBounds(0, 0, 1366, 768);
        add(l1);

        // Текст "Hotel Management System"
        JLabel l2 = new JLabel("Hotel Management System");
        l2.setForeground(Color.WHITE);
        l2.setFont(new Font("Serif", Font.BOLD, 70));
        l2.setBounds(200, 60, 1000, 90);
        l1.add(l2);

        // Кнопка "Next"
        b1 = new JButton("Next");
        b1.setBounds(1150, 650, 150, 50);
        b1.setBackground(Color.WHITE);
        b1.setForeground(Color.BLACK);
        b1.setFont(new Font("Tahoma", Font.BOLD, 18));
        b1.addActionListener(this);
        l1.add(b1);

        // Настройки окна
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    // Обработка событий кнопок
    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Кнопка "Next"
            new Login().setVisible(true); // Переход на экран входа
            this.setVisible(false); // Скрытие текущего окна
        }
    }

    public static void main(String[] args) {
        new HotelManagementSystem().setVisible(true);
    }
}









// src/hotel/management/system/Login.java
package h;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;

public class Login extends JFrame implements ActionListener {

    JLabel l1, l2;
    JTextField t1;
    JPasswordField t2;
    JButton b1, b2;
    JCheckBox check;

    Login() {

        // Username Label and TextField
        l1 = new JLabel("Username");
        l1.setBounds(40, 50, 100, 30);
        add(l1);

        t1 = new JTextField();
        t1.setBounds(150, 50, 150, 30);
        add(t1);

        // Password Label and PasswordField
        l2 = new JLabel("Password");
        l2.setBounds(40, 100, 100, 30);
        add(l2);

        t2 = new JPasswordField();
        t2.setBounds(150, 100, 150, 30);
        add(t2);

        // Show Password Checkbox
        check = new JCheckBox("Show Password");
        check.setBounds(150, 140, 150, 25);
        check.setBackground(Color.WHITE);
        check.addActionListener(this);
        add(check);

        // Login Button
        b1 = new JButton("Login");
        b1.setBounds(40, 200, 120, 30);
        b1.setForeground(Color.WHITE);
        b1.setBackground(Color.BLACK);
        b1.addActionListener(this);
        add(b1);

        // Cancel Button
        b2 = new JButton("Cancel");
        b2.setBounds(200, 200, 120, 30);
        b2.setForeground(Color.WHITE);
        b2.setBackground(Color.BLACK);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/second.jpg")); // Change image path as needed
        Image i2 = i1.getImage().getScaledInstance(200, 200, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l3 = new JLabel(i3);
        l3.setBounds(350, 10, 200, 200);
        add(l3);

        // Signup Link as a Button
        JButton l4 = new JButton("<HTML><U>Don't have an account? Signup</U></HTML>");
        l4.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        l4.setBorderPainted(false);
        l4.setForeground(Color.BLUE.darker());
        l4.setBackground(Color.WHITE);
        l4.setBounds(350, 220, 200, 30);
        l4.setFocusPainted(false);
        l4.setFont(new Font("Tahoma", Font.PLAIN, 12));
        l4.addActionListener(this);
        add(l4);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(700, 300, 600, 400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        // Handle show password checkbox
        if (ae.getSource() == check) {
            if (check.isSelected()) {
                t2.setEchoChar((char) 0);
            } else {
                t2.setEchoChar('*');
            }
        }

        // Handle Login Button
        if (ae.getSource() == b1) {
            String username = t1.getText().trim();
            String password = new String(t2.getPassword()).trim();

            // Basic Validation
            if (username.isEmpty() || password.isEmpty()) {
                JOptionPane.showMessageDialog(null, "Please enter username and password.");
                return;
            }

            ConnectMySQL c = new ConnectMySQL();

            try {
                // Check in Administrators
                String queryAdmin = "SELECT * FROM Administrators WHERE login = ? AND password = ?";
                PreparedStatement pstmtAdmin = c.c.prepareStatement(queryAdmin);
                pstmtAdmin.setString(1, username);
                pstmtAdmin.setString(2, password);
                ResultSet rsAdmin = pstmtAdmin.executeQuery();

                if (rsAdmin.next()) {
                    new Dashboard().setVisible(true);
                    this.setVisible(false);
                    return;
                }

                // Check in Receptionists
                String queryReceptionist = "SELECT * FROM Receptionists WHERE login = ? AND password = ?";
                PreparedStatement pstmtReceptionist = c.c.prepareStatement(queryReceptionist);
                pstmtReceptionist.setString(1, username);
                pstmtReceptionist.setString(2, password);
                ResultSet rsReceptionist = pstmtReceptionist.executeQuery();

                if (rsReceptionist.next()) {
                    new Reception().setVisible(true);
                    this.setVisible(false);
                    return;
                }

                // If not found
                JOptionPane.showMessageDialog(null, "Invalid username or password.");
                t1.setText("");
                t2.setText("");
            } catch (Exception e) {
                e.printStackTrace();
            }

        }

        // Handle Cancel Button
        if (ae.getSource() == b2) {
            this.setVisible(false);
            new HotelManagementSystem().setVisible(true);
        }

        // Handle Signup Link
        if (ae.getActionCommand().contains("Don't have an account? Signup")) {
            new SignUp().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new Login();
    }
}










// src/hotel/management/system/ManagerInfo.java
package h;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import net.proteanit.sql.DbUtils;

public class ManagerInfo extends JFrame implements ActionListener {

    JTable t1;
    JButton b1, b2;

    ManagerInfo() {

        JLabel l1 = new JLabel("Manager Information");
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(350, 20, 300, 30);
        add(l1);

        // Table to display manager information
        t1 = new JTable();
        t1.setBounds(0, 70, 1000, 300);
        add(t1);

        // Load Data Button
        b1 = new JButton("Load Data");
        b1.setBounds(350, 400, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Back Button
        b2 = new JButton("Back");
        b2.setBounds(500, 400, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/manager.png"));
        Image i2 = i1.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l2 = new JLabel(i3);
        l2.setBounds(350, 130, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(450, 200, 1020, 480);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        ConnectMySQL c = new ConnectMySQL();

        if (ae.getSource() == b1) { // Load Data Button
            try {
                String query = "SELECT full_name, age, gender, job_title, salary, phone, national_id, email, created_at, updated_at FROM Employees WHERE job_title = 'Manager'";
                ResultSet rs = c.s.executeQuery(query);
                t1.setModel(DbUtils.resultSetToTableModel(rs));
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Back Button
            new Reception().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new ManagerInfo().setVisible(true);
    }
}









// src/hotel/management/system/Reception.java
package h;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Reception extends JFrame implements ActionListener {

    JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12;

    Reception() {

        JLabel l1 = new JLabel("Reception");
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(400, 20, 200, 30);
        add(l1);

        // Новая форма клиента
        b1 = new JButton("New Customer Form");
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.setBounds(30, 80, 200, 30);
        b1.addActionListener(this);
        add(b1);

        // Информация о клиенте
        b5 = new JButton("Customer Info");
        b5.setBackground(Color.BLACK);
        b5.setForeground(Color.WHITE);
        b5.setBounds(30, 130, 200, 30);
        b5.addActionListener(this);
        add(b5);

        // Выезд клиента
        b7 = new JButton("Check Out");
        b7.setBackground(Color.BLACK);
        b7.setForeground(Color.WHITE);
        b7.setBounds(30, 180, 200, 30);
        b7.addActionListener(this);
        add(b7);

        // Обновление статуса бронирования
        b8 = new JButton("Update Check Status");
        b8.setBackground(Color.BLACK);
        b8.setForeground(Color.WHITE);
        b8.setBounds(30, 230, 200, 30);
        b8.addActionListener(this);
        add(b8);

        // Обновление статуса комнаты
        b9 = new JButton("Update Room Status");
        b9.setBackground(Color.BLACK);
        b9.setForeground(Color.WHITE);
        b9.setBounds(30, 280, 200, 30);
        b9.addActionListener(this);
        add(b9);

        // Поиск комнаты
        b11 = new JButton("Search Room");
        b11.setBackground(Color.BLACK);
        b11.setForeground(Color.WHITE);
        b11.setBounds(30, 330, 200, 30);
        b11.addActionListener(this);
        add(b11);

        // Кнопка "Back"
        b12 = new JButton("Back");
        b12.setBackground(Color.BLACK);
        b12.setForeground(Color.WHITE);
        b12.setBounds(30, 380, 200, 30);
        b12.addActionListener(this);
        add(b12);

        // Логотип/Изображение
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/fourth.jpg"));
        JLabel l2 = new JLabel(i1);
        l2.setBounds(300, 80, 500, 400);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(500, 200, 850, 500);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Новая форма клиента
            new AddCustomer().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b5) { // Информация о клиенте
            new CustomerInfo().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b7) { // Выезд клиента
            new CheckOut().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b8) { // Обновление статуса бронирования
            new UpdateStatus().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b9) { // Обновление статуса комнаты
            new UpdateRoom().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b11) { // Поиск комнаты
            new SearchRoom().setVisible(true);
            this.setVisible(false);
        } else if (ae.getSource() == b12) { // Кнопка "Back"
            new Login().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new Reception().setVisible(true);
    }
}








// src/hotel/management/system/SearchRoom.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import net.proteanit.sql.DbUtils;

public class SearchRoom extends JFrame implements ActionListener {

    JComboBox<String> c1, c2, c3;
    JTextField t1, t2;
    JButton b1, b2, b3;
    JTable t3;

    SearchRoom() {

        JLabel l1 = new JLabel("Search Room");
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(400, 20, 200, 30);
        add(l1);

        // Bed Type
        JLabel l2 = new JLabel("Bed Type");
        l2.setBounds(50, 80, 100, 30);
        add(l2);

        c1 = new JComboBox<>(new String[]{"Single Bed", "Double Bed", "Queen", "King", "Twin"});
        c1.setBounds(150, 80, 150, 30);
        add(c1);

        // Price Range
        JLabel l3 = new JLabel("Price Range");
        l3.setBounds(50, 130, 100, 30);
        add(l3);

        t1 = new JTextField();
        t1.setBounds(150, 130, 70, 30);
        add(t1);

        JLabel to = new JLabel("to");
        to.setBounds(230, 130, 20, 30);
        add(to);

        t2 = new JTextField();
        t2.setBounds(250, 130, 70, 30);
        add(t2);

        // Availability
        JLabel l4 = new JLabel("Availability");
        l4.setBounds(50, 180, 100, 30);
        add(l4);

        c2 = new JComboBox<>(new String[]{"All", "Available", "Occupied", "Maintenance"});
        c2.setBounds(150, 180, 150, 30);
        add(c2);

        // Search Button
        b1 = new JButton("Search");
        b1.setBounds(50, 240, 100, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Load All Rooms
        b2 = new JButton("Load All");
        b2.setBounds(170, 240, 100, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Back Button
        b3 = new JButton("Back");
        b3.setBounds(290, 240, 100, 30);
        b3.setBackground(Color.BLACK);
        b3.setForeground(Color.WHITE);
        b3.addActionListener(this);
        add(b3);

        // Table to display rooms
        t3 = new JTable();
        t3.setBounds(0, 300, 1000, 300);
        add(t3);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 150, 1020, 650);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        ConnectMySQL c = new ConnectMySQL();

        if (ae.getSource() == b1) { // Search Button
            String bedType = (String) c1.getSelectedItem();
            String minPrice = t1.getText();
            String maxPrice = t2.getText();
            String availability = (String) c2.getSelectedItem();

            String query = "SELECT room_number, bed_type, room_type, price, status FROM Rooms WHERE bed_type = '" + bedType + "'";

            if (!minPrice.isEmpty() && !maxPrice.isEmpty()) {
                query += " AND price BETWEEN " + minPrice + " AND " + maxPrice;
            }

            if (!availability.equals("All")) {
                query += " AND status = '" + availability + "'";
            }

            try {
                ResultSet rs = c.s.executeQuery(query);
                t3.setModel(DbUtils.resultSetToTableModel(rs));
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Load All Rooms
            try {
                ResultSet rs = c.s.executeQuery("SELECT room_number, bed_type, room_type, price, status FROM Rooms");
                t3.setModel(DbUtils.resultSetToTableModel(rs));
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b3) { // Back Button
            new Reception().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new SearchRoom().setVisible(true);
    }
}








// src/hotel/management/system/SignUp.java
package h;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

public class SignUp extends JFrame implements ActionListener {

    JLabel l1, l2, l3, l4;
    JTextField t1, t2, t3, t4;
    JPasswordField t5;
    JButton b1, b2;
    JComboBox<String> roleComboBox;
    JCheckBox check;

    // Predefined registration code for administrators
    private static final String ADMIN_REG_CODE = "ADMIN2023"; // Change as needed

    SignUp() {

        // Role Selection
        l3 = new JLabel("Role");
        l3.setBounds(40, 50, 100, 30);
        add(l3);

        roleComboBox = new JComboBox<>(new String[]{"Receptionist", "Administrator"});
        roleComboBox.setBounds(150, 50, 150, 30);
        roleComboBox.addActionListener(this);
        add(roleComboBox);

        // Full Name
        l1 = new JLabel("Full Name");
        l1.setBounds(40, 100, 100, 30);
        add(l1);

        t1 = new JTextField();
        t1.setBounds(150, 100, 150, 30);
        add(t1);

        // Phone Number
        l2 = new JLabel("Phone Number");
        l2.setBounds(40, 150, 100, 30);
        add(l2);

        t2 = new JTextField();
        t2.setBounds(150, 150, 150, 30);
        add(t2);

        // Email
        l4 = new JLabel("Email");
        l4.setBounds(40, 200, 100, 30);
        add(l4);

        t3 = new JTextField();
        t3.setBounds(150, 200, 150, 30);
        add(t3);

        // Password
        JLabel l5 = new JLabel("Password");
        l5.setBounds(40, 250, 100, 30);
        add(l5);

        t5 = new JPasswordField();
        t5.setBounds(150, 250, 150, 30);
        add(t5);

        // Show Password Checkbox
        check = new JCheckBox("Show Password");
        check.setBounds(150, 290, 150, 25);
        check.setBackground(Color.WHITE);
        check.addActionListener(this);
        add(check);

        // Registration Code (only visible for Administrators)
        l4 = new JLabel("Registration Code");
        l4.setBounds(40, 340, 120, 30);
        l4.setVisible(false); // Initially hidden
        add(l4);

        t4 = new JTextField();
        t4.setBounds(170, 340, 150, 30);
        t4.setVisible(false); // Initially hidden
        add(t4);

        // Signup Button
        b1 = new JButton("Signup");
        b1.setBounds(40, 400, 120, 30);
        b1.setForeground(Color.WHITE);
        b1.setBackground(Color.BLACK);
        b1.addActionListener(this);
        add(b1);

        // Cancel Button
        b2 = new JButton("Cancel");
        b2.setBounds(200, 400, 120, 30);
        b2.setForeground(Color.WHITE);
        b2.setBackground(Color.BLACK);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/second.jpg")); // Change image path as needed
        Image i2 = i1.getImage().getScaledInstance(200, 200, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l6 = new JLabel(i3);
        l6.setBounds(350, 100, 200, 200);
        add(l6);

        // Login Link as a Button
        JButton l7 = new JButton("<HTML><U>Already have an account? Login</U></HTML>");
        l7.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        l7.setBorderPainted(false);
        l7.setForeground(Color.BLUE.darker());
        l7.setBackground(Color.WHITE);
        l7.setBounds(350, 320, 200, 30);
        l7.setFocusPainted(false);
        l7.setFont(new Font("Tahoma", Font.PLAIN, 12));
        l7.addActionListener(this);
        add(l7);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(700, 300, 600, 500);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);

    }

    public void actionPerformed(ActionEvent ae) {
        // Handle role selection to show/hide registration code field
        if (ae.getSource() == roleComboBox) {
            String selectedRole = (String) roleComboBox.getSelectedItem();
            if (selectedRole.equals("Administrator")) {
                l4.setVisible(true);
                t4.setVisible(true);
            } else {
                l4.setVisible(false);
                t4.setVisible(false);
            }
        }

        // Handle show password checkbox
        if (ae.getSource() == check) {
            if (check.isSelected()) {
                t5.setEchoChar((char) 0);
            } else {
                t5.setEchoChar('*');
            }
        }

        // Handle Signup Button
        if (ae.getSource() == b1) {
            String role = (String) roleComboBox.getSelectedItem();
            String fullName = t1.getText().trim();
            String phone = t2.getText().trim();
            String email = t3.getText().trim();
            String password = new String(t5.getPassword()).trim();

            // Basic Validation
            if (fullName.isEmpty() || phone.isEmpty() || email.isEmpty() || password.isEmpty()) {
                JOptionPane.showMessageDialog(null, "Please fill all required fields.");
                return;
            }

            // Additional Validation for Administrator
            String registrationCode = "";
            if (role.equals("Administrator")) {
                registrationCode = t4.getText().trim();
                if (registrationCode.isEmpty()) {
                    JOptionPane.showMessageDialog(null, "Please enter the registration code for Administrator.");
                    return;
                }
                if (!registrationCode.equals(ADMIN_REG_CODE)) {
                    JOptionPane.showMessageDialog(null, "Invalid Registration Code.");
                    return;
                }
            }

            ConnectMySQL c = new ConnectMySQL();

            String tableName = role.equals("Administrator") ? "Administrators" : "Receptionists";

            // Prepare SQL statement with placeholders to prevent SQL injection
            String query;
            if (role.equals("Administrator")) {
                query = "INSERT INTO Administrators (full_name, phone_number, email, login, password, registration_code, created_at, updated_at) "
                        + "VALUES (?, ?, ?, ?, ?, ?, NOW(), NOW())";
            } else {
                query = "INSERT INTO Receptionists (full_name, phone_number, email, login, password, created_at, updated_at) "
                        + "VALUES (?, ?, ?, ?, ?, NOW(), NOW())";
            }

            try {
                PreparedStatement pstmt = c.c.prepareStatement(query);
                pstmt.setString(1, fullName);
                pstmt.setString(2, phone);
                pstmt.setString(3, email);
                pstmt.setString(4, phone); // Using phone as login; adjust as needed
                pstmt.setString(5, password);
                if (role.equals("Administrator")) {
                    pstmt.setString(6, registrationCode);
                }
                pstmt.executeUpdate();
                JOptionPane.showMessageDialog(null, role + " Account Created Successfully");
                new Login().setVisible(true);
                this.setVisible(false);
            } catch (SQLIntegrityConstraintViolationException e) {
                JOptionPane.showMessageDialog(null, "Username, Phone Number, or Email already exists!");
            } catch (Exception e) {
                e.printStackTrace();
            }

        }

        // Handle Cancel Button
        if (ae.getSource() == b2) {
            this.setVisible(false);
            new Login().setVisible(true);
        }

        // Handle Login Link
        if (ae.getActionCommand().contains("Already have an account? Login")) {
            new Login().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new SignUp();
    }
}







// src/hotel/management/system/UpdateRoom.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class UpdateRoom extends JFrame implements ActionListener {

    JComboBox<String> c1, c2;
    JTextField t1;
    JButton b1, b2, b3;

    UpdateRoom() {

        JLabel l1 = new JLabel("Update Room Status");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(150, 20, 300, 30);
        add(l1);

        // Select Room
        JLabel roomSelect = new JLabel("Select Room");
        roomSelect.setBounds(50, 80, 100, 30);
        add(roomSelect);

        c1 = new JComboBox<>();
        try {
            ConnectMySQL c = new ConnectMySQL();
            String query = "SELECT room_number FROM Rooms";
            ResultSet rs = c.s.executeQuery(query);
            while (rs.next()) {
                c1.addItem(rs.getString("room_number"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        c1.setBounds(160, 80, 150, 30);
        add(c1);

        // Availability
        JLabel availability = new JLabel("Availability");
        availability.setBounds(50, 130, 100, 30);
        add(availability);

        c2 = new JComboBox<>(new String[]{"Available", "Occupied", "Maintenance"});
        c2.setBounds(160, 130, 150, 30);
        add(c2);

        // Submit Button
        b1 = new JButton("Update");
        b1.setBounds(80, 200, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Back Button
        b2 = new JButton("Back");
        b2.setBounds(220, 200, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Logo/Image
        ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("h/images/updateroom.png"));
        Image i2 = i1.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT);
        ImageIcon i3 = new ImageIcon(i2);
        JLabel l2 = new JLabel(i3);
        l2.setBounds(350, 80, 300, 300);
        add(l2);

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(400, 200, 700, 400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Update Button
            String roomNumber = (String) c1.getSelectedItem();
            String availability = (String) c2.getSelectedItem();

            ConnectMySQL c = new ConnectMySQL();

            try {
                String query = "UPDATE Rooms SET available = " + (availability.equals("Available") ? "TRUE" : "FALSE") + ", status = '" + availability + "', updated_at = NOW() WHERE room_number = " + roomNumber + "";
                c.s.executeUpdate(query);
                JOptionPane.showMessageDialog(null, "Room Status Updated Successfully");
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Back Button
            new Reception().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new UpdateRoom().setVisible(true);
    }
}










// src/hotel/management/system/UpdateStatus.java
package h;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class UpdateStatus extends JFrame implements ActionListener {

    JComboBox<String> c1, c2;
    JTextField t1, t2;
    JButton b1, b2;

    UpdateStatus() {

        JLabel l1 = new JLabel("Update Check-in Status");
        l1.setForeground(Color.BLUE);
        l1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        l1.setBounds(150, 20, 300, 30);
        add(l1);

        // Customer Phone Number
        JLabel l2 = new JLabel("Customer Phone No.");
        l2.setBounds(50, 80, 150, 30);
        add(l2);

        c1 = new JComboBox<>();
        try {
            ConnectMySQL c = new ConnectMySQL();
            String query = "SELECT phone FROM Customers";
            ResultSet rs = c.s.executeQuery(query);
            while (rs.next()) {
                c1.addItem(rs.getString("phone"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        c1.setBounds(200, 80, 150, 30);
        add(c1);

        // Reservation Status
        JLabel l3 = new JLabel("Reservation Status");
        l3.setBounds(50, 130, 150, 30);
        add(l3);

        c2 = new JComboBox<>(new String[]{"Booked", "Checked-in", "Checked-out", "Cancelled"});
        c2.setBounds(200, 130, 150, 30);
        add(c2);

        // Total Amount
        JLabel l4 = new JLabel("Total Amount");
        l4.setBounds(50, 180, 150, 30);
        add(l4);

        t1 = new JTextField();
        t1.setBounds(200, 180, 150, 30);
        add(t1);

        // Deposit
        JLabel l5 = new JLabel("Deposit");
        l5.setBounds(50, 230, 150, 30);
        add(l5);

        t2 = new JTextField();
        t2.setBounds(200, 230, 150, 30);
        add(t2);

        // Update Button
        b1 = new JButton("Update");
        b1.setBounds(80, 300, 120, 30);
        b1.setBackground(Color.BLACK);
        b1.setForeground(Color.WHITE);
        b1.addActionListener(this);
        add(b1);

        // Back Button
        b2 = new JButton("Back");
        b2.setBounds(220, 300, 120, 30);
        b2.setBackground(Color.BLACK);
        b2.setForeground(Color.WHITE);
        b2.addActionListener(this);
        add(b2);

        // Auto-fill Total Amount and Deposit based on Reservation
        c1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String phone = (String) c1.getSelectedItem();
                try {
                    ConnectMySQL c = new ConnectMySQL();
                    String query = "SELECT r.total_amount, r.deposit FROM Reservations r JOIN Customers c ON r.customer_id = c.customer_id WHERE c.phone = '" + phone + "' AND r.status = 'Booked'";
                    ResultSet rs = c.s.executeQuery(query);
                    if (rs.next()) {
                        t1.setText(String.valueOf(rs.getDouble("total_amount")));
                        t2.setText(String.valueOf(rs.getDouble("deposit")));
                    } else {
                        t1.setText("");
                        t2.setText("");
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        });

        getContentPane().setBackground(Color.WHITE);

        setLayout(null);
        setBounds(450, 200, 500, 400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == b1) { // Update Button
            String phone = (String) c1.getSelectedItem();
            String status = (String) c2.getSelectedItem();
            String totalAmountStr = t1.getText();
            String depositStr = t2.getText();

            double totalAmount = 0.0;
            double deposit = 0.0;

            try {
                totalAmount = Double.parseDouble(totalAmountStr);
                deposit = Double.parseDouble(depositStr);
            } catch (NumberFormatException e) {
                JOptionPane.showMessageDialog(null, "Please enter valid amounts");
                return;
            }

            ConnectMySQL c = new ConnectMySQL();

            try {
                String updateQuery = "UPDATE Reservations r JOIN Customers c ON r.customer_id = c.customer_id "
                        + "SET r.status = '" + status + "', r.total_amount = " + totalAmount + ", r.deposit = " + deposit + ", r.updated_at = NOW() "
                        + "WHERE c.phone = '" + phone + "'";
                c.s.executeUpdate(updateQuery);
                JOptionPane.showMessageDialog(null, "Reservation Status Updated Successfully");
            } catch (Exception e) {
                e.printStackTrace();
            }

        } else if (ae.getSource() == b2) { // Back Button
            new Reception().setVisible(true);
            this.setVisible(false);
        }
    }

    public static void main(String[] args) {
        new UpdateStatus().setVisible(true);
    }
}










-- Создание базы данных
CREATE DATABASE IF NOT EXISTS hotellsk;
USE hotellsk;

-- Таблица Administrators
CREATE TABLE Administrators (
    admin_id INT AUTO_INCREMENT PRIMARY KEY,
    full_name VARCHAR(150) NOT NULL,
    passport_number VARCHAR(20) UNIQUE NOT NULL,
    address TEXT NOT NULL,
    phone_number VARCHAR(15) UNIQUE NOT NULL,
    email VARCHAR(100) UNIQUE NOT NULL,
    login VARCHAR(20) UNIQUE NOT NULL,
    password VARCHAR(255) NOT NULL,
    registration_code VARCHAR(50) UNIQUE NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Таблица Receptionists
CREATE TABLE Receptionists (
    receptionist_id INT AUTO_INCREMENT PRIMARY KEY,
    full_name VARCHAR(150) NOT NULL,
    passport_number VARCHAR(20) UNIQUE NOT NULL,
    address TEXT NOT NULL,
    phone_number VARCHAR(15) UNIQUE NOT NULL,
    email VARCHAR(100) UNIQUE NOT NULL,
    login VARCHAR(20) UNIQUE NOT NULL,
    password VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Таблица Employees (для других сотрудников)
CREATE TABLE Employees (
    employee_id INT AUTO_INCREMENT PRIMARY KEY,
    full_name VARCHAR(100) NOT NULL,
    age INT,
    gender ENUM('Male', 'Female', 'Other'),
    job_title VARCHAR(50) NOT NULL,
    salary DECIMAL(10, 2) NOT NULL,
    phone VARCHAR(15) UNIQUE NOT NULL,
    national_id VARCHAR(20) UNIQUE NOT NULL,
    email VARCHAR(100) UNIQUE NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Таблица Rooms
CREATE TABLE Rooms (
    room_id INT AUTO_INCREMENT PRIMARY KEY,
    room_number INT UNIQUE NOT NULL,
    available BOOLEAN DEFAULT TRUE,
    status ENUM('Available', 'Occupied', 'Maintenance') DEFAULT 'Available',
    price DECIMAL(10,2) NOT NULL,
    bed_type ENUM('Single', 'Double', 'Queen', 'King', 'Twin') NOT NULL,
    room_type VARCHAR(50),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Таблица Room_Images
CREATE TABLE Room_Images (
    image_id INT AUTO_INCREMENT PRIMARY KEY,
    room_id INT NOT NULL,
    image_url VARCHAR(255) NOT NULL,
    is_primary BOOLEAN DEFAULT FALSE,
    FOREIGN KEY (room_id) REFERENCES Rooms(room_id) ON DELETE CASCADE
);

-- Таблица Customers
CREATE TABLE Customers (
    customer_id INT AUTO_INCREMENT PRIMARY KEY,
    full_name VARCHAR(100) NOT NULL,
    phone VARCHAR(15) UNIQUE NOT NULL,
    email VARCHAR(100) UNIQUE,
    gender ENUM('Male', 'Female', 'Other'),
    country VARCHAR(50),
    address TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Таблица Reservations
CREATE TABLE Reservations (
    reservation_id INT AUTO_INCREMENT PRIMARY KEY,
    customer_id INT NOT NULL,
    room_id INT NOT NULL,
    check_in DATE NOT NULL,
    check_out DATE NOT NULL,
    status ENUM('Booked', 'Checked-in', 'Checked-out', 'Cancelled') DEFAULT 'Booked',
    total_amount DECIMAL(10,2),
    deposit DECIMAL(10,2),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id) ON DELETE CASCADE,
    FOREIGN KEY (room_id) REFERENCES Rooms(room_id) ON DELETE CASCADE
);

-- Таблица Payments
CREATE TABLE Payments (
    payment_id INT AUTO_INCREMENT PRIMARY KEY,
    reservation_id INT NOT NULL,
    amount DECIMAL(10, 2) NOT NULL,
    payment_date DATE NOT NULL,
    payment_method ENUM('Cash', 'Credit Card', 'Debit Card', 'Online Transfer') NOT NULL,
    FOREIGN KEY (reservation_id) REFERENCES Reservations(reservation_id) ON DELETE CASCADE
);

доделай все чтобы все работало и чтобы при Регистрации в окне было две плашки ресепшионист и администратор
если пользователь хочет зарегистрироваться как один из них он должен написать все свои данные чтобы заполнить все поля в таблице
различие в том что если пользователь хочет зарегистрироваться в качестве администратора то ему при регистрации нужно обязательно ввести уникальный код

для входа в обоих случаях нужны просто логин и пароль после входа должно автоматически определяться какая роль у пользователя админ или ресепшионист
также при регистрации нужно писать все данные которые необходимы в базе данных


напиши полные коды для компонентов которые ты хочешь изменить