NASER add taskززطزSQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION montask.ST_SetSRID does not exist (Connection: mysql, SQL: update ttendances set ip_exit = 51.684726144224, distance_exit = 850, exited_at = 2026-04-23 13:59:46, exit_location = ST_SetSRID(ST_Point(51.684726144224, 32.652053279154), 4326), duration = 04:59:46, ttendances.updated_at = 2026-04-23 13:59:46 where id = 937)
This commit is contained in:
Notes:
mobinesaghi
2026-04-23 14:42:21 +03:30
NASER add task functions undepended
@@ -1,91 +1,247 @@
|
||||
<?php
|
||||
|
||||
use App\Models\App;
|
||||
use App\Models\User;
|
||||
use App\Models\Tasks;
|
||||
|
||||
$users = User::get();
|
||||
$apps = App::get();
|
||||
|
||||
if (isset($task)) {
|
||||
$selectedAssignees = [];
|
||||
if ($task && $task->assignees) {
|
||||
$decoded = json_decode($task->assignees, true);
|
||||
$selectedAssignees = is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@extends('app')
|
||||
@section('content')
|
||||
<div class="w-full mt-[90px] justify-center container flex ">
|
||||
<div class="bg-white w-[350px] p-6 rounded-xl ">
|
||||
<h1 class="w-full bg-cyan-500 rounded-t-xl text-center p-1.5 font-bold text-slate-50">ایجاد وظیفه جدید</h1>
|
||||
<form action="{{Route('create_api')}}" method="POST" class="grid grid-cols-2 gap-4 items-center">
|
||||
<div class="bg-white w-[350px] rounded-xl ">
|
||||
<h1 class="w-[350px] bg-cyan-500 rounded-t-xl text-center p-1.5 font-bold text-slate-50">{{isset($task) ? "ویرایش وظیفه" : "ایجاد وظیفه جدید"}}
|
||||
</h1>
|
||||
<form action="{{isset($task) ? Route('task.edit') : Route('task.create')}}" method="POST" class=" p-6 grid-cols-2 gap-4 items-center">
|
||||
@csrf
|
||||
<!-- نام Issue (الزامی) -->
|
||||
<label for="name" class="font-medium text-sm">نام:</label>
|
||||
<input class="rounded-lg border border-gray-300 p-2 w-full" type="text" id="name" name="name" required>
|
||||
@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>
|
||||
|
||||
<!-- توضیحات HTML -->
|
||||
<label for="description_html" class="font-medium text-sm">توضیحات:</label>
|
||||
<textarea id="description_html" name="description_html"
|
||||
class="rounded-lg border border-gray-300 p-2 w-full"></textarea>
|
||||
<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>
|
||||
|
||||
<!-- اولویت -->
|
||||
<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">ندارد</option>
|
||||
<option value="urgent">فوری</option>
|
||||
<option value="high">بالا</option>
|
||||
<option value="medium">عادی</option>
|
||||
<option value="low">پایین</option>
|
||||
<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>
|
||||
|
||||
<!-- تاریخ شروع -->
|
||||
<label for="start_date" class="font-medium text-sm">تاریخ شروع:</label>
|
||||
<input class="rounded-lg border border-gray-300 p-2 w-full" type="date" id="start_date"
|
||||
name="start_date">
|
||||
<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}}"
|
||||
placeholder="تاریخ شروع" autocomplete="off" readonly required>
|
||||
<input type="hidden" name="start_date" id="start_date_gregorian">
|
||||
|
||||
<!-- تاریخ هدف -->
|
||||
<label for="target_date" class="font-medium text-sm">تاریخ هدف:</label>
|
||||
<input class="rounded-lg border border-gray-300 p-2 w-full" type="date" id="target_date"
|
||||
name="target_date">
|
||||
<!-- تاریخ هدف -->
|
||||
<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>--}}
|
||||
<input type="hidden" name="target_date" id="target_date_gregorian">
|
||||
</div>
|
||||
|
||||
<!-- وضعیت -->
|
||||
<label for="state" class="font-medium text-sm">وضعیت:</label>
|
||||
<select id="state" name="state"
|
||||
class="rounded-lg border border-gray-300 p-2 w-full">
|
||||
<option value="c73c2044-ea14-42cb-b08d-cecf3d1fdfb5">درحال انجام</option>
|
||||
<option value="a9ce312f-cfca-491e-8e3d-1975aa6ebc10">در انتظار</option>
|
||||
<option value="dea1fb57-a281-4fe7-8f3e-ee5567637e35">دارای خطا</option>
|
||||
<option value="770fbe42-99f6-41db-9b9e-773d9cced1a5">در صف انجام</option>
|
||||
<option value="b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0">انجامشده</option>
|
||||
<option value="d61d14a3-72f7-4f44-894b-efe8b2a75be1">لغوشده</option>
|
||||
<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>
|
||||
|
||||
<!-- کاربران مسئول -->
|
||||
{{-- <label for="assignees" class="font-medium text-sm">انتصاب کاربران:</label>--}}
|
||||
<label class="font-medium text-sm">انتصاب کاربران:</label>
|
||||
<div class="rounded-lg border border-gray-300 p-2 w-full max-h-32 overflow-y-auto space-y-2">
|
||||
@foreach($users as $user)
|
||||
<label class="flex items-center space-x-2">
|
||||
<input type="checkbox" name="assignees[]" value="{{ $user->plain_id }}" class="rounded text-cyan-600 focus:ring-cyan-500">
|
||||
<span>{{ $user->name }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
<label for="assignees" class="font-medium text-sm">انتصاب
|
||||
کاربران:</label>
|
||||
<div class="relative" id="dropdown-container">
|
||||
{{-- دکمه --}}
|
||||
<button type="button" id="dropdown-btn"
|
||||
class="w-full bg-white border border-gray-300 rounded-lg px-4 py-2 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 mt-1 w-full bg-white border border-gray-300 rounded-lg shadow-lg">
|
||||
|
||||
<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' : '' }}>
|
||||
|
||||
<span>{{ $user->name }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
</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">
|
||||
{{-- <!-- برچسبها -->--}}
|
||||
{{-- <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">--}}
|
||||
|
||||
<!-- Issue والد -->
|
||||
<label for="parent" class="font-medium text-sm">پروژه والد:</label>
|
||||
<select id="parent" name="parent" class="rounded-lg border border-gray-300 p-2 w-full">
|
||||
@foreach($tasks as $task)
|
||||
<option value="{{$task->task_id}}">{{$task->name}}</option>
|
||||
@endforeach
|
||||
<!-- اپ -->
|
||||
<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 }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
|
||||
<!-- امتیاز تخمین -->
|
||||
<label for="estimate_point" class="font-medium text-sm">Estimate Point (0-7):</label>
|
||||
<input class="rounded-lg border border-gray-300 p-2 w-full" type="number" id="estimate_point"
|
||||
name="estimate_point" min="0" max="7">
|
||||
|
||||
<!-- دکمه -->
|
||||
<div></div>
|
||||
<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">
|
||||
ایجاد وظیفه
|
||||
</button>
|
||||
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>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const dropdownBtn = document.getElementById('dropdown-btn');
|
||||
const dropdownList = document.getElementById('dropdown-list');
|
||||
const searchInput = document.getElementById('search-input');
|
||||
const usersList = document.getElementById('users-list');
|
||||
const selectedCountSpan = document.getElementById('selected-count');
|
||||
|
||||
// باز و بسته کردن
|
||||
dropdownBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
dropdownList.classList.toggle('hidden');
|
||||
if (!dropdownList.classList.contains('hidden')) {
|
||||
searchInput.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// بستن با کلیک بیرون
|
||||
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';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// آپدیت تعداد
|
||||
function updateSelectedCount() {
|
||||
const selected = document.querySelectorAll('.user-checkbox:checked');
|
||||
const count = selected.length;
|
||||
selectedCountSpan.textContent = count === 0 ? 'انتخاب کاربران' : count + ' کاربر انتخاب شده';
|
||||
}
|
||||
|
||||
document.querySelectorAll('.user-checkbox').forEach(checkbox => {
|
||||
checkbox.addEventListener('change', updateSelectedCount);
|
||||
});
|
||||
|
||||
updateSelectedCount();
|
||||
|
||||
$(document).ready(function () {
|
||||
// تاریخ شروع با ساعت جاری
|
||||
$('#start_date').persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true,
|
||||
toolbox: {
|
||||
calendarSwitch: {enabled: false},
|
||||
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,
|
||||
toolbox: {
|
||||
calendarSwitch: {enabled: false},
|
||||
todayButton: {enabled: true, text: {fa: 'امروز'}}
|
||||
},
|
||||
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('');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
Reference in New Issue
Block a user