| |
| <div class="space-y-6"> |
| |
| <div> |
| <label for="id_name" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.name.label }} |
| </label> |
| {{ form.name }} |
| {% if form.name.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.name.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div> |
| <label for="id_description" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.description.label }} |
| </label> |
| {{ form.description }} |
| {% if form.description.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.description.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div> |
| <label for="id_code" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.code.label }} |
| </label> |
| |
| {{ form.code }} |
| |
| <div id="code-editor-container" style="height: 400px;" class="rounded-lg border border-code-border overflow-hidden"></div> |
| {% if form.code.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.code.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> |
| |
| <div> |
| <label for="id_environment" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.environment.label }} |
| </label> |
| {{ form.environment }} |
| {% if form.environment.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.environment.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div> |
| <label for="id_timeout_seconds" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.timeout_seconds.label }} |
| </label> |
| {{ form.timeout_seconds }} |
| {% if form.timeout_seconds.help_text %} |
| <p class="mt-1 text-xs text-code-muted">{{ form.timeout_seconds.help_text }}</p> |
| {% endif %} |
| {% if form.timeout_seconds.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.timeout_seconds.errors.0 }}</p> |
| {% endif %} |
| </div> |
| </div> |
|
|
| |
| <div> |
| <label class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.tags.label }} |
| </label> |
| <div class="flex flex-wrap gap-2 p-4 bg-code-bg border border-code-border rounded-lg min-h-[3rem]"> |
| {% for checkbox in form.tags %} |
| <label class="inline-flex items-center px-3 py-1.5 rounded-full cursor-pointer border transition-colors |
| {% if checkbox.data.selected %}border-code-accent bg-code-accent/20{% else %}border-code-border bg-code-surface hover:border-code-accent/50{% endif %}"> |
| <input type="checkbox" name="tags" value="{{ checkbox.data.value }}" {% if checkbox.data.selected %}checked{% endif %} class="sr-only peer"> |
| <span class="w-2 h-2 rounded-full mr-2 tag-dot-{{ checkbox.data.attrs.data_color|default:'gray' }}"></span> |
| <span class="text-sm text-code-text">{{ checkbox.choice_label }}</span> |
| </label> |
| {% empty %} |
| <p class="text-sm text-code-muted">No tags available. <a href="{% url 'cpanel:tag_list' %}" class="text-code-accent hover:underline">Create tags</a></p> |
| {% endfor %} |
| </div> |
| {% if form.tags.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.tags.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div class="flex items-center space-x-3"> |
| {{ form.is_enabled }} |
| <label for="id_is_enabled" class="text-sm font-medium text-code-text"> |
| {{ form.is_enabled.label }} |
| </label> |
| {% if form.is_enabled.errors %} |
| <p class="text-sm text-code-red">{{ form.is_enabled.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| {% if schedule_form %} |
| |
| <div class="mt-8 pt-6 border-t border-code-border"> |
| <h3 class="text-lg font-semibold text-code-text mb-4">Schedule Configuration</h3> |
|
|
| |
| <div class="mb-6"> |
| <label class="block text-sm font-medium text-code-text mb-3">Run Mode</label> |
| <div class="grid grid-cols-3 gap-4"> |
| {% for radio in schedule_form.run_mode %} |
| <label class="relative flex items-center justify-center p-4 border border-code-border rounded-lg cursor-pointer hover:border-code-accent transition-colors {% if radio.data.selected %}border-code-accent bg-code-accent/10{% endif %}"> |
| <input type="radio" name="run_mode" value="{{ radio.data.value }}" {% if radio.data.selected %}checked{% endif %} class="sr-only peer" onchange="toggleScheduleOptions(this.value)"> |
| <span class="text-code-text font-medium">{{ radio.choice_label }}</span> |
| </label> |
| {% endfor %} |
| </div> |
| {% if schedule_form.run_mode.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ schedule_form.run_mode.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div id="interval-options" class="mb-6 {% if schedule_form.instance.run_mode != 'interval' %}hidden{% endif %}"> |
| <label for="id_interval_minutes" class="block text-sm font-medium text-code-text mb-2"> |
| {{ schedule_form.interval_minutes.label }} |
| </label> |
| {{ schedule_form.interval_minutes }} |
| {% if schedule_form.interval_minutes.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ schedule_form.interval_minutes.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div id="daily-options" class="mb-6 {% if schedule_form.instance.run_mode != 'daily' %}hidden{% endif %}"> |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> |
| <div> |
| <label for="id_daily_times_input" class="block text-sm font-medium text-code-text mb-2"> |
| {{ schedule_form.daily_times_input.label }} |
| </label> |
| {{ schedule_form.daily_times_input }} |
| <p class="mt-1 text-xs text-code-muted">{{ schedule_form.daily_times_input.help_text }}</p> |
| {% if schedule_form.daily_times_input.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ schedule_form.daily_times_input.errors.0 }}</p> |
| {% endif %} |
| </div> |
| <div> |
| <label for="id_timezone" class="block text-sm font-medium text-code-text mb-2"> |
| Timezone |
| </label> |
| {{ schedule_form.timezone }} |
| {% if schedule_form.timezone.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ schedule_form.timezone.errors.0 }}</p> |
| {% endif %} |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="flex items-center space-x-3"> |
| {{ schedule_form.is_active }} |
| <label for="id_is_active" class="text-sm font-medium text-code-text"> |
| {{ schedule_form.is_active.label }} |
| </label> |
| {% if schedule_form.is_active.errors %} |
| <p class="text-sm text-code-red">{{ schedule_form.is_active.errors.0 }}</p> |
| {% endif %} |
| </div> |
| </div> |
|
|
| <script> |
| function toggleScheduleOptions(mode) { |
| document.getElementById('interval-options').classList.toggle('hidden', mode !== 'interval'); |
| document.getElementById('daily-options').classList.toggle('hidden', mode !== 'daily'); |
| } |
| </script> |
| {% endif %} |
|
|
| |
| <div class="mt-8 pt-6 border-t border-code-border"> |
| <h3 class="text-lg font-semibold text-code-text mb-4">Notification Settings</h3> |
|
|
| <div class="space-y-6"> |
| |
| <div> |
| <label for="id_notify_on" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.notify_on.label }} |
| </label> |
| {{ form.notify_on }} |
| {% if form.notify_on.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.notify_on.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div> |
| <label for="id_notify_email" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.notify_email.label }} |
| </label> |
| {{ form.notify_email }} |
| {% if form.notify_email.help_text %} |
| <p class="mt-1 text-xs text-code-muted">{{ form.notify_email.help_text }}</p> |
| {% endif %} |
| {% if form.notify_email.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.notify_email.errors.0 }}</p> |
| {% endif %} |
| </div> |
|
|
| |
| <div class="p-4 bg-code-bg rounded-lg space-y-4"> |
| <div class="flex items-center space-x-3"> |
| {{ form.notify_webhook_enabled }} |
| <label for="id_notify_webhook_enabled" class="text-sm font-medium text-code-text"> |
| {{ form.notify_webhook_enabled.label }} |
| </label> |
| </div> |
|
|
| <div> |
| <label for="id_notify_webhook_url" class="block text-sm font-medium text-code-text mb-2"> |
| {{ form.notify_webhook_url.label }} |
| </label> |
| {{ form.notify_webhook_url }} |
| {% if form.notify_webhook_url.help_text %} |
| <p class="mt-1 text-xs text-code-muted">{{ form.notify_webhook_url.help_text }}</p> |
| {% endif %} |
| {% if form.notify_webhook_url.errors %} |
| <p class="mt-1 text-sm text-code-red">{{ form.notify_webhook_url.errors.0 }}</p> |
| {% endif %} |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
|
|