Files
ladill-servers/resources/views/hosting/panel/cron.blade.php
T
isaaccladandCursor 29cdfe67b8
Deploy Ladill Servers / deploy (push) Successful in 29s
Replace native confirm() dialogs with styled confirm modals.
Add shared confirm-dialog component, Alpine ladillConfirm store, and
swap browser confirms for consistent bottom-sheet modals across user,
admin, and hosting flows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 21:11:10 +00:00

146 lines
9.8 KiB
PHP

<x-hosting-panel-layout :account="$account">
<x-slot name="title">Cron Jobs - {{ $account->username }}</x-slot>
<x-slot name="header">Cron Jobs</x-slot>
<div class="space-y-6">
@if(session('success'))
<div class="rounded-lg bg-emerald-50 border border-emerald-200 p-4">
<p class="text-sm text-emerald-800">{{ session('success') }}</p>
</div>
@endif
@if(session('error'))
<div class="rounded-lg bg-red-50 border border-red-200 p-4">
<p class="text-sm text-red-800">{{ session('error') }}</p>
</div>
@endif
<div class="rounded-xl border border-slate-200 bg-white p-6">
<h3 class="text-base font-semibold text-slate-900 mb-4">Add Cron Job</h3>
<form action="{{ route('hosting.panel.cron.add', $account) }}" method="POST" class="space-y-4">
@csrf
<div class="grid gap-4 sm:grid-cols-5">
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Minute</label>
<input type="text" name="minute" value="*" required class="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm font-mono focus:border-indigo-500 focus:ring-indigo-500">
<p class="mt-1 text-[10px] text-slate-500">0-59 or *</p>
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Hour</label>
<input type="text" name="hour" value="*" required class="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm font-mono focus:border-indigo-500 focus:ring-indigo-500">
<p class="mt-1 text-[10px] text-slate-500">0-23 or *</p>
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Day</label>
<input type="text" name="day" value="*" required class="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm font-mono focus:border-indigo-500 focus:ring-indigo-500">
<p class="mt-1 text-[10px] text-slate-500">1-31 or *</p>
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Month</label>
<input type="text" name="month" value="*" required class="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm font-mono focus:border-indigo-500 focus:ring-indigo-500">
<p class="mt-1 text-[10px] text-slate-500">1-12 or *</p>
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Weekday</label>
<input type="text" name="weekday" value="*" required class="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm font-mono focus:border-indigo-500 focus:ring-indigo-500">
<p class="mt-1 text-[10px] text-slate-500">0-6 or *</p>
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Command</label>
<input type="text" name="command" required placeholder="/usr/bin/php /home/{{ $account->username }}/public_html/artisan schedule:run" class="w-full rounded-lg border border-slate-200 px-4 py-2.5 text-sm font-mono focus:border-indigo-500 focus:ring-indigo-500">
<p class="mt-1 text-xs text-slate-500">Use full paths for commands and scripts</p>
</div>
<button type="submit" class="inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-5 py-2.5 text-sm font-medium text-white hover:bg-indigo-700 transition">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Add Cron Job
</button>
</form>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-6">
<h3 class="text-base font-semibold text-slate-900 mb-2">Common Schedules</h3>
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium text-slate-700">Every minute</p>
<code class="text-xs font-mono text-slate-600">* * * * *</code>
</div>
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium text-slate-700">Every 5 minutes</p>
<code class="text-xs font-mono text-slate-600">*/5 * * * *</code>
</div>
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium text-slate-700">Every hour</p>
<code class="text-xs font-mono text-slate-600">0 * * * *</code>
</div>
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium text-slate-700">Daily at midnight</p>
<code class="text-xs font-mono text-slate-600">0 0 * * *</code>
</div>
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium text-slate-700">Weekly (Sunday)</p>
<code class="text-xs font-mono text-slate-600">0 0 * * 0</code>
</div>
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium text-slate-700">Monthly</p>
<code class="text-xs font-mono text-slate-600">0 0 1 * *</code>
</div>
</div>
</div>
<div class="rounded-xl border border-slate-200 bg-white overflow-hidden">
<div class="px-6 py-4 border-b border-slate-200">
<h3 class="text-base font-semibold text-slate-900">Active Cron Jobs</h3>
</div>
@if(count($cronJobs))
<table class="min-w-full divide-y divide-slate-200">
<thead class="bg-slate-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase">Schedule</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase">Command</th>
<th class="px-6 py-3 text-right text-xs font-medium text-slate-500 uppercase">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-200">
@foreach($cronJobs as $job)
<tr class="hover:bg-slate-50">
<td class="px-6 py-4 whitespace-nowrap">
<code class="text-sm font-mono text-slate-700 bg-slate-100 px-2 py-1 rounded">{{ $job['schedule'] }}</code>
</td>
<td class="px-6 py-4">
<code class="text-sm font-mono text-slate-600 break-all">{{ $job['command'] }}</code>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<x-confirm-dialog
:name="'delete-cron-'.$job['line_number']"
title="Delete cron job?"
message="Delete this cron job?"
:action="route('hosting.panel.cron.delete', $account)"
method="DELETE"
confirm-label="Delete"
>
<x-slot:fields>
<input type="hidden" name="line_number" value="{{ $job['line_number'] }}">
</x-slot:fields>
<x-slot:trigger>
<button type="button" class="inline-flex items-center gap-1.5 rounded-lg border border-red-200 bg-white px-3 py-1.5 text-xs font-medium text-red-600 hover:bg-red-50 transition">
<svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"/></svg>
Delete
</button>
</x-slot:trigger>
</x-confirm-dialog>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<div class="px-6 py-12 text-center">
<svg class="mx-auto h-12 w-12 text-slate-300" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<p class="mt-4 text-sm text-slate-500">No cron jobs configured yet.</p>
</div>
@endif
</div>
</div>
</x-hosting-panel-layout>