edit filter time
This commit is contained in:
@@ -22,127 +22,126 @@ if (isset($task)) {
|
||||
<div class="w-full mt-[70px] justify-center container flex">
|
||||
<div class="ui-card">
|
||||
<div class="ui-card-header">{{isset($task) ? "ویرایش وظیفه" : "ایجاد وظیفه جدید"}}</div>
|
||||
<form action="{{isset($task) ? Route('task.edit') : Route('task.create')}}" method="POST" class="ui-card-body grid grid-cols-2 gap-4 items-center">
|
||||
<form action="{{isset($task) ? Route('task.edit') : Route('task.create')}}" method="POST" class="ui-card-body ui-form-stack">
|
||||
@csrf
|
||||
@if(isset($task))
|
||||
<input type="hidden" id="id" name="id" value="{{$task->id}}">
|
||||
@endif
|
||||
<label for="title" class="font-medium text-sm"><span class="text-red-500">*</span>عنوان:</label>
|
||||
<input class="rounded-lg border border-gray-300 p-2 w-full" value="{{$task->title ?? null}}" type="text"
|
||||
id="title" name="title" required>
|
||||
|
||||
<label for="description" class="font-medium text-sm">توضیحات:</label>
|
||||
<textarea id="description" name="description"
|
||||
class="rounded-lg border border-gray-300 p-2 w-full">{{$task->description ?? null}}</textarea>
|
||||
<div class="ui-form-field">
|
||||
<label for="title"><span class="text-red-500">*</span> عنوان</label>
|
||||
<input class="ui-input" value="{{$task->title ?? null}}" type="text"
|
||||
id="title" name="title" required>
|
||||
</div>
|
||||
|
||||
<label for="priority" class="font-medium text-sm">اولویت:</label>
|
||||
<select id="priority" name="priority" class="rounded-lg border border-gray-300 p-2 w-full">
|
||||
<option value="none" {{ old('priority', $task->priority ?? '') == 'none' ? 'selected' : '' }}>ندارد</option>
|
||||
<option value="low" {{ old('priority', $task->priority ?? '') == 'low' ? 'selected' : '' }}>کم</option>
|
||||
<option value="medium" {{ old('priority', $task->priority ?? '') == 'medium' ? 'selected' : '' }}>عادی</option>
|
||||
<option value="urgent" {{ old('priority', $task->priority ?? '') == 'urgent' ? 'selected' : '' }}>فوری</option>
|
||||
<option value="high" {{ old('priority', $task->priority ?? '') == 'high' ? 'selected' : '' }}>زیاد</option>
|
||||
</select>
|
||||
<div class="ui-form-field">
|
||||
<label for="description">توضیحات</label>
|
||||
<textarea id="description" name="description" class="ui-input">{{$task->description ?? null}}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- تاریخ شروع -->
|
||||
<div class="p-2">
|
||||
<label for="start_date" class="font-medium text-sm">تاریخ شروع <span
|
||||
class="text-red-500">*</span></label>
|
||||
<input type="text" id="start_date" name="start_date_display"
|
||||
class="rounded-lg border border-gray-300 p-2 " value="{{$task->start_date ?? null}}"
|
||||
<div class="ui-form-field">
|
||||
<label for="priority">اولویت</label>
|
||||
<select id="priority" name="priority" class="ui-input">
|
||||
<option value="none" {{ old('priority', $task->priority ?? '') == 'none' ? 'selected' : '' }}>ندارد</option>
|
||||
<option value="low" {{ old('priority', $task->priority ?? '') == 'low' ? 'selected' : '' }}>کم</option>
|
||||
<option value="medium" {{ old('priority', $task->priority ?? '') == 'medium' ? 'selected' : '' }}>عادی</option>
|
||||
<option value="urgent" {{ old('priority', $task->priority ?? '') == 'urgent' ? 'selected' : '' }}>فوری</option>
|
||||
<option value="high" {{ old('priority', $task->priority ?? '') == 'high' ? 'selected' : '' }}>زیاد</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ui-form-field">
|
||||
<label for="start_date">تاریخ شروع <span class="text-red-500">*</span></label>
|
||||
<input type="text" id="start_date" name="start_date_display" class="ui-input"
|
||||
value="{{$task->start_date ?? null}}"
|
||||
placeholder="تاریخ شروع" autocomplete="off" readonly required>
|
||||
<input type="hidden" name="start_date" id="start_date_gregorian">
|
||||
</div>
|
||||
|
||||
<!-- تاریخ هدف -->
|
||||
<label for="target_date" class="font-medium text-sm">تاریخ هدف</label>
|
||||
{{-- <div class="relative">--}}
|
||||
<input type="text" id="target_date" name="target_date_display"
|
||||
class="rounded-lg border border-gray-300 p-2 pwt-datepicker-input-element mt-2"
|
||||
value="{{$task->target_date ?? null}}"
|
||||
placeholder="تاریخ هدف" autocomplete="off" readonly>
|
||||
<button type="button" id="clear_target_date"
|
||||
class="absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-red-500">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M6 18L18 6M6 6l12 12"></path>
|
||||
</svg>
|
||||
</button>
|
||||
{{-- </div>--}}
|
||||
<div class="ui-form-field">
|
||||
<label for="target_date">تاریخ هدف</label>
|
||||
<div class="ui-input-wrap">
|
||||
<input type="text" id="target_date" name="target_date_display" class="ui-input"
|
||||
value="{{$task->target_date ?? null}}"
|
||||
placeholder="تاریخ هدف" autocomplete="off" readonly>
|
||||
<button type="button" id="clear_target_date" class="ui-input-clear" aria-label="پاک کردن تاریخ هدف">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M6 18L18 6M6 6l12 12"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="target_date" id="target_date_gregorian">
|
||||
</div>
|
||||
|
||||
<!-- وضعیت -->
|
||||
<label for="state" class="font-medium text-sm"><span class="text-red-500">*</span>وضعیت:</label>
|
||||
<select id="state" name="state" class="rounded-lg border border-gray-300 p-2 w-full" required>
|
||||
<option value="1" {{ old('state', $task->state ?? '') == 1 ? 'selected' : '' }}>در انتظار</option>
|
||||
<option value="2" {{ old('state', $task->state ?? '') == 2 ? 'selected' : '' }}>در صف انجام</option>
|
||||
<option value="3" {{ old('state', $task->state ?? '') == 3 ? 'selected' : '' }}>درحال انجام</option>
|
||||
<option value="4" {{ old('state', $task->state ?? '') == 4 ? 'selected' : '' }}>انجامشده</option>
|
||||
</select>
|
||||
<div class="ui-form-field">
|
||||
<label for="state"><span class="text-red-500">*</span> وضعیت</label>
|
||||
<select id="state" name="state" class="ui-input" required>
|
||||
<option value="1" {{ old('state', $task->state ?? '') == 1 ? 'selected' : '' }}>در انتظار</option>
|
||||
<option value="2" {{ old('state', $task->state ?? '') == 2 ? 'selected' : '' }}>در صف انجام</option>
|
||||
<option value="3" {{ old('state', $task->state ?? '') == 3 ? 'selected' : '' }}>درحال انجام</option>
|
||||
<option value="4" {{ old('state', $task->state ?? '') == 4 ? 'selected' : '' }}>انجامشده</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- کاربران مسئول -->
|
||||
<label for="assignees" class="font-medium text-sm">انتصاب
|
||||
کاربران:</label>
|
||||
<div class="relative" id="dropdown-container">
|
||||
{{-- دکمه --}}
|
||||
<button type="button" id="dropdown-btn"
|
||||
class="ui-input text-right flex justify-between items-center">
|
||||
<span id="selected-count">انتخاب کاربران</span>
|
||||
<svg class="w-4 h-4 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M19 9l-7 7-7-7"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="ui-form-field">
|
||||
<label for="dropdown-btn">انتصاب کاربران</label>
|
||||
<div class="relative" id="dropdown-container">
|
||||
<button type="button" id="dropdown-btn"
|
||||
class="ui-input text-right flex justify-between items-center">
|
||||
<span id="selected-count">انتخاب کاربران</span>
|
||||
<svg class="w-4 h-4 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M19 9l-7 7-7-7"></path>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div id="dropdown-list"
|
||||
class="hidden absolute z-20 w-full ui-panel border border-gray-300 rounded-lg shadow-lg">
|
||||
<div id="dropdown-list"
|
||||
class="hidden absolute z-20 w-full ui-panel border border-gray-300 rounded-lg shadow-lg mt-1">
|
||||
|
||||
<div class="p-2 border-b">
|
||||
<input type="text" id="search-input"
|
||||
class="w-full px-3 py-1 border border-gray-200 rounded-lg text-sm"
|
||||
placeholder="جستجوی کاربر...">
|
||||
</div>
|
||||
<div class="p-2 border-b">
|
||||
<input type="text" id="search-input"
|
||||
class="w-full px-3 py-1 border border-gray-200 rounded-lg text-sm"
|
||||
placeholder="جستجوی کاربر...">
|
||||
</div>
|
||||
|
||||
{{-- لیست کاربران --}}
|
||||
<div id="users-list" class="max-h-48 overflow-y-auto space-y-1 ">
|
||||
@foreach($users as $user)
|
||||
<label class="user-item flex items-center gap-2 p-1 hover:bg-gray-50 rounded cursor-pointer"
|
||||
data-name="{{ $user->name }}">
|
||||
<input type="checkbox"
|
||||
name="assignees[]"
|
||||
value="{{ $user->id }}"
|
||||
class="user-checkbox rounded text-cyan-600"
|
||||
{{ isset($task) && (in_array($user->id, $selectedAssignees)) ? 'checked' : '' }}>
|
||||
<div id="users-list" class="max-h-48 overflow-y-auto space-y-1 p-1">
|
||||
@foreach($users as $user)
|
||||
<label class="user-item flex items-center gap-2 p-1 hover:bg-gray-50 rounded cursor-pointer"
|
||||
data-name="{{ $user->name }}">
|
||||
<input type="checkbox"
|
||||
name="assignees[]"
|
||||
value="{{ $user->id }}"
|
||||
class="user-checkbox rounded text-cyan-600"
|
||||
{{ isset($task) && (in_array($user->id, $selectedAssignees)) ? 'checked' : '' }}>
|
||||
|
||||
<span>{{ $user->name }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
<span>{{ $user->name }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <!-- برچسبها -->--}}
|
||||
{{-- <label for="labels" class="font-medium text-sm">برچسبها:</label>--}}
|
||||
{{-- <input class="rounded-lg border border-gray-300 p-2 w-full"--}}
|
||||
{{-- type="text" id="labels" name="labels[]" placeholder="UUID1, UUID2">--}}
|
||||
<div class="ui-form-field">
|
||||
<label for="app">نام اپ</label>
|
||||
<select id="app" name="app" class="ui-input">
|
||||
<option value="">-- انتخاب اپ --</option>
|
||||
@if(!empty($apps) && count($apps) > 0)
|
||||
@foreach($apps as $app)
|
||||
<option value="{{ $app->id }}" {{ old('app', $task->app ?? '') == $app->id ? 'selected' : '' }}>
|
||||
{{ $app->name_fa }} {{ $app->type_fa }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- اپ -->
|
||||
<label for="app" class="font-medium text-sm">نام اپ:</label>
|
||||
<select id="app" name="app" class="rounded-lg z-20 border border-gray-300 p-2 w-full">
|
||||
<option value="">-- انتخاب اپ --</option>
|
||||
@if(!empty($apps) && count($apps) > 0)
|
||||
@foreach($apps as $app)
|
||||
<option value="{{ $app->id }}" {{ old('app', $task->app ?? '') == $app->id ? 'selected' : '' }}>
|
||||
{{ $app->name_fa }} {{ $app->type_fa }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
|
||||
<div class="inline-block flex pt-3 justify-center">
|
||||
<button type="submit"
|
||||
class="bg-cyan-600 text-white py-2 px-4 rounded-lg hover:bg-cyan-700 transition <!--mr-24 mt-2.5-->">
|
||||
{{isset($task) ? "ویرایش" : "ایجاد وظیفه جدید"}}</button>
|
||||
<div class="ui-form-actions">
|
||||
<button type="submit"
|
||||
class="bg-cyan-600 text-white py-2 px-6 rounded-lg hover:bg-cyan-700 transition">
|
||||
{{isset($task) ? "ویرایش" : "ایجاد وظیفه جدید"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -156,7 +155,6 @@ if (isset($task)) {
|
||||
const usersList = document.getElementById('users-list');
|
||||
const selectedCountSpan = document.getElementById('selected-count');
|
||||
|
||||
// باز و بسته کردن
|
||||
dropdownBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
dropdownList.classList.toggle('hidden');
|
||||
@@ -165,29 +163,22 @@ if (isset($task)) {
|
||||
}
|
||||
});
|
||||
|
||||
// بستن با کلیک بیرون
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!dropdownBtn.contains(e.target) && !dropdownList.contains(e.target)) {
|
||||
dropdownList.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
// قابلیت جستجو
|
||||
searchInput.addEventListener('input', function () {
|
||||
const searchText = this.value.toLowerCase();
|
||||
const items = usersList.querySelectorAll('.user-item');
|
||||
|
||||
items.forEach(item => {
|
||||
const name = item.getAttribute('data-name').toLowerCase();
|
||||
if (name.includes(searchText)) {
|
||||
item.style.display = 'flex';
|
||||
} else {
|
||||
item.style.display = 'none';
|
||||
}
|
||||
item.style.display = name.includes(searchText) ? 'flex' : 'none';
|
||||
});
|
||||
});
|
||||
|
||||
// آپدیت تعداد
|
||||
function updateSelectedCount() {
|
||||
const selected = document.querySelectorAll('.user-checkbox:checked');
|
||||
const count = selected.length;
|
||||
@@ -201,7 +192,6 @@ if (isset($task)) {
|
||||
updateSelectedCount();
|
||||
|
||||
$(document).ready(function () {
|
||||
// تاریخ شروع با ساعت جاری
|
||||
$('#start_date').persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true,
|
||||
@@ -210,15 +200,12 @@ if (isset($task)) {
|
||||
todayButton: {enabled: true, text: {fa: 'امروز'}}
|
||||
},
|
||||
onSelect: function (unix) {
|
||||
// تبدیل به میلادی
|
||||
let gregorian = new persianDate(unix).toCalendar('gregorian').toLocale('en');
|
||||
let dateStr = gregorian.format('YYYY-MM-DD');
|
||||
$('#start_date_gregorian').val(dateStr);
|
||||
console.log('Start Gregorian:', dateStr);
|
||||
}
|
||||
});
|
||||
|
||||
// تاریخ هدف
|
||||
$('#target_date').persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true,
|
||||
@@ -229,13 +216,10 @@ if (isset($task)) {
|
||||
onSelect: function (unix) {
|
||||
let gregorianDate = new persianDate(unix).toCalendar('gregorian').toLocale('en');
|
||||
let dateStrTarget = gregorianDate.format('YYYY-MM-DD');
|
||||
// let dateTimeStr = `${dateStr} 23:59:59`;
|
||||
$('#target_date_gregorian').val(dateStrTarget);
|
||||
console.log('Target DateTime (Gregorian):', dateStrTarget);
|
||||
}
|
||||
});
|
||||
|
||||
// دکمه پاک کردن تاریخ هدف
|
||||
$('#clear_target_date').on('click', function () {
|
||||
$('#target_date').val('');
|
||||
$('#target_date_gregorian').val('');
|
||||
@@ -243,4 +227,4 @@ if (isset($task)) {
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user