NASER fix some issue

This commit is contained in:
Montzar.ah.01
2026-04-25 19:45:15 +00:00
parent cf50c3371f
commit a285bcceac
4 changed files with 30 additions and 43 deletions
+4 -10
View File
@@ -72,7 +72,7 @@ namespace App\Http\Controllers;
// ]);
if ($admin->bale) {
try {
$response = Http::post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
$response = Http::withoutVerifying()->post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
"chat_id" => $admin->bale,
'text' => $message,
]);
@@ -86,7 +86,7 @@ namespace App\Http\Controllers;
}
}else{
try {
$response = Http::post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
$response = Http::withoutVerifying()->post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
"chat_id" => '985309723',
'text' => $message,
]);
@@ -101,12 +101,7 @@ namespace App\Http\Controllers;
foreach ($admins as $admin) {
try{
Http::/*withOptions([
'curl' => [
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
CURLOPT_TCP_FASTOPEN => 1,
]
])->*/withoutVerifying()->post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
Http::withoutVerifying()->post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
"chat_id" => $admin->bale,
'text' => $message,
]);
@@ -124,8 +119,7 @@ namespace App\Http\Controllers;
"chat_id" => $admin->bale,
'text' => $message,
]);
} catch (\Exception $e) {
}
} catch (\Exception $e) {}
}
}
}
+18 -7
View File
@@ -138,7 +138,7 @@ class TaskController extends Controller
$user = User::where('user_name', $_COOKIE['user_identity'])->first();
if ($user) {
if ($user->is_admin == 1) {
$tasks = Tasks::with(['duration', 'comments.user'])
$tasks = Tasks::with(['duration', 'comments.user', 'appName'])
->orderBy('target_date', 'desc')
->get();
// dd($tasks);
@@ -182,6 +182,22 @@ class TaskController extends Controller
'tasks' => (new Tasks())->filterByState($tasks),
'count' => $count,
'user_id' => $user->id,
'isAdminLevel1' => $user->is_admin == 1,
'mentionUsers' => User::select('id', 'name', 'user_name')->get(),
'appsList' => App::select('id', 'name_fa')->get(),
'priorityLabels' => [
'urgent' => 'فوری',
'high' => 'بالا',
'medium' => 'متوسط',
'low' => 'پایین'
],
'priorityColors' => [
'urgent' => 'bg-red-100 text-red-800',
'high' => 'bg-orange-100 text-orange-800',
'medium' => 'bg-yellow-100 text-yellow-800',
'low' => 'bg-green-100 text-green-800'
],
]);
} else {
return back()->with('message', [
@@ -529,12 +545,7 @@ class TaskController extends Controller
private function send_bale($chat_id, $message)
{
try {
Http::withOptions([
'curl' => [
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
CURLOPT_TCP_FASTOPEN => 1,
]
])->withoutVerifying()->post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
Http::withoutVerifying()->post('https://tapi.bale.ai/1482838710:sYbLzby0tuLRzHvP4d3LsbcNwg2sjSDLTAU/sendMessage', [
"chat_id" => $chat_id,
'text' => $message,
]);
+2 -2
View File
@@ -62,8 +62,8 @@ class Tasks extends Model
return $this->belongsTo(User::class);
}
public function app(){
return $this->belogsTo(App::class);
public function appName(){
return $this->belongsTo(App::class, 'app' , 'id');
}
public function duration(){
+5 -23
View File
@@ -6,13 +6,6 @@ use App\Models\User;
use App\Models\App;
$mentionUsers = User::select('id', 'name', 'user_name')->get();
$appsList = App::select('id', 'name_fa')->get();
$isAdminLevel1 = false;
if (isset($_COOKIE['user_identity'])) {
$isAdminLevel1 = (int)User::where('user_name', $_COOKIE['user_identity'])->value('is_admin') === 1;
}
$backlog = <<<SVG
<svg height="12px" width="12px" viewBox="0 0 16 16" class="flex-shrink-0 flex-shrink-0 size-4" xmlns="http://www.w3.org/2000/svg"><g>
<g transform="translate(8 8) rotate(-90)"><line x1="5.75" y1="0" x2="6.5" y2="0" stroke="#60646C" stroke-width="1.21" stroke-linecap="round">
@@ -67,18 +60,7 @@ $state = [
];
//$p_tasks = Pivot_Tasks::get();
$priorityLabels = [
'urgent' => 'فوری',
'high' => 'بالا',
'medium' => 'متوسط',
'low' => 'پایین'
];
$priorityColors = [
'urgent' => 'bg-red-100 text-red-800',
'high' => 'bg-orange-100 text-orange-800',
'medium' => 'bg-yellow-100 text-yellow-800',
'low' => 'bg-green-100 text-green-800'
];
?>
@extends('app')
@@ -115,8 +97,7 @@ $priorityColors = [
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">
اولویت
</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">تاریخ
شروع
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">{{ $isAdminLevel1 ? 'نام اپ' : 'تاریخ شروع' }}
</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">مهلت
</th>
@@ -155,6 +136,7 @@ $priorityColors = [
$actionType = $ended_at ? 'start' : ($started_at ? 'end' : 'start');
$p_id = $lastDuration?->id ?? '';
@endphp
{{--@if($_COOKIE['user_identity'] == 'naser_me') {{dump($task)}} @endif--}}
<tr class="hover:bg-gray-50">
<td class="px-2 py-2">
<div class="flex items-center gap-2">
@@ -173,7 +155,7 @@ $priorityColors = [
</span>
</td>
<td class="px-2 py-2 text-sm text-gray-600">
{{ $task->start_date ? Jalalian::fromCarbon(Carbon::parse($task->start_date))->format('Y/m/d') : '-' }}
{{ $isAdminLevel1 ? $task->appName->name_fa : Jalalian::fromCarbon(Carbon::parse($task->start_date))->format('Y/m/d') }}
</td>
<td class="px-2 py-2 text-sm text-gray-600">
{{ $task->target_date ? Jalalian::fromCarbon(Carbon::parse($task->target_date))->format('Y/m/d') : '-' }}
@@ -772,7 +754,7 @@ $priorityColors = [
const appTypes = {1:'خانگی', 2:'همکار'};
if (appNameEl) {
const app = (appsList || []).find(a => String(a.id) === String(task.app));
appNameEl.textContent = app?.name_fa ` (${appTypes[app.type]})` || '-';
appNameEl.textContent = app ? `${app.name_fa} (${appTypes[app.type]})` : '-';
}
// اولویت