<?php
$content = file_get_contents('index.php');

$search1 = '<div class="mb-3">
                                                    <label class="form-label fw-semibold" data-en="Assigned Outlet" data-ar="الفرع">Assigned Outlet</label>
                                                    <select name="outlet_id" class="form-select">
                                                        <option value="">--- Global (Admin only) ---</option>
                                                        <?php foreach (($data[\'outlets\'] ?? []) as $o): ?>
                                                        <option value="<?= $o[\'id\'] ?>" <?= ($u[\'outlet_id\'] ?? null) == $o[\'id\'] ? \'selected\' : \'\' ?>><?= htmlspecialchars($o[\'name\']) ?></option>
                                                        <?php endforeach; ?>
                                                    </select>
                                                </div>';

$content = str_replace($search1 . "\n                                                " . $search1, $search1, $content);


$search2 = '<div class="mb-3">
                        <label class="form-label" data-en="Assigned Outlet" data-ar="الفرع">Assigned Outlet</label>
                        <select name="outlet_id" class="form-select">
                            <option value="">--- Global (Admin only) ---</option>
                            <?php foreach (($data[\'outlets\'] ?? []) as $o): ?>
                            <option value="<?= $o[\'id\'] ?>"><?= htmlspecialchars($o[\'name\']) ?></option>
                            <?php endforeach; ?>
                        </select>
                    </div>';

$content = str_replace($search2 . "\n                    " . $search2, $search2, $content);

file_put_contents('index.php', $content);
echo "Duplicates removed.\n";
