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;
use App\Models\ConfSmartupdate;
use App\Models\LogSendPath2customer;
use Livewire\Component;
use Livewire\WithPagination;
class SendPatchEdit extends Component
{
use WithPagination;
public $PID,$patchName , $serverKeyOption, $serverKeyOwnerType, $company, $db_type, $cur_ver;
public $perPage = 10;
public $search = '';
......@@ -25,6 +27,7 @@ class SendPatchEdit extends Component
protected $listeners = ['deletePatch', 'refreshComponent' => '$refresh' , 'sendPatch'];
public function mount($editPid)
{
// $this->setPage(1);
$this->PID = $editPid;
$patch = ConfSmartupdate::where("PID", $editPid)->first();
$this->patchName = $patch->PATCHNAME;
......@@ -208,6 +211,7 @@ class SendPatchEdit extends Component
public function render()
{
$query = ConfServerLicense::query();
if ($this->selectedOwnerType) {
......@@ -230,7 +234,6 @@ class SendPatchEdit extends Component
: 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'));
}
}
......@@ -14,7 +14,7 @@ class ServerLicenseCreate extends Component
{
public $phpVersions = [];
public $teams = [];
public $teams ;
public $sizings = [];
public $customerTypes = [];
public $dbTypes = [];
......@@ -40,58 +40,36 @@ class ServerLicenseCreate extends Component
public $contactCustomerName;
// protected $rules = [
// 'SNKEY' => 'required|string|max:255',
// 'NBTEAM' => 'required|integer',
// 'CUSTOMERSIZE' => 'required|integer',
// 'CUSTOMERTYPE' => 'required|integer',
// 'COMPANY' => 'required|string|max:255',
// 'BRANCH' => 'nullable|string|max:255',
// 'STATUS' => 'required|in:Y,N',
// 'LICENSEDATE' => 'required|date',
// 'PHP_VERSION_ID' => 'required|integer',
// 'CUR_VERSION' => 'required|string|max:255',
// 'INSTALL_DATE' => 'required|date',
// 'INSTALL_VERSION' => 'required|string|max:255',
// 'DATABASETYPE' => 'required|integer',
// 'OWNERTYPE' => 'required|integer',
// 'HSCODEMETHOD' => 'required|integer|in:1,2',
// 'CUSTOMERURL' => 'required|string|max:255',
// 'CONTACT' => 'required|string|max:255',
// 'CONTACTCUSTOMERNAME' => 'required|string|max:255',
// ];
protected $rules = [
'serverKey' => 'required|string|max:255',
'teamId' => 'required|integer',
'customerSize' => 'required|integer',
'customerTypes' => 'required',
'company' => 'required|string|max:255',
'branch' => 'nullable|string|max:255',
'status' => 'required|in:Y,N',
'licenseDate' => 'required|date',
'phpVersionId' => 'required|integer',
'currentVersion' => 'required|string|max:255',
'installDate' => 'required|date',
'installVersion' => 'required|string|max:255',
'databaseType' => 'required',
'ownerType' => 'required',
'hscodeMethod' => 'required|integer|in:1,2',
'customerUrl' => 'required|string|max:255',
'contact' => 'required|string|max:255',
'contactCustomerName' => 'required|string|max:255',
];
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()
{
// $this->validate();
$this->validate();
// dd($this->teamId);
ConfServerLicense::create([
'SNKEY' => $this->serverKey,
'NBTEAM' => $this->teamId,
......@@ -123,6 +101,29 @@ class ServerLicenseCreate extends Component
}
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');
}
}
......@@ -44,7 +44,7 @@ class ServerLicenseEdit extends Component
public $contactCustomerName;
public $licenseId;
public $message, $messages = [];
protected $listeners = ['gotoModal'];
protected $listeners = ['gotoModal','setMessage'];
public $modalLoaded = false;
public $SNKEY;
public $selectDateOrg;
......@@ -61,6 +61,7 @@ class ServerLicenseEdit extends Component
public $fileDownloads = [];
public function loadModal()
{
$this->modalLoaded = true;
......@@ -158,7 +159,7 @@ class ServerLicenseEdit extends Component
]);
$message = 'Server License updated successfully!';
$this->message = $message;
$this->setMessage($message);
// session()->flash('message', 'Server License updated successfully!');
}
}
......@@ -253,7 +254,7 @@ class ServerLicenseEdit extends Component
$this->loadData();
$this->loadMapping();
$message = 'CSV Mapping updated successfully!';
$this->message = $message;
$this->setMessage($message);
}
......@@ -292,7 +293,8 @@ class ServerLicenseEdit extends Component
$this->loadData();
$this->loadPrintForm();
$message = 'Print form updated successfully!';
$this->message = $message;
// $this->message = $message;
$this->setMessage($message);
}
public function loadUserInterface()
......@@ -336,7 +338,8 @@ class ServerLicenseEdit extends Component
$this->loadData();
$this->loadPrintForm();
$message = 'User Interface updated successfully!';
$this->message = $message;
// $this->message = $message;
$this->setMessage($message);
}
public function loadGlobal()
......@@ -399,7 +402,8 @@ class ServerLicenseEdit extends Component
$this->loadData();
$this->loadPrintForm();
$message = 'Global updated successfully!';
$this->message = $message;
// $this->message = $message;
$this->setMessage($message);
}
public function loadParameter()
{
......@@ -440,7 +444,8 @@ class ServerLicenseEdit extends Component
$this->loadData();
$this->loadParameter();
$message = 'Parameter updated successfully!';
$this->message = $message;
// $this->message = $message;
$this->setMessage($message);
}
public function loadOnload()
......@@ -480,7 +485,8 @@ class ServerLicenseEdit extends Component
$this->loadData();
$this->loadOnload();
$message = 'Onload updated successfully!';
$this->message = $message;
// $this->message = $message;
$this->setMessage($message);
}
public function loadValidate()
......@@ -522,7 +528,7 @@ class ServerLicenseEdit extends Component
$message = 'Validate updated successfully!';
// $this->message = $message;
//
$this->setMessage($message);
}
......
......@@ -6,6 +6,7 @@ use App\Models\ConfServerLicense;
use Livewire\Component;
use Livewire\WithPagination;
use App\Models\ConfSmartUpdate;
use PDO;
class ServerLicenseIndex extends Component
{
......@@ -30,9 +31,25 @@ class ServerLicenseIndex extends Component
$query = ConfServerLicense::select('ID', 'SNKEY', 'COMPANY', 'STATUS', 'CUR_VERSION', 'DATABASETYPE', 'LICENSEDATE');
if($this->searchSelected == 'PHP_VERSION_ID') {
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');
$results = $query->paginate($this->perPage);
......
<div class="bg-main-container">
<div class="max-w-full mx-auto px-5 ">
{{-- <div class="flex flex-wrap items-center"> --}}
<h2 class="text-2xl text-black ">
Server License Management
</h2>
<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> --}}
<div class="flex flex-wrap items-center">
</div>
@if (session()->has('message'))
<div class="alert alert-success">
{{ session('message') }}
</div>
@endif
<div class="flex flex-wrap -mx-3 w-full bg-main-container items-center justify-center ">
<div class="w-4/5 p-5 mb-6 shadow-md rounded-lg">
<div class="flex flex-wrap -mx-3 w-full items-center justify-center ">
<div class="w-3/5 p-5 mb-6 shadow-md bg-white rounded-lg">
<form>
<!-- Server Key -->
<div class="mb-4 flex items-center">
<div class=" 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"
<div class="flex flex-col w-3/4">
<input type="text" id="serverKey" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="serverKey">
@error('serverKey')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Team -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="teamId" class="w-1/4 text-gray-700">Team</label>
<div class="flex flex-col w-3/4">
<select id="teamId" wire:model.defer="teamId"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
@foreach ($teams as $team)
<option value="{{ $team->id }}">{{ $team->teamName }}</option>
@endforeach
</select>
@error('teamId')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Customer Sizing -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="customerSize" class="w-1/4 text-gray-700">Customer Sizing</label>
<div class="flex flex-col w-3/4">
<select id="customerSize" wire:model.defer="customerSize"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
@foreach ($sizings as $size)
<option value="{{ $size->id }}">{{ $size->sizeName }}</option>
@endforeach
</select>
@error('customerSize')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Customer Type -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="customerType" class="w-1/4 text-gray-700">Customer Type</label>
<div class="flex flex-col w-3/4">
<select id="customerType" wire:model.defer="customerType"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
@foreach ($customerTypes as $type)
<option value="{{ $type->id }}">{{ $type->sizeTypeName }}</option>
@endforeach
</select>
@error('customerTypes')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Company -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="company" class="w-1/4 text-gray-700">Company</label>
<input type="text" id="company" class="w-3/4 p-2 border border-gray-300 rounded-md"
<div class="flex flex-col w-3/4">
<input type="text" id="company" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="company">
@error('company')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Branch -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="branch" class="w-1/4 text-gray-700">Branch</label>
<input type="text" id="branch" class="w-3/4 p-2 border border-gray-300 rounded-md"
<div class="flex flex-col w-3/4">
<input type="text" id="branch" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="branch">
@error('branch')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Status -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label class="w-1/4 text-gray-700">Status</label>
<div class="flex flex-col w-3/4">
<div class="flex items-center w-3/4">
<label class="mr-4">
<input type="radio" name="status" value="Y" wire:model.defer="status"> Yes
......@@ -81,102 +113,177 @@
<input type="radio" name="status" value="N" wire:model.defer="status"> No
</label>
</div>
@error('status')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Licensedate -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="licenseDate" class="w-1/4 text-gray-700">License Date</label>
<input type="date" id="licenseDate" class="w-3/4 p-2 border border-gray-300 rounded-md"
<div class="flex flex-col w-3/4">
<input type="date" id="licenseDate" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="licenseDate">
@error('licenseDate')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- PHP Version -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="phpVersionId" class="w-1/4 text-gray-700">PHP Version</label>
<div class="flex flex-col w-3/4">
<select id="phpVersionId" wire:model.defer="phpVersionId"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
@foreach ($phpVersions as $version)
<option value="{{ $version->id }}">{{ $version->version }}</option>
@endforeach
</select>
@error('phpVersionId')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Version ปัจจุบัน -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="currentVersion" class="w-1/4 text-gray-700">Version ปัจจุบัน</label>
<input type="text" id="currentVersion" class="w-3/4 p-2 border border-gray-300 rounded-md"
<div class="flex flex-col w-3/4">
<input type="text" id="currentVersion" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="currentVersion">
@error('currentVersion')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- วันที่ไป Install -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="installDate" class="w-1/4 text-gray-700">วันที่ไป Install</label>
<input type="date" id="installDate" class="w-3/4 p-2 border border-gray-300 rounded-md"
<div class="flex flex-col w-3/4">
<input type="date" id="installDate" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="installDate">
@error('installDate')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Version ที่ลงครั้งแรก -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="installVersion" class="w-1/4 text-gray-700">Version ที่ลงครั้งแรก</label>
<input type="text" id="installVersion" class="w-3/4 p-2 border border-gray-300 rounded-md"
<div class="flex flex-col w-3/4">
<input type="text" id="installVersion" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="installVersion">
@error('installVersion')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Database Type -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="databaseType" class="w-1/4 text-gray-700">Database Type</label>
<div class="flex flex-col w-3/4">
<select id="databaseType" wire:model.defer="databaseType"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
@foreach ($dbTypes as $db)
<option value="{{ $db->id }}">{{ $db->dbName }}</option>
@endforeach
</select>
@error('databaseType')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Server of -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="ownerType" class="w-1/4 text-gray-700">Server of</label>
<div class="flex flex-col w-3/4">
<select id="ownerType" wire:model.defer="ownerType"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
@foreach ($ownerTypes as $owner)
<option value="{{ $owner->owntype_code }}">{{ $owner->owntype_description }}</option>
<option value="{{ $owner->owntype_code }}">{{ $owner->owntype_description }}
</option>
@endforeach
</select>
@error('ownerType')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- HSCODE 2017 Method -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="hscodeMethod" class="w-1/4 text-gray-700">HSCODE 2017 Method</label>
<div class="flex flex-col w-3/4">
<select id="hscodeMethod" wire:model.defer="hscodeMethod"
class="w-3/4 p-2 border border-gray-300 rounded-md">
class=" p-2 border border-gray-300 rounded-md">
<option value="1" {{ $hscodeMethod == '1' ? 'selected' : '' }}>Patch</option>
<option value="2" {{ $hscodeMethod == '2' ? 'selected' : '' }}>Run script</option>
<option value="2" {{ $hscodeMethod == '2' ? 'selected' : '' }}>Run script
</option>
</select>
@error('hscodeMethod')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- URL / IP Address -->
<div class="mb-4 flex items-center">
<div class="mt-3 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"
<div class="flex flex-col w-3/4">
<input type="text" id="customerUrl" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="customerUrl">
@error('customerUrl')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Contact -->
<div class="mb-4 flex items-center">
<div class="mt-3 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"
<div class="flex flex-col w-3/4">
<input type="text" id="contact" class=" p-2 border border-gray-300 rounded-md"
wire:model.defer="contact">
@error('contact')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Contact Customer Name -->
<div class="mb-4 flex items-center">
<div class="mt-3 flex items-center">
<label for="contactCustomerName" class="w-1/4 text-gray-700">Contact Customer Name</label>
<div class="flex flex-col w-3/4">
<input type="text" id="contactCustomerName"
class="w-3/4 p-2 border border-gray-300 rounded-md" wire:model.defer="contactCustomerName">
class=" p-2 border border-gray-300 rounded-md" wire:model.defer="contactCustomerName">
@error('contactCustomerName')
<div class="text-red-500 text-sm ">
{{ $message }}</div>
@enderror
</div>
</div>
<!-- Save and Reset Buttons -->
<div class="flex justify-center">
<div class="mt-3 flex justify-center space-x-2">
<a type="button" href="/server-license"
class="bg-slate-300 text-black px-4 py-2 rounded-md hover:bg-slate-900 hover:text-white">Back</a>
<button type="button" wire:click="save"
class="bg-primary text-white px-4 py-2 rounded-md hover:bg-primary-focus">Save</button>
</div>
......
<div class="bg-main-container">
<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') }">
<template x-for="(message, index) in messages" :key="index">
......@@ -256,7 +255,9 @@
class="w-3/4 p-2 border border-gray-300 rounded-md"
wire:model.defer="contactCustomerName">
</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"
class="bg-primary text-white px-4 py-2 rounded-md hover:bg-primary-focus">Save</button>
</div>
......
......@@ -122,10 +122,10 @@
<i aria-hidden="true" class="fab fa-apple social-icon"></i>
Sign in with Apple
</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>
Sign in with Microsoft Teams
</a>
</a> --}}
</div>
{{-- <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