Commit 2d580162 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

issue paginate send patch and serverlicense

parent e4b91a1c
...@@ -8,9 +8,11 @@ use App\Models\ConfServerPendding; ...@@ -8,9 +8,11 @@ use App\Models\ConfServerPendding;
use App\Models\ConfSmartupdate; use App\Models\ConfSmartupdate;
use App\Models\LogSendPath2customer; use App\Models\LogSendPath2customer;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination;
class SendPatchEdit extends Component class SendPatchEdit extends Component
{ {
use WithPagination;
public $PID,$patchName , $serverKeyOption, $serverKeyOwnerType, $company, $db_type, $cur_ver; public $PID,$patchName , $serverKeyOption, $serverKeyOwnerType, $company, $db_type, $cur_ver;
public $perPage = 10; public $perPage = 10;
public $search = ''; public $search = '';
...@@ -25,6 +27,7 @@ class SendPatchEdit extends Component ...@@ -25,6 +27,7 @@ class SendPatchEdit extends Component
protected $listeners = ['deletePatch', 'refreshComponent' => '$refresh' , 'sendPatch']; protected $listeners = ['deletePatch', 'refreshComponent' => '$refresh' , 'sendPatch'];
public function mount($editPid) public function mount($editPid)
{ {
// $this->setPage(1);
$this->PID = $editPid; $this->PID = $editPid;
$patch = ConfSmartupdate::where("PID", $editPid)->first(); $patch = ConfSmartupdate::where("PID", $editPid)->first();
$this->patchName = $patch->PATCHNAME; $this->patchName = $patch->PATCHNAME;
...@@ -208,6 +211,7 @@ class SendPatchEdit extends Component ...@@ -208,6 +211,7 @@ class SendPatchEdit extends Component
public function render() public function render()
{ {
$query = ConfServerLicense::query(); $query = ConfServerLicense::query();
if ($this->selectedOwnerType) { if ($this->selectedOwnerType) {
...@@ -219,9 +223,9 @@ class SendPatchEdit extends Component ...@@ -219,9 +223,9 @@ class SendPatchEdit extends Component
} }
$this->serverKeyOption = $query->get(['ID as id', 'SNKEY as name'])->toArray(); $this->serverKeyOption = $query->get(['ID as id', 'SNKEY as name'])->toArray();
$ownerType = ConfServerOwnertype::all(); $ownerType = ConfServerOwnertype::all();
$results = $this->searchSelected && $this->keyword $results = $this->searchSelected && $this->keyword
? ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID') ? ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID')
->where('PatchID', $this->PID) ->where('PatchID', $this->PID)
...@@ -230,7 +234,6 @@ class SendPatchEdit extends Component ...@@ -230,7 +234,6 @@ class SendPatchEdit extends Component
: ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID') : ConfServerPendding::join('conf_server_license as p2', 'conf_server_pendding.ServerID', '=', 'p2.ID')
->where('PatchID', $this->PID) ->where('PatchID', $this->PID)
->paginate($this->perPage); ->paginate($this->perPage);
return view('livewire.pages.send-patch.send-patch-edit', compact('ownerType', 'results')); return view('livewire.pages.send-patch.send-patch-edit', compact('ownerType', 'results'));
} }
} }
...@@ -14,7 +14,7 @@ class ServerLicenseCreate extends Component ...@@ -14,7 +14,7 @@ class ServerLicenseCreate extends Component
{ {
public $phpVersions = []; public $phpVersions = [];
public $teams = []; public $teams ;
public $sizings = []; public $sizings = [];
public $customerTypes = []; public $customerTypes = [];
public $dbTypes = []; public $dbTypes = [];
...@@ -40,58 +40,36 @@ class ServerLicenseCreate extends Component ...@@ -40,58 +40,36 @@ class ServerLicenseCreate extends Component
public $contactCustomerName; public $contactCustomerName;
// protected $rules = [ protected $rules = [
// 'SNKEY' => 'required|string|max:255', 'serverKey' => 'required|string|max:255',
// 'NBTEAM' => 'required|integer', 'teamId' => 'required|integer',
// 'CUSTOMERSIZE' => 'required|integer', 'customerSize' => 'required|integer',
// 'CUSTOMERTYPE' => 'required|integer', 'customerTypes' => 'required',
// 'COMPANY' => 'required|string|max:255', 'company' => 'required|string|max:255',
// 'BRANCH' => 'nullable|string|max:255', 'branch' => 'nullable|string|max:255',
// 'STATUS' => 'required|in:Y,N', 'status' => 'required|in:Y,N',
// 'LICENSEDATE' => 'required|date', 'licenseDate' => 'required|date',
// 'PHP_VERSION_ID' => 'required|integer', 'phpVersionId' => 'required|integer',
// 'CUR_VERSION' => 'required|string|max:255', 'currentVersion' => 'required|string|max:255',
// 'INSTALL_DATE' => 'required|date', 'installDate' => 'required|date',
// 'INSTALL_VERSION' => 'required|string|max:255', 'installVersion' => 'required|string|max:255',
// 'DATABASETYPE' => 'required|integer', 'databaseType' => 'required',
// 'OWNERTYPE' => 'required|integer', 'ownerType' => 'required',
// 'HSCODEMETHOD' => 'required|integer|in:1,2', 'hscodeMethod' => 'required|integer|in:1,2',
// 'CUSTOMERURL' => 'required|string|max:255', 'customerUrl' => 'required|string|max:255',
// 'CONTACT' => 'required|string|max:255', 'contact' => 'required|string|max:255',
// 'CONTACTCUSTOMERNAME' => 'required|string|max:255', 'contactCustomerName' => 'required|string|max:255',
// ]; ];
public function mount() public function mount()
{ {
$this->phpVersions = DB::table('master_php_ver')
->orderBy('id', 'asc')
->get();
$this->teams = DB::table('master_team')
->orderBy('id', 'asc')
->get();
$this->sizings = DB::table('master_size')
->orderBy('id', 'asc')
->get();
$this->customerTypes = DB::table('master_sizeType')
->orderBy('id', 'asc')
->get();
$this->dbTypes = DB::table('master_dbtype')
->orderBy('id', 'asc')
->get();
$this->ownerTypes = DB::table('conf_server_ownertype')
->orderBy('owntypeid', 'asc')
->get();
} }
public function save() public function save()
{ {
// $this->validate(); $this->validate();
// dd($this->teamId);
ConfServerLicense::create([ ConfServerLicense::create([
'SNKEY' => $this->serverKey, 'SNKEY' => $this->serverKey,
'NBTEAM' => $this->teamId, 'NBTEAM' => $this->teamId,
...@@ -123,6 +101,29 @@ class ServerLicenseCreate extends Component ...@@ -123,6 +101,29 @@ class ServerLicenseCreate extends Component
} }
public function render() public function render()
{ {
$this->phpVersions = DB::table('master_php_ver')
->orderBy('id', 'asc')
->get();
$this->teams = DB::table('master_team')
->orderBy('id', 'asc')
->get();
$this->sizings = DB::table('master_size')
->orderBy('id', 'asc')
->get();
$this->customerTypes = DB::table('master_sizeType')
->orderBy('id', 'asc')
->get();
$this->dbTypes = DB::table('master_dbtype')
->orderBy('id', 'asc')
->get();
$this->ownerTypes = DB::table('conf_server_ownertype')
->orderBy('owntypeid', 'asc')
->get();
return view('livewire.pages.server-license.server-license-create'); return view('livewire.pages.server-license.server-license-create');
} }
} }
...@@ -44,7 +44,7 @@ class ServerLicenseEdit extends Component ...@@ -44,7 +44,7 @@ class ServerLicenseEdit extends Component
public $contactCustomerName; public $contactCustomerName;
public $licenseId; public $licenseId;
public $message, $messages = []; public $message, $messages = [];
protected $listeners = ['gotoModal']; protected $listeners = ['gotoModal','setMessage'];
public $modalLoaded = false; public $modalLoaded = false;
public $SNKEY; public $SNKEY;
public $selectDateOrg; public $selectDateOrg;
...@@ -61,6 +61,7 @@ class ServerLicenseEdit extends Component ...@@ -61,6 +61,7 @@ class ServerLicenseEdit extends Component
public $fileDownloads = []; public $fileDownloads = [];
public function loadModal() public function loadModal()
{ {
$this->modalLoaded = true; $this->modalLoaded = true;
...@@ -158,7 +159,7 @@ class ServerLicenseEdit extends Component ...@@ -158,7 +159,7 @@ class ServerLicenseEdit extends Component
]); ]);
$message = 'Server License updated successfully!'; $message = 'Server License updated successfully!';
$this->message = $message; $this->setMessage($message);
// session()->flash('message', 'Server License updated successfully!'); // session()->flash('message', 'Server License updated successfully!');
} }
} }
...@@ -253,7 +254,7 @@ class ServerLicenseEdit extends Component ...@@ -253,7 +254,7 @@ class ServerLicenseEdit extends Component
$this->loadData(); $this->loadData();
$this->loadMapping(); $this->loadMapping();
$message = 'CSV Mapping updated successfully!'; $message = 'CSV Mapping updated successfully!';
$this->message = $message; $this->setMessage($message);
} }
...@@ -292,7 +293,8 @@ class ServerLicenseEdit extends Component ...@@ -292,7 +293,8 @@ class ServerLicenseEdit extends Component
$this->loadData(); $this->loadData();
$this->loadPrintForm(); $this->loadPrintForm();
$message = 'Print form updated successfully!'; $message = 'Print form updated successfully!';
$this->message = $message; // $this->message = $message;
$this->setMessage($message);
} }
public function loadUserInterface() public function loadUserInterface()
...@@ -336,7 +338,8 @@ class ServerLicenseEdit extends Component ...@@ -336,7 +338,8 @@ class ServerLicenseEdit extends Component
$this->loadData(); $this->loadData();
$this->loadPrintForm(); $this->loadPrintForm();
$message = 'User Interface updated successfully!'; $message = 'User Interface updated successfully!';
$this->message = $message; // $this->message = $message;
$this->setMessage($message);
} }
public function loadGlobal() public function loadGlobal()
...@@ -399,7 +402,8 @@ class ServerLicenseEdit extends Component ...@@ -399,7 +402,8 @@ class ServerLicenseEdit extends Component
$this->loadData(); $this->loadData();
$this->loadPrintForm(); $this->loadPrintForm();
$message = 'Global updated successfully!'; $message = 'Global updated successfully!';
$this->message = $message; // $this->message = $message;
$this->setMessage($message);
} }
public function loadParameter() public function loadParameter()
{ {
...@@ -440,7 +444,8 @@ class ServerLicenseEdit extends Component ...@@ -440,7 +444,8 @@ class ServerLicenseEdit extends Component
$this->loadData(); $this->loadData();
$this->loadParameter(); $this->loadParameter();
$message = 'Parameter updated successfully!'; $message = 'Parameter updated successfully!';
$this->message = $message; // $this->message = $message;
$this->setMessage($message);
} }
public function loadOnload() public function loadOnload()
...@@ -480,7 +485,8 @@ class ServerLicenseEdit extends Component ...@@ -480,7 +485,8 @@ class ServerLicenseEdit extends Component
$this->loadData(); $this->loadData();
$this->loadOnload(); $this->loadOnload();
$message = 'Onload updated successfully!'; $message = 'Onload updated successfully!';
$this->message = $message; // $this->message = $message;
$this->setMessage($message);
} }
public function loadValidate() public function loadValidate()
...@@ -522,7 +528,7 @@ class ServerLicenseEdit extends Component ...@@ -522,7 +528,7 @@ class ServerLicenseEdit extends Component
$message = 'Validate updated successfully!'; $message = 'Validate updated successfully!';
// $this->message = $message; //
$this->setMessage($message); $this->setMessage($message);
} }
......
...@@ -6,6 +6,7 @@ use App\Models\ConfServerLicense; ...@@ -6,6 +6,7 @@ use App\Models\ConfServerLicense;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination; use Livewire\WithPagination;
use App\Models\ConfSmartUpdate; use App\Models\ConfSmartUpdate;
use PDO;
class ServerLicenseIndex extends Component class ServerLicenseIndex extends Component
{ {
...@@ -30,9 +31,25 @@ class ServerLicenseIndex extends Component ...@@ -30,9 +31,25 @@ class ServerLicenseIndex extends Component
$query = ConfServerLicense::select('ID', 'SNKEY', 'COMPANY', 'STATUS', 'CUR_VERSION', 'DATABASETYPE', 'LICENSEDATE'); $query = ConfServerLicense::select('ID', 'SNKEY', 'COMPANY', 'STATUS', 'CUR_VERSION', 'DATABASETYPE', 'LICENSEDATE');
if ($this->searchSelected && $this->keyword) { if($this->searchSelected == 'PHP_VERSION_ID') {
$query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%'); if($this->keyword == '32' ){
if ($this->searchSelected && $this->keyword) {
$query->whereIn('PHP_VERSION_ID', [0,1]);
}
}elseif($this->keyword == '64' ){
if ($this->searchSelected && $this->keyword) {
$query->whereIn('PHP_VERSION_ID', [0,2]);
}
}else{
$query->whereIn('PHP_VERSION_ID', []);
}
}else{
if ($this->searchSelected && $this->keyword) {
$query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%');
}
} }
$query->orderBy('ID', 'DESC'); $query->orderBy('ID', 'DESC');
$results = $query->paginate($this->perPage); $results = $query->paginate($this->perPage);
......
<div class="bg-main-container"> <div class="bg-main-container">
<div class="max-w-full mx-auto p-5 "> <div class="max-w-full mx-auto p-5 ">
<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 x-data="{ messages: @entangle('messages') }"> <div x-data="{ messages: @entangle('messages') }">
<template x-for="(message, index) in messages" :key="index"> <template x-for="(message, index) in messages" :key="index">
...@@ -256,7 +255,9 @@ ...@@ -256,7 +255,9 @@
class="w-3/4 p-2 border border-gray-300 rounded-md" class="w-3/4 p-2 border border-gray-300 rounded-md"
wire:model.defer="contactCustomerName"> wire:model.defer="contactCustomerName">
</div> </div>
<div class="flex justify-center"> <div class="flex justify-center space-x-2">
<a type="button" href="/server-license"
class="bg-slate-700 text-white px-4 py-2 rounded-md hover:bg-slate-900">Back</a>
<button type="button" wire:click="updateLicense" <button type="button" wire:click="updateLicense"
class="bg-primary text-white px-4 py-2 rounded-md hover:bg-primary-focus">Save</button> class="bg-primary text-white px-4 py-2 rounded-md hover:bg-primary-focus">Save</button>
</div> </div>
......
...@@ -122,10 +122,10 @@ ...@@ -122,10 +122,10 @@
<i aria-hidden="true" class="fab fa-apple social-icon"></i> <i aria-hidden="true" class="fab fa-apple social-icon"></i>
Sign in with Apple Sign in with Apple
</a> --}} </a> --}}
<a href="{{ url('auth/microsoft') }}" class="social-button"> {{-- <a href="{{ url('auth/microsoft') }}" class="social-button">
<i aria-hidden="true" class="fab fa-microsoft social-icon"></i> <i aria-hidden="true" class="fab fa-microsoft social-icon"></i>
Sign in with Microsoft Teams Sign in with Microsoft Teams
</a> </a> --}}
</div> </div>
{{-- <div class="text-center mt-6 text-white"> {{-- <div class="text-center mt-6 text-white">
......
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