update: change url, scroll intoview

main
marszayn 2025-08-12 11:44:57 +07:00
parent e4fbd77c5c
commit fbf33f3bc3
3 changed files with 49 additions and 12 deletions

View File

@ -4,7 +4,7 @@ using eSPJ.Models;
namespace eSPJ.Controllers.SpjAdminController; namespace eSPJ.Controllers.SpjAdminController;
[Route("admin")] [Route("transport/spj-admin")]
public class SpjAdminController : Controller public class SpjAdminController : Controller
{ {
private static readonly Guid DummySpjGuid = new Guid("9f5b8f3a-1c2d-4a5b-9a7c-1234567890ab"); private static readonly Guid DummySpjGuid = new Guid("9f5b8f3a-1c2d-4a5b-9a7c-1234567890ab");

View File

@ -328,6 +328,43 @@
return markup; return markup;
} }
}); });
$('#manual-barcode-select').on('select2:open', function (e) {
setTimeout(function() {
scrollToSelect2();
}, 100);
});
$(document).on('focus', '.select2-search__field', function() {
setTimeout(function() {
scrollToSelect2();
}, 300);
});
}
function scrollToSelect2() {
const selectElement = document.getElementById('manual-barcode-select');
const select2Container = selectElement?.nextElementSibling;
if (select2Container) {
select2Container.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'nearest'
});
if (window.innerWidth <= 768) {
const rect = select2Container.getBoundingClientRect();
const scrollTop = window.pageYOffset + rect.top - (window.innerHeight / 3);
window.scrollTo({
top: scrollTop,
behavior: 'smooth'
});
}
}
} }
function formatSpjOption(spj) { function formatSpjOption(spj) {
@ -341,12 +378,12 @@
return $( return $(
'<div class="spj-option">' + '<div class="spj-option">' +
'<div class="spj-code">' + spj.text + '</div>' + '<div class="spj-code">' + spj.platNomor + '|' + spj.nomorPintu + '</div>' +
'<div class="spj-details">' + @* '<div class="spj-details">' +
'<span>' + spj.driverName + '</span>' + '<span>' + spj.driverName + '</span>' +
'<span class="bg-orange-300 rounded-full px-2 py-1 text-xs text-gray-500">' + spj.nomorPintu + '</span>' + '<span class="bg-orange-300 rounded-full px-2 py-1 text-xs text-gray-500">' + spj.nomorPintu + '</span>' +
'</div>' + '</div>' + *@
'<div style="font-size: 11px; color: #9ca3af; font-family: monospace;">' + spj.platNomor + '</div>' + '<div style="font-size: 11px; color: #9ca3af; font-family: monospace;">' + spj.text + '</div>' +
'</div>' '</div>'
); );
} }
@ -632,7 +669,7 @@
} }
processUrlFor(id) { processUrlFor(id) {
const basePath = '@Url.Content("~/admin/scan/process/")'; const basePath = '@Url.Content("~/transport/spj-adminscan/process/")';
return basePath + encodeURIComponent(id); return basePath + encodeURIComponent(id);
} }
@ -646,7 +683,7 @@
} }
resolveSpj(code) { resolveSpj(code) {
const url = '@Url.Content("~/admin/scan/resolve")'; const url = '@Url.Content("~/transport/spj-adminscan/resolve")';
return $.ajax({ return $.ajax({
url: url, url: url,
type: 'POST', type: 'POST',
@ -687,7 +724,7 @@
const waktu = now.toLocaleTimeString('id-ID', { hour: '2-digit', minute: '2-digit' }); const waktu = now.toLocaleTimeString('id-ID', { hour: '2-digit', minute: '2-digit' });
this.showSuccessModal(trimmed, tanggal, waktu); this.showSuccessModal(trimmed, tanggal, waktu);
} }
else if (resp.data.status === "exits") { else if (resp.data.status === "exists") {
this.showModal('error', 'SPJ sudah di Scan', (resp && resp.message) ? resp.message : 'Kode SPJ sudah digunakan.', true); this.showModal('error', 'SPJ sudah di Scan', (resp && resp.message) ? resp.message : 'Kode SPJ sudah digunakan.', true);
} else } else
{ {

View File

@ -10,7 +10,7 @@
<!-- Navigation Content --> <!-- Navigation Content -->
<div class="flex justify-between items-center px-8 relative pt-6"> <div class="flex justify-between items-center px-8 relative pt-6">
<!-- Home Button --> <!-- Home Button -->
<a href="@Url.Action("Index", "Admin")" class="flex flex-col items-center gap-1 px-4 py-2 transition-all duration-300 hover:scale-105 group"> <a href="@Url.Action("Index", "SpjAdmin")" class="flex flex-col items-center gap-1 px-4 py-2 transition-all duration-300 hover:scale-105 group">
<div class="relative"> <div class="relative">
<i class="w-6 h-6 text-gray-400 group-hover:text-orange-500 transition-colors duration-300" data-lucide="home"></i> <i class="w-6 h-6 text-gray-400 group-hover:text-orange-500 transition-colors duration-300" data-lucide="home"></i>
<div class="absolute -bottom-0.5 left-1/2 transform -translate-x-1/2 w-0 h-0.5 bg-orange-500 group-hover:w-full transition-all duration-300"></div> <div class="absolute -bottom-0.5 left-1/2 transform -translate-x-1/2 w-0 h-0.5 bg-orange-500 group-hover:w-full transition-all duration-300"></div>
@ -22,7 +22,7 @@
<!-- Profile Button --> <!-- Profile Button -->
<a href="@Url.Action("History", "Admin")" class="flex flex-col items-center gap-1 px-4 py-2 transition-all duration-300 hover:scale-105 group"> <a href="@Url.Action("History", "SpjAdmin")" class="flex flex-col items-center gap-1 px-4 py-2 transition-all duration-300 hover:scale-105 group">
<div class="relative"> <div class="relative">
<i class="w-6 h-6 text-gray-400 group-hover:text-orange-500 transition-colors duration-300" data-lucide="clipboard-check"></i> <i class="w-6 h-6 text-gray-400 group-hover:text-orange-500 transition-colors duration-300" data-lucide="clipboard-check"></i>
<div class="absolute -bottom-0.5 left-1/2 transform -translate-x-1/2 w-0 h-0.5 bg-orange-500 group-hover:w-full transition-all duration-300"></div> <div class="absolute -bottom-0.5 left-1/2 transform -translate-x-1/2 w-0 h-0.5 bg-orange-500 group-hover:w-full transition-all duration-300"></div>
@ -34,7 +34,7 @@
<!-- Center Submit --> <!-- Center Submit -->
<div class="absolute -top-4 left-1/2 transform -translate-x-1/2"> <div class="absolute -top-4 left-1/2 transform -translate-x-1/2">
<a href="@Url.Action("Scan", "Admin")" id="odoBtn" class="hover:cursor-pointer w-14 h-14 bg-gradient-to-br from-orange-500 via-orange-400 to-orange-600 rounded-full shadow-xl flex items-center justify-center transition-all duration-300 hover:scale-110 hover:rotate-6 border-4 border-white ring-2 ring-orange-200"> <a href="@Url.Action("Scan", "SpjAdmin")" id="odoBtn" class="hover:cursor-pointer w-14 h-14 bg-gradient-to-br from-orange-500 via-orange-400 to-orange-600 rounded-full shadow-xl flex items-center justify-center transition-all duration-300 hover:scale-110 hover:rotate-6 border-4 border-white ring-2 ring-orange-200">
<i class="w-6 h-6 text-white" data-lucide="camera"></i> <i class="w-6 h-6 text-white" data-lucide="camera"></i>
</a> </a>
</div> </div>