Commit 4bcd8562 authored by Thidaporn Laisan's avatar Thidaporn Laisan
Browse files

Merge branch 'sprint1' of...

Merge branch 'sprint1' of https://idemo.netbay.co.th/gitlab/sarun.netbay/spnpatch-laravel into sprint1
parents bb63f795 2d580162
......@@ -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) {
......@@ -219,9 +223,9 @@ class SendPatchEdit extends Component
}
$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)
......@@ -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 && $this->keyword) {
$query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%');
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 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