<?php

require_once "../config/database.php";


if (!isset($_GET['printer_id'])) {

    die("Printer not selected");

}


$printerId = $_GET['printer_id'];


$db = new Database();

$conn = $db->connect();


$stmt = $conn->prepare(

    "SELECT * FROM printers WHERE id=?"

);


$stmt->execute([$printerId]);


$printer = $stmt->fetch();



if(!$printer){

    die("Printer not found");

}


?>


<!DOCTYPE html>

<html>

<head>

<title>SmartPrint Upload</title>


<meta name="viewport" content="width=device-width, initial-scale=1.0">


<style>

body{

margin:0;

font-family:Segoe UI,Arial;

background:
linear-gradient(
135deg,
#020617,
#0f172a
);

color:white;

}



.container{

min-height:100vh;

display:flex;

justify-content:center;

align-items:center;

padding:20px;

}



.card{

background:#111827;

width:420px;

padding:30px;

border-radius:20px;

box-shadow:
0 20px 40px rgba(0,0,0,.5);

}



h1{

text-align:center;

}



.info{

background:#1e293b;

padding:15px;

border-radius:12px;

margin-bottom:20px;

}



input[type=file]{

width:100%;

padding:12px;

background:#0f172a;

color:white;

border-radius:10px;

border:1px solid #334155;

}



button{

margin-top:20px;

width:100%;

padding:15px;

border:none;

border-radius:12px;


background:
linear-gradient(
135deg,
#2563eb,
#06b6d4
);


color:white;

font-size:16px;

font-weight:bold;

}



</style>


</head>


<body>


<div class="container">


<div class="card">


<h1>
Upload Document
</h1>



<div class="info">

Printer:

<br>

<b>
<?= htmlspecialchars($printer['printer_name']) ?>
</b>


</div>




<form action="process_upload.php"
method="POST"
enctype="multipart/form-data">



<input type="hidden"
name="printer_id"
value="<?= $printer['id'] ?>">



<input 
type="file" 
name="document"
accept=".pdf,.doc,.docx,.jpg,.jpeg,.png"
required>



<button>

Continue

</button>


</form>


</div>


</div>


</body>

</html>