Commit 74be1082 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

update new ui

parent d9e7ef9c
Pipeline #26899 passed with stage
in 1 minute and 22 seconds
......@@ -8,9 +8,9 @@ class HomeController extends Controller
{
public function index()
{
$menu = 'Patch';
$currentContent = 'Patch';
return view('.home', compact('menu', 'currentContent'));
return view('home', compact('menu', 'currentContent'));
}
}
......@@ -2,47 +2,71 @@
namespace App\Http\Livewire\Pages\FormatFileMaster;
use App\Models\ConfFormatFile;
use Livewire\Component;
use App\Models\Role;
use App\Models\Permission;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class FileEdit extends Component
{
public $editRoleId;
public $permissions;
public $roleId;
public $role;
public $name, $description, $permission_lists = [];
public $editId;
public $file;
public $name;
protected $rules = [
'role.name' => 'required',
];
public function mount($editRoleId, $permissions)
public function mount($editId)
{
$this->editRoleId = $editRoleId;
$this->permissions = $permissions;
$this->role = Role::findOrFail($editRoleId);
$this->name = $this->role->name;
$this->description = $this->role->description;
$this->permission_lists = $this->role->permissions->pluck('id')->toArray();
$this->permissions = Permission::all();
$this->editId = $editId;
$fileFormat = ConfFormatFile::findOrFail($this->editId);
$this->name = $fileFormat->name;
}
public function render()
{
$permission_lists = $this->permission_lists;
return view('livewire.pages.role.role-edit', compact('permission_lists'));
return view('livewire.pages.format-file-master.file-edit');
}
public function submitEditForm($selectedList)
public function submitEditForm()
{
// $this->validate();
$this->permission_lists = array_map('intval', $selectedList);
$this->role->name = $this->name;
$this->role->description = $this->description;
$this->role->permissions()->sync($this->permission_lists);
$this->role->save();
$this->validate();
$filePath = null;
if ($this->file) {
if ($this->isEditMode && $this->editId) {
$oldFile = ConfFormatFile::find($this->editId)->file;
if ($oldFile && Storage::disk('public')->exists($oldFile)) {
Storage::disk('public')->delete($oldFile);
}
}
$filePath = $this->file->store('runtime/format', 'public');
}
$date = date("Ymd");
$timestamp = date("His");
if ($this->isEditMode && $this->editId) {
$fileFormat = ConfFormatFile::findOrFail($this->editId);
} else {
$fileFormat = new ConfFormatFile;
}
$fileFormat->name = $this->name;
if ($filePath) {
$fileFormat->file = $filePath;
}
$fileFormat->date = $date;
$fileFormat->timestamp = $timestamp;
$fileFormat->save();
$this->reset(['name', 'file']);
$this->emit('showRoleList', 'Role successfully updated.');
return redirect()->route('format-file-master.index')->with('message', 'Format File saved successfully.');
}
public function goBack()
{
......
......@@ -18,7 +18,7 @@ class FileIndex extends Component
public $editId;
public $deleteId;
public $keyword = '';
public $route = '';
public $route = '';
public $selectedOption = 'name';
public $searchBy;
public $menu;
......@@ -40,7 +40,6 @@ class FileIndex extends Component
public function render()
{
;
$query = ConfFormatFile::select('formatservice_ID', 'name', 'file', 'date', 'timestamp', 'ac');
if ($this->searchSelected && $this->keyword) {
......@@ -73,7 +72,7 @@ class FileIndex extends Component
public function showDeleteModal($patchFileId)
{
$this->emit('showDeleteModal' ,$patchFileId);
$this->emit('showDeleteModal' ,$patchFileId);
}
public function deleteItem($id) {
......
......@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Validator;
use App\Models\Shippingnetnews;
use App\Models\Shippingnetnewstype;
use App\Models\Shippingnetservergroup;
use Illuminate\Support\Facades\Cache;
use Livewire\WithPagination;
class NewsIndex extends Component
......@@ -45,8 +46,13 @@ class NewsIndex extends Component
'authorDate' => 'Author Date',
];
$this->searchType = Shippingnetnewstype::all()->pluck('newstype','id');
$this->searchCategory = Shippingnetservergroup::all()->pluck('groupname','groupID');
$this->searchType = Cache::remember('shippingnetnewstype', 60, function () {
return Shippingnetnewstype::all()->pluck('newstype', 'id');
});
$this->searchCategory = Cache::remember('shippingnetservergroup', 60, function () {
return Shippingnetservergroup::all()->pluck('groupname', 'groupID');
});
}
public function search()
......@@ -85,12 +91,11 @@ class NewsIndex extends Component
}
public function deleteItem($deleteNewsId)
{
if (!Auth::user()->hasPermissions(['delete-user'])) {
if (!Auth::user()->hasPermissions(['delete-news'])) {
$this->showNoPermissionModal = true;
return;
}
$news = Shippingnetnews::find($deleteNewsId);
//test
if ($news) {
$news->delete();
$message = "Deleted Successfully";
......@@ -106,7 +111,7 @@ class NewsIndex extends Component
{
$query = Shippingnetnews::query();
$query = Shippingnetnews::with('group');
if(!empty($this->searchCateSelected)) {
$query->where('groupID', $this->searchCateSelected);
}
......
......@@ -11,7 +11,8 @@ use Illuminate\Support\Facades\Cache;
class PatchEdit extends Component
{
public $patchId ,$message;
public $patchId;
public $message;
public $progressSave = 0, $isProcessing = false, $progress = 0, $currentStep = 0;
public $searchProject = '';
public $selectedBranch, $selectedPatch, $showModal;
......@@ -43,6 +44,7 @@ class PatchEdit extends Component
protected $listeners = ['gotoModal', 'reloadComponent', 'deletePatchFile'];
public $modalLoaded = false;
public $contentType = 'application/json';
public function loadModal()
{
$this->modalLoaded = true;
......@@ -62,12 +64,11 @@ class PatchEdit extends Component
$client = new Client([
'headers' => [
'Authorization' => 'Bearer ' . env('GITLAB_API_TOKEN'),
'Accept' => 'application/json',
'Accept' => $this->contentType,
],
'verify' => false,
]);
$page = 1;
$perPage = 100;
$response = $client->get(env('GITLAB_API_URL') . '/projects', [
'query' => [
......@@ -82,13 +83,12 @@ class PatchEdit extends Component
}
public function getChangedFiles()
{
// dd($this->selectedProject);die();
$this->fileChangesTemp = [];
$client = new Client([
'headers' => [
'Authorization' => 'Bearer ' . env('GITLAB_API_TOKEN'),
'Accept' => 'application/json',
'Accept' => $this->contentType,
],
'verify' => false,
]);
......@@ -128,7 +128,6 @@ class PatchEdit extends Component
}
$current = &$current[$part];
}
// $current['id'] = $file['fid'];
}
return $tree;
}
......@@ -142,6 +141,7 @@ class PatchEdit extends Component
public function loadPatchData()
{
$patch = ConfSmartUpdate::findOrFail($this->patchId);
$this->PATCHNAME = $patch->PATCHNAME;
$this->PDATE = $patch->PDATE;
$this->PHP_VERSION = $patch->PHP_VERSION;
......@@ -157,9 +157,9 @@ class PatchEdit extends Component
$this->UNINSTALL = $patch->UNINSTALL;
$this->PATCHCODE_SERVER = $patch->PATCHCODE_SERVER;
$filePath = TabPatchFile::where("ptid", $this->patchId)->get()->toArray();
$filePath = TabPatchFile::select('fid','ptid','file_name')->where("ptid", $this->patchId)->get()->toArray();
$this->filePatch = $filePath;
$this->filePatchChanges = $this->buildTree($filePath);
}
public function startProcess()
......@@ -175,25 +175,6 @@ class PatchEdit extends Component
public function processStep()
{
// $this->isProcessing = true;
// $this->dispatchBrowserEvent('process-started');
// $this->validate([
// 'PATCHNAME' => 'required|string|max:255',
// 'PDATE' => 'required|date',
// 'PHP_VERSION' => 'required|integer',
// 'PLEVEL' => 'required|string|max:255',
// 'PCODE' => 'required|string|max:255',
// 'MAJOR_VERSION' => 'required|string|max:255',
// 'PDESC' => 'required|string|max:255',
// 'Remark' => 'required|string|max:255',
// 'POWNER' => 'required|string|max:255',
// 'PAPPROVEDATE' => 'required|date',
// 'PTYPE' => 'required|string|max:255',
// 'PATCHCODE' => 'required|string',
// 'UNINSTALL' => 'required|string|max:255',
// 'PATCHCODE_SERVER' => 'required|string',
// ]);
$confSmartUpdate = ConfSmartUpdate::findOrFail($this->patchId);
$confSmartUpdate->PATCHNAME = $this->PATCHNAME;
$confSmartUpdate->PDATE = $this->PDATE;
......@@ -213,60 +194,53 @@ class PatchEdit extends Component
if ($this->isProcessing && count($this->fileChangesTemp) > 0) {
$totalFiles = count($this->fileChangesTemp);
// $currentStep = (int)($this->progress / (100 / $totalFiles));
$this->currentStep = $totalFiles - ($totalFiles - $this->currentStep);
if ($this->currentStep < $totalFiles) {
$file = $this->fileChangesTemp[$this->currentStep];
$filedata = $this->getFileContentFromGit($file, $this->endCommit);
$filePath = $this->formatFilePath($file);
$filePath = $this->formatFilePath($file , 'SPN');
$existingFile = TabPatchFile::where('file_name', $filePath)
->where('ptid', $confSmartUpdate->PID)
->first();
if (!$existingFile) {
// ถ้าไม่มีชื่อไฟล์นี้ในฐานข้อมูล ให้บันทึกข้อมูล
$filepath = new TabPatchFile;
$filepath->ptid = $confSmartUpdate->PID;
$filepath->file_name = $filePath;
$filepath->file_data = base64_encode($filedata);
$filepath->save();
} else {
// file name ซ้ำ
}
$this->currentStep += 1;
$this->progress = round(($this->currentStep / $totalFiles) * 100, 2);
if($this->progress == 100) {
// $this->isProcessing = false;
if ($this->progress == 100) {
$this->message = 'Patch details and file changes updated successfully.';
$this->emit('reloadComponent', $this->patchId);
$this->reset(['fileChangesTemp', 'fileGitChanges', 'currentStep']);
}
} else {
// $this->isProcessing = false;
// session()->flash('message', 'Patch details and file changes updated successfully.');
// $this->message = 'Patch details and file changes updated successfully.';
// $this->reset(['fileChangesTemp', 'fileGitChanges', 'currentStep', 'progress']);
}
}
return $this->progress;
}
private function formatFilePath($file)
private function formatFilePath($file ,$project)
{
if (strpos($file, 'SPN/') !== false) {
return str_replace("SPN/", "../SPN/", $file);
} else if (strpos($file, 'spn/') !== false) {
return str_replace("spn/", "../spn/", $file);
$lowerProject = strtolower($project);
$upperProject = strtoupper($project);
if (strpos($file, $upperProject.'/') !== false) {
return str_replace("$upperProject/", "../$upperProject/", $file);
} elseif (strpos($file, '$lowerProject/') !== false) {
return str_replace("$lowerProject/", "../$lowerProject/", $file);
} else {
return str_replace("IE5DEV.shippingnet", ".", $file);
}
}
private function getFileContentFromGit($filePath, $commit)
{
$token = env('GITLAB_API_TOKEN');
......@@ -275,7 +249,7 @@ class PatchEdit extends Component
'base_uri' => 'https://idemo.netbay.co.th/gitlab/api/v4/',
'headers' => [
'Authorization' => "Bearer $token",
'Accept' => 'application/json',
'Accept' => $this->contentType,
],
'verify' => false,
]);
......@@ -302,16 +276,9 @@ class PatchEdit extends Component
private function buildTree($files)
{
$tree = [];
foreach ($files as $file) {
if (strpos($file['file_name'], "../SPN/") !== false) {
$filePath = str_replace("../SPN/", "SPN/", $file['file_name']);
} else if (strpos($file['file_name'], "../spn/") !== false) {
$filePath = str_replace("../spn/", "spn/", $file['file_name']);
} else {
$filePath = "IE5DEV.shippingnet" . substr($file['file_name'], 1);
}
$filePath = $this->generateFilePath($file['file_name']);
$pathParts = explode('/', $filePath);
$current = &$tree;
......@@ -327,6 +294,36 @@ class PatchEdit extends Component
return $tree;
}
private function generateFilePath($fileName)
{
if (strpos($fileName, "IE5DEV.shippingnet") !== false) {
return $this->processShippingNetPath($fileName);
} elseif (strpos($fileName, "IE5DEV.seamanifest") !== false) {
return $this->processSeaManifestPath($fileName);
}
return $fileName;
}
private function processShippingNetPath($fileName)
{
if (strpos($fileName, "../SPN/") !== false) {
return str_replace("../SPN/", "SPN/", $fileName);
} elseif (strpos($fileName, "../spn/") !== false) {
return str_replace("../spn/", "spn/", $fileName);
}
return "IE5DEV.shippingnet" . substr($fileName, 1);
}
private function processSeaManifestPath($fileName)
{
if (strpos($fileName, "../seamanifest/") !== false) {
return str_replace("../seamanifest/", "seamanifest/", $fileName);
} elseif (strpos($fileName, "../SEAMANIFEST/") !== false) {
return str_replace("../SEAMANIFEST/", "SEAMANIFEST/", $fileName);
}
return "IE5DEV.seamanifest" . substr($fileName, 1);
}
public function loadPage($page)
{
$this->emit('menuChanged', $page);
......@@ -338,7 +335,7 @@ class PatchEdit extends Component
$pathFile = TabPatchFile::where("fid", $patchFileId)->first();
$patchId = $pathFile->ptid;
$pathFile = TabPatchFile::where("fid", $patchFileId)->delete();
TabPatchFile::where("fid", $patchFileId)->delete();
$message = "Deleted File ID : " . json_encode($patchFileId) . " Successfully";
$this->message = $message;
......
......@@ -55,18 +55,17 @@ class PatchIndex extends Component
{
$this->editPid = $pid;
$this->action = 'edit';
// $this->emit('showpatchEditForm');
}
public function showDeleteModal($patchFileId)
{
$this->emit('showDeleteModal' ,$patchFileId);
$this->emit('showDeleteModal' ,$patchFileId);
}
public function deleteItem($pid) {
$pathFile = TabPatchFile::where("ptid", $pid)->delete();
$patch = ConfSmartUpdate::where("PID", $pid)->delete();
TabPatchFile::where("ptid", $pid)->delete();
ConfSmartUpdate::where("PID", $pid)->delete();
$message = "Deleted Patch ID : " . json_encode($pid) . " Successfully";
$this->message = $message;
}
......
......@@ -43,7 +43,7 @@ class SendMultiPatchBox extends Component
public function updateSelectedPatches($patchId, $allSelectPatchName)
{
if (is_array($patchId)) {
$this->selectedPatches = $patchId;
$this->selectedPatches = $patchId;
$this->selectedPatchName = $allSelectPatchName;
} else {
if (in_array($patchId, $this->selectedPatches)) {
......@@ -80,7 +80,7 @@ class SendMultiPatchBox extends Component
$checkPendding = ConfServerPendding::where("PatchID", $pId)->where("ServerID", $serverLicense->ID)->first();
if (isset($checkPendding)) {
$checkPendding = ConfServerPendding::where("PatchID", $pId)->where("ServerID", $serverLicense->ID)->update([
ConfServerPendding::where("PatchID", $pId)->where("ServerID", $serverLicense->ID)->update([
"TaskStatus" => "0",
"TaskFinish" => '0000_00_00 00:00:00'
]);
......@@ -113,7 +113,6 @@ class SendMultiPatchBox extends Component
}
public function render()
{
// dd($this->selectedPatches);
return view('livewire.pages.send-patch.send-multi-patch-box');
}
}
......@@ -8,6 +8,8 @@ class ConfFormatFile extends Model
{
protected $table = 'conf_format_file';
public $timestamps = false;
protected $primaryKey ='formatservice_ID';
protected $fillable = [
'formatservice_ID',
'name',
......
......@@ -14,10 +14,14 @@
'pages.exchangerate.exchangerate-index' => 'App\\Http\\Livewire\\Pages\\Exchangerate\\ExchangerateIndex',
'pages.exchangerate.exchangerate-upload' => 'App\\Http\\Livewire\\Pages\\Exchangerate\\ExchangerateUpload',
'pages.format-file-master.file-create' => 'App\\Http\\Livewire\\Pages\\FormatFileMaster\\FileCreate',
'pages.format-file-master.file-edit' => 'App\\Http\\Livewire\\Pages\\FormatFileMaster\\FileEdit',
'pages.format-file-master.file-index' => 'App\\Http\\Livewire\\Pages\\FormatFileMaster\\FileIndex',
'pages.group.group-create' => 'App\\Http\\Livewire\\Pages\\Group\\GroupCreate',
'pages.group.group-edit' => 'App\\Http\\Livewire\\Pages\\Group\\GroupEdit',
'pages.group.group-index' => 'App\\Http\\Livewire\\Pages\\Group\\GroupIndex',
'pages.news.news-create' => 'App\\Http\\Livewire\\Pages\\News\\NewsCreate',
'pages.news.news-edit' => 'App\\Http\\Livewire\\Pages\\News\\NewsEdit',
'pages.news.news-index' => 'App\\Http\\Livewire\\Pages\\News\\NewsIndex',
'pages.parameter.parameter-create' => 'App\\Http\\Livewire\\Pages\\Parameter\\ParameterCreate',
'pages.parameter.parameter-edit' => 'App\\Http\\Livewire\\Pages\\Parameter\\ParameterEdit',
'pages.parameter.parameter-index' => 'App\\Http\\Livewire\\Pages\\Parameter\\ParameterIndex',
......@@ -27,6 +31,7 @@
'pages.patch.patch-edit' => 'App\\Http\\Livewire\\Pages\\Patch\\PatchEdit',
'pages.patch.patch-index' => 'App\\Http\\Livewire\\Pages\\Patch\\PatchIndex',
'pages.patch.patch-master-file' => 'App\\Http\\Livewire\\Pages\\Patch\\PatchMasterFile',
'pages.report.report-index' => 'App\\Http\\Livewire\\Pages\\Report\\ReportIndex',
'pages.role.role-create' => 'App\\Http\\Livewire\\Pages\\Role\\RoleCreate',
'pages.role.role-edit' => 'App\\Http\\Livewire\\Pages\\Role\\RoleEdit',
'pages.role.role-index' => 'App\\Http\\Livewire\\Pages\\Role\\RoleIndex',
......
<div class="sidebar sidebar-panel print:hidden">
<div class="flex h-full grow flex-col border-r border-slate-150 bg-white dark:border-navy-700 dark:bg-navy-750">
<div class="flex items-center justify-between pr-5 pl-1 pt-1">
<!-- Application Logo -->
<div class="flex">
<a href="/">
<img class=" transition-transform duration-500 ease-in-out "
src="{{ asset('images/express-logonew.png') }}" alt="logo" />
</a>
</div>
<button @click="$store.global.isSidebarExpanded = false"
class="btn h-7 w-7 rounded-full p-0 text-primary hover:bg-slate-300/20 focus:bg-slate-300/20 active:bg-slate-300/25 dark:text-accent-light/80 dark:hover:bg-navy-300/20 dark:focus:bg-navy-300/20 dark:active:bg-navy-300/25 xl:hidden">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
</svg>
</button>
</div>
<div class="h-[calc(100%-4.5rem)] overflow-x-hidden pb-6 mt-5" x-data="{ expandedItem: null }" x-init="$el._x_simplebar = new SimpleBar($el);">
@foreach ($allSidebarItems as $key => $menuItemsGroup)
@if ($key > 0)
<div class="my-3 mx-4 h-px bg-slate-200 dark:bg-navy-500"></div>
@endif
<h1 class="py-2 font-medium text-xs uppercase mx-4 text-slate-800 dark:text-navy-50">
{{ $menuItemsGroup['title'] }}
</h1>
@foreach ($menuItemsGroup['items'] as $menuItems)
<ul class="grow space-y-1.5 px-5 font-inter font-medium">
@foreach ($menuItems as $keyMenu => $menu)
@if (isset($menu['submenu']))
<li x-data="accordionItem('{{ $keyMenu }}')">
<a :class="expanded ? 'text-slate-800 font-semibold dark:text-navy-50' :
'text-slate-600 dark:text-navy-200'"
@click="expanded = !expanded"
class="flex items-center justify-between py-2 text-xs+ tracking-wide outline-none transition-[color,padding-left] duration-300 ease-in-out hover:text-slate-800 dark:hover:text-navy-50"
href="javascript:void(0);">
<span>{{ $menu['title'] }}</span>
<svg :class="expanded && 'rotate-90'" xmlns="http://www.w3.org/2000/svg"
class="h-4 w-4 text-slate-400 transition-transform ease-in-out"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 5l7 7-7 7"></path>
</svg>
</a>
<ul x-collapse x-show="expanded">
@foreach ($menu['submenu'] as $keyMenu => $submenu)
<li
@if ($submenu['route_name'] === $pageName) x-init="$el.scrollIntoView({block:'center'}); expanded = true" @endif>
<a href="{{ route($submenu['route_name']) }}"
class="flex items-center justify-between p-2 text-xs+ tracking-wide
outline-none transition-[color,padding-left] duration-300 ease-in-out hover:pl-4
{{ $submenu['route_name'] === $pageName ? 'text-primary dark:text-accent-light font-medium' : 'text-slate-600 hover:text-slate-800 dark:text-navy-200 dark:hover:text-navy-50' }}">
<div class="flex items-center space-x-2">
<div
class="h-1.5 w-1.5 rounded-full border border-current opacity-40">
</div>
<span>{{ $submenu['title'] }}</span>
</div>
</a>
</li>
@endforeach
</ul>
</li>
@else
<li
@if ($menu['route_name'] === $pageName) x-init="$el.scrollIntoView({block:'center'});" @endif>
<a href="{{ route($menu['route_name']) }}"
class="flex text-xs+ py-2 tracking-wide outline-none transition-all duration-300 ease-in-out {{ $menu['route_name'] === $pageName ? 'rounded-lg bg-primary px-5 py-2.5 text-white dark:text-white font-medium' : 'text-slate-600 hover:text-slate-800 dark:text-navy-200 dark:hover:text-navy-50' }}">
{{ $menu['title'] }}
</a>
</li>
@endif
@endforeach
</ul>
@endforeach
@endforeach
</div>
</div>
</div>
<div class="h-full text-white bg-main-container w-80 p-4 transition-all duration-300 overflow-y" x-data="{ activeLink: window.location.pathname }">
<div class="rounded-2xl p-3 bg-white w-full mb-2">
<ul >
<li class="mb-1 flex justify-between">
<a href="/" class="text-black block py-1 px-4 rounded text-xl">Spn Patch</a>
<button @click="sidebarOpen = false; if (!sidebarOpen) setTimeout(() => showSidebarButton = true, 400)" class="mb-4 pt-1 focus:outline-none">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="black" viewBox="0 0 24 24"
stroke="black">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 6h16M4 12h16m-7 6h7" />
</svg>
</button>
</li>
<li class="mb-1">
<a href="#" class="block py-1 px-4 rounded hover:primary-focus text-black"> <i
class="fa fa-home mx-2"></i>Home</a>
</li>
</ul>
</div>
<div class="rounded-2xl p-3 bg-white w-full mb-2" x-data="{ open: ['/patch', '/master-file', '/exchange-rate', '/discharge-port'].includes(activeLink) }">
<ul >
<li class="mb-1">
<a href="#" @click="open = !open" class="block py-2 px-4 rounded text-black flex items-center">
<i class="fa fa-server mr-2"></i> Patch
<svg class="ml-auto h-4 w-4 transition-transform transform" :class="open ? 'rotate-180' : ''"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</a>
</li>
<div x-show="open" class="transition-all duration-300" x-cloak>
<li class="mb-1 ml-6">
<a href="/patch" :class="activeLink === '/patch' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-edit mr-2"></i>Create Patch</a>
</li>
<li class="mb-1 ml-6">
<a href="/master-file" :class="activeLink === '/master-file' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-edit mr-2"></i>Create MasterFile</a>
</li>
<li class="mb-1 ml-6">
<a href="/exchange-rate" :class="activeLink === '/exchange-rate' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-edit mr-2"></i>Create Exchange Rate</a>
</li>
<li class="mb-1 ml-6">
<a href="/discharge-port" :class="activeLink === '/discharge-port' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>Create Discharge Port</a>
</li>
</div>
</ul>
</div>
<div class="rounded-2xl p-3 bg-white w-full mb-2" x-data="{ open: ['/send-patch', '/send-multi-patch', '/delete-multi-patch'].includes(activeLink) }">
<ul >
<li class="mb-1">
<a href="#" @click="open = !open" class="block py-2 px-4 rounded text-black flex items-center">
<i class="fa fa-server mr-2"></i> Send Patch
<svg class="ml-auto h-4 w-4 transition-transform transform" :class="open ? 'rotate-180' : ''"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</a>
</li>
<div x-show="open" class="transition-all duration-300" x-cloak>
<li class="mb-1 ml-6">
<a href="/send-patch" :class="activeLink === '/send-patch' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-edit mr-2"></i>Send Patch</a>
</li>
<li class="mb-1 ml-6">
<a href="/send-multi-patch" :class="activeLink === '/send-multi-patch' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>Send Multi Patch</a>
</li>
<li class="mb-1 ml-6">
<a href="/delete-multi-patch" :class="activeLink === '/delete-multi-patch' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>Delete Multi Patch</a>
</li>
</div>
</ul>
</div>
<div class="rounded-2xl p-3 bg-white w-full mb-2">
<ul >
<li class="mb-1">
<a href="/news" :class="activeLink === '/news' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded text-black flex items-center">
<i class="fa fa-server mr-2"></i> News & Update
</a>
</li>
</ul>
</div>
<div class="rounded-2xl p-3 bg-white w-full mb-2" x-data="{ open: ['/company', '/role', '/group', '/user', '/format-file-master'].includes(activeLink) }">
<ul >
<li class="mb-1">
<a href="#" @click="open = !open" class="block py-2 px-4 rounded text-black flex items-center">
<i class="fa fa-server mr-2"></i> Configuration
<svg class="ml-auto h-4 w-4 transition-transform transform" :class="open ? 'rotate-180' : ''"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</a>
</li>
<div x-show="open" class="transition-all duration-300" x-cloak>
<li class="mb-1 ml-6">
<a href="/company" :class="activeLink === '/company' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-edit mr-2"></i>Company</a>
</li>
<li class="mb-1 ml-6">
<a href="/role" :class="activeLink === '/role' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>Role</a>
</li>
<li class="mb-1 ml-6">
<a href="/group" :class="activeLink === '/group' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>Group</a>
</li>
<li class="mb-1 ml-6">
<a href="/user" :class="activeLink === '/user' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>User</a>
</li>
<li class="mb-1 ml-6">
<a href="/format-file-master" :class="activeLink === '/format-file-master' ? 'bg-primary-focus text-white' : 'text-black'"
class="block py-2 px-4 rounded hover:bg-primary-focus hover:text-white"> <i class="fa fa-user mr-2"></i>Format File Master</a>
</li>
</div>
</ul>
</div>
<div class="rounded-2xl p-3 bg-white w-full mb-2 bottom-0">
<div x-data="{ open: false, timer: null }" @click.away="open = false" @mouseenter="open = true; clearTimeout(timer)"
@mouseleave="timer = setTimeout(() => open = false, 100)"
class="relative px-2 py-1 rounded text-gray-700 hover:bg-primary-focus hover:text-white cursor-pointer">
<i class="fa fa-user" aria-hidden="true"></i>
<span>Hello, {{ $userName ?? '' }}</span>
<ul x-cloak x-show="open" @click="open = false" @mouseleave="open = false"
class="absolute left-0 mt-2 w-32 bg-white shadow-lg">
<li class="block px-4 py-2 text-gray-700 hover:bg-stone-100">
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="button" onclick="event.preventDefault(); this.closest('form').submit();">
Logout
</button>
</form>
</li>
</ul>
</div>
</div>
</div>
<x-app-layout title="Starter Sideblock" is-sidebar-open="true" is-header-blur="true">
<style> [x-cloak] {
display: none;
}</style>
<livewire:navbar :currentContent="$currentContent"/>
<livewire:main-container :currentContent="$currentContent" />
</x-app-layout>
\ No newline at end of file
<style>
[x-cloak] {
display: none;
}
</style>
<div x-data="{ sidebarOpen: true, showSidebarButton: false }" class="flex h-screen">
<div x-show="sidebarOpen" class="w-1/5 bg-gray-100"
x-transition:enter="transition transform ease-out duration-300" x-transition:enter-start="-translate-x-full"
x-transition:enter-end="translate-x-0" x-transition:leave="transition transform ease-in duration-300"
x-transition:leave-start="translate-x-0" x-transition:leave-end="-translate-x-full">
<!-- Sidebar Content -->
@include('components.sidebar', [
'currentContent' => $currentContent,
'userName' => auth()->user()->username ?? '',
])
</div>
<button @click="sidebarOpen = true; showSidebarButton= false" x-show="showSidebarButton" x-cloak
class="mb-4 ml-2 pt-1 focus:outline-none "
x-transition:enter="transition ease-out duration-100 transform"
x-transition:enter-start="opacity-0 -translate-x-full" x-transition:enter-end="opacity-100 translate-x-0"
x-transition:leave="transition ease-in duration-300 transform"
x-transition:leave-start="opacity-300 translate-x-0" x-transition:leave-end="opacity-0 -translate-x-full">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="black" viewBox="0 0 24 24" stroke="black">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7" />
</svg>
</button>
<div :class="sidebarOpen ? 'w-4/5 mr-5' : 'w-full ml-2 mr-5'" class="transition-all duration-300">
<livewire:main-container :currentContent="$currentContent" />
</div>
</div>
</x-app-layout>
<div class="bg-main-container mt-1 z-0 ">
<div class="bg-main-container mt-1 z-0 w-full">
<link href="{{ asset('css/pages/patch.css') }}" rel="stylesheet">
<div wire:loading.delay wire:loading.class.remove="hidden"
......@@ -12,7 +12,7 @@
</div>
{{-- end loading --}}
<div wire:loading.remove class="bg-main-container mx-4">
<div wire:loading.remove class="bg-main-container">
@switch($currentContent)
@case('Role')
<livewire:pages.role.role-index wire:init />
......
<div>
<div x-cloak>
@include('components.no-permission')
<div wire:loading.class="flex" wire:loading.class.remove="hidden" wire:target="showCompanyList"
class="absolute inset-0 items-center justify-center z-50 bg-slate-50 dark:bg-navy-900 hidden">
......@@ -6,23 +6,14 @@
<div class="app-preloader-inner relative inline-block h-48 w-48"></div>
</div>
</div>
<div class="flex items-center space-x-4 py-5 lg:py-6 ">
<ul class="hidden flex-wrap items-center space-x-2 sm:flex">
<li class="flex items-center space-x-2">
<a class="text-primary transition-colors hover:text-primary-focus dark:text-accent-light dark:hover:text-accent"
href="/">Home</a>
<svg x-ignore xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</li>
<li class="flex items-center space-x-2">
<a class="text-primary transition-colors hover:text-primary-focus dark:text-accent-light dark:hover:text-accent"
wire:click="$emit('menuClicked', 'Company')">Company</a>
</li>
</ul>
<div class="my-5 flex h-8 place-content-center px-4 ">
<h2 class="text-xl text-slate-800">
Company Management
</h2>
<h2 class="ml-3 text-xl text-slate-800 font-semibold underline underline-offset-4">
{{ $action === 'create' ? 'Create' : ($action === 'edit' ? 'Edit' : '') }}
</h2>
</div>
@if ($action === 'list')
<div x-data="{ show: @entangle('showMessage'), message: '' }" x-init="window.addEventListener('show-message', event => {
......@@ -53,41 +44,33 @@
selectedCompanies: @entangle('selectedCompanies')
}" class="grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6 ">
<div class="card pb-4">
<div class="my-3 flex h-8 items-center justify-between px-4 sm:px-5">
<h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base">
Company Management
</h2>
</div>
<div class="card pb-4 py-4 ">
<div class="flex justify-between">
<div class="px-2 ml-4">
<button wire:click="showCompanyCreateForm()"
class="btn h-6 w-28 rounded space-x-1 bg-primary px-3 text-xs font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor" class="w-3 h-3">
<path stroke-linecap="round" stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z">
</path>
</svg>
<span>Create</span>
</button>
<a @click.prevent="if (selectedCompaniesAlpine.length > 0) { showDeleteListModal = true; } else { showAlert = true;}"
class="btn h-6 w-28 rounded space-x-1 bg-primary px-3 text-xs font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor" class="w-3 h-3">
<path stroke-linecap="round" stroke-linejoin="round"
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0">
</path>
</svg>
<span>Delete</span>
</a>
<div class="flex ">
<div class="px-1 ml-5">
<button type="button" class="py-2 px-3 bg-primary rounded-md text-white hover:bg-primary-focus"
wire:click="showCompanyCreateForm"><i aria-hidden="true" class="fa fa-add fa-solid"></i>Add</button>
</div>
<div class=" ml-1">
<a @click.prevent="if (selectedCompaniesAlpine.length > 0) { showDeleteListModal = true; } else { showAlert = true;}"
class="py-2 px-3 bg-primary rounded-md text-white hover:bg-primary-focus flex items-center space-x-1">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-3 h-3">
<path stroke-linecap="round" stroke-linejoin="round"
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0">
</path>
</svg>
<span>Delete</span>
</a>
</div>
</div>
<div class="inline-flex flex-initial">
<div x-data="{ isInputActive: true }">
<div class="flex gap-3 px-5 items-center">
<div class="flex gap-4 px-5 items-center">
<button @click="isInputActive = !isInputActive"
class="btn h-8 w-10 rounded-full p-0 hover:bg-slate-300/20 focus:bg-slate-300/20 active:bg-slate-300/25 dark:hover:bg-navy-300/20 dark:focus:bg-navy-300/20 dark:active:bg-navy-300/25">
class="btn h-8 w-10 rounded-full p-0 hover:bg-primary-focus hover:text-main-container active:text-main-container focus:text-main-container primary-focus hover:text-main-container active:text-main-container focus:text-main-container dark:hover:bg-navy-300/20 dark:focus:bg-navy-300/20 dark:active:bg-navy-300/25">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4.5 w-4.5" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
......@@ -97,16 +80,19 @@
<span class="w-64" x-show="isInputActive === true">
<input
class="form-input h-9 peer w-full rounded-lg border border-slate-300 bg-transparent px-3 py-2 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="Search Keyword" type="text" wire:model="keyword" />
placeholder="Search Keyword" type="text" wire:model.defer="keyword" />
</span>
<span class="w-52" x-show="isInputActive === true">
<select wire:model="searchSelected"
class="form-select h-9 w-full rounded-lg border border-slate-300 bg-white px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent">
<select wire:model.defer="searchSelected"
class="form-select h-9 w-full rounded-lg border border-slate-300 bg-main-container px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent">
@foreach ($searchBy as $key => $by)
<option value="{{ $key }}">{{ $by }}</option>
@endforeach
</select>
</span>
<button type="button"
class="bg-primary text-white px-4 py-2 rounded hover:bg-primary-focus"
wire:click="search">Search</button>
</div>
</div>
</div>
......@@ -144,7 +130,7 @@
<tr class="border-y border-transparent border-b-slate-200 dark:border-b-navy-500">
<td class="whitespace-nowrap px-4 py-3 sm:px-5">
<label class="inline-flex items-center space-x-2">
<input @change="toggleGroup($event)"
<input @change="toggleGroup($event)"
class="form-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary hover:border-primary focus:border-primary dark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type="checkbox" wire:model.defer="selectedCompanies"
value="{{ $company->id }}" />
......@@ -156,14 +142,14 @@
<td class="whitespace-nowrap px-4 py-3 sm:px-5">{{ $company->name }}</td>
<td class="whitespace-nowrap px-4 py-3 sm:px-5">{{ $company->name_en }}</td>
<td class="whitespace-nowrap px-4 py-3 sm:px-5 text-center">
<div class="flex justify-center space-x-2">
<div class="flex justify-center space-x-1">
<a wire:click="showCompanyEditForm({{ $company->id }})"
class="btn h-8 w-8 p-0 text-info hover:bg-info/20 focus:bg-info/20 active:bg-info/25">
class="btn h-8 w-8 p-0 hover:bg-info/20 focus:bg-info/20 active:bg-info/25">
<i class="fa fa-edit"></i>
</a>
<div>
<a @click="$wire.emit('showDeleteModal', {{ $company->id }})"
class="btn h-8 w-8 p-0 text-error hover:bg-error/20 focus:bg-error/20 active:bg-error/25">
class="btn h-8 w-8 p-0 hover:text-white focus:text-white active:bg-error/25">
<i class="fa fa-trash-alt"></i>
</a>
</div>
......
<div class="grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6">
<form wire:submit.prevent="save">
@csrf
<div class="card pb-4">
<div class="my-3 flex h-8 items-center justify-between px-4 sm:px-5">
<h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base">
<i class="fa-solid fa-edit text-primary"></i> Create
</h2>
</div>
<div class="w-3/4 px-3 space-y-3 m-auto mb-4">
<div class="flex items-center">
<label for="" class="w-2/12 mr-2">
<span>Name :</span>
</label>
<span class="relative flex w-full">
<input wire:model.defer="name"
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="" name="name" type="text" value="{{ old('name') }}" />
@error('name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
<div class="flex items-center">
@if ($file)
<div class="mt-2 text-sm text-slate-600 dark:text-slate-300 mr-4">
Uploaded File: {{ $file->getClientOriginalName() }}
</div>
@endif
<span wire:loading>
<svg class="animate-spin h-5 w-5 text-primary m-3" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</span>
<label for="file-upload"
class="btn bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 dark:bg-navy-500 dark:text-navy-50 dark:hover:bg-navy-450 dark:focus:bg-navy-450 dark:active:bg-navy-450/90"
aria-label="Upload File">
<input tabindex="-1" id="file-upload" type="file" wire:model="file"
class="pointer-events-none absolute inset-0 h-full w-full opacity-0" />
<div class="flex items-center space-x-2">
<svg xmlns="http://www.w3.org/2000/svg" class="size-5" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
</svg>
<span>Choose File</span>
</div>
@error('file')
<span class="error">{{ $message }}</span>
@enderror
</label>
</div>
</div>
<div class="grid grid-cols-12 justify-center space-x-2 pt-4">
<a href="/format-file-master"
class="col-start-4 btn border border-slate-300 font-medium text-slate-800 hover:bg-slate-150 focus:bg-slate-150 active:bg-slate-150/80 dark:border-navy-450 dark:text-navy-50 dark:hover:bg-navy-500 dark:focus:bg-navy-500 dark:active:bg-navy-500/90">
Cancel
</a>
<button type="submit"
class="btn ml-3 bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
Save
</button>
</div>
</div>
</form>
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment