Commit 04602d47 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

add sub menu serverlicense

parent fc521718
......@@ -3,13 +3,19 @@
namespace App\Http\Livewire\Pages\ServerLicense;
use App\Models\ConfServerLicense;
use App\Models\ConfServerPendding;
use Livewire\Component;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use ZipArchive;
use Livewire\WithPagination;
class ServerLicenseEdit extends Component
{
use WithPagination;
public $perPage = 10;
public $tab = 'form';
public $phpVersions = [];
public $teams = [];
......@@ -37,17 +43,22 @@ class ServerLicenseEdit extends Component
public $contact;
public $contactCustomerName;
public $licenseId;
public $message;
public $message, $messages = [];
protected $listeners = ['gotoModal'];
public $modalLoaded = false;
public $SNKEY;
public $selectDateOrg;
public $orgList = [];
public $allDate;
public $mappingList = [], $labelList = [], $userInterfaceList = [], $globalList = [], $parameterList = [], $onloadList = [], $validateList = [];
public $mappingList = [], $labelList = [], $userInterfaceList = [], $globalList = [], $parameterList = [], $onloadList = [], $validateList = [], $mapToList = [], $fileNameList = [];
protected $historyPatchList;
public $sortHistoryField = 'TaskDate';
public $sortHistoryDirection = 'asc';
public $globalListGroup = [];
public $fieldList = ['mapId', 'mapName', 'mapType', 'mapTo', 'mapConfig'];
public $backupFeedback, $info = [];
public $mainvarCode;
public $fileDownloads = [];
public function loadModal()
......@@ -60,6 +71,7 @@ class ServerLicenseEdit extends Component
$this->loadData();
}
public function loadData()
{
$license = ConfServerLicense::find($this->licenseId);
......@@ -87,26 +99,10 @@ class ServerLicenseEdit extends Component
if ($license && !empty($license->BACKUP_FEEDBACK)) {
$compressedData = gzuncompress(base64_decode($license->BACKUP_FEEDBACK));
$this->backupFeedback = $compressedData;
// $utf8Data = iconv('TIS-620', 'UTF-8', $compressedData);
$currentEncoding = mb_detect_encoding($compressedData, mb_detect_order(), true);
$this->info = null;
eval('$this->info = ' . trim($compressedData) . ';');
$this->mappingList = $this->info['DATA']['conf_mapping'];
foreach ($this->mappingList['mapConfig'] as $index => $config) {
$this->mappingList['mapConfig'][$index] = base64_decode($config);
}
if ($this->info && isset($this->info['DATA']['conf_label_form'])) {
$this->labelList = $this->info['DATA']['conf_label_form'];
}
if ($this->info && isset($this->info['DATA']['conf_ui'])) {
$this->userInterfaceList = $this->info['DATA']['conf_ui'];
}
if ($this->info && isset($this->info['DATA']['conf_global'])) {
$this->globalList = $this->info['DATA']['conf_global'];
}
}
}
......@@ -219,12 +215,12 @@ class ServerLicenseEdit extends Component
{
$this->tab = 'csvMapping';
// if ($this->info && isset($this->info['DATA']['conf_mapping'])) {
// $this->mappingList = $this->info['DATA']['conf_mapping'];
// foreach ($this->mappingList['mapConfig'] as $index => $config) {
// $this->mappingList['mapConfig'][$index] = base64_decode($config);
// }
// }
if ($this->info && isset($this->info['DATA']['conf_mapping'])) {
$this->mappingList = $this->info['DATA']['conf_mapping'];
foreach ($this->mappingList['mapConfig'] as $index => $config) {
$this->mappingList['mapConfig'][$index] = base64_decode($config);
}
}
}
public function saveMapping()
{
......@@ -234,7 +230,7 @@ class ServerLicenseEdit extends Component
foreach ($fieldList as $field) {
foreach ($this->mappingList[$field] as $index => $value) {
if ($field == 'mapConfig') {
$DATA[$field][] = base64_encode(iconv("UTF-8", "TIS-620", $value));
$DATA[$field][] = base64_encode(htmlspecialchars_decode(iconv("UTF-8", "TIS-620", $value), ENT_QUOTES));
} else {
$DATA[$field][] = htmlspecialchars_decode(iconv("UTF-8", "TIS-620", $value), ENT_QUOTES);
}
......@@ -254,7 +250,7 @@ class ServerLicenseEdit extends Component
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadMapping();
$message = 'CSV Mapping updated successfully!';
$this->message = $message;
......@@ -265,9 +261,9 @@ class ServerLicenseEdit extends Component
{
$this->tab = 'printForm';
// if ($this->info && isset($this->info['DATA']['conf_label_form'])) {
// $this->labelList = $this->info['DATA']['conf_label_form'];
// }
if ($this->info && isset($this->info['DATA']['conf_label_form'])) {
$this->labelList = $this->info['DATA']['conf_label_form'];
}
}
public function savePrintForm()
{
......@@ -293,7 +289,7 @@ class ServerLicenseEdit extends Component
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadPrintForm();
$message = 'Print form updated successfully!';
$this->message = $message;
......@@ -303,9 +299,9 @@ class ServerLicenseEdit extends Component
{
$this->tab = 'userInterface';
// if ($this->info && isset($this->info['DATA']['conf_ui'])) {
// $this->userInterfaceList = $this->info['DATA']['conf_ui'];
// }
if ($this->info && isset($this->info['DATA']['conf_ui'])) {
$this->userInterfaceList = $this->info['DATA']['conf_ui'];
}
}
public function saveUserInterface()
{
......@@ -315,9 +311,13 @@ class ServerLicenseEdit extends Component
foreach ($fieldList as $field) {
foreach ($this->userInterfaceList[$field] as $index => $value) {
if ($field == 'user_default') {
$DATA[$field][] = base64_encode(htmlspecialchars_decode(iconv("UTF-8", "TIS-620", $value), ENT_QUOTES));
} else {
$DATA[$field][] = htmlspecialchars_decode(iconv("UTF-8", "TIS-620", $value), ENT_QUOTES);
}
}
}
$this->info['DATA']['conf_ui'] = $DATA;
......@@ -333,6 +333,7 @@ class ServerLicenseEdit extends Component
}
}
$this->loadData();
$this->loadPrintForm();
$message = 'User Interface updated successfully!';
$this->message = $message;
......@@ -342,9 +343,10 @@ class ServerLicenseEdit extends Component
{
$this->tab = 'global';
// if ($this->info && isset($this->info['DATA']['conf_ui'])) {
// $this->globalList = $this->info['DATA']['conf_ui'];
// }
if ($this->info && isset($this->info['DATA']['conf_global'])) {
$this->globalList = $this->info['DATA']['conf_global'];
}
$groupedData = [];
$globalTemp = $this->globalList;
......@@ -392,15 +394,325 @@ class ServerLicenseEdit extends Component
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadPrintForm();
$message = 'Global updated successfully!';
$this->message = $message;
}
public function loadParameter()
{
$this->tab = 'parameter';
if ($this->info && isset($this->info['DATA']['conf_parameter'])) {
$this->parameterList = $this->info['DATA']['conf_parameter'];
}
// dd($this->parameterList);
}
public function saveParameter()
{
$fieldList = array('PID', 'name', 'value', 'description', 'active');
$DATA = [];
foreach ($fieldList as $field) {
foreach ($this->parameterList[$field] as $index => $value) {
$DATA[$field][] = htmlspecialchars_decode($value, ENT_QUOTES);
}
}
//
$this->info['DATA']['conf_parameter'] = $DATA;
$newBackupFeedback = base64_encode(gzcompress(var_export($this->info, true)));
$license = ConfServerLicense::find($this->licenseId);
if ($license) {
$updatedRows = $license->update(['BACKUP_FEEDBACK' => $newBackupFeedback]);
if ($updatedRows > 0) {
$message = 'Parameter saved successfully!';
} else {
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadParameter();
$message = 'Parameter updated successfully!';
$this->message = $message;
}
public function loadOnload()
{
$this->tab = 'onload';
if ($this->info && isset($this->info['DATA']['conf_onload'])) {
$this->onloadList = $this->info['DATA']['conf_onload'];
}
// dd($this->onloadList);
}
public function saveOnload()
{
$fieldList = array('SKEY', 'SERVNAME', 'ACT', 'ONLOAD');
$DATA = [];
foreach ($fieldList as $field) {
foreach ($this->onloadList[$field] as $index => $value) {
$DATA[$field][] = htmlspecialchars_decode($value, ENT_QUOTES);
}
}
$this->info['DATA']['conf_onload'] = $DATA;
$newBackupFeedback = base64_encode(gzcompress(var_export($this->info, true)));
$license = ConfServerLicense::find($this->licenseId);
if ($license) {
$updatedRows = $license->update(['BACKUP_FEEDBACK' => $newBackupFeedback]);
if ($updatedRows > 0) {
$message = 'Onload saved successfully!';
} else {
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadOnload();
$message = 'Onload updated successfully!';
$this->message = $message;
}
public function loadValidate()
{
$this->tab = 'validate';
if ($this->info && isset($this->info['DATA']['conf_validate'])) {
$this->validateList = $this->info['DATA']['conf_validate'];
}
// dd($this->validateList);
}
public function saveValidate()
{
$fieldList = array('id', 'step', 'level', 'name', 'desc', 'validateCode', 'doctype', 'active');
$DATA = [];
foreach ($fieldList as $field) {
foreach ($this->validateList[$field] as $index => $value) {
$DATA[$field][] = htmlspecialchars_decode($value, ENT_QUOTES);
}
}
$this->info['DATA']['conf_validate'] = $DATA;
$newBackupFeedback = base64_encode(gzcompress(var_export($this->info, true)));
$license = ConfServerLicense::find($this->licenseId);
if ($license) {
$updatedRows = $license->update(['BACKUP_FEEDBACK' => $newBackupFeedback]);
if ($updatedRows > 0) {
$message = 'Validate saved successfully!';
} else {
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadValidate();
$message = 'Validate updated successfully!';
// $this->message = $message;
$this->setMessage($message);
}
public function loadMapTo()
{
$this->tab = 'mapTo';
if ($this->info && isset($this->info['DATA']['conf_mapto'])) {
$this->mapToList = $this->info['DATA']['conf_mapto'];
}
}
public function saveMapTo()
{
$fieldList = array('id', 'name', 'code', 'type');
$DATA = [];
foreach ($fieldList as $field) {
foreach ($this->mapToList[$field] as $index => $value) {
if ($field == 'code') {
$DATA[$field][] = base64_encode(htmlspecialchars_decode($value, ENT_QUOTES));
} else {
$DATA[$field][] = htmlspecialchars_decode($value, ENT_QUOTES);
}
}
}
$this->info['DATA']['conf_mapto'] = $DATA;
$newBackupFeedback = base64_encode(gzcompress(var_export($this->info, true)));
$license = ConfServerLicense::find($this->licenseId);
if ($license) {
$updatedRows = $license->update(['BACKUP_FEEDBACK' => $newBackupFeedback]);
if ($updatedRows > 0) {
$message = 'Map To saved successfully!';
} else {
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadMapTo();
$message = 'MapTo updated successfully!';
// $this->message = $message;
$this->setMessage($message);
}
public function loadMainVar()
{
$this->tab = 'mainVar';
if ($this->info && isset($this->info['MAINVAR'])) {
$this->mainvarCode = $this->info['MAINVAR'];
}
}
public function saveMainVar()
{
$this->info['MAINVAR'] = $this->mainvarCode;
$newBackupFeedback = base64_encode(gzcompress(var_export($this->info, true)));
$license = ConfServerLicense::find($this->licenseId);
if ($license) {
$updatedRows = $license->update(['BACKUP_FEEDBACK' => $newBackupFeedback]);
if ($updatedRows > 0) {
$message = 'Main Var saved successfully!';
} else {
$message = 'No changes were made.';
}
}
$this->loadData();
$this->loadMainVar();
$message = 'Main Var updated successfully!';
$this->setMessage($message);
}
public function loadFileDownload()
{
$this->tab = 'fileDownload';
if ($this->info && isset($this->info['FileDownload'])) {
$this->fileDownloads = $this->info['FileDownload'] ?? [];
$this->fileNameList = $this->info['Filename'] ?? [];
}
}
public function downloadAllFile()
{
$dateCurrent = now()->format('Y-m-d H:i:s');
$zip = new ZipArchive();
$dateExport = now()->format('Ymd');
$zipName = "{$this->SNKEY}_{$dateExport}.zip";
$zipFilePath = storage_path("app/temp/{$zipName}");
if (!Storage::exists('temp')) {
Storage::makeDirectory('temp');
}
if ($zip->open($zipFilePath, ZipArchive::CREATE) !== true) {
return response()->json(['error' => "Cannot open <$zipFilePath>"], 500);
}
$fileDownloads = $this->info['FileDownload'] ?? [];
$filenames = $this->info['Filename'] ?? [];
$textLog = "\n{$dateCurrent} {$this->SNKEY} ??TempUser?? [ ";
foreach ($fileDownloads as $key => $codeFile) {
$filename = $filenames[$key] ?? 'unknown_file' . $key . '.txt';
$filename = ltrim($filename, './');
$tempFilePath = storage_path('app/temp/' . $filename);
$dirname = dirname($tempFilePath);
if (!is_dir($dirname)) {
mkdir($dirname, 0777, true);
}
if (file_put_contents($tempFilePath, $codeFile) !== false) {
$tempFiles[] = $tempFilePath;
if (!$zip->addFile($tempFilePath, $filename)) {
session()->flash('error', "Failed to add $filename to ZIP");
return;
}
} else {
session()->flash('error', "Failed to create temporary file for $filename");
return;
}
$textLog .= " {$filename} |";
}
$zip->close();
foreach ($tempFiles as $file) {
if (file_exists($file)) {
unlink($file);
}
}
if (file_exists($zipFilePath)) {
$textLog = rtrim($textLog, '|') . " ]";
$logPath = storage_path("logs/patchGetFile_{$dateExport}.txt");
file_put_contents($logPath, $textLog, FILE_APPEND);
return response()->download($zipFilePath)->deleteFileAfterSend(true);
} else {
session()->flash('error', 'Zip file not found.');
}
}
public function loadHistoryPatch()
{
$this->tab = 'historyPatch';
}
public function sortHistoryBy($field)
{
if ($this->sortHistoryField === $field) {
$this->sortHistoryDirection = $this->sortHistoryDirection === 'asc' ? 'desc' : 'asc';
} else {
$this->sortHistoryField = $field;
$this->sortHistoryDirection = 'asc';
}
}
public function setMessage($message)
{
$this->messages[] = $message;
}
public function render()
{
return view('livewire.pages.server-license.server-license-edit');
$this->tab = 'historyPatch';
$this->historyPatchList = DB::table('conf_server_pendding as cp')
->join('conf_smartupdate as cs', 'cp.PatchID', '=', 'cs.PID')
->select(
'cp.TaskDate',
'cp.TaskStatus',
'cp.TaskRunner',
'cp.TaskFinish',
'cs.PID',
'cs.PATCHNAME',
'cs.PAPPROVEDATE',
'cs.PDESC'
)
->where('cp.ServerID', $this->licenseId)
->orderBy($this->sortHistoryField, $this->sortHistoryDirection)
->paginate($this->perPage);
return view('livewire.pages.server-license.server-license-edit', [
'historyPatchList' => $this->historyPatchList,
]);
}
}
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: MAINVAR.inc</h1>
<button wire:click="downloadAllFile" class="bg-info hover:info-focus text-white font-bold py-2 px-4 rounded">
Download
</button>
</div>
<div class="overflow-x-auto p-4">
<table class="is-hoverable table w-full text-left border-b">
<thead>
<tr>
<th
class="whitespace-nowrap rounded-tl-md bg-slate-300 px-4 py-1 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-5">
#
</th>
<th
class="whitespace-nowrap bg-slate-300 px-2 py-1 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-2">
File Name
</th>
<th
class="whitespace-nowrap rounded-tr-md bg-slate-300 px-2 py-1 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-2">
Action
</th>
</tr>
</thead>
<tbody>
@if (count($fileNameList) > 0)
@foreach ($fileNameList as $key => $file)
<tr class="border-y border-transparent border-b-slate-200 dark:border-b-navy-500">
<td class="py-2 px-4 border w-32">
{{ $key + 1 }}
</td>
<td class="py-2 px-4 border w-32">
{{ $file }}
</td>
<td class="whitespace-nowrap px-1 py-1 sm:px-2">
<div class="flex justify-center space-x-2">
<a
class="btn h-8 w-8 p-0 hover:text-main-container active:text-main-container hover:primary-focus focus:primary-focus active:bg-info/25">
<i class="fa fa-download"></i>
</a>
</div>
</td>
</tr>
@endforeach
@endif
</tbody>
</div>
</div>
</div>
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: History Patch</h1>
<button class="bg-info hover:info-focus text-white font-bold py-2 px-4 rounded">
Export Query
</button>
</div>
<!-- Table Section -->
<div class="overflow-x-auto p-4">
<table class="min-w-full bg-white border border-gray-300">
<thead>
<tr class="bg-slate-300 text-gray-700">
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cp.TaskDate')">
Task Date
@if ($sortHistoryField == 'cp.TaskDate')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cp.TaskStatus')">
Task Status
@if ($sortHistoryField == 'cp.TaskStatus')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cp.TaskRunner')">
Task Runner
@if ($sortHistoryField == 'cp.TaskRunner')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cp.TaskFinish')">
Task Finish
@if ($sortHistoryField == 'cp.TaskFinish')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cs.PID')">
Patch ID
@if ($sortHistoryField == 'cs.PID')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cs.PATCHNAME')">
Patch Name
@if ($sortHistoryField == 'cs.PATCHNAME')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cs.PAPPROVEDATE')">
Approve Date
@if ($sortHistoryField == 'cs.PAPPROVEDATE')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
<th class="py-2 px-4 border-b cursor-pointer" wire:click="sortHistoryBy('cs.PDESC')">
Description
@if ($sortHistoryField == 'cs.PDESC')
<span>{{ $sortHistoryDirection == 'asc' ? '↑' : '↓' }}</span>
@endif
</th>
</tr>
</thead>
<tbody>
{{-- @if (count($historyPatchList) > 0) --}}
@foreach ($historyPatchList as $key => $patch)
<tr class="border-b">
<td class="py-2 px-4 border min-w-36 max-w-36 text-center">{{ $patch->TaskDate }}</td>
<td class="py-2 px-4 border min-w-24 max-w-24 text-center">{{ $patch->TaskStatus }}</td>
<td class="py-2 px-4 border min-w-24 max-w-24 text-center">{{ $patch->TaskRunner }}</td>
<td class="py-2 px-4 border min-w-36 max-w-36 text-center">{{ $patch->TaskFinish }}</td>
<td class="py-2 px-4 border min-w-24 max-w-24 text-center">{{ $patch->PID }}</td>
<td class="py-2 px-4 border min-w-48 max-w-48 text-center">{{ $patch->PATCHNAME }}</td>
<td class="py-2 px-4 border min-w-32 max-w-32 text-center">{{ $patch->PAPPROVEDATE }}</td>
<td class="py-2 px-4 border min-w-64 max-w-64 text-center">{{ $patch->PDESC }}</td>
</tr>
@endforeach
{{-- @endif --}}
</tbody>
</table>
<div class="mt-4">
{{ $historyPatchList->links('livewire.paginate-custom') }}
</div>
</div>
</div>
</div>
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: MAINVAR.inc</h1>
</div>
<div class="overflow-x-auto p-4">
<div class="w-full p-4">
<h3 class="text-lg font-semibold">Code:</h3>
<textarea wire:model.defer="mainvarCode" rows="20" class="w-full p-2 border rounded language-none"
placeholder="Paste your code here..." style="max-height: 60vh; overflow-y: auto;"></textarea>
<button wire:click="saveMainVar"
class="bg-primary hover:bg-primary-focus text-white font-bold py-2 px-4 rounded mt-2">Save</button>
</div>
</div>
</div>
</div>
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: Map To</h1>
<button class="bg-info hover:info-focus text-white font-bold py-2 px-4 rounded">
Export Query
</button>
</div>
<!-- Table Section -->
<div class="overflow-x-auto p-4">
<table class="min-w-full bg-white border border-gray-300">
<thead>
<tr class="bg-slate-300 text-gray-700">
<th class="py-2 px-4 border-b">ID</th>
<th class="py-2 px-4 border-b">Name</th>
<th class="py-2 px-4 border-b">Code</th>
<th class="py-2 px-4 border-b">Type</th>
</tr>
</thead>
<tbody>
@if (count($mapToList) > 0)
@foreach ($mapToList['id'] as $index => $onload)
<tr class="border-b">
<td class="py-2 px-4 border w-24 text-center">{{ $index +1 }}</td>
<td class="py-2 px-4 border w-32">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="mapToList.step.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="mapToList.level.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-32">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="mapToList.name.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="mapToList.desc.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="mapToList.validateCode.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="mapToList.doctype.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-24">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="mapToList.active.{{ $index }}" />
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<div class="p-4">
<button wire:click="saveMapTo"
class="bg-primary hover:bg-primary-focus text-white font-bold py-2 px-4 rounded">
Save
</button>
</div>
</div>
</div>
</div>
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: Onload Condition</h1>
<button class="bg-info hover:info-focus text-white font-bold py-2 px-4 rounded">
Export Query
</button>
</div>
<!-- Table Section -->
<div class="overflow-x-auto p-4">
<table class="min-w-full bg-white border border-gray-300">
<thead>
<tr class="bg-slate-300 text-gray-700">
<th class="py-2 px-4 border-b">Serverkey</th>
<th class="py-2 px-4 border-b">Service Name</th>
<th class="py-2 px-4 border-b">Action</th>
<th class="py-2 px-4 border-b">Onload Code</th>
</tr>
</thead>
<tbody>
@if (count($onloadList) > 0)
@foreach ($onloadList['SKEY'] as $index => $onload)
<tr class="border-b">
<td class="py-2 px-4 border w-32">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="onloadList.SKEY.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="onloadList.SERVNAME.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-32">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="onloadList.ACT.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="onloadList.ONLOAD.{{ $index }}"></textarea>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<div class="p-4">
<button wire:click="saveOnload"
class="bg-primary hover:bg-primary-focus text-white font-bold py-2 px-4 rounded">
Save
</button>
</div>
</div>
</div>
</div>
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: Print Form</h1>
<button class="bg-info hover:info-focus text-white font-bold py-2 px-4 rounded">
Export Query
</button>
</div>
<!-- Table Section -->
<div class="overflow-x-auto p-4">
<table class="min-w-full bg-white border border-gray-300">
<thead>
<tr class="bg-slate-300 text-gray-700">
<th class="py-2 px-4 border-b">Name</th>
<th class="py-2 px-4 border-b">Value</th>
<th class="py-2 px-4 border-b">Description</th>
<th class="py-2 px-4 border-b">Active</th>
</tr>
</thead>
<tbody>
@if (count($parameterList) > 0)
@foreach ($parameterList['PID'] as $index => $parameter)
<tr class="border-b">
<td class="py-2 px-4 border min-w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="parameterList.name.{{ $index }}" />
</td>
<td class="py-2 px-4 border min-w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="parameterList.value.{{ $index }}" />
</td>
<td class="py-2 px-4 border min-w-48">
<textarea class="w-full p-1 border rounded" wire:model.defer="parameterList.description.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border min-w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="parameterList.active.{{ $index }}" />
</td>
<input type="hidden" wire:model.defer="parameterList.PID.{{ $index }}">
</tr>
@endforeach
@endif
</tbody>
</table>
<div class="p-4">
<button wire:click="saveParameter"
class="bg-primary hover:bg-primary-focus text-white font-bold py-2 px-4 rounded">
Save
</button>
</div>
</div>
</div>
</div>
......@@ -7,15 +7,17 @@
<a type="button" href="/server-license"
class="btn m-3 text-white bg-primary px-3 py-2 hover:bg-primary-focus">Back</a>
{{-- </div> --}}
@if ($message)
<div class="alert alert-success">
<div wire:ignore x-data="{ show: true }" x-init="setTimeout(() => show = false, 3000)" x-show.transition.duration.500ms="show"
class="fixed top-5 right-5 z-50 bg-green-500 text-white py-2 px-4 rounded-md shadow-lg">
{{ $message }}
<div x-data="{ messages: @entangle('messages') }">
<template x-for="(message, index) in messages" :key="index">
<div x-data="{ show: true }" x-init="setTimeout(() => {
show = false;
setTimeout(() => { messages.splice(index, 1); }, 500);
}, 3000)" x-show="show" x-transition
class="fixed top-5 right-5 z-50 bg-green-500 text-white py-2 px-4 rounded-md shadow-lg mt-2">
<span x-text="message"></span>
</div>
</template>
</div>
@endif
<div class="flex flex-wrap -mx-3 w-full bg-main-container items-center justify-center " x-data="{ activeTab: 'form' }">
<div class="w-11/12 p-5 mb-6 shadow-md rounded-lg">
<div class="mb-4 border-b border-gray-200">
......@@ -57,8 +59,8 @@
class="inline-block py-2 px-4">Parameter</a>
</li>
<li class="mr-2">
<a href="#" @click.prevent="activeTab = 'onlaod'" wire:click="loadOnlaod"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'onlaod' }"
<a href="#" @click.prevent="activeTab = 'onload'" wire:click="loadOnload"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'onload' }"
class="inline-block py-2 px-4">Onload</a>
</li>
<li class="mr-2">
......@@ -66,7 +68,26 @@
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'validate' }"
class="inline-block py-2 px-4">Validate</a>
</li>
<li class="mr-2">
<a href="#" @click.prevent="activeTab = 'mapTo'" wire:click="loadMapTo"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'mapTo' }"
class="inline-block py-2 px-4">Map To</a>
</li>
<li class="mr-2">
<a href="#" @click.prevent="activeTab = 'mainVar'" wire:click="loadMainVar"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'mainVar' }"
class="inline-block py-2 px-4">MainVar</a>
</li>
<li class="mr-2">
<a href="#" @click.prevent="activeTab = 'fileDownload'" wire:click="loadFileDownload"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'fileDownload' }"
class="inline-block py-2 px-4">File Download</a>
</li>
<li class="mr-2">
<a href="#" @click.prevent="activeTab = 'historyPatch'" wire:click="loadHistoryPatch"
:class="{ 'border-b-2 border-blue-600 text-blue-600': activeTab === 'historyPatch' }"
class="inline-block py-2 px-4">History Patch</a>
</li>
</ul>
</div>
<div class="flex flex-wrap items-center justify-center ">
......@@ -75,8 +96,8 @@
<!-- Server Key -->
<div class="mb-4 flex items-center">
<label for="serverKey" class="w-1/4 text-gray-700">Server Key</label>
<input type="text" id="serverKey" class="w-3/4 p-2 border border-gray-300 rounded-md"
wire:model.defer="serverKey">
<input type="text" id="serverKey"
class="w-3/4 p-2 border border-gray-300 rounded-md" wire:model.defer="serverKey">
</div>
<!-- Team -->
......@@ -147,7 +168,6 @@
</div>
</div>
<!-- Licensedate -->
<div class="mb-4 flex items-center">
<label for="licenseDate" class="w-1/4 text-gray-700">License Date</label>
<input type="date" id="licenseDate"
......@@ -155,7 +175,6 @@
wire:model.defer="licenseDate">
</div>
<!-- PHP Version -->
<div class="mb-4 flex items-center">
<label for="phpVersionId" class="w-1/4 text-gray-700">PHP Version</label>
<select id="phpVersionId" wire:model.defer="phpVersionId"
......@@ -168,7 +187,6 @@
</select>
</div>
<!-- Version ปัจจุบัน -->
<div class="mb-4 flex items-center">
<label for="currentVersion" class="w-1/4 text-gray-700">Version ปัจจุบัน</label>
<input type="text" id="currentVersion"
......@@ -176,7 +194,6 @@
wire:model.defer="currentVersion">
</div>
<!-- วันที่ไป Install -->
<div class="mb-4 flex items-center">
<label for="installDate" class="w-1/4 text-gray-700">วันที่ไป Install</label>
<input type="date" id="installDate"
......@@ -184,7 +201,6 @@
wire:model.defer="installDate">
</div>
<!-- Version ที่ลงครั้งแรก -->
<div class="mb-4 flex items-center">
<label for="installVersion" class="w-1/4 text-gray-700">Version ที่ลงครั้งแรก</label>
<input type="text" id="installVersion"
......@@ -192,7 +208,6 @@
wire:model.defer="installVersion">
</div>
<!-- Database Type -->
<div class="mb-4 flex items-center">
<label for="databaseType" class="w-1/4 text-gray-700">Database Type</label>
<select id="databaseType" wire:model.defer="databaseType"
......@@ -205,7 +220,6 @@
</select>
</div>
<!-- Server of -->
<div class="mb-4 flex items-center">
<label for="ownerType" class="w-1/4 text-gray-700">Server of</label>
<select id="ownerType" wire:model.defer="ownerType"
......@@ -219,8 +233,6 @@
</select>
</div>
<!-- HSCODE 2017 Method -->
<div class="mb-4 flex items-center">
<label for="hscodeMethod" class="w-1/4 text-gray-700">HSCODE 2017 Method</label>
<select id="hscodeMethod" wire:model.defer="hscodeMethod"
......@@ -230,23 +242,17 @@
</option>
</select>
</div>
<!-- URL / IP Address -->
<div class="mb-4 flex items-center">
<label for="customerUrl" class="w-1/4 text-gray-700">URL / IP Address</label>
<input type="text" id="customerUrl"
class="w-3/4 p-2 border border-gray-300 rounded-md"
wire:model.defer="customerUrl">
</div>
<!-- Contact -->
<div class="mb-4 flex items-center">
<label for="contact" class="w-1/4 text-gray-700">Contact</label>
<input type="text" id="contact"
class="w-3/4 p-2 border border-gray-300 rounded-md" wire:model.defer="contact">
</div>
<!-- Contact Customer Name -->
<div class="mb-4 flex items-center">
<label for="contactCustomerName" class="w-1/4 text-gray-700">Contact Customer
Name</label>
......@@ -254,8 +260,6 @@
class="w-3/4 p-2 border border-gray-300 rounded-md"
wire:model.defer="contactCustomerName">
</div>
<!-- Save and Reset Buttons -->
<div class="flex justify-center">
<button type="button" wire:click="updateLicense"
class="bg-primary text-white px-4 py-2 rounded-md hover:bg-primary-focus">Save</button>
......@@ -263,34 +267,32 @@
</form>
</div>
</div>
<div x-show="activeTab === 'organize'">
{{-- @if ($tab == 'organize') --}}
@if ($tab == 'organize')
@include('livewire.pages.server-license.organize')
{{-- @endif --}}
@endif
</div>
<div x-show="activeTab === 'csvMapping'">
{{-- @if ($tab == 'csvMapping') --}}
@if ($tab == 'csvMapping')
@include('livewire.pages.server-license.csv-mapping')
{{-- @endif --}}
@endif
</div>
<div x-show="activeTab === 'printForm'">
{{-- @if ($tab == 'printForm') --}}
@if ($tab == 'printForm')
@include('livewire.pages.server-license.print-form')
{{-- @endif --}}
@endif
</div>
<div x-show="activeTab === 'userInterface'">
{{-- @if ($tab == 'userInterface') --}}
@if ($tab == 'userInterface')
@include('livewire.pages.server-license.user-interface')
{{-- @endif --}}
@endif
</div>
<div x-show="activeTab === 'global'">
@if ($tab == 'global')
@include('livewire.pages.server-license.global')
@endif
</div>
{{-- <div x-show="activeTab === 'parameter'">
<div x-show="activeTab === 'parameter'">
@if ($tab == 'parameter')
@include('livewire.pages.server-license.parameter')
@endif
......@@ -299,8 +301,32 @@
@if ($tab == 'onload')
@include('livewire.pages.server-license.onload')
@endif
</div> --}}
</div>
<div x-show="activeTab === 'validate'">
@if ($tab == 'validate')
@include('livewire.pages.server-license.validate')
@endif
</div>
<div x-show="activeTab === 'mapTo'">
@if ($tab == 'mapTo')
@include('livewire.pages.server-license.map-to')
@endif
</div>
<div x-show="activeTab === 'mainVar'">
@if ($tab == 'mainVar')
@include('livewire.pages.server-license.main-var')
@endif
</div>
<div x-show="activeTab === 'fileDownload'">
@if ($tab == 'fileDownload')
@include('livewire.pages.server-license.file-download')
@endif
</div>
<div x-show="activeTab === 'historyPatch'">
@if ($tab === 'historyPatch')
@include('livewire.pages.server-license.history-patch', ['historyPatchList' => $historyPatchList])
@endif
</div>
</div>
</div>
......
......@@ -32,29 +32,29 @@
@foreach ($userInterfaceList['name'] as $index => $mapId)
<tr class="border-b">
<td class="py-2 px-4 border">{{ $index + 1 }}</td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.pageCode.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.name.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.tname.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.required.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.type.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.spec.{{ $index }}" /></td>
<td class="py-2 px-4 border w-2/4">
<td class="py-2 px-4 border min-w-32"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.pageCode.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-32"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.name.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-32"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.tname.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.required.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-32"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.type.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.spec.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="userInterfaceList.manual.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border w-2/4">
<td class="py-2 px-4 border min-w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="userInterfaceList.user_note.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.js_before_focus.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.cannotImport.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.fname.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportFlag.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportOrderBy.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportCondition.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportTable.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportType.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportFormat.{{ $index }}" /></td>
<td class="py-2 px-4 border"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportAlign.{{ $index }}" /></td>
<td class="py-2 px-4 border w-2/4">
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.js_before_focus.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.cannotImport.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-32"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.fname.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportFlag.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportOrderBy.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportCondition.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-32"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportTable.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportType.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportFormat.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-24"><input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="userInterfaceList.reportAlign.{{ $index }}" /></td>
<td class="py-2 px-4 border min-w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="userInterfaceList.user_default.{{ $index }}"></textarea>
</td>
</tr>
......
<div class=" p-4">
<div class="max-w-full mx-auto bg-white rounded-lg">
<!-- Header -->
<div class="text-black p-4 rounded-t-lg flex justify-between items-center">
<h1 class="text-lg font-semibold">{{ $company }} (SN={{ $serverKey }}):: Onload Condition</h1>
<button class="bg-info hover:info-focus text-white font-bold py-2 px-4 rounded">
Export Query
</button>
</div>
<!-- Table Section -->
<div class="overflow-x-auto p-4">
<table class="min-w-full bg-white border border-gray-300">
<thead>
<tr class="bg-slate-300 text-gray-700">
<th class="py-2 px-4 border-b">ID</th>
<th class="py-2 px-4 border-b">Step</th>
<th class="py-2 px-4 border-b">Level</th>
<th class="py-2 px-4 border-b">Name</th>
<th class="py-2 px-4 border-b">Description</th>
<th class="py-2 px-4 border-b">Validate Code</th>
<th class="py-2 px-4 border-b">Doctype</th>
<th class="py-2 px-4 border-b">Active</th>
</tr>
</thead>
<tbody>
@if (count($validateList) > 0)
@foreach ($validateList['id'] as $index => $onload)
<tr class="border-b">
<td class="py-2 px-4 border w-24 text-center">{{ $index +1 }}</td>
<td class="py-2 px-4 border w-32">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="validateList.step.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="validateList.level.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-32">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="validateList.name.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="validateList.desc.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border w-64">
<textarea class="w-full p-1 border rounded" wire:model.defer="validateList.validateCode.{{ $index }}"></textarea>
</td>
<td class="py-2 px-4 border w-48">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="validateList.doctype.{{ $index }}" />
</td>
<td class="py-2 px-4 border w-24">
<input type="text" class="w-full p-2 border border-gray-300 rounded-md" wire:model.defer="validateList.active.{{ $index }}" />
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<div class="p-4">
<button wire:click="saveValidate"
class="bg-primary hover:bg-primary-focus text-white font-bold py-2 px-4 rounded">
Save
</button>
</div>
</div>
</div>
</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