Aggiunta stylesheet pagina gestione prodotti

This commit is contained in:
2026-04-13 13:19:41 +02:00
parent 60871cfe7d
commit caef4421f1
2 changed files with 107 additions and 18 deletions
+21 -18
View File
@@ -141,32 +141,35 @@ $stmt_prod->close();
</thead>
<tbody>
<?php foreach ($products as $product): ?>
<tr>
<form action="" method="post" enctype="multipart/form-data">
<td><?php echo $product['ProductID']; ?><input type="hidden" name="product_id" value="<?php echo $product['ProductID']; ?>"></td>
<td><input type="text" name="name" value="<?php echo htmlspecialchars($product['ProductName']); ?>" required></td>
<td><textarea name="description" required><?php echo htmlspecialchars($product['Description']); ?></textarea></td>
<td>
<select name="category_id" required>
<tr class="product-row">
<form class="product-form" action="" method="post" enctype="multipart/form-data">
<td class="product-id-cell"><?php echo $product['ProductID']; ?><input type="hidden" name="product_id" value="<?php echo $product['ProductID']; ?>"></td>
<td class="product-name-cell"><input class="product-name-input" type="text" name="name" value="<?php echo htmlspecialchars($product['ProductName']); ?>" required></td>
<td class="product-description-cell"><textarea class="product-description-textarea" name="description" required><?php echo htmlspecialchars($product['Description']); ?></textarea></td>
<td class="product-category-cell">
<select class="product-category-select" name="category_id" required>
<?php foreach ($categories as $cat): ?>
<option value="<?php echo $cat['CategoryID']; ?>" <?php if ($cat['CategoryID'] == $product['CategoryID']) echo 'selected'; ?>><?php echo htmlspecialchars($cat['Name']); ?></option>
<?php endforeach; ?>
</select>
</td>
<td><input type="number" name="price" step="0.01" value="<?php echo $product['Price']; ?>" required></td>
<td>
<div style="display: flex; align-items: center;">
<button type="button" onclick="adjustStock(this.nextElementSibling, -1)">-</button>
<input type="number" name="stock" min="0" value="<?php echo $product['StockQuantity']; ?>" required style="width: 60px; text-align: center;">
<button type="button" onclick="adjustStock(this.previousElementSibling, 1)">+</button>
<td class="product-price-cell"><input class="product-price-input" type="number" name="price" step="0.01" value="<?php echo $product['Price']; ?>" required></td>
<td class="product-stock-cell">
<div class="stock-control">
<button type="button" class="stock-button" onclick="adjustStock(this.nextElementSibling, -1)">-</button>
<input class="stock-input" type="number" name="stock" min="0" value="<?php echo $product['StockQuantity']; ?>" required>
<button type="button" class="stock-button" onclick="adjustStock(this.previousElementSibling, 1)">+</button>
</div>
</td>
<td>
<td class="product-image-cell">
<?php $image_display = '/img/' . ltrim($product['ImagePath'], '/'); ?>
<img src="<?php echo htmlspecialchars($image_display); ?>" alt="Immagine" style="max-width: 100px;"><br>
<input type="file" name="image" accept="image/*">
<input type="hidden" name="current_image" value="<?php echo htmlspecialchars(basename($product['ImagePath'])); ?>"></td>
<td><button type="submit" name="save">Salva</button></td>
<img class="product-image-preview" src="<?php echo htmlspecialchars($image_display); ?>" alt="Immagine"><br>
<div class="image-upload">
<input class="product-image-input" type="file" name="image" accept="image/*">
<input type="hidden" name="current_image" value="<?php echo htmlspecialchars(basename($product['ImagePath'])); ?>">
</div>
</td>
<td class="product-action-cell"><button class="save-button" type="submit" name="save">Salva</button></td>
</form>
</tr>
<?php endforeach; ?>
+86
View File
@@ -256,6 +256,92 @@ form button:hover {
padding: 20px;
}
.product-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.product-table th,
.product-table td {
border: 1px solid #ddd;
padding: 12px;
vertical-align: top;
}
.product-table th {
background-color: #f8f9fa;
font-weight: 700;
text-align: left;
}
.product-row:hover {
background-color: #f7f9fb;
}
.product-name-input,
.product-description-textarea,
.product-category-select,
.product-price-input,
.stock-input,
.product-image-input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.product-description-textarea {
min-height: 80px;
resize: vertical;
}
.stock-control {
display: flex;
align-items: center;
gap: 8px;
}
.stock-button {
width: 32px;
height: 32px;
border: none;
border-radius: 4px;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
.stock-button:hover {
background-color: #0056b3;
}
.product-image-preview {
max-width: 100px;
display: block;
margin-bottom: 8px;
}
.image-upload {
display: flex;
flex-direction: column;
gap: 8px;
}
.save-button {
padding: 10px 16px;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
.save-button:hover {
background-color: #218838;
}
.admin-divider{
display: block;
height: 1px;