fix: restrict delete button to admins

This commit is contained in:
2025-11-10 09:14:05 +01:00
parent 2964dda0d1
commit 104a8c2da6

View File

@@ -54,6 +54,12 @@ const buildSelectionRange = (start, end, minDate) => {
}; };
}; };
const sortEntriesByLabel = (entries = []) => {
return [...entries].sort((a, b) =>
(a.label || '').localeCompare(b.label || '', 'de', { sensitivity: 'base' })
);
};
const PickupConfigEditor = () => { const PickupConfigEditor = () => {
const [config, setConfig] = useState([]); const [config, setConfig] = useState([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
@@ -108,7 +114,7 @@ const PickupConfigEditor = () => {
{ id: "42322", active: false, checkProfileId: false, onlyNotify: false, label: "Edeka Haueneberstein" }, { id: "42322", active: false, checkProfileId: false, onlyNotify: false, label: "Edeka Haueneberstein" },
{ id: "51450", active: false, checkProfileId: true, onlyNotify: false, label: "Hornbach Grünwinkel" } { id: "51450", active: false, checkProfileId: true, onlyNotify: false, label: "Hornbach Grünwinkel" }
]; ];
setConfig(staticConfig); setConfig(sortEntriesByLabel(staticConfig));
setLoading(false); setLoading(false);
}, 500); }, 500);
} catch (err) { } catch (err) {
@@ -261,8 +267,6 @@ const PickupConfigEditor = () => {
</td> </td>
<td className="px-4 py-2"> <td className="px-4 py-2">
<span className="font-medium">{item.label}</span> <span className="font-medium">{item.label}</span>
<br />
<span className="text-sm text-gray-500">ID: {item.id}</span>
</td> </td>
<td className="px-4 py-2 text-center"> <td className="px-4 py-2 text-center">
<input <input