refactor: Redesign availability section with toggles and grid

This commit is contained in:
Kerby Martino (aider) committed 2025-05-11 02:26:29 +08:00
1 parent c83d34eb1d
commit 3d8f1f4da7
1 file changed
+19 -14
+19 -14
View File
@@ -125,25 +125,30 @@
</div>
<div>
<h3 class="text-md font-medium text-gray-800 mb-2">Weekly Availability & Hours</h3>
<div class="space-y-3">
<h3 class="text-md font-medium text-gray-800 mb-3">Weekly Availability & Hours</h3>
<div class="space-y-4">
{% assign days = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" | split: "," %}
{% for day in days %}
<div class="p-3 border border-gray-200 rounded-lg bg-gray-50">
<div class="flex items-center justify-between">
<label for="available-{{ day | downcase }}" class="flex items-center cursor-pointer">
<input type="checkbox" id="available-{{ day | downcase }}" name="available_days[]" value="{{ day }}" class="h-4 w-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500" onchange="toggleTimeSelection('{{ day | downcase }}')">
<span class="ml-2 text-sm font-medium text-gray-700">{{ day }}</span>
</label>
</div>
<div id="time-selection-{{ day | downcase }}" class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-2 hidden">
<div class="bg-gray-50 p-4 rounded-lg shadow-sm">
<label for="available-{{ day | downcase }}" class="flex items-center justify-between w-full cursor-pointer">
<span class="text-sm font-medium text-gray-900">{{ day }}</span>
<input type="checkbox"
id="available-{{ day | downcase }}"
name="available_days[]"
value="{{ day }}"
class="sr-only peer"
onchange="toggleTimeSelection('{{ day | downcase }}')">
<div class="relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-offset-2 peer-focus:ring-indigo-500 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
<div id="time-selection-{{ day | downcase }}" class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3 hidden">
<div>
<label for="start-time-{{ day | downcase }}" class="block text-xs font-medium text-gray-600">Open</label>
<input type="time" id="start-time-{{ day | downcase }}" name="start_time_{{ day | downcase }}" class="w-full mt-1 px-2 py-1.5 border border-gray-400 rounded-sm focus:outline-none focus:border-indigo-700 sm:text-sm">
<label for="start-time-{{ day | downcase }}" class="block text-xs font-medium text-gray-700 mb-1">Open</label>
<input type="time" id="start-time-{{ day | downcase }}" name="start_time_{{ day | downcase }}" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-white">
</div>
<div>
<label for="end-time-{{ day | downcase }}" class="block text-xs font-medium text-gray-600">Close</label>
<input type="time" id="end-time-{{ day | downcase }}" name="end_time_{{ day | downcase }}" class="w-full mt-1 px-2 py-1.5 border border-gray-400 rounded-sm focus:outline-none focus:border-indigo-700 sm:text-sm">
<label for="end-time-{{ day | downcase }}" class="block text-xs font-medium text-gray-700 mb-1">Close</label>
<input type="time" id="end-time-{{ day | downcase }}" name="end_time_{{ day | downcase }}" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-white">
</div>
</div>
</div>