list, add, and edit providers essential functions working

This commit is contained in:
matt committed 2026-10-21 02:52:36 -07:00
1 parent b2a4307eae
commit 269366b7b6
4 files changed
+207 -76

No files matched your search

+11 -12
View File
@@ -46,15 +46,12 @@ if ($rateOptionsSetting && isset($rateOptionsSetting['value'])) {
}
// Update form handling to process selected rates
$selectedRates = $_POST['rates'] ?? [];
$selectedRateKeys = $_POST['rate_selected'] ?? [];
$ratesArray = [];
foreach ($selectedRates as $item) {
$parts = explode(':', $item, 2);
if (count($parts) == 2) {
$ratesArray[] = [$parts[0] => $parts[1]];
}
foreach ($selectedRateKeys as $key) {
$value = $_POST['rate_value'][$key] ?? '0';
$ratesArray[] = [$key => $value];
}
$created = null;
$errors = [];
@@ -126,14 +123,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<label>Photo URL:<br><input type="text" name="photo" value="<?=htmlspecialchars($_POST['photo'] ?? '')?>"></label>
<?php if (!empty($rateOptions)) : ?>
<label>Rate Options:<br>
<?php foreach ($rateOptions as $option) :
<?php
foreach ($rateOptions as $option) :
// echo $option;
$key = $option;
$value = 0;
?>
<input type="checkbox" name="rates[]" value="<?=htmlspecialchars($key . ':' . $value)?>"
<?php if (in_array($key . ':' . $value, $selectedRates)) echo 'checked'; ?>>
<?=htmlspecialchars($key)?>: <?=htmlspecialchars($value)?> <br>
<input type="checkbox" name="rate_selected[]" value="<?=htmlspecialchars($key)?>"
<?php if (in_array($key, $selectedRateKeys)) echo 'checked'; ?>>
<?=htmlspecialchars($key)?>:
<input type="number" name="rate_value[<?=htmlspecialchars($key)?>]" value="<?=htmlspecialchars($ratesArray[$key] ?? $value)?>" style="width:60px;">
<br>
<?php endforeach; ?>
</label>
<?php endif; ?>
@@ -144,4 +144,3 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
</body>
</html>