Commit daa72e61 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

add send patch and up to uat

parent ecb4cce7
......@@ -18,8 +18,8 @@ class PatchCreate extends Component
public $branches = [];
public $selectedProject;
public $selectedBranch;
public $startCommit = '3d8740';
public $endCommit = '608212';
public $startCommit = '';
public $endCommit = '';
public $fileChanges = [], $filePathChanges = [];
public $searchProject = 'SPN64Bits';
public $UNINSTALL = '$b=1';
......
......@@ -23,8 +23,8 @@ class PatchEdit extends Component
public $filePatch = [];
public $fileChangesTemp = [];
public $fileChanges = [];
public $startCommit = 'fba646c8';
public $endCommit = '3172788';
public $startCommit = '';
public $endCommit = '';
public $PATCHNAME;
public $PDATE;
public $PHP_VERSION;
......@@ -49,7 +49,7 @@ class PatchEdit extends Component
}
public function mount($editPid)
{
$editPid = '15689'; // remove this when real
// $editPid = '15689'; // remove this when real
$this->patchId = $editPid;
$this->loadPatchData();
}
......
......@@ -11,7 +11,7 @@ use Livewire\Component;
class SendPatchEdit extends Component
{
public $PID, $serverKeyOption;
public $PID, $serverKeyOption, $serverKeyOwnerType, $company, $db_type, $cur_ver;
public $perPage = 10;
public $search = '';
public $server_lists;
......@@ -20,53 +20,103 @@ class SendPatchEdit extends Component
public $searchSelected = 'SNKEY';
public $keyword = '';
public $selectedPenddings = [];
public $serverkey = '', $showSearch = false , $searchInProgress = false , $resultsServerkey = [];
public $serverKeyWaitingSend = [];
public $serverkey = '', $showSearch = false, $searchInProgress = false, $resultsServerkey = [];
public $serverKeyWaitingSend = [], $serverKeySuccess = [];
protected $listeners = ['deletePatch', 'refreshComponent' => '$refresh'];
public function mount($editPid)
{
// $this->PID = $editPid;
$this->PID = 15670;
$this->PID = $editPid;
// $this->PID = 15670;
// $this->updateServerLists();
}
public function updatedServerkey()
{
$this->showSearch = true;
$this->searchResults();
}
public function updatedCompany()
{
$this->searchResults();
}
public function updatedDbType()
{
$this->searchResults();
}
public function updatedCurVer()
{
$this->searchResults();
}
public function selectAllResults()
{
$this->searchInProgress = true;
foreach ($this->resultsServerkey as $result) {
$this->selectResult($result->SNKEY);
}
$this->serverkey = '';
}
public function searchResults()
{
if ($this->searchInProgress) {
$this->reset('resultsServerkey');
}
$this->searchInProgress = true;
$this->resultsServerkey = ConfServerLicense::where('SNKEY', 'LIKE', '%' . $this->serverkey . '%')->take(50)->get();
$this->searchInProgress = false;
$query = ConfServerLicense::query();
if (!empty($this->serverkey)) {
$query->where('SNKEY', 'LIKE', '%' . $this->serverkey . '%');
}
if (!empty($this->company)) {
$query->where('COMPANY', 'LIKE', '%' . $this->company . '%');
}
if (!empty($this->db_type)) {
$query->where('DATABASETYPE', 'LIKE', '%' . $this->db_type . '%');
}
if (!empty($this->cur_ver)) {
$query->where('CUR_VERSION', 'LIKE', '%' . $this->cur_ver . '%');
}
$this->resultsServerkey = $query->take(50)->get();
$this->showSearch = true;
$this->searchInProgress = false;
}
public function selectResult($key)
{
$this->serverkey = $key;
$this->resultsServerkey = [];
$this->showSearch = false;
$temp= ConfServerLicense::where('SNKEY', $key )->first();
$temp = ConfServerLicense::where('SNKEY', $key)->first();
$keys = array_column($this->serverKeyWaitingSend, 'key');
if (!in_array($key, $keys)) {
$this->serverKeyWaitingSend[] = ['id' => $temp->ID, 'key' => $key];
$this->serverKeyWaitingSend[] = ['id' => $temp->ID, 'key' => $key, 'db' => $temp->DATABASE_TYPE, 'cur_ver' => $temp->CUR_VERSION];
}
}
public function removeServerKey($key)
{
$this->serverKeyWaitingSend = array_filter($this->serverKeyWaitingSend, function ($serverKey) use ($key) {
return $serverKey['key'] !== $key;
});
$this->serverKeyWaitingSend = array_values($this->serverKeyWaitingSend);
}
public function updatedSelectedOwnerType($value)
{
dd($value);
if (!empty($value)) {
// อัปเดต serverKeyOption โดยพิจารณาจาก owner type ที่เลือก
$this->serverKeyOption = $this->fetchServerKeyOption($value);
$serverKeyOwnerType = $this->fetchServerKeyOption($value);
if (count($serverKeyOwnerType) > 0) {
foreach ($serverKeyOwnerType as $sk) {
$this->selectResult($sk["name"]);
}
}
} else {
$this->serverKeyOption = [];
$this->serverKeyOwnerType = [];
}
$this->serverkey = '';
}
protected function fetchServerKeyOption($ownerType)
......@@ -84,59 +134,33 @@ class SendPatchEdit extends Component
}
public function render()
{
$query = ConfServerLicense::query();
if ($this->selectedOwnerType) {
$query->where('OWNERTYPE', $this->selectedOwnerType);
}
if ($this->search) {
$query->where('SNKEY', 'like', '%' . $this->search . '%');
}
$this->serverKeyOption = $query->get(['ID as id', 'SNKEY as name'])->toArray();
// // dd( $this->server_lists);
$ownerType = ConfServerOwnertype::all();
$results = $this->searchSelected && $this->keyword
? ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID')
->where('PatchID', $this->PID)
->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%')
->paginate($this->perPage)
: ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID')
->where('PatchID', $this->PID)
->paginate($this->perPage);
return view('livewire.pages.send-patch.send-patch-edit', compact('ownerType', 'results'));
}
public function sendPatch()
{
if (!is_array($this->server_lists)) {
$arr_server_lists = explode(",", $this->server_lists);
} else {
$arr_server_lists = $this->server_lists;
}
$arr_server_lists = $this->serverKeyWaitingSend;
if (isset($arr_server_lists)) {
foreach ($arr_server_lists as $serverId) {
foreach ($arr_server_lists as $server) {
$serverPedding = new ConfServerPendding;
$serverPedding->ServerID = $serverId;
$serverPedding->ServerID = $server["id"];
$serverPedding->PatchID = $this->PID;
$serverPedding->TaskDate = date("Y-m-d H:i:s");
$serverPedding->TaskType = "";
$serverPedding->TaskStatus = "0";
$serverPedding->TaskRunner = auth()->user()->USERNAME;
$serverPedding->TaskRunner = auth()->user()->username;
$serverPedding->save();
static::logSendPatch($this->PID, $serverId, "Add Patch");
$this->server_lists = [];
static::logSendPatch($this->PID, $server["id"], "Add Patch");
array_push($this->serverKeySuccess , $server);
$this->emit('patchSent', $server);
}
}
$this->serverKeyWaitingSend = [];
}
public function resendPatch($serverId)
......@@ -183,4 +207,32 @@ class SendPatchEdit extends Component
$log->IPACTIVE = request()->ip();
$log->save();
}
public function render()
{
$query = ConfServerLicense::query();
if ($this->selectedOwnerType) {
$query->where('OWNERTYPE', $this->selectedOwnerType);
}
if ($this->search) {
$query->where('SNKEY', 'like', '%' . $this->search . '%');
}
$this->serverKeyOption = $query->get(['ID as id', 'SNKEY as name'])->toArray();
$ownerType = ConfServerOwnertype::all();
$results = $this->searchSelected && $this->keyword
? ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID')
->where('PatchID', $this->PID)
->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%')
->paginate($this->perPage)
: ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID')
->where('PatchID', $this->PID)
->paginate($this->perPage);
return view('livewire.pages.send-patch.send-patch-edit', compact('ownerType', 'results'));
}
}
public/images/login-background.jpg

166 KB | W: | H:

public/images/login-background.jpg

68.3 KB | W: | H:

public/images/login-background.jpg
public/images/login-background.jpg
public/images/login-background.jpg
public/images/login-background.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -19,9 +19,7 @@
.progress-bar {
height: 20px;
background-color: #4CAF50;
/* สีเขียว */
transition: width 0.5s;
/* การเปลี่ยนแปลงเรียบๆ */
}
</style>
<a href="/patch" type="button" class="btn mx-auto m-3 text-white bg-primary px-3 py-2">Back</a>
......
......@@ -15,7 +15,7 @@
</h2>
<a href="/send-patch" type="button" class="btn ml-1 my-3 text-white bg-primary px-3 py-2">Back</a>
</div>
<div class="" x-data="{ tomGReady: false , serverKeyWaitingSend : @entangle('serverKeyWaitingSend').defer }" x-show="true">
<div class="" x-data="{ tomGReady: false, serverKeyWaitingSend: @entangle('serverKeyWaitingSend').defer }" x-show="true">
<div class="mb-4">
<div class="grid grid-cols-12 gap-2 ">
<div class="bg-main-container col-span-3 p-6 rounded-lg shadow-md">
......@@ -28,9 +28,11 @@
<input type="text"
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"
wire:model.debounce.500ms="serverkey" placeholder="Search for a server key">
<span wire:loading wire:target="serverkey" class="absolute right-3">
<svg class="animate-spin h-5 w-5 text-black" 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>
<span wire:loading wire:target="serverkey, selectedOwnerType, company, db_type, cur_ver, selectAllResults" class="absolute right-3">
<svg class="animate-spin h-5 w-5 text-black"
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>
......@@ -38,10 +40,16 @@
</span>
</div>
@if (!empty($serverkey) && $showSearch)
<ul class="absolute left-0 right-0 mt-2 border border-gray-200 rounded-md max-h-64 overflow-auto z-50 bg-white">
@if ($showSearch)
<ul
class="absolute left-0 right-0 mt-2 border border-gray-200 rounded-md max-h-64 overflow-auto z-50 bg-white">
<li class="p-2 bg-gray-200 hover:bg-gray-300 cursor-pointer font-semibold"
wire:click="selectAllResults">
Select All
</li>
@forelse($resultsServerkey as $result)
<li class="p-2 hover:bg-gray-100 cursor-pointer" wire:click="selectResult('{{ $result->SNKEY }}')">
<li class="p-2 hover:bg-gray-100 cursor-pointer"
wire:click="selectResult('{{ $result->SNKEY }}')">
{{ $result->SNKEY }}
</li>
@empty
......@@ -79,13 +87,13 @@
<div>
<label for="company"
class="block text-sm font-medium text-gray-700">Company</label>
<input type="text" id="company" name="company"
<input type="text" id="company" name="company" wire:model='company'
class="mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
</div>
<div>
<label for="db_type" class="block text-sm font-medium text-gray-700">DB
Type</label>
<input type="text" id="db_type" name="db_type"
<input type="text" id="db_type" name="db_type" wire:model='db_type'
class="mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
</div>
</div>
......@@ -98,10 +106,10 @@
<div>
<label for="cur_ver" class="block text-sm font-medium text-gray-700">Cur.
Ver.</label>
<input type="text" id="cur_ver" name="cur_ver"
<input type="text" id="cur_ver" name="cur_ver" wire:model='cur_ver'
class="mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
</div>
<div>
{{-- <div>
<label for="hscode_method" class="block text-sm font-medium text-gray-700">HSCODE
2017 Method</label>
<select id="hscode_method" name="hscode_method"
......@@ -109,12 +117,12 @@
<option>Please Select</option>
<!-- Options -->
</select>
</div>
</div> --}}
</div>
</div>
<!-- Company Select Group -->
<div>
{{-- <div>
<h3 class="text-lg font-medium text-gray-900 mb-2">Company Selection</h3>
<div>
<label for="company_select"
......@@ -125,14 +133,20 @@
<!-- Options -->
</select>
</div>
</div>
</div> --}}
</div>
<div class="bg-main-container p-6 rounded-lg shadow-md col-span-4">
<h3 class="text-lg font-medium text-gray-900 mb-2">Server key waiting to send</h3>
<div id="serverkey-list" class="overflow-y: auto">
<div id="serverkey-list" class="overflow-y-auto max-h-[70vh]">
<div class="bg-gray m-3">
@foreach ($serverKeyWaitingSend as $key => $serverkey)
<button class="bg-blue-500 text-white px-4 py-2 rounded m-1">{{ $serverkey["id"]. " : ".$serverkey["key"] }}</button>
<div class="flex items-center bg-blue-500 text-white w-full px-4 py-2 rounded m-1">
<span class="flex-grow">{{ $serverkey['key'] }}</span>
<button wire:click="removeServerKey('{{ $serverkey['key'] }}')"
class="ml-2">
<i class="fas fa-trash-alt"></i>
</button>
</div>
@endforeach
</div>
</div>
......@@ -145,9 +159,31 @@
</div>
</div>
</div>
<div class="bg-main-container p-6 rounded-lg shadow-md col-span-4"></div>
<div class="bg-main-container p-6 rounded-lg shadow-md col-span-4">
<h3 class="text-lg font-medium text-gray-900 mb-2">Server key send success</h3>
{{-- <div id="serverkey-list" class="overflow-y-auto max-h-[70vh]">
<div class="bg-gray m-3">
@foreach ($serverKeySuccess as $key => $serverkey)
<div class="flex items-center bg-lime-600 text-white w-full px-4 py-2 rounded m-1">
<span class="flex-grow">{{ $serverkey['key'] }}</span>
</div>
@endforeach
</div>
</div> --}}
<div x-data="{ serverKeySuccess: [] }" x-init="
Livewire.on('patchSent', server => {
serverKeySuccess.push(server); // เพิ่ม server ที่สำเร็จลงในรายการ
});
">
<!-- UI ที่จะแสดงรายการของ server ที่สำเร็จ -->
<template x-for="server in serverKeySuccess" :key="server.id">
<div class="bg-green-100 text-green-700 p-2 rounded mb-2">
Patch Sent: <span x-text="server.key"></span>
</div>
</template>
</div>
</div>
</div>
</div>
......
......@@ -32,7 +32,7 @@
$FORMAT[5]['FILD']='countryCode';
$FORMAT[6]['NAME']='Quantity';
$FORMAT[6]['TYPE']='15N';
$FORMAT[6]['TYPE']='14NDE3';
$FORMAT[6]['FILD']='quantity';
$FORMAT[7]['NAME']='Quantity Unit';
......@@ -47,12 +47,12 @@
$FORMAT[9]['TYPE']='512A';
$FORMAT[9]['FILD']='enDescription';
$FORMAT[10]['NAME']='Condition';
$FORMAT[10]['NAME']='Permission Goods Condition';
$FORMAT[10]['TYPE']='512A';
$FORMAT[10]['FILD']='condition';
$FORMAT[11]['NAME']='Announce Number';
$FORMAT[11]['TYPE']='10N';
$FORMAT[11]['TYPE']='10A';
$FORMAT[11]['FILD']='announceNo';
$FORMAT[12]['NAME']='Announce Date';
......
......@@ -9,7 +9,7 @@
$FORMAT[0]['FORMAT']='';
$FORMAT[1]['NAME']='Name';
$FORMAT[1]['TYPE']='72A';
$FORMAT[1]['TYPE']='35A';
$FORMAT[1]['FILD']='name';
$FORMAT[1]['FORMAT']='';
......@@ -18,4 +18,9 @@
$FORMAT[2]['FILD']='currency';
$FORMAT[2]['FORMAT']='';
$FORMAT[3]['NAME']='wtocountry';
$FORMAT[3]['TYPE']='1A';
$FORMAT[3]['FILD']='wtocountry';
$FORMAT[3]['FORMAT']='';
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?php
$DATABASE='master_exciseno';
$PKEY[0]['FILD']='exciseno';
$PKEY[1]['FILD']='startdate';
......
<?php
$DATABASE='master_port';
$PKEY[0]['FILD']='portCode';
$FORMAT[0]['NAME']='portCode';
$FORMAT[0]['TYPE']='4N';
$FORMAT[0]['FILD']='portCode';
$FORMAT[1]['NAME']='portName';
$FORMAT[1]['TYPE']='125A';
$FORMAT[1]['FILD']='portName';
?>
\ No newline at end of file
<?php
$DATABASE='master_port';
$PKEY[0]['FILD']='portCode';
$FORMAT[0]['NAME']='portCode';
$FORMAT[0]['TYPE']='4N';
$FORMAT[0]['FILD']='portCode';
$FORMAT[1]['NAME']='portName';
$FORMAT[1]['TYPE']='125A';
$FORMAT[1]['FILD']='portName';
?>
\ No newline at end of file
<?php
$DATABASE='master_permissiongoods';
$PKEY[0]['FILD'] = 'tariffClass';
$PKEY[1]['FILD'] = 'tariffStat';
$PKEY[2]['FILD'] = 'startDate';
$PKEY[3]['FILD'] = 'permissionGoodsType';
$PKEY[4]['FILD'] = 'companyTaxNo';
$FORMAT[0]['NAME']='TariffClassification';
$FORMAT[0]['TYPE']='12A';
$FORMAT[0]['FILD']='tariffClass';
$FORMAT[1]['NAME']='Tariff Stat';
$FORMAT[1]['TYPE']='3A';
$FORMAT[1]['FILD']='tariffStat';
$FORMAT[2]['NAME']='Permission Goods Type';
$FORMAT[2]['TYPE']='2A';
$FORMAT[2]['FILD']='permissionGoodsType';
$FORMAT[3]['NAME']='Company Tax Number';
$FORMAT[3]['TYPE']='17A';
$FORMAT[3]['FILD']='companyTaxNo';
$FORMAT[4]['NAME']='Validate Indicator';
$FORMAT[4]['TYPE']='2A';
$FORMAT[4]['FILD']='validateIndicator';
$FORMAT[5]['NAME']='countryCode';
$FORMAT[5]['TYPE']='2A';
$FORMAT[5]['FILD']='countryCode';
$FORMAT[6]['NAME']='Quantity';
$FORMAT[6]['TYPE']='15N';
$FORMAT[6]['FILD']='quantity';
$FORMAT[7]['NAME']='Quantity Unit';
$FORMAT[7]['TYPE']='3A';
$FORMAT[7]['FILD']='quantityUnit';
$FORMAT[8]['NAME']='Permission Goods Thai Description';
$FORMAT[8]['TYPE']='3000A';
$FORMAT[8]['FILD']='thDescription';
$FORMAT[9]['NAME']='Permission Goods English Description';
$FORMAT[9]['TYPE']='3000A';
$FORMAT[9]['FILD']='enDescription';
$FORMAT[10]['NAME']='Condition';
$FORMAT[10]['TYPE']='512A';
$FORMAT[10]['FILD']='condition';
$FORMAT[11]['NAME']='Announce Number';
$FORMAT[11]['TYPE']='10N';
$FORMAT[11]['FILD']='announceNo';
$FORMAT[12]['NAME']='Announce Date';
$FORMAT[12]['TYPE']='8N';
$FORMAT[12]['FILD']='announceDate';
$FORMAT[13]['NAME']='Start Date';
$FORMAT[13]['TYPE']='8N';
$FORMAT[13]['FILD']='startDate';
$FORMAT[14]['NAME']='Expired Date';
$FORMAT[14]['TYPE']='8N';
$FORMAT[14]['FILD']='expiredDate';
?>
\ No newline at end of file
......@@ -50,7 +50,7 @@
},
{
"NAME": "Quantity",
"TYPE": "15N",
"TYPE": "14NDE3",
"FILD": "quantity"
},
{
......@@ -69,13 +69,13 @@
"FILD": "enDescription"
},
{
"NAME": "Condition",
"NAME": "Permission Goods Condition",
"TYPE": "512A",
"FILD": "condition"
},
{
"NAME": "Announce Number",
"TYPE": "10N",
"TYPE": "10A",
"FILD": "announceNo"
},
{
......
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