fix refactor function check leave day, update handle ticket send mail

This commit is contained in:
dbdbd9 2025-06-20 14:29:47 +07:00
parent 500d6ec34d
commit 3263bce784
4 changed files with 357 additions and 253 deletions

View File

@ -452,142 +452,196 @@ class TicketController extends Controller
// Tổng giới hạn ngày nghỉ có phép tối đa trong tháng // Tổng giới hạn ngày nghỉ có phép tối đa trong tháng
$maxDaysPerMonth = $this->getMaxLeaveDaysPerMonth(); $maxDaysPerMonth = $this->getMaxLeaveDaysPerMonth();
$monthIndex = 0;
$onleaveTmp = 0; // Ngày phép trừ tạm (tính phép cho nhiều tháng)
foreach ($requestMonths as $monthKey => $monthData) { foreach ($requestMonths as $monthData) {
if ($monthsInfoWaiting) { if ($monthsInfoWaiting) {
// dd($requestMonths, $monthsInfoWaiting);
foreach ($monthsInfoWaiting as $monthInfo) { foreach ($monthsInfoWaiting as $monthInfo) {
if ($monthInfo['month'] == $monthData['month'] && $monthInfo['year'] == $monthData['year']) { if ($monthInfo['month'] == $monthData['month'] && $monthInfo['year'] == $monthData['year']) {
$remainingDaysInMonthIsUsed += $monthInfo['remaining_days_in_month_remaining']; $remainingDaysInMonthIsUsed += $monthInfo['remaining_days_in_month_remaining'];
// dd($remainingDaysInMonthIsUsed);
} }
} }
} }
// Tổng số ngày nghỉ có phép trong tháng // Số ngày nghỉ trong tháng
$usedDaysInMonth = $this->getUsedLeaveDaysInMonth($user, $monthData['year'], $monthData['month'], 'ONLEAVE'); $onleaveDaysInMonth = $this->getUsedLeaveDaysInMonth($user, $monthData['year'], $monthData['month'], 'ONLEAVE'); // Có phép
// Tổng số ngày nghỉ không phép trong tháng $nopayDaysInMonth = $this->getUsedLeaveDaysInMonth($user, $monthData['year'], $monthData['month'], 'LEAVE_WITHOUT_PAY'); // Không phép
$usedDaysInMonthWithoutPay = $this->getUsedLeaveDaysInMonth($user, $monthData['year'], $monthData['month'], 'LEAVE_WITHOUT_PAY'); $usedDaysInMonth = $onleaveDaysInMonth + $nopayDaysInMonth; // Tổng
// Tổng số ngày nghỉ trong tháng = tổng ngày nghỉ có phép + tổng ngày nghỉ không phép + tổng ngày yêu cầu // Tổng ngày nghỉ sẽ dùng trong tháng
$totalDaysInMonth = $usedDaysInMonth + $usedDaysInMonthWithoutPay + $monthData['days_requested']; $willUsedDaysInMonth = $usedDaysInMonth + $monthData['days_requested'];
// Tổng phép có trong tháng // Ngày phép
$totalLeaveDaysInMonth = $this->getTotalLeaveDaysInMonth($user, $monthData['year'], $monthData['month'], $isAccept); $onleaveDaysTotal = $this->getTotalLeaveDaysInMonth($user, $monthData['year'], $monthData['month'], $isAccept); // Tổng phép của user
$usedOnleaveDaysTotal = $this->getTotalLeaveDaysInMonthToMonth($user, $monthData['year'], $monthData['month']); // Phép đã dùng
$remainingOnleaveDays = $onleaveDaysTotal - $usedOnleaveDaysTotal - $onleaveTmp; // Phép còn lại
// Tính tổng số ngày nghỉ có phép đến tháng hiện tại // Tổng ngày phép còn lại trong tháng
$totalLeaveDaysInMonthToMonth = $this->getTotalLeaveDaysInMonthToMonth($user, $monthData['year'], $monthData['month']); $remainingOnleaveDaysInMonth = $remainingOnleaveDays - $remainingDaysInMonthIsUsed;
//Ngày phép còn lại trong tháng // Log::debug(
$remainingDaysInMonth = $totalLeaveDaysInMonth - $totalLeaveDaysInMonthToMonth; // "📊 Thống kê ngày phép:\n" .
// " - Tháng: {$monthData['month']}\n" .
$remainingDaysInMonthRemaining = $remainingDaysInMonth - $remainingDaysInMonthIsUsed; // " - Tổng ngày nghỉ có phép trong tháng: $onleaveDaysInMonth\n" .
// if ($monthsInfoWaiting) { // " - Tổng ngày nghỉ không phép trong tháng: $nopayDaysInMonth\n" .
// dd( // " - Tổng ngày nghỉ đã dùng trong tháng: $usedDaysInMonth\n" .
// "Ngày phép còn lại trong tháng: " . $remainingDaysInMonthRemaining, // " - Tổng ngày nghỉ sẽ dùng trong tháng: $willUsedDaysInMonth\n" .
// "Ngày phép còn lại: " . $remainingDaysInMonth, // " - Tổng ngày phép: $onleaveDaysTotal\n" .
// "Ngày phép đã sử dụng: " . $remainingDaysInMonthIsUsed, // " - Tổng ngày phép đã nghỉ: $usedOnleaveDaysTotal\n" .
// "Ngày phép yêu cầu: " . $monthData['days_requested'], // " - Tổng ngày phép còn lại: $remainingOnleaveDays\n" .
// "Tổng ngày nghỉ trong tháng: " . $totalDaysInMonth, // " - Tổng ngày phép còn lại trong tháng: $remainingOnleaveDaysInMonth\n"
// "Ngày phép đã sử dụng: " . $usedDaysInMonth,
// ); // );
// }
$month_data_status = 'ok'; $month_data_status = 'ok';
$days_will_use = 0; $onleave_days_will_use = 0; // Ngày phép sẽ dùng trong tháng
$days_will_use_without_pay = 0; $nopay_days_will_use = 0; // Ngày ko phép sẽ dùng trong tháng
// Xử lý các trường hợp thiếu ngày phép
if ($remainingDaysInMonthRemaining <= 0) { //hết phép // Ngày phép còn lại <= 0 (Hết phép)
if ($remainingOnleaveDaysInMonth <= 0) {
$hasInsufficientDays = true; $hasInsufficientDays = true;
$month_data_status = 'no_days_left'; $month_data_status = 'no_days_left';
$monthMessage = "* Hiện tại bạn đã hết phép nghỉ trong tháng {$monthData['month']}/{$monthData['year']}\n - Bạn sẽ nộp: " . $monthData['days_requested'] . " ngày không phép."; $onleave_days_will_use = 0;
$nopay_days_will_use = $monthData['days_requested'];
// Message cảnh báo nghỉ ko phép
$monthMessage = $this->buildMonthlyLeaveMessage(
$monthIndex,
$maxDaysPerMonth,
$monthData,
$remainingOnleaveDaysInMonth,
$onleaveDaysInMonth,
$nopayDaysInMonth,
$onleave_days_will_use,
$nopay_days_will_use
);
$errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage; $errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage;
$days_will_use = 0; Log::debug("--- Hết phép trong tháng ---", [
$days_will_use_without_pay = $monthData['days_requested']; "Phep" => $onleave_days_will_use,
} else if ($remainingDaysInMonthRemaining < $monthData['days_requested']) { // không đủ ngày phép "Khong Phep" => $nopay_days_will_use
if ( ]);
$remainingDaysInMonthRemaining >= $maxDaysPerMonth }
) {
// Ngày phép còn lại < ngày yêu cầu (Không đủ phép)
else if ($remainingOnleaveDaysInMonth < $monthData['days_requested']) {
// Vượt limit
if ($remainingOnleaveDaysInMonth >= $maxDaysPerMonth) {
$hasInsufficientDays = true; $hasInsufficientDays = true;
$month_data_status = 'exceed_max_days'; $month_data_status = 'exceed_max_days';
$daysNotEnough = $monthData['days_requested'] - $maxDaysPerMonth; $onleave_days_will_use = $maxDaysPerMonth - $onleaveDaysInMonth;
$monthMessage = "* Theo quy định ngày phép tối đa mỗi tháng là {$maxDaysPerMonth} ngày. \nTháng {$monthData['month']}/{$monthData['year']}: \n - Bạn đã sử dụng {$usedDaysInMonth} ngày phép, còn lại {$remainingDaysInMonthRemaining} ngày phép.\n - Bạn sẽ sử dụng {$maxDaysPerMonth} ngày phép và {$daysNotEnough} ngày không phép."; $nopay_days_will_use = $monthData['days_requested'] - $maxDaysPerMonth + $onleaveDaysInMonth;
$errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage;
$days_will_use = $maxDaysPerMonth; Log::debug("--- Không đủ phép trong tháng, vượt quá limit ---", [
$days_will_use_without_pay = $monthData['days_requested'] - $maxDaysPerMonth; "Phep" => $onleave_days_will_use,
} else { "Khong Phep" => $nopay_days_will_use
]);
}
// Không vượt limit
else {
$hasInsufficientDays = true; $hasInsufficientDays = true;
$month_data_status = 'insufficient_days'; $month_data_status = 'insufficient_days';
$daysNotEnough = $monthData['days_requested'] - $remainingDaysInMonthRemaining; $onleave_days_will_use = $remainingOnleaveDaysInMonth;
$monthMessage = "* Tháng {$monthData['month']}/{$monthData['year']}: \n - Số ngày phép còn lại: {$remainingDaysInMonthRemaining}, Số ngày yêu cầu: {$monthData['days_requested']}.\n - Bạn sẽ sử dụng {$remainingDaysInMonthRemaining} ngày phép và {$daysNotEnough} ngày không phép."; $nopay_days_will_use = $monthData['days_requested'] - $remainingOnleaveDaysInMonth;
$errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage;
$remainingDaysInMonthIsUsed = $remainingDaysInMonth; // lấy số ngày phép còn lại của tháng đó
$days_will_use = $remainingDaysInMonthRemaining; Log::debug("--- Không đủ phép trong tháng, ko vượt limit ---", [
$days_will_use_without_pay = $daysNotEnough; "Phep" => $onleave_days_will_use,
"Khong Phep" => $nopay_days_will_use
]);
} }
} else if (
$remainingDaysInMonthRemaining >= $monthData['days_requested']
) { // Đủ ngày phép ở tháng đó
// 1. Check thêm rule 1 tháng chỉ được nghỉ tối đa $maxDaysPerMonth ngày có phép, ngày vượt sẽ là ngày không phép
if ($totalDaysInMonth > $maxDaysPerMonth) {
$daysWithoutPermission = $totalDaysInMonth - $maxDaysPerMonth;
$daysWillUse = $maxDaysPerMonth - $usedDaysInMonth; // số ngày phép sẽ sử dụng
// Message cảnh báo nghỉ ko phép
$monthMessage = $this->buildMonthlyLeaveMessage(
$monthIndex,
$maxDaysPerMonth,
$monthData,
$remainingOnleaveDaysInMonth,
$onleaveDaysInMonth,
$nopayDaysInMonth,
$onleave_days_will_use,
$nopay_days_will_use
);
$errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage;
}
// Ngày phép còn lại >= ngày yêu cầu (Đủ phép)
else {
// Vượt limit
if ($willUsedDaysInMonth > $maxDaysPerMonth) {
$hasInsufficientDays = true; $hasInsufficientDays = true;
$month_data_status = 'exceed_max_days'; $month_data_status = 'exceed_max_days';
$onleave_days_will_use = $maxDaysPerMonth - $onleaveDaysInMonth;
$nopay_days_will_use = $willUsedDaysInMonth - $maxDaysPerMonth - $nopayDaysInMonth;
$monthMessage = "* Theo quy định ngày phép tối đa mỗi tháng là {$maxDaysPerMonth} ngày. \nTháng {$monthData['month']}/{$monthData['year']}: \n - Bạn đã sử dụng {$usedDaysInMonth} ngày phép, còn lại {$remainingDaysInMonthRemaining} ngày phép.\n - Bạn sẽ sử dụng " . $daysWillUse . " ngày phép và {$daysWithoutPermission} ngày không phép."; Log::debug("--- Đủ phép, vượt limit ---", [
"Phep" => $onleave_days_will_use,
$errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage; "Khong Phep" => $nopay_days_will_use
$days_will_use = $daysWillUse; ]);
$days_will_use_without_pay = $daysWithoutPermission; }
} else if ($monthData['days_requested'] + $remainingDaysInMonthIsUsed > $maxDaysPerMonth) { // Waiting ticket
else if ($monthData['days_requested'] + $remainingDaysInMonthIsUsed > $maxDaysPerMonth) {
if ($remainingDaysInMonthIsUsed > 0) { if ($remainingDaysInMonthIsUsed > 0) {
$onleave_days_will_use = $maxDaysPerMonth - $remainingDaysInMonthIsUsed;
$daysWillUse = $maxDaysPerMonth - $remainingDaysInMonthIsUsed; // số ngày phép sẽ sử dụng $nopay_days_will_use = $monthData['days_requested'] - $onleave_days_will_use;
$daysWithoutPermission = $monthData['days_requested'] - $daysWillUse;
$monthMessage = "* Theo quy định ngày phép tối đa mỗi tháng là {$maxDaysPerMonth} ngày. \nTháng {$monthData['month']}/{$monthData['year']}: \n - Bạn đã sử dụng {$remainingDaysInMonthIsUsed} ngày phép, còn lại {$remainingDaysInMonthRemaining} ngày phép.\n - Bạn sẽ sử dụng " . $daysWillUse . " ngày phép và {$daysWithoutPermission} ngày không phép.";
} else { } else {
$daysWithoutPermission = $monthData['days_requested'] - $maxDaysPerMonth; $onleave_days_will_use = $maxDaysPerMonth;
$monthMessage = "* Theo quy định ngày phép tối đa mỗi tháng là {$maxDaysPerMonth} ngày. \nTháng {$monthData['month']}/{$monthData['year']}: \n - Số ngày phép còn lại: {$remainingDaysInMonthRemaining}, Số ngày yêu cầu: {$monthData['days_requested']}.\n - Bạn sẽ sử dụng {$maxDaysPerMonth} ngày phép và {$daysWithoutPermission} ngày không phép."; $nopay_days_will_use = $monthData['days_requested'] - $maxDaysPerMonth;
} }
$hasInsufficientDays = true; $hasInsufficientDays = true;
$month_data_status = 'exceed_max_days'; $month_data_status = 'exceed_max_days';
Log::debug("--- Đủ phép, Waiting ticket ---", [
"Phep" => $onleave_days_will_use,
"Khong Phep" => $nopay_days_will_use
]);
}
// Đủ phép
else {
$onleave_days_will_use = $monthData['days_requested'];
$nopay_days_will_use = 0;
Log::debug("--- Đủ phép ---", [
"Phep" => $onleave_days_will_use,
"Khong Phep" => $nopay_days_will_use
]);
}
// Message cảnh báo nghỉ ko phép
$monthMessage = $this->buildMonthlyLeaveMessage(
$monthIndex,
$maxDaysPerMonth,
$monthData,
$remainingOnleaveDaysInMonth,
$onleaveDaysInMonth,
$nopayDaysInMonth,
$onleave_days_will_use,
$nopay_days_will_use
);
$errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage; $errorMessage .= $errorMessage ? "\n\n" . $monthMessage : $monthMessage;
$days_will_use = $maxDaysPerMonth; $remainingOnleaveDaysInMonth = $monthData['days_requested'];
$days_will_use_without_pay = $daysWithoutPermission;
} else {
$days_will_use = $monthData['days_requested'];
$days_will_use_without_pay = 0;
}
$remainingDaysInMonthRemaining = $monthData['days_requested'];
} else {
$days_will_use = $monthData['days_requested'];
$days_will_use_without_pay = 0;
} }
$month_data = [ $month_data = [
'year' => $monthData['year'], 'year' => $monthData['year'],
'month' => $monthData['month'], 'month' => $monthData['month'],
'total_leave_days_in_month' => $totalLeaveDaysInMonth, //tổng số ngày phép 'total_leave_days_in_month' => $onleaveDaysTotal, // tổng số ngày phép
'total_leave_days_in_month_to_month' => $totalLeaveDaysInMonthToMonth, //tổng ngày nghỉ có phép đã nghỉ 'total_leave_days_in_month_to_month' => $usedOnleaveDaysTotal, // tổng ngày nghỉ có phép đã nghỉ
'remaining_days_in_month' => $remainingDaysInMonth, //số ngày phép còn lại 'remaining_days_in_month' => $remainingOnleaveDays, // số ngày phép còn lại
'days_used' => $usedDaysInMonth, //tổng số ngày nghỉ có phép đã nghỉ ở tháng hiện tại 'days_used' => $onleaveDaysInMonth, // tổng số ngày nghỉ có phép đã nghỉ ở tháng hiện tại
'days_used_without_pay' => $usedDaysInMonthWithoutPay, //tổng số ngày nghỉ không phép đã nghỉ ở tháng hiện tại 'days_used_without_pay' => $nopayDaysInMonth, // tổng số ngày nghỉ không phép đã nghỉ ở tháng hiện tại
'days_requested' => $monthData['days_requested'], //số ngày yêu cầu nghỉ của tháng 'days_requested' => $monthData['days_requested'], // số ngày yêu cầu nghỉ của tháng
'remaining_days_in_month_remaining' => $remainingDaysInMonthRemaining, 'remaining_days_in_month_remaining' => $remainingOnleaveDaysInMonth,
'days_will_use' => $days_will_use, //Số ngày phép sẽ sử dụng 'days_will_use' => $onleave_days_will_use, //Số ngày phép sẽ sử dụng
'days_will_use_without_pay' => $days_will_use_without_pay, //Số ngày không phép sẽ sử dụng 'days_will_use_without_pay' => $nopay_days_will_use, //Số ngày không phép sẽ sử dụng
'status' => $month_data_status, // mặc định là ok 'status' => $month_data_status, // mặc định là ok
]; ];
// Thêm thông tin tháng vào mảng kết quả // Thêm thông tin tháng vào mảng kết quả
$monthsInfo[] = $month_data; $monthsInfo[] = $month_data;
$monthIndex++;
$onleaveTmp += $onleave_days_will_use; // Cộng ngày phép dùng tạm trong tháng
} }
// Trả về kết quả tổng hợp // Trả về kết quả tổng hợp
if ($hasInsufficientDays) { if ($hasInsufficientDays) {
return [ return [
@ -777,7 +831,7 @@ class TicketController extends Controller
if (!$ticket || $ticket->status !== "WAITING") { if (!$ticket || $ticket->status !== "WAITING") {
// No ticket found or already confirmed or refused // No ticket found or already confirmed or refused
return redirect()->to(config('app.client_url') . '/tickets-management'); return redirect()->to(config('app.client_url') . '/404');
} }
$dataMasterTypeNotes = CategoryController::getListMasterByType("REASON_NOTES"); $dataMasterTypeNotes = CategoryController::getListMasterByType("REASON_NOTES");
@ -785,13 +839,14 @@ class TicketController extends Controller
$leaveWithoutPay = null; $leaveWithoutPay = null;
if ($dataMasterTypeNotes) { if ($dataMasterTypeNotes) {
// get nghỉ phép, nghỉ không phép // Get nghỉ phép, nghỉ không phép
$onleave = optional($dataMasterTypeNotes->where('c_code', 'ONLEAVE')->first())->c_code; $onleave = optional($dataMasterTypeNotes->where('c_code', 'ONLEAVE')->first())->c_code;
$leaveWithoutPay = optional($dataMasterTypeNotes->where('c_code', 'LEAVE_WITHOUT_PAY')->first())->c_code; $leaveWithoutPay = optional($dataMasterTypeNotes->where('c_code', 'LEAVE_WITHOUT_PAY')->first())->c_code;
} }
// Không tìm được ngày phép, ko phép
if ($onleave == null || $leaveWithoutPay == null) { if ($onleave == null || $leaveWithoutPay == null) {
return redirect()->to(config('app.client_url') . '/tickets-management'); return redirect()->to(config('app.client_url') . '/404');
} }
if ($action == "confirm") { if ($action == "confirm") {
@ -1234,6 +1289,51 @@ class TicketController extends Controller
return $results; return $results;
} }
private function buildMonthlyLeaveMessage(
$index,
$max,
$monthData,
$totalLeave,
$usedLeave,
$usedNoPay,
$willUseLeave,
$willUseNoPay
): string {
$message = "";
if ($index === 0) {
$message .= "* Quy định: mỗi tháng được nghỉ tối đa {$max} ngày phép\n";
$message .= "- Bạn đang có: {$totalLeave} ngày phép\n\n";
}
// Hiển thị cộng phép nếu gửi ticket trong tương lai
$monthValue = $monthData['year'] . '-' . sprintf('%02d', $monthData['month']);
$currentMonth = date('Y-m');
if ($monthValue > $currentMonth && $index !== 0) {
$message .= "* Bạn được cộng 1 phép\n";
}
// In mỗi tháng
$message .= "Tháng {$monthData['month']}/{$monthData['year']}:\n";
if ($usedLeave > 0 || $usedNoPay > 0) {
$message .= " - Bạn đã sử dụng: ";
$usedParts = [];
if ($usedLeave > 0) $usedParts[] = "{$usedLeave} phép";
if ($usedNoPay > 0) $usedParts[] = "{$usedNoPay} không phép";
$message .= implode(', ', $usedParts) . "\n";
}
if ($willUseLeave > 0 || $willUseNoPay > 0) {
$message .= " - Bạn sẽ sử dụng: ";
$usedParts = [];
if ($willUseLeave > 0) $usedParts[] = "{$willUseLeave} phép";
if ($willUseNoPay > 0) $usedParts[] = "{$willUseNoPay} không phép";
$message .= implode(', ', $usedParts);
}
return $message;
}
/** /**
* Tính tổng số ngày nghỉ từ mảng các khoảng thời gian. * Tính tổng số ngày nghỉ từ mảng các khoảng thời gian.
* 'ALL' = 1 ngày, 'S'/'C' = 0.5 ngày. * 'ALL' = 1 ngày, 'S'/'C' = 0.5 ngày.

View File

@ -1,4 +1,3 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -37,9 +36,7 @@
<title>{{ $data['subject'] }}</title> <title>{{ $data['subject'] }}</title>
</head> </head>
<body> <body style="
<body style="
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
background-color: #edf2f7; background-color: #edf2f7;
"> ">
@ -83,7 +80,7 @@
<tr> <tr>
<td> <td>
<p style=" white-space:pre-line; margin: 0; margin-bottom: 5px"> <p style=" white-space:pre-line; margin: 0; margin-bottom: 5px">
Employee <span style="color: #222222;font-weight: bold;">{{ $data['name'] }}</span> has sent a request ticket, the specific content is as follows: Employee <span style="color: #222222;font-weight: bold;">{{ $data['name'] }}</span> has sent a <a href="{{ config('app.client_url') . $data['link'] }}"> request ticket</a>, the specific content is as follows:
</p> </p>
</td> </td>
</tr> </tr>
@ -101,42 +98,8 @@
<tr> <tr>
<td> <td>
<p
style="
margin: 0 0 16px;
padding: 5px;
margin: 5px;
text-align: center;
"
>
<a
href="{{ config('app.client_url') . $data['link'] }}"
style="
color: #fff;
border-radius: 10px;
background-color: rgba(68, 115, 196);
background-image: linear-gradient(
to top left,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0.2) 30%,
rgba(0, 0, 0, 0)
);
text-decoration: none;
display: inline-block;
font-weight: 600;
font-size: 16px;
line-height: 150%;
text-align: center;
margin: 0;
padding: 10px 12px;
"
>
Check now</a
>
</p>
<p style="text-align: center"> <p style="text-align: center">
Or you can quick You can quick
<span style="font-weight: bold">Confirm</span> or <span style="font-weight: bold">Confirm</span> or
<span style="font-weight: bold">Refuse</span> here: <span style="font-weight: bold">Refuse</span> here:
</p> </p>
@ -147,8 +110,7 @@
justify-content: center; justify-content: center;
gap: 10px; gap: 10px;
margin-top: 10px; margin-top: 10px;
" ">
>
<a <a
href="{{ route('email.ticket.handle', ['ticket_id' => $data['ticket_id'], 'action' => 'confirm', 'admin_email' => $data['admin_email']]) }}" href="{{ route('email.ticket.handle', ['ticket_id' => $data['ticket_id'], 'action' => 'confirm', 'admin_email' => $data['admin_email']]) }}"
style=" style="
@ -169,10 +131,8 @@
text-align: center; text-align: center;
margin: 0; margin: 0;
padding: 10px 12px; padding: 10px 12px;
" ">
> Confirm</a>
Confirm</a
>
<a <a
href="{{ route('email.ticket.handle', ['ticket_id' => $data['ticket_id'], 'action' => 'refuse', 'admin_email' => $data['admin_email']]) }}" href="{{ route('email.ticket.handle', ['ticket_id' => $data['ticket_id'], 'action' => 'refuse', 'admin_email' => $data['admin_email']]) }}"
@ -194,10 +154,18 @@
text-align: center; text-align: center;
margin: 0; margin: 0;
padding: 10px 12px; padding: 10px 12px;
" ">
> Refuse</a>
Refuse</a </div>
> </td>
</tr>
<tr>
<td style="color: #222222;">
<div style="margin-top: 3rem">
<p><span style="font-weight: bold">Note</span>: If you are redirected to a <span style="font-weight: bold">404 page</span>, it means:</p>
<p>1. The ticket has already been approved by another admin.</p>
<p>2. The ticket has been deleted.</p>
</div> </div>
</td> </td>
</tr> </tr>
@ -229,7 +197,6 @@
</td> </td>
</tr> </tr>
</table> </table>
</body>
</body> </body>
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -1,5 +1,42 @@
export const PageNotFound = () => { import {
return <>{'Not found!'}</> Box,
Button,
Container,
Image,
SimpleGrid,
Text,
Title,
} from '@mantine/core'
import image404 from '../../../public/404Image.jpg'
import { useNavigate } from 'react-router-dom'
const PageNotFound = () => {
const navigate = useNavigate()
return (
<Container mt="lg">
<SimpleGrid spacing={{ base: 40, sm: 80 }} cols={{ base: 1, sm: 2 }}>
<Box py="3rem">
<Title> Something is not right...</Title>
<Text c="dimmed" size="lg">
Page you are trying to open does not exist. You may have mistyped
the address, or the page has been moved to another URL. If you think
this is an error contact support.
</Text>
<Button
variant="outline"
size="md"
mt="xl"
onClick={() => navigate('/')}
>
Get back to home page
</Button>
</Box>
<Image src={image404} />
</SimpleGrid>
</Container>
)
} }
export default PageNotFound export default PageNotFound